Documentation ¶
Index ¶
- Constants
- Variables
- type FromAddress
- func (kp *FromAddress) Address() string
- func (kp *FromAddress) Equal(a *FromAddress) bool
- func (kp *FromAddress) FromAddress() *FromAddress
- func (kp *FromAddress) Hint() (r [4]byte)
- func (kp *FromAddress) MarshalBinary() ([]byte, error)
- func (kp *FromAddress) MarshalText() ([]byte, error)
- func (kp *FromAddress) Sign(input []byte) ([]byte, error)
- func (kp *FromAddress) SignBase64(input []byte) (string, error)
- func (kp *FromAddress) SignDecorated(input []byte) (xdr.DecoratedSignature, error)
- func (kp *FromAddress) SignPayloadDecorated(input []byte) (xdr.DecoratedSignature, error)
- func (kp *FromAddress) UnmarshalBinary(b []byte) error
- func (kp *FromAddress) UnmarshalText(text []byte) error
- func (kp *FromAddress) Verify(input []byte, sig []byte) error
- type Full
- func (kp *Full) Address() string
- func (kp *Full) Equal(f *Full) bool
- func (kp *Full) FromAddress() *FromAddress
- func (kp *Full) Hint() (r [4]byte)
- func (kp *Full) Seed() string
- func (kp *Full) Sign(input []byte) ([]byte, error)
- func (kp *Full) SignBase64(input []byte) (string, error)
- func (kp *Full) SignDecorated(input []byte) (xdr.DecoratedSignature, error)
- func (kp *Full) SignPayloadDecorated(input []byte) (xdr.DecoratedSignature, error)
- func (kp *Full) Verify(input []byte, sig []byte) error
- type KP
Constants ¶
const ( // DefaultSignerWeight represents the starting weight of the default signer // for an account. DefaultSignerWeight = 1 )
Variables ¶
var ( // ErrInvalidKey will be returned by operations when the keypair 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 keypair does 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 keypair to which only the address is know. This KP can verify signatures, but cannot sign them.
NOTE: ensure the address provided is a valid strkey encoded hcnet address. Some operations will panic otherwise. It's recommended that you create these structs through the Parse() method.
func MustParseAddress ¶ added in v1.11.1
func MustParseAddress(address string) *FromAddress
MustParseAddress is the panic-on-fail version of ParseAddress
func ParseAddress ¶ added in v1.11.1
func ParseAddress(address string) (*FromAddress, error)
ParseAddress constructs a new FromAddress keypair from the provided string, which should be an address.
func (*FromAddress) Address ¶
func (kp *FromAddress) Address() string
func (*FromAddress) Equal ¶ added in v1.11.1
func (kp *FromAddress) Equal(a *FromAddress) bool
func (*FromAddress) FromAddress ¶ added in v1.11.1
func (kp *FromAddress) FromAddress() *FromAddress
FromAddress gets the address-only representation, or public key, of this keypair, which is itself.
func (*FromAddress) Hint ¶
func (kp *FromAddress) Hint() (r [4]byte)
func (*FromAddress) MarshalBinary ¶ added in v1.11.1
func (kp *FromAddress) MarshalBinary() ([]byte, error)
func (*FromAddress) MarshalText ¶ added in v1.11.1
func (kp *FromAddress) MarshalText() ([]byte, error)
func (*FromAddress) SignBase64 ¶ added in v1.11.1
func (kp *FromAddress) SignBase64(input []byte) (string, error)
func (*FromAddress) SignDecorated ¶
func (kp *FromAddress) SignDecorated(input []byte) (xdr.DecoratedSignature, error)
func (*FromAddress) SignPayloadDecorated ¶ added in v1.11.1
func (kp *FromAddress) SignPayloadDecorated(input []byte) (xdr.DecoratedSignature, error)
func (*FromAddress) UnmarshalBinary ¶ added in v1.11.1
func (kp *FromAddress) UnmarshalBinary(b []byte) error
func (*FromAddress) UnmarshalText ¶ added in v1.11.1
func (kp *FromAddress) UnmarshalText(text []byte) error
type Full ¶
type Full struct {
// contains filtered or unexported fields
}
func FromRawSeed ¶
FromRawSeed creates a new keypair from the provided raw ED25519 seed
func MustParseFull ¶ added in v1.11.1
MustParseFull is the panic-on-fail version of ParseFull
func MustRandom ¶ added in v1.11.1
func MustRandom() *Full
MustRandom is the panic-on-fail version of Random.
func ParseFull ¶ added in v1.11.1
ParseFull constructs a new Full keypair from the provided string, which should be a seed.
func (*Full) FromAddress ¶ added in v1.11.1
func (kp *Full) FromAddress() *FromAddress
FromAddress gets the address-only representation, or public key, of this Full keypair.
func (*Full) SignBase64 ¶ added in v1.11.1
SignBase64 signs the input data and returns a base64 encoded string, the common format in which signatures are exchanged.
func (*Full) SignDecorated ¶
func (kp *Full) SignDecorated(input []byte) (xdr.DecoratedSignature, error)
func (*Full) SignPayloadDecorated ¶ added in v1.11.1
func (kp *Full) SignPayloadDecorated(input []byte) (xdr.DecoratedSignature, error)
SignPayloadDecorated returns a decorated signature that signs for a signed payload signer where the input is the payload being signed.
type KP ¶
type KP interface { Address() string FromAddress() *FromAddress Hint() [4]byte Verify(input []byte, signature []byte) error Sign(input []byte) ([]byte, error) SignBase64(input []byte) (string, error) SignDecorated(input []byte) (xdr.DecoratedSignature, error) SignPayloadDecorated(input []byte) (xdr.DecoratedSignature, error) }
KP is the main interface for this package
func Master ¶
Master returns the master keypair for a given network passphrase Deprecated: Use keypair.Root instead.