示例#1
0
func generateSignedPreKey() *axolotl.SignedPreKeyRecord {
	kp := axolotl.NewECKeyPair()
	id := getNextSignedPreKeyID()
	var random [64]byte
	randBytes(random[:])
	priv := identityKey.PrivateKey.Key()
	signature := curve25519sign.Sign(priv, kp.PublicKey.Serialize(), random)
	record := axolotl.NewSignedPreKeyRecord(id, uint64(time.Now().UnixNano()*1000), kp, signature[:])
	textSecureStore.StoreSignedPreKey(id, record)
	return record
}
示例#2
0
func generatePreKey(id uint32) error {
	kp := axolotl.NewECKeyPair()
	record := axolotl.NewPreKeyRecord(id, kp)
	err := textSecureStore.StorePreKey(id, record)
	return err
}