Documentation ¶
Index ¶
- Variables
- type FromAddress
- func (kp *FromAddress) Address() string
- func (kp *FromAddress) Equal(a *FromAddress) bool
- func (kp *FromAddress) FromAddress() (*FromAddress, error)
- func (kp *FromAddress) Hint() (r [4]byte)
- func (kp *FromAddress) PublicKey() *[32]byte
- func (kp *FromAddress) Sign(_ []byte) ([]byte, error)
- func (kp *FromAddress) Verify(message []byte, sig []byte) error
- type Full
- func (kp *Full) Address() string
- func (kp *Full) Equal(f *Full) bool
- func (kp *Full) FromAddress() (*FromAddress, error)
- func (kp *Full) Hint() (r [4]byte)
- func (kp *Full) PublicKey() ed25519.PublicKey
- func (kp *Full) Seed() string
- func (kp *Full) Sign(message []byte) ([]byte, error)
- func (kp *Full) Verify(message, signature []byte) error
- type KP
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidKey will be returned by operations when the keys being used // could not be decoded. ErrInvalidKey = errors.New("invalid key") // ErrInvalidSignature is returned when the signature is invalid, either // through malformation or if it does not verify the message against the // provided public key ErrInvalidSignature = errors.New("signature verification failed") // ErrCannotSign is returned when attempting to sign a message when // the keys do not have the secret key available ErrCannotSign = errors.New("cannot sign") )
Functions ¶
This section is empty.
Types ¶
type FromAddress ¶
type FromAddress struct {
// contains filtered or unexported fields
}
FromAddress represents a keys to which only the address is known. This KP can verify signatures, but cannot sign messages.
func ParseAddress ¶
func ParseAddress(address string) (*FromAddress, error)
ParseAddress constructs a new FromAddress keys from the provided string, which should be an address.
func (*FromAddress) Equal ¶
func (kp *FromAddress) Equal(a *FromAddress) bool
Equal compares two FromAddress instances.
func (*FromAddress) FromAddress ¶
func (kp *FromAddress) FromAddress() (*FromAddress, error)
FromAddress gets the address-only representation of these keys, which is itself.
func (*FromAddress) Hint ¶
func (kp *FromAddress) Hint() (r [4]byte)
Hint provides four last bytes of public key.
func (*FromAddress) PublicKey ¶
func (kp *FromAddress) PublicKey() *[32]byte
PublicKey is public key getter.
type Full ¶
type Full struct {
// contains filtered or unexported fields
}
Full represents a keys with generated on ed25519 key pair and seed used for its creation. In addition, it stores address which is public key representation in human-readable form.
func FromRawSeed ¶
FromRawSeed creates a new keys from the provided raw ED25519 seed
func ParseFull ¶
ParseFull constructs a new Full keys from the provided string, which should be a seed.
func (*Full) FromAddress ¶
func (kp *Full) FromAddress() (*FromAddress, error)
FromAddress gets the address-only representation, or public key, of this Full keys.