Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair interface { fmt.Stringer Sign(message []byte) ([]byte, error) Verify(message, signature []byte) bool GetPublicKey() *PublicKey }
KeyPair represents a public/private key pair.
func NewKeyPairFromRandom ¶
NewKeyPairFromRandom creates a random KeyPair using the specified curve.
func NewKeyPairFromString ¶
NewKeyPairFromString creates a new KeyPair from a optionally curve-prefixed base58 string.
type KeyPairEd25519 ¶
type KeyPairEd25519 struct {
// contains filtered or unexported fields
}
KeyPairEd25519 is an ed25519 implementation of KeyPair.
func (*KeyPairEd25519) GetPublicKey ¶
func (k *KeyPairEd25519) GetPublicKey() *PublicKey
GetPublicKey returns the PublicKey corresponding to the KeyPair's private key.
func (*KeyPairEd25519) Sign ¶
func (k *KeyPairEd25519) Sign(message []byte) ([]byte, error)
Sign signs a message with the KeyPair's private key.
func (*KeyPairEd25519) String ¶
func (k *KeyPairEd25519) String() string
func (*KeyPairEd25519) Verify ¶
func (k *KeyPairEd25519) Verify(message, signature []byte) bool
Verify reports whether signature is a valid signature of message by the KeyPair's public key.
type PublicKey ¶
PublicKey represents a public key.
func NewPublicKeyFromString ¶
NewPublicKeyFromString creates a new public key from a base58 encoded string prefixed with the key type string.