signers

package
v0.0.0-...-6d4bf48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package signers associates signers and their corresponding keys.

Index

Constants

View Source
const (
	AssetKeySpace   keySpace = 0
	AccountKeySpace keySpace = 1
)

Variables

View Source
var (
	// ErrBadQuorum is returned by Create when the quorum
	// provided is less than 1 or greater than the number
	// of xpubs provided.
	ErrBadQuorum = errors.New("quorum must be greater than 1 and less than or equal to the length of xpubs")

	// ErrBadXPub is returned by Create when the xpub
	// provided isn't valid.
	ErrBadXPub = errors.New("invalid xpub format")

	// ErrNoXPubs is returned by create when the xpubs
	// slice provided is empty.
	ErrNoXPubs = errors.New("at least one xpub is required")

	// ErrBadType is returned when a find operation
	// retrieves a signer that is not the expected type.
	ErrBadType = errors.New("retrieved type does not match expected type")

	// ErrDupeXPub is returned by create when the same xpub
	// appears twice in a single call.
	ErrDupeXPub = errors.New("xpubs cannot contain the same key more than once")
)

Functions

func ConvertKeys

func ConvertKeys(xpubs [][]byte) ([]chainkd.XPub, error)

func Path

func Path(s *Signer, ks keySpace, itemIndexes ...uint64) [][]byte

Path returns the complete path for derived keys

Types

type Signer

type Signer struct {
	ID       string
	Type     string
	XPubs    []chainkd.XPub
	Quorum   int
	KeyIndex uint64
}

Signer is the abstract concept of a signer, which is composed of a set of keys as well as the amount of signatures needed for quorum.

func Create

func Create(ctx context.Context, db pg.DB, typ string, xpubs []chainkd.XPub, quorum int, clientToken string) (*Signer, error)

Create creates and stores a Signer in the database

func Find

func Find(ctx context.Context, db pg.DB, typ, id string) (*Signer, error)

Find retrieves a Signer from the database using the type and id.

func List

func List(ctx context.Context, db pg.DB, typ, prev string, limit int) ([]*Signer, string, error)

List returns a paginated set of Signers, limited to the provided type.

func New

func New(id, typ string, xpubs [][]byte, quorum int, keyIndex uint64) (*Signer, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL