Documentation
¶
Index ¶
Constants ¶
const SecretKeySize = 64
Variables ¶
var SigningContext = []byte("substrate")
SigningContext is the context for signatures used or created with substrate
Functions ¶
This section is empty.
Types ¶
type Ed25519 ¶
type Ed25519 struct {
// contains filtered or unexported fields
}
func NewEd25519 ¶
NewEd25519 create new ed25519 keyring seed: 0x + 64 hex string if seed length not 64, will panic
type Keypair ¶
type Keypair interface { Sign(msg []byte) ([]byte, error) Public() PublicKey Private() PrivateKey }
type PrivateKey ¶
type Sr25519 ¶
type Sr25519 struct {
// contains filtered or unexported fields
}
type Sr25519Keypair ¶
type Sr25519Keypair struct {
// contains filtered or unexported fields
}
Sr25519Keypair is a sr25519 public-private keypair
func GenerateSr25519Keypair ¶
func GenerateSr25519Keypair() (*Sr25519Keypair, error)
GenerateSr25519Keypair returns a new sr25519 keypair
func NewSr25519FromSeed ¶
func NewSr25519FromSeed(seed []byte) (*Sr25519Keypair, error)
NewSr25519FromSeed from Secret seed to SecretKey
func NewSr25519Keypair ¶
func NewSr25519Keypair(priv *sr25519.SecretKey) (*Sr25519Keypair, error)
NewSr25519Keypair returns a Sr25519Keypair given a schnorrkel secret key
func (*Sr25519Keypair) Private ¶
func (kp *Sr25519Keypair) Private() PrivateKey
Private returns the private key corresponding to this keypair
func (*Sr25519Keypair) Public ¶
func (kp *Sr25519Keypair) Public() PublicKey
Public returns the public key corresponding to this keypair
type Sr25519PrivateKey ¶
type Sr25519PrivateKey struct {
// contains filtered or unexported fields
}
func (*Sr25519PrivateKey) Decode ¶
func (k *Sr25519PrivateKey) Decode(in []byte) error
Decode decodes the input bytes into a private key and sets the receiver the decoded key Input must be 32 bytes, or else this function will error
func (*Sr25519PrivateKey) Encode ¶
func (k *Sr25519PrivateKey) Encode() []byte
Encode returns the 32-byte encoding of the private key
func (*Sr25519PrivateKey) Public ¶
func (k *Sr25519PrivateKey) Public() (PublicKey, error)
Public returns the public key corresponding to this private key
type Sr25519PublicKey ¶
type Sr25519PublicKey struct {
// contains filtered or unexported fields
}
func (*Sr25519PublicKey) Decode ¶
func (k *Sr25519PublicKey) Decode(in []byte) error
Decode decodes the input bytes into a public key and sets the receiver the decoded key Input must be 32 bytes, or else this function will error
func (*Sr25519PublicKey) Encode ¶
func (k *Sr25519PublicKey) Encode() []byte
Encode returns the 32-byte encoding of the public key
func (*Sr25519PublicKey) Verify ¶
func (k *Sr25519PublicKey) Verify(msg, sig []byte) bool
Verify uses the sr25519 signature algorithm to verify that the message was signed by this public key; it returns true if this key created the signature for the message, false otherwise