crypto

package
v0.0.0-...-ef514fe Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrvKey

type PrvKey []byte

PrvKey is a ed25519 extended private key.

func NewPrvKey

func NewPrvKey(bech string) (PrvKey, error)

NewPrvKey creates a new private key from a bech32 encoded private key.

func (PrvKey) Bech32

func (prv PrvKey) Bech32(prefix string) string

Bech32 returns the private key encoded as bech32.

func (PrvKey) PubKey

func (prv PrvKey) PubKey() PubKey

XPubKey returns the XPubKey derived from the private key.

func (*PrvKey) Sign

func (prv *PrvKey) Sign(message []byte) []byte

func (PrvKey) String

func (prv PrvKey) String() string

type PubKey

type PubKey []byte

PubKey is a edd25519 public key.

func NewPubKey

func NewPubKey(bech string) (PubKey, error)

NewPubKey creates a new public key from a bech32 encoded public key.

func (PubKey) Bech32

func (pub PubKey) Bech32(prefix string) string

Bech32 returns the public key encoded as bech32.

func (PubKey) Hash

func (pub PubKey) Hash() ([]byte, error)

Hash returns the public key hash using blake2b224.

func (PubKey) String

func (pub PubKey) String() string

func (PubKey) Verify

func (pub PubKey) Verify(message, signature []byte) bool

Verify reports whether sig is a valid signature of message by the public key.

type XPrvKey

type XPrvKey []byte

XPrvKey is the extended private key (64 bytes) appended with the chain code (32 bytes).

func NewXPrvKey

func NewXPrvKey(bech string) (XPrvKey, error)

NewXPrvKey creates a new extended private key from a bech32 encoded private key.

func NewXPrvKeyFromEntropy

func NewXPrvKeyFromEntropy(entropy []byte, password string) XPrvKey

func (XPrvKey) Bech32

func (prv XPrvKey) Bech32(prefix string) string

Bech32 returns the private key encoded as bech32.

func (XPrvKey) Derive

func (xsk XPrvKey) Derive(index uint32) XPrvKey

Derive derives a children XPrv using BIP32-Ed25519

func (XPrvKey) PrvKey

func (prv XPrvKey) PrvKey() PrvKey

PrvKey returns the ed25519 extended private key.

func (XPrvKey) PubKey

func (prv XPrvKey) PubKey() PubKey

XPubKey returns the XPubKey derived from the extended private key.

func (*XPrvKey) Sign

func (prv *XPrvKey) Sign(message []byte) []byte

func (XPrvKey) String

func (prv XPrvKey) String() string

func (XPrvKey) XPubKey

func (prv XPrvKey) XPubKey() XPubKey

XPubKey returns the XPubKey derived from the extended private key.

type XPubKey

type XPubKey []byte

XPubKey is the public key (32 bytes) appended with the chain code (32 bytes).

func NewXPubKey

func NewXPubKey(bech string) (XPubKey, error)

NewXPubKey creates a new extended public key from a bech32 encoded extended public key.

func (XPubKey) Derive

func (xvk XPubKey) Derive(index uint32) (XPubKey, error)

Derive derives a children XPub using BIP32-Ed25519

func (XPubKey) PubKey

func (pub XPubKey) PubKey() PubKey

XPubKey returns the PubKey from the extended public key.

func (XPubKey) String

func (pub XPubKey) String() string

func (XPubKey) Verify

func (pub XPubKey) Verify(message, sig []byte) bool

Verify reports whether sig is a valid signature of message by the extended public key.

Jump to

Keyboard shortcuts

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