sakg

package
v0.2202.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Overview

Package sakg implements ADR 0008: Standard Account Key Generation.

Index

Constants

View Source
const (
	// BIP32PathMnemonicComponent is the string representing the mnemonic
	// (first) component of a BIP-0032 path.
	BIP32PathMnemonicComponent = "m"
	// BIP32HardenedComponentSuffix is the string representing the suffix of a
	// hardened component of a BIP-00032 path.
	BIP32HardenedComponentSuffix = "'"
)
View Source
const BIP32PathPrefix = "m/44'/474'"

BIP32PathPrefix is the Oasis Network's BIP-0032 path prefix as defined by ADR 0008.

View Source
const HardenedKeysIndexStart = uint32(0x80000000)

HardenedKeysIndexStart is the index of the first hardened BIP-0032 key.

View Source
const MaxAccountKeyNumber = uint32(0x7fffffff)

MaxAccountKeyNumber is the maximum allowed key number when using ADR 0008.

Variables

This section is empty.

Functions

This section is empty.

Types

type BIP32Path

type BIP32Path []uint32

BIP32Path represents a BIP-0032 path.

func GetAccountSigner

func GetAccountSigner(
	mnemonic string,
	passphrase string,
	number uint32,
) (signature.Signer, BIP32Path, error)

GetAccountSigner generates a signer for the given mnemonic, passphrase and account according to ADR 0008.

func NewBIP32Path

func NewBIP32Path(pathStr string) (BIP32Path, error)

NewBIP32Path creates a BIP32Path object from the given BIP-0032 path's string representation.

func (BIP32Path) MarshalText

func (path BIP32Path) MarshalText() ([]byte, error)

MarshalText encodes a BIP-0032 path into text form.

func (BIP32Path) String

func (path BIP32Path) String() string

String returns the string representation of a BIP-0032 path.

NOTE: Hardened paths are marked with BIP32HardenedComponentSuffix.

func (*BIP32Path) UnmarshalText

func (path *BIP32Path) UnmarshalText(text []byte) error

UnmarshalText decodes a text marshaled BIP-0032 path.

Jump to

Keyboard shortcuts

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