go: github.com/stellar/go/keypair Index | Files

package keypair

import "github.com/stellar/go/keypair"

Index

Package Files

from_address.go full.go main.go

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")
)

type FromAddress Uses

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 stellar address. Some operations will panic otherwise. It's recommended that you create these structs through the Parse() method.

func (*FromAddress) Address Uses

func (kp *FromAddress) Address() string

func (*FromAddress) Hint Uses

func (kp *FromAddress) Hint() (r [4]byte)

func (*FromAddress) Sign Uses

func (kp *FromAddress) Sign(input []byte) ([]byte, error)

func (*FromAddress) SignDecorated Uses

func (kp *FromAddress) SignDecorated(input []byte) (xdr.DecoratedSignature, error)

func (*FromAddress) Verify Uses

func (kp *FromAddress) Verify(input []byte, sig []byte) error

type Full Uses

type Full struct {
    // contains filtered or unexported fields
}

func FromRawSeed Uses

func FromRawSeed(rawSeed [32]byte) (*Full, error)

FromRawSeed creates a new keypair from the provided raw ED25519 seed

func MustRandom Uses

func MustRandom() *Full

MustRandom is the panic-on-fail version of Random.

func Random Uses

func Random() (*Full, error)

Random creates a random full keypair

func (*Full) Address Uses

func (kp *Full) Address() string

func (*Full) Hint Uses

func (kp *Full) Hint() (r [4]byte)

func (*Full) Seed Uses

func (kp *Full) Seed() string

func (*Full) Sign Uses

func (kp *Full) Sign(input []byte) ([]byte, error)

func (*Full) SignDecorated Uses

func (kp *Full) SignDecorated(input []byte) (xdr.DecoratedSignature, error)

func (*Full) Verify Uses

func (kp *Full) Verify(input []byte, sig []byte) error

type KP Uses

type KP interface {
    Address() string
    Hint() [4]byte
    Verify(input []byte, signature []byte) error
    Sign(input []byte) ([]byte, error)
    SignDecorated(input []byte) (xdr.DecoratedSignature, error)
}

KP is the main interface for this package

func Master Uses

func Master(networkPassphrase string) KP

Master returns the master keypair for a given network passphrase

func MustParse Uses

func MustParse(addressOrSeed string) KP

MustParse is the panic-on-fail version of Parse

func Parse Uses

func Parse(addressOrSeed string) (KP, error)

Parse constructs a new KP from the provided string, which should be either an address, or a seed. If the provided input is a seed, the resulting KP will have signing capabilities.

Package keypair imports 8 packages (graph) and is imported by 147 packages. Updated 2019-11-12. Refresh now. Tools for package owners.