Documentation
¶
Overview ¶
Package crypto implements the cryptography used in the Cashu protocol as explained in Cashu.
Index ¶
- Constants
- func BlindMessage(secret string, r *secp256k1.PrivateKey) (*secp256k1.PublicKey, *secp256k1.PrivateKey, error)
- func BlindMessageDeprecated(secret string, r *secp256k1.PrivateKey) (*secp256k1.PublicKey, *secp256k1.PrivateKey)
- func DeriveKeysetId(keyset map[uint64]KeyPair) string
- func HashToCurve(message []byte) (*secp256k1.PublicKey, error)
- func HashToCurveDeprecated(message []byte) *secp256k1.PublicKey
- func SignBlindedMessage(B_ *secp256k1.PublicKey, k *secp256k1.PrivateKey) *secp256k1.PublicKey
- func UnblindSignature(C_ *secp256k1.PublicKey, r *secp256k1.PrivateKey, K *secp256k1.PublicKey) *secp256k1.PublicKey
- func Verify(secret string, k *secp256k1.PrivateKey, C *secp256k1.PublicKey) bool
- type KeyPair
- type KeyPairTemp
- type Keyset
- type KeysetTemp
- type KeysetsMap
Constants ¶
const DomainSeparator = "Secp256k1_HashToCurve_Cashu_"
Variables ¶
This section is empty.
Functions ¶
func BlindMessage ¶
func BlindMessage(secret string, r *secp256k1.PrivateKey) (*secp256k1.PublicKey, *secp256k1.PrivateKey, error)
B_ = Y + rG
func BlindMessageDeprecated ¶
func BlindMessageDeprecated(secret string, r *secp256k1.PrivateKey) (*secp256k1.PublicKey, *secp256k1.PrivateKey)
func DeriveKeysetId ¶
DeriveKeysetId returns the string ID derived from the map keyset The steps to derive the ID are: - sort public keys by their amount in ascending order - concatenate all public keys to one byte array - HASH_SHA256 the concatenated public keys - take the first 14 characters of the hex-encoded hash - prefix it with a keyset ID version byte
func HashToCurve ¶
The domain separator is b"Secp256k1_HashToCurve_Cashu_" or bytes.fromhex("536563703235366b315f48617368546f43757276655f43617368755f").
func HashToCurveDeprecated ¶
func SignBlindedMessage ¶
C_ = kB_
func UnblindSignature ¶
func UnblindSignature(C_ *secp256k1.PublicKey, r *secp256k1.PrivateKey, K *secp256k1.PublicKey) *secp256k1.PublicKey
C = C_ - rK
Types ¶
type KeyPair ¶
type KeyPair struct {
PrivateKey *secp256k1.PrivateKey
PublicKey *secp256k1.PublicKey
}
func (*KeyPair) MarshalJSON ¶
func (*KeyPair) UnmarshalJSON ¶
type KeyPairTemp ¶
type Keyset ¶
func GenerateKeyset ¶
func (*Keyset) DerivePublic ¶
DerivePublic returns the keyset's public keys as a map of amounts uint64 to strings that represents the public key
func (*Keyset) MarshalJSON ¶
func (*Keyset) UnmarshalJSON ¶
type KeysetTemp ¶
type KeysetsMap ¶
KeysetsMap maps a mint url to map of string keyset id to keyset