Documentation
¶
Index ¶
Constants ¶
const ( // PublicKeySize is the size, in bytes, of public keys as used in this package. PublicKeySize = 32 // PrivateKeySize is the size, in bytes, of private keys as used in this package. PrivateKeySize = 64 // SignatureSize is the size, in bytes, of signatures generated and verified by this package. SignatureSize = 64 // AddressSize is the size in bytes of an address extracted from the public key AddressSize = 20 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressSize]byte
Address is the address container
func AddressFromHex ¶
AddressFromHex decodes a hex version of the address into an Address
func PublicKeyBytesToAddress ¶
PublicKeyBytesToAddress returns the address for the bytes version of the public key
type PrivateKeyEd25519 ¶
type PrivateKeyEd25519 [PrivateKeySize]byte
PrivateKeyEd25519 is the private key container
func GeneratePrivateKey ¶
func GeneratePrivateKey() PrivateKeyEd25519
GeneratePrivateKey generates a new private key
func PrivateKeyFromHex ¶
func PrivateKeyFromHex(h string) (PrivateKeyEd25519, error)
PrivateKeyFromHex decodes a hexified private key into PrivateKeyEd25519
func PrivateKeyFromSecret ¶
func PrivateKeyFromSecret(secret []byte) PrivateKeyEd25519
PrivateKeyFromSecret generates a private key from a given secret
func (PrivateKeyEd25519) Bytes ¶
func (privKey PrivateKeyEd25519) Bytes() []byte
Bytes return the the private key as bytes
func (PrivateKeyEd25519) PubKey ¶
func (privKey PrivateKeyEd25519) PubKey() PublicKeyEd25519
PubKey returns the public key for this private key
func (PrivateKeyEd25519) Sign ¶
func (privKey PrivateKeyEd25519) Sign(msg []byte) []byte
Sign a message
func (PrivateKeyEd25519) ToHex ¶
func (privKey PrivateKeyEd25519) ToHex() string
ToHex returns the private key as a hex value
type PublicKeyEd25519 ¶
type PublicKeyEd25519 [PublicKeySize]byte
PublicKeyEd25519 is the public key container
func PublicKeyFromBytes ¶
func PublicKeyFromBytes(bits []byte) (PublicKeyEd25519, error)
func PublicKeyFromHex ¶
func PublicKeyFromHex(h string) (PublicKeyEd25519, error)
PublicKeyFromHex decodes a hex version of the public key into PublicKeyEd25519
func (PublicKeyEd25519) Bytes ¶
func (pubKey PublicKeyEd25519) Bytes() []byte
Bytes returns the public key as bytes
func (PublicKeyEd25519) ToAddress ¶
func (pubKey PublicKeyEd25519) ToAddress() Address
ToAddress returns the associated address for the the key
func (PublicKeyEd25519) ToHex ¶
func (pubKey PublicKeyEd25519) ToHex() string
ToHex returns the public key as a hex