vc

package
v0.0.0-...-e11dbd8 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FairxCoinId (even tho there is no coin) the FairX HD space
	FairxCoinId = "950"

	// FairxMasterKeyPath
	FairxMasterKeyPath = "m/44'/0'/0'/0'"

	// FairXKeyPathFormat is a path format used for FairX Node key pairs
	// Always hardened = m/44'/org_id'/credential_id'/claim_id'
	FairXKeyPathFormat = "m/44'/%d'/%d'/%d'"
	// FirstHardenedIndex is the index of the first hardened key.
	FirstHardenedIndex = uint32(0x80000000)
)

Variables

View Source
var (
	ErrInvalidPath        = errors.New("Invalid derivation path")
	ErrNoPublicDerivation = errors.New("No public derivation for ed25519")
)

Functions

func VerifySignature

func VerifySignature(key *Key, contentSigned []byte, signature []byte) error

Types

type Key

type Key struct {
	Key       []byte
	ChainCode []byte
}

func DeriveForPath

func DeriveForPath(path string, seed []byte) (*Key, error)

DeriveForPath derives key for a path in BIP-44 format and a seed. Ed25119 derivation operated on hardened keys only.

func Generate

func Generate() *Key

func NewMasterKey

func NewMasterKey(seed []byte) (*Key, error)

NewMasterKey generates a new master key from seed.

func (*Key) Derive

func (k *Key) Derive(i uint32) (*Key, error)

func (*Key) PublicKey

func (k *Key) PublicKey() ([]byte, error)

PublicKey returns public key for a derived private key.

func (*Key) PublicKeyMultibase

func (k *Key) PublicKeyMultibase() (string, error)

PublicKeyString returns Base64URL encoded representation of public key

func (*Key) RawSeed

func (k *Key) RawSeed() [32]byte

RawSeed returns raw seed bytes

func (*Key) Sign

func (k *Key) Sign(content []byte) ([]byte, error)

Signs somethign with this key

Jump to

Keyboard shortcuts

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