signers

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package signers associates signers and their corresponding keys.

Index

Constants

View Source
const (
	AssetKeySpace   keySpace = 0
	AccountKeySpace keySpace = 1
)
View Source
const (
	//BIP0032 compatible previous derivation rule m/account/address_index
	BIP0032 uint8 = iota
	//BIP0032 path derivation rule m/purpose'/coin_type'/account'/change/address_index
	BIP0044
)

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 or equal to 1, and must be 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")

	// 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")
	ErrDeriveRule = errors.New("invalid key derive rule")
)
View Source
var (
	// BIP44Purpose purpose field 0x0000002c little-endian mode.
	BIP44Purpose = []byte{0x2C, 0x00, 0x00, 0x00}
	// BTMCoinType coin type field 0x00000099 little-endian mode.
	BTMCoinType = []byte{0x99, 0x00, 0x00, 0x00}
)

Functions

func GetBip0032Path added in v1.0.7

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

GetBip0032Path returns the complete path for bip0032 derived keys

func IDGenerate added in v0.4.0

func IDGenerate() string

IDGenerate generate signer unique id

func Path

func Path(s *Signer, ks keySpace, change bool, addrIndex uint64) ([][]byte, error)

Path returns the complete path for derived keys

Types

type Signer

type Signer struct {
	Type       string         `json:"type"`
	XPubs      []chainkd.XPub `json:"xpubs"`
	Quorum     int            `json:"quorum"`
	KeyIndex   uint64         `json:"key_index"`
	DeriveRule uint8          `json:"derive_rule"`
}

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(signerType string, xpubs []chainkd.XPub, quorum int, keyIndex uint64, deriveRule uint8) (*Signer, error)

Create creates and stores a Signer in the database

type SortKeys added in v1.0.7

type SortKeys []chainkd.XPub

func (SortKeys) Len added in v1.0.7

func (s SortKeys) Len() int

func (SortKeys) Less added in v1.0.7

func (s SortKeys) Less(i, j int) bool

func (SortKeys) Swap added in v1.0.7

func (s SortKeys) Swap(i, j int)

Jump to

Keyboard shortcuts

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