Documentation ¶
Index ¶
Constants ¶
const ( PublicKeySize = ed25519.PublicKeySize SignatureSize = ed25519.SignatureSize PrivateKeySize = ed25519.PrivateKeySize SeedSize = ed25519.SeedSize )
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
func GenerateKey() (publicKey PublicKey, privateKey PrivateKey, err error)
GenerateKey creates a public/private key pair.
Types ¶
type KeyPair ¶
type KeyPair struct { PrivateKey PrivateKey PublicKey PublicKey }
func GenerateKeyPair ¶
func GenerateKeyPair() (keyPair KeyPair)
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
PrivateKey is the type of Ed25519 private keys.
func GeneratePrivateKey ¶
func GeneratePrivateKey() (privateKey PrivateKey, err error)
GenerateKey creates a private key.
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(bytes []byte) (result PrivateKey, err error, consumedBytes int)
PrivateKeyFromBytes creates a PrivateKey from the given bytes.
func PrivateKeyFromSeed ¶
func PrivateKeyFromSeed(seed []byte) (result PrivateKey)
PrivateKeyFromSeed calculates a private key from a seed.
func (PrivateKey) Bytes ¶
func (privateKey PrivateKey) Bytes() []byte
Bytes returns the privateKey in bytes.
func (PrivateKey) Public ¶
func (privateKey PrivateKey) Public() (result PublicKey)
Public returns the PublicKey corresponding to privateKey.
func (PrivateKey) Sign ¶
func (privateKey PrivateKey) Sign(data []byte) (result Signature)
Sign signs the message with privateKey and returns a signature.
func (PrivateKey) String ¶
func (privateKey PrivateKey) String() string
String returns a human readable version of the PrivateKey (base58 encoded).
type PublicKey ¶
type PublicKey [PublicKeySize]byte
PublicKey is the type of Ed25519 public keys.
func ParsePublicKey ¶
func ParsePublicKey(marshalUtil *marshalutil.MarshalUtil) (PublicKey, error)
func PublicKeyFromBytes ¶
PublicKeyFromBytes creates a PublicKey from the given bytes.
func RecoverKey ¶
RecoverKey makes sure that key and signature have the correct length and verifies whether sig is a valid signature of data by pub.
func (PublicKey) String ¶
String returns a human readable version of the PublicKey (base58 encoded).
func (*PublicKey) UnmarshalBinary ¶
type Signature ¶
type Signature [SignatureSize]byte
var EmptySignature Signature
func ParseSignature ¶
func ParseSignature(marshalUtil *marshalutil.MarshalUtil) (Signature, error)
func SignatureFromBytes ¶
SignatureFromBytes creates a Signature from the given bytes.
func (Signature) String ¶
String returns a human readable version of the Signature (base58 encoded).