Пример #1
0
// For use with golang/crypto/nacl/box
// If error, returns nil.
func (pubKey PubKeyEd25519) ToCurve25519() *[32]byte {
	keyCurve25519, pubKeyBytes := new([32]byte), [32]byte(pubKey)
	ok := extra25519.PublicKeyToCurve25519(keyCurve25519, &pubKeyBytes)
	if !ok {
		return nil
	}
	return keyCurve25519
}
Пример #2
0
// For use with golang/crypto/nacl/box
// If error, returns nil.
func (pubKey PubKeyEd25519) ToCurve25519() *[32]byte {
	keyEd25519, keyCurve25519 := new([32]byte), new([32]byte)
	copy(keyEd25519[:], pubKey)
	ok := extra25519.PublicKeyToCurve25519(keyCurve25519, keyEd25519)
	if !ok {
		return nil
	}
	return keyCurve25519
}