signer

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SigntureFlagEd25519     = 0x0
	SigntureFlagSecp256k1   = 0x1
	AddressLength           = 64
	DerivationPathEd25519   = `m/44'/784'/0'/0'/0'`
	DerivationPathSecp256k1 = `m/54'/784'/0'/0/0`
)
View Source
const (
	FirstHardenedIndex = uint32(0x80000000)
)

Variables

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

Functions

func IntentWithScope

func IntentWithScope(intentScope IntentScope) []int

Types

type AppId

type AppId int
const (
	Sui AppId = 0
)

type IntentScope

type IntentScope int
const (
	TransactionData    IntentScope = 0
	TransactionEffects IntentScope = 1
	CheckpointSummary  IntentScope = 2
	PersonalMessage    IntentScope = 3
)

type IntentVersion

type IntentVersion int
const (
	V0 IntentVersion = 0
)

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 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) RawSeed

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

RawSeed returns raw seed bytes

type Signer

type Signer struct {
	PriKey  ed25519.PrivateKey
	PubKey  ed25519.PublicKey
	Address string
}

func NewSigner

func NewSigner(seed []byte) *Signer

func NewSignertWithMnemonic

func NewSignertWithMnemonic(mnemonic string) (*Signer, error)

Jump to

Keyboard shortcuts

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