address

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAC1

func FormatAC1(hash []byte) string

FormatAC1 formats the hash of an Accumulate public key as an Accumulate AC1 address. (ed25519)

func FormatAC2 added in v1.4.0

func FormatAC2(hash []byte) string

FormatAC2 formats the hash of an Accumulate public key as an Accumulate AC2 (ecdsa) address.

func FormatAC3 added in v1.4.0

func FormatAC3(hash []byte) string

FormatAC3 formats the hash of an Accumulate public key as an Accumulate AC3 (rsa) address.

func FormatAS1

func FormatAS1(seed []byte) string

FormatAS1 formats an Accumulate private key as an Accumulate AS1 address. (ed25519)

func FormatAS2 added in v1.4.0

func FormatAS2(seed []byte) string

FormatAS2 formats an Accumulate private key as an Accumulate AS2 ecdsa address.

func FormatAS3 added in v1.4.0

func FormatAS3(seed []byte) string

FormatAS3 formats an Accumulate private key as an Accumulate AS3 rsa address.

func FormatBTC

func FormatBTC(hash []byte) string

FormatBTC formats the hash of a Bitcoin public key as a P2PKH address, additionally prefixed with 'BT'.

func FormatETH

func FormatETH(hash []byte) string

FormatETH formats the hash of an Ethereum public key as an Ethereum address.

func FormatFA

func FormatFA(hash []byte) string

FormatFA formats the hash of a Factom public key as a Factom FA address.

func FormatFs

func FormatFs(seed []byte) string

FormatFs formats a Factom private key as a Factom Fs address.

func FormatMH

func FormatMH(hash []byte, code uint64) string

FormatMH formats an unknown hash as a multihash Accumulate address.

Types

type Address

type Address interface {
	String() string
	GetType() protocol.SignatureType
	GetPublicKeyHash() ([]byte, bool)
	GetPublicKey() ([]byte, bool)
	GetPrivateKey() ([]byte, bool)
}

func Parse

func Parse(s string) (Address, error)

type Lite

type Lite struct {
	Url   *url.URL
	Bytes []byte
}

func (*Lite) GetPrivateKey

func (l *Lite) GetPrivateKey() ([]byte, bool)

func (*Lite) GetPublicKey

func (l *Lite) GetPublicKey() ([]byte, bool)

func (*Lite) GetPublicKeyHash

func (l *Lite) GetPublicKeyHash() ([]byte, bool)

func (*Lite) GetType

func (l *Lite) GetType() protocol.SignatureType

func (*Lite) String

func (l *Lite) String() string

type PrivateKey

type PrivateKey struct {
	PublicKey
	Key []byte
}

func FromED25519PrivateKey added in v1.4.0

func FromED25519PrivateKey(key []byte) *PrivateKey

func FromETHPrivateKey added in v1.4.0

func FromETHPrivateKey(key *ecdsa.PrivateKey) *PrivateKey

func FromEcdsaPrivateKey added in v1.4.0

func FromEcdsaPrivateKey(key *ecdsa.PrivateKey) *PrivateKey

func FromPrivateKeyBytes added in v1.4.0

func FromPrivateKeyBytes(priv []byte, typ protocol.SignatureType) (*PrivateKey, error)

func FromRSAPrivateKey added in v1.4.0

func FromRSAPrivateKey(key *rsa.PrivateKey) *PrivateKey

func (*PrivateKey) GetPrivateKey

func (p *PrivateKey) GetPrivateKey() ([]byte, bool)

func (*PrivateKey) String

func (p *PrivateKey) String() string

type PublicKey

type PublicKey struct {
	Type protocol.SignatureType
	Key  []byte
}

func FromED25519PublicKey added in v1.4.0

func FromED25519PublicKey(key []byte) *PublicKey

func FromEcdsaPublicKeyAsPKIX added in v1.4.0

func FromEcdsaPublicKeyAsPKIX(key *ecdsa.PublicKey) *PublicKey

func FromRSAPublicKey added in v1.4.0

func FromRSAPublicKey(key *rsa.PublicKey) *PublicKey

func (*PublicKey) GetPrivateKey

func (p *PublicKey) GetPrivateKey() ([]byte, bool)

func (*PublicKey) GetPublicKey

func (p *PublicKey) GetPublicKey() ([]byte, bool)

func (*PublicKey) GetPublicKeyHash

func (p *PublicKey) GetPublicKeyHash() ([]byte, bool)

func (*PublicKey) GetType

func (p *PublicKey) GetType() protocol.SignatureType

func (*PublicKey) String

func (p *PublicKey) String() string

type PublicKeyHash

type PublicKeyHash struct {
	Type protocol.SignatureType
	Hash []byte
}

func (*PublicKeyHash) GetPrivateKey

func (p *PublicKeyHash) GetPrivateKey() ([]byte, bool)

func (*PublicKeyHash) GetPublicKey

func (p *PublicKeyHash) GetPublicKey() ([]byte, bool)

func (*PublicKeyHash) GetPublicKeyHash

func (p *PublicKeyHash) GetPublicKeyHash() ([]byte, bool)

func (*PublicKeyHash) GetType

func (p *PublicKeyHash) GetType() protocol.SignatureType

func (*PublicKeyHash) String

func (p *PublicKeyHash) String() string

type Unknown

type Unknown struct {
	Value    []byte
	Encoding rune
}

func (*Unknown) GetPrivateKey

func (u *Unknown) GetPrivateKey() ([]byte, bool)

func (*Unknown) GetPublicKey

func (u *Unknown) GetPublicKey() ([]byte, bool)

func (*Unknown) GetPublicKeyHash

func (u *Unknown) GetPublicKeyHash() ([]byte, bool)

func (*Unknown) GetType

func (u *Unknown) GetType() protocol.SignatureType

func (*Unknown) String

func (u *Unknown) String() string

type UnknownHash

type UnknownHash struct {
	Hash []byte
}

func (*UnknownHash) GetPrivateKey

func (u *UnknownHash) GetPrivateKey() ([]byte, bool)

func (*UnknownHash) GetPublicKey

func (u *UnknownHash) GetPublicKey() ([]byte, bool)

func (*UnknownHash) GetPublicKeyHash

func (u *UnknownHash) GetPublicKeyHash() ([]byte, bool)

func (*UnknownHash) GetType

func (u *UnknownHash) GetType() protocol.SignatureType

func (*UnknownHash) String

func (u *UnknownHash) String() string

type UnknownMultihash

type UnknownMultihash multihash.DecodedMultihash

func (*UnknownMultihash) GetPrivateKey

func (u *UnknownMultihash) GetPrivateKey() ([]byte, bool)

func (*UnknownMultihash) GetPublicKey

func (u *UnknownMultihash) GetPublicKey() ([]byte, bool)

func (*UnknownMultihash) GetPublicKeyHash

func (u *UnknownMultihash) GetPublicKeyHash() ([]byte, bool)

func (*UnknownMultihash) GetType

func (*UnknownMultihash) String

func (u *UnknownMultihash) String() string

Jump to

Keyboard shortcuts

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