bls12_381

package module
v0.0.0-...-551cdcc Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RecommendedSeedLen = 32 // 256 bits
	MinSeedBytes       = 16 // 128 bits
	MaxSeedBytes       = 64 // 512 bits

)
View Source
const DefaultPurpose = 12381

Variables

View Source
var (
	ErrInvalidSeedLen = fmt.Errorf("seed length must be between %d and %d bits",
		MinSeedBytes*8, MaxSeedBytes*8)
	ErrDeriveBeyondMaxDepth = errors.New("cannot derive a key with more than 255 indices in its path")
	ErrInvalidKeyLen        = errors.New("the provided serialized extended key length is invalid")
	ErrBadChecksum          = errors.New("bad extended key checksum")
)

Functions

func DeriveChildSK

func DeriveChildSK(parent_SK *big.Int, index uint32) (*big.Int, error)

noinspection ALL

func DeriveMasterSK

func DeriveMasterSK(seed []byte) (*big.Int, error)

noinspection ALL

func GenerateSeed

func GenerateSeed(length uint8) ([]byte, error)

Types

type DerivationPath

type DerivationPath []uint32

func ParseDerivationPath

func ParseDerivationPath(path string, base ...DerivationPath) (DerivationPath, error)

ParseDerivationPath converts a user specified derivation path string to the internal binary representation.

Full derivation paths need to start with the `m/` prefix, relative derivation paths (which will get appended to the provided base path) must not have prefixes in front of the first element. Whitespace is ignored. Modified copy from https://github.com/ethereum/go-ethereum/blob/master/accounts/hd.go

func (DerivationPath) String

func (path DerivationPath) String() string

String implements the stringer interface, converting a binary derivation path to its canonical representation.

type ExtendedKey

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

func DeriveKey

func DeriveKey(master *ExtendedKey, path DerivationPath) (*ExtendedKey, error)

func NewExtendedKey

func NewExtendedKey(privateKey, parentFP []byte, depth uint8,
	childNum uint32) *ExtendedKey

func NewKeyFromString

func NewKeyFromString(key string) (*ExtendedKey, error)

NewKeyFromString returns a new extended key instance from a base58-encoded extended key.

func NewMaster

func NewMaster(seed []byte) (*ExtendedKey, error)

func (*ExtendedKey) Address

func (k *ExtendedKey) Address() address.Address

func (*ExtendedKey) Child

func (k *ExtendedKey) Child(i uint32) (*ExtendedKey, error)

func (*ExtendedKey) Depth

func (k *ExtendedKey) Depth() uint8

func (*ExtendedKey) MarshalJSON

func (k *ExtendedKey) MarshalJSON() ([]byte, error)

func (*ExtendedKey) ParentFingerprint

func (k *ExtendedKey) ParentFingerprint() uint32

func (*ExtendedKey) PrivateKey

func (k *ExtendedKey) PrivateKey() ffi.PrivateKey

func (*ExtendedKey) PublicKey

func (k *ExtendedKey) PublicKey() ffi.PublicKey

func (*ExtendedKey) String

func (k *ExtendedKey) String() string

String returns the extended key as a human-readable base58-encoded string.

func (*ExtendedKey) UnmarshalJSON

func (k *ExtendedKey) UnmarshalJSON(b []byte) error

func (*ExtendedKey) Zero

func (k *ExtendedKey) Zero()

Jump to

Keyboard shortcuts

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