key

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToSlice

func ArrayToSlice(array [operation.Ed25519KeySize]byte) []byte

func SliceToArray

func SliceToArray(slice []byte) [operation.Ed25519KeySize]byte

Types

type OTAKey

type OTAKey struct {
	// contains filtered or unexported fields
}

OTAKey is a pair of keys used to recover coin's one-time-address

func GenerateOTAKey

func GenerateOTAKey(privateKey []byte) OTAKey

func (OTAKey) GetOTASecretKey

func (otaKey OTAKey) GetOTASecretKey() *operation.Scalar

func (OTAKey) GetPublicSpend

func (otaKey OTAKey) GetPublicSpend() *operation.Point

func (*OTAKey) SetOTASecretKey

func (otaKey *OTAKey) SetOTASecretKey(otaSecretKey []byte)

func (*OTAKey) SetPublicSpend

func (otaKey *OTAKey) SetPublicSpend(publicSpend []byte)

type PaymentAddress

type PaymentAddress struct {
	Pk        PublicKey       // 32 bytes, use to receive coin (CoinV1)
	Tk        TransmissionKey // 32 bytes, use to encrypt pointByte
	OTAPublic PublicOTAKey    `json:"OTAPublic,omitempty"` // 32 bytes, used to receive coin (CoinV2)
}

PaymentAddress is an address of the payee

func GeneratePaymentAddress

func GeneratePaymentAddress(privateKey []byte) PaymentAddress

GeneratePaymentAddress generates a payment address corresponding to a spending key

func (*PaymentAddress) Bytes

func (addr *PaymentAddress) Bytes() []byte

Bytes converts payment address to bytes array

func (PaymentAddress) GetOTAPublicKey

func (addr PaymentAddress) GetOTAPublicKey() *operation.Point

func (PaymentAddress) GetPublicSpend

func (addr PaymentAddress) GetPublicSpend() *operation.Point

func (PaymentAddress) GetPublicView

func (addr PaymentAddress) GetPublicView() *operation.Point

func (*PaymentAddress) SetBytes

func (addr *PaymentAddress) SetBytes(bytes []byte) error

SetBytes reverts bytes array to payment address

func (PaymentAddress) String

func (addr PaymentAddress) String() string

String encodes a payment address as a hex string

type PaymentInfo

type PaymentInfo struct {
	PaymentAddress PaymentAddress
	Amount         uint64
	Message        []byte // 512 bytes
}

PaymentInfo contains an address of a payee and a value of coins he/she will receive

func InitPaymentInfo

func InitPaymentInfo(addr PaymentAddress, amount uint64, message []byte) *PaymentInfo

type PrivateKey

type PrivateKey []byte

32-byte spending key

func GeneratePrivateKey

func GeneratePrivateKey(seed []byte) PrivateKey

GeneratePrivateKey generates a random 32-byte spending key

type PrivateOTAKey

type PrivateOTAKey []byte

32-byte secret key: used to check if a coin belongs to a receiver (for receivers of COIN2 only)

func GeneratePrivateOTAKey

func GeneratePrivateOTAKey(privateKey []byte) PrivateOTAKey

type PublicKey

type PublicKey []byte

32-byte public key

func GeneratePublicKey

func GeneratePublicKey(privateKey []byte) PublicKey

GeneratePublicKey computes a 32-byte public-key corresponding to a spending key

type PublicOTAKey

type PublicOTAKey []byte

32-byte public OTA key: used to generate one-time-address coin (for senders of COINV2 only)

func GeneratePublicOTAKey

func GeneratePublicOTAKey(privateOTAKey PrivateOTAKey) PublicOTAKey

type ReceivingKey

type ReceivingKey []byte

32-byte receiving key

func GenerateReceivingKey

func GenerateReceivingKey(privateKey []byte) ReceivingKey

GenerateReceivingKey generates a 32-byte receiving key

type TransmissionKey

type TransmissionKey []byte

32-byte transmission key

func GenerateTransmissionKey

func GenerateTransmissionKey(receivingKey []byte) TransmissionKey

GenerateTransmissionKey computes a 33-byte transmission key corresponding to a receiving key

type ViewingKey

type ViewingKey struct {
	Pk PublicKey    // 33 bytes, use to receive coin
	Rk ReceivingKey // 32 bytes, use to decrypt pointByte
}

ViewingKey is a public/private key pair to encrypt coins in an outgoing transaction

func GenerateViewingKey

func GenerateViewingKey(privateKey []byte) ViewingKey

GenerateViewingKey generates a viewingKey corresponding to a spending key

func (ViewingKey) GetPrivateView

func (viewKey ViewingKey) GetPrivateView() *operation.Scalar

func (ViewingKey) GetPublicSpend

func (viewKey ViewingKey) GetPublicSpend() *operation.Point

Jump to

Keyboard shortcuts

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