Documentation ¶
Index ¶
- Constants
- Variables
- func ErrCreateAddress(err error) error
- func ErrCreatePrivateKey(err error) error
- func ErrCreatePublicKey(err error) error
- func ErrInvalidAddressLen(len int) error
- func ErrInvalidHashLen(len int) error
- func ErrInvalidPrivateKeyLen(len int) error
- func ErrInvalidPrivateKeySeedLenError(seedLen int) error
- func ErrInvalidPublicKeyLen(len int) error
- func SHA3Hash(bz []byte) []byte
- type Address
- type Ed25519PrivateKey
- func (priv Ed25519PrivateKey) Address() Address
- func (priv Ed25519PrivateKey) Bytes() []byte
- func (priv Ed25519PrivateKey) Equals(other PrivateKey) bool
- func (priv Ed25519PrivateKey) PublicKey() PublicKey
- func (priv Ed25519PrivateKey) Seed() []byte
- func (priv Ed25519PrivateKey) Sign(msg []byte) ([]byte, error)
- func (priv Ed25519PrivateKey) Size() int
- func (priv Ed25519PrivateKey) String() string
- func (priv *Ed25519PrivateKey) UnmarshalJSON(data []byte) error
- type Ed25519PublicKey
- func (pub Ed25519PublicKey) Address() Address
- func (pub Ed25519PublicKey) Bytes() []byte
- func (pub Ed25519PublicKey) Equals(other PublicKey) bool
- func (pub Ed25519PublicKey) Size() int
- func (pub Ed25519PublicKey) String() string
- func (pub *Ed25519PublicKey) UnmarshalJSON(data []byte) error
- func (pub Ed25519PublicKey) Verify(msg []byte, sig []byte) bool
- type PrivateKey
- type PublicKey
Constants ¶
View Source
const ( AddressLen = 20 SeedSize = ed25519.SeedSize )
View Source
const ( InvalidAddressLenError = "the address length is not valid" InvalidHashLenError = "the hash length is not valid" CreateAddressError = "an error occurred creating the address" InvalidPrivateKeyLenError = "the private key length is not valid" InvalidPrivateKeySeedLenError = "the seed is too short to create a private key" CreatePrivateKeyError = "an error occurred creating the private key" InvalidPublicKeyLenError = "the public key length is not valid" CreatePublicKeyError = "an error occurred creating the public key" )
Variables ¶
View Source
var ( PublicKeyLen = ed25519.PublicKeySize PrivateKeyLen = ed25519.PrivateKeySize )
View Source
var (
SHA3HashLen = crypto.SHA3_256.Size()
)
Functions ¶
func ErrCreateAddress ¶
func ErrCreatePrivateKey ¶
func ErrCreatePublicKey ¶
func ErrInvalidAddressLen ¶
func ErrInvalidHashLen ¶
func ErrInvalidPrivateKeyLen ¶
func ErrInvalidPublicKeyLen ¶
Types ¶
type Address ¶
type Address []byte
TODO(discuss): Consider create a type for signature and having constraints for each type as well.
func AddressFromString ¶
func GenerateAddress ¶
func NewAddress ¶
func NewAddressFromBytes ¶
func (*Address) UnmarshalJSON ¶
type Ed25519PrivateKey ¶
type Ed25519PrivateKey ed25519.PrivateKey
func (Ed25519PrivateKey) Address ¶
func (priv Ed25519PrivateKey) Address() Address
func (Ed25519PrivateKey) Bytes ¶
func (priv Ed25519PrivateKey) Bytes() []byte
func (Ed25519PrivateKey) Equals ¶
func (priv Ed25519PrivateKey) Equals(other PrivateKey) bool
func (Ed25519PrivateKey) PublicKey ¶
func (priv Ed25519PrivateKey) PublicKey() PublicKey
func (Ed25519PrivateKey) Seed ¶
func (priv Ed25519PrivateKey) Seed() []byte
func (Ed25519PrivateKey) Size ¶
func (priv Ed25519PrivateKey) Size() int
func (Ed25519PrivateKey) String ¶
func (priv Ed25519PrivateKey) String() string
func (*Ed25519PrivateKey) UnmarshalJSON ¶
func (priv *Ed25519PrivateKey) UnmarshalJSON(data []byte) error
type Ed25519PublicKey ¶
func (Ed25519PublicKey) Address ¶
func (pub Ed25519PublicKey) Address() Address
func (Ed25519PublicKey) Bytes ¶
func (pub Ed25519PublicKey) Bytes() []byte
func (Ed25519PublicKey) Equals ¶
func (pub Ed25519PublicKey) Equals(other PublicKey) bool
func (Ed25519PublicKey) Size ¶
func (pub Ed25519PublicKey) Size() int
func (Ed25519PublicKey) String ¶
func (pub Ed25519PublicKey) String() string
func (*Ed25519PublicKey) UnmarshalJSON ¶
func (pub *Ed25519PublicKey) UnmarshalJSON(data []byte) error
type PrivateKey ¶
type PrivateKey interface { Bytes() []byte String() string Equals(other PrivateKey) bool PublicKey() PublicKey Address() Address Sign(msg []byte) ([]byte, error) Size() int Seed() []byte }
func GeneratePrivateKey ¶
func GeneratePrivateKey() (PrivateKey, error)
func NewPrivateKey ¶
func NewPrivateKey(hexString string) (PrivateKey, error)
func NewPrivateKeyFromBytes ¶
func NewPrivateKeyFromBytes(bz []byte) (PrivateKey, error)
func NewPrivateKeyFromSeed ¶
func NewPrivateKeyFromSeed(seed []byte) (PrivateKey, error)
Click to show internal directories.
Click to hide internal directories.