Documentation ¶
Index ¶
- func GenerateKeypair() (*SecretKey, *PublicKey, error)
- func NewRandomElement() (*r255.Element, error)
- func NewRandomScalar() (*r255.Scalar, error)
- func NewSigningContext(context, msg []byte) *merlin.Transcript
- func ScalarFromBytes(b [32]byte) (*r255.Scalar, error)
- type MiniSecretKey
- type PublicKey
- type SecretKey
- type Signature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeypair ¶
GenerateKeypair generates a new schnorrkel secret key and public key
func NewRandomElement ¶
NewRandomElement returns a random ristretto element
func NewRandomScalar ¶
NewRandomScalar returns a random ristretto scalar
func NewSigningContext ¶
func NewSigningContext(context, msg []byte) *merlin.Transcript
NewSigningContext returns a new transcript initialized with the context for the signature .see: https://github.com/w3f/schnorrkel/blob/db61369a6e77f8074eb3247f9040ccde55697f20/src/context.rs#L183
Types ¶
type MiniSecretKey ¶
type MiniSecretKey struct {
// contains filtered or unexported fields
}
MiniSecretKey is a secret scalar
func NewMiniSecretKey ¶
func NewMiniSecretKey(b [64]byte) *MiniSecretKey
NewMiniSecretKey derives a mini secret key from a byte array
func NewMiniSecretKeyFromRaw ¶
func NewMiniSecretKeyFromRaw(b [32]byte) (*MiniSecretKey, error)
NewMiniSecretKeyFromRaw derives a mini secret key from little-endian encoded raw bytes.
func NewRandomMiniSecretKey ¶
func NewRandomMiniSecretKey() (*MiniSecretKey, error)
NewRandomMiniSecretKey generates a mini secret key from random
func (*MiniSecretKey) Decode ¶
func (s *MiniSecretKey) Decode(in [32]byte) (err error)
func (*MiniSecretKey) ExpandEd25519 ¶
func (s *MiniSecretKey) ExpandEd25519() *SecretKey
ExpandEd25519 expands a mini secret key into a secret key https://github.com/w3f/schnorrkel/blob/43f7fc00724edd1ef53d5ae13d82d240ed6202d5/src/keys.rs#L196
func (*MiniSecretKey) ExpandUniform ¶
func (s *MiniSecretKey) ExpandUniform() *SecretKey
ExpandUniform
func (*MiniSecretKey) Public ¶
func (s *MiniSecretKey) Public() *PublicKey
Public gets the public key corresponding to this mini secret key
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is a member
func NewPublicKey ¶
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey consists of a secret scalar and a signing nonce change type key to *r255.scalar
func (*SecretKey) Sign ¶
func (sk *SecretKey) Sign(t *merlin.Transcript) (*Signature, error)
Sign uses the schnorr signature algorithm to sign a message See the following for the transcript message https://github.com/w3f/schnorrkel/blob/db61369a6e77f8074eb3247f9040ccde55697f20/src/sign.rs#L158 Schnorr w/ transcript, secret key x: 1. choose random r from group 2. R = gr 3. k = scalar(transcript.extract_bytes()) 4. s = kx + r signature: (R, s) public key used for verification: y = g^x
type Signature ¶
Signature holds a schnorrkel signature
func (*Signature) Decode ¶
Decode sets a Signature from bytes see: https://github.com/w3f/schnorrkel/blob/db61369a6e77f8074eb3247f9040ccde55697f20/src/sign.rs#L100
func (*Signature) Encode ¶
Encode turns a signature into a byte array see: https://github.com/w3f/schnorrkel/blob/db61369a6e77f8074eb3247f9040ccde55697f20/src/sign.rs#L77