address

package
v4.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ResultFail = SignatureVerifyResult(iota)
	ResultSuccessSpend
	ResultSuccessView
)
View Source
const ChecksumLength = 4
View Source
const PackedAddressSpend = 0
View Source
const PackedAddressView = 1

Variables

View Source
var PackedAddressGlobalNetwork uint8 = monero.MainNetwork

Functions

func GetDerivationNoAllocate

func GetDerivationNoAllocate(viewPublicKeyPoint *edwards25519.Point, txKey *edwards25519.Scalar) crypto.PublicKeyBytes

GetDerivationNoAllocate Special version

func GetDerivationNoAllocateTable

func GetDerivationNoAllocateTable(viewPublicKeyTable *edwards25519.PrecomputedTable, txKey *edwards25519.Scalar) crypto.PublicKeyBytes

GetDerivationNoAllocateTable Special version but with table

func GetDeterministicTransactionPrivateKey

func GetDeterministicTransactionPrivateKey(seed types.Hash, prevId types.Hash) crypto.PrivateKey

func GetEphemeralPublicKey

func GetEphemeralPublicKey(a Interface, txKey crypto.PrivateKey, outputIndex uint64) crypto.PublicKey

func GetEphemeralPublicKeyAndViewTag

func GetEphemeralPublicKeyAndViewTag(a Interface, txKey crypto.PrivateKey, outputIndex uint64) (crypto.PublicKey, uint8)

func GetEphemeralPublicKeyAndViewTagNoAllocate

func GetEphemeralPublicKeyAndViewTagNoAllocate(spendPublicKeyPoint *edwards25519.Point, derivation crypto.PublicKeyBytes, outputIndex uint64, hasher *sha3.HasherState) (crypto.PublicKeyBytes, uint8)

GetEphemeralPublicKeyAndViewTagNoAllocate Special version of GetEphemeralPublicKeyAndViewTag

func GetMessageHash

func GetMessageHash(a Interface, message []byte, mode uint8) types.Hash

func GetPublicKeyForSharedData

func GetPublicKeyForSharedData(a Interface, sharedData crypto.PrivateKey) crypto.PublicKey

func GetTxProofV1

func GetTxProofV1(a Interface, txId types.Hash, txKey crypto.PrivateKey, message string) string

func GetTxProofV2

func GetTxProofV2(a Interface, txId types.Hash, txKey crypto.PrivateKey, message string) string

Types

type Address

type Address struct {
	SpendPub crypto.PublicKeyBytes
	ViewPub  crypto.PublicKeyBytes
	Network  uint8
	// contains filtered or unexported fields
}

func FromBase58

func FromBase58(address string) *Address

func FromBase58NoChecksumCheck

func FromBase58NoChecksumCheck(address []byte) *Address

func FromRawAddress

func FromRawAddress(network uint8, spend, view crypto.PublicKey) *Address

func (*Address) Compare

func (a *Address) Compare(b Interface) int

func (*Address) MarshalJSON

func (a *Address) MarshalJSON() ([]byte, error)

func (*Address) PublicKeys

func (a *Address) PublicKeys() (spend, view crypto.PublicKey)

func (*Address) SpendPublicKey

func (a *Address) SpendPublicKey() *crypto.PublicKeyBytes

func (*Address) ToAddress

func (a *Address) ToAddress(network uint8, err ...error) *Address

func (*Address) ToBase58

func (a *Address) ToBase58() []byte

func (*Address) ToPackedAddress

func (a *Address) ToPackedAddress() PackedAddress

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(b []byte) error

func (*Address) ViewPublicKey

func (a *Address) ViewPublicKey() *crypto.PublicKeyBytes

type Checksum

type Checksum [ChecksumLength]byte

type Interface

type Interface interface {
	Compare(b Interface) int

	PublicKeys() (spend, view crypto.PublicKey)

	SpendPublicKey() *crypto.PublicKeyBytes
	ViewPublicKey() *crypto.PublicKeyBytes

	ToAddress(network uint8, err ...error) *Address
	ToPackedAddress() PackedAddress
}

type PackedAddress

type PackedAddress [2]crypto.PublicKeyBytes

PackedAddress 0 = spend, 1 = view

var ZeroPrivateKeyAddress PackedAddress

ZeroPrivateKeyAddress Special address with private keys set to both zero. Useful to detect unsupported signatures from hardware wallets on Monero GUI

func NewPackedAddress

func NewPackedAddress(spend, view crypto.PublicKey) (result PackedAddress)

func NewPackedAddressFromBytes

func NewPackedAddressFromBytes(spend, view crypto.PublicKeyBytes) (result PackedAddress)

func (PackedAddress) Bytes

func (p PackedAddress) Bytes() []byte

func (*PackedAddress) Compare

func (p *PackedAddress) Compare(b Interface) int

Compare special consensus comparison

func (*PackedAddress) ComparePacked

func (p *PackedAddress) ComparePacked(other *PackedAddress) int

func (*PackedAddress) PublicKeys

func (p *PackedAddress) PublicKeys() (spend, view crypto.PublicKey)

func (PackedAddress) Reference

func (p PackedAddress) Reference() *PackedAddress

func (*PackedAddress) SpendPublicKey

func (p *PackedAddress) SpendPublicKey() *crypto.PublicKeyBytes

func (*PackedAddress) ToAddress

func (p *PackedAddress) ToAddress(network uint8, err ...error) *Address

func (PackedAddress) ToBase58

func (p PackedAddress) ToBase58(network uint8, err ...error) []byte

func (*PackedAddress) ToPackedAddress

func (p *PackedAddress) ToPackedAddress() PackedAddress

func (*PackedAddress) ViewPublicKey

func (p *PackedAddress) ViewPublicKey() *crypto.PublicKeyBytes

type SignatureVerifyResult

type SignatureVerifyResult int
const (
	ResultFailZeroSpend SignatureVerifyResult = -2
	ResultFailZeroView  SignatureVerifyResult = -1
)

func VerifyMessage

func VerifyMessage(a Interface, message []byte, signature string) SignatureVerifyResult

func VerifyMessageFallbackToZero

func VerifyMessageFallbackToZero(a Interface, message []byte, signature string) SignatureVerifyResult

VerifyMessageFallbackToZero Check for Monero GUI behavior to generate wrong signatures on view-only wallets

Jump to

Keyboard shortcuts

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