cashier

package
v0.0.0-...-91f0152 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PossibilityByteCount = 2 // bytes

)

Variables

This section is empty.

Functions

This section is empty.

Types

type CashTokensProof

type CashTokensProof struct {
	TXID          string        `json:"txid"`
	Vout          uint32        `json:"vout"`
	Confirmations int64         `json:"confirmations"`
	TokenInfo     bch.TokenInfo `json:"tokenInfo"`
	TokenData     hexutil.Bytes `json:"tokenData"`
	Sig           hexutil.Bytes `json:"sig"`
}

type Cashier

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

func NewCashier

func NewCashier(bchClient bch.IBchClient, privKey *ecdsa.PrivateKey) *Cashier

func (*Cashier) DecryptForPaidUser

func (c *Cashier) DecryptForPaidUser(
	encodedMetaData []byte,
	encryptedData []byte,
	reencryptPubKey []byte,
	rawTx []byte,
) (*ReencryptedDataForPaidUser, error)

func (*Cashier) DecryptForTokenOwner

func (c *Cashier) DecryptForTokenOwner(
	encodedMetaData []byte,
	encryptedData []byte,
	reencryptPubKey []byte,
	txid string,
	vout uint32,
) (*ReencryptedDataForTokenOwner, error)

func (*Cashier) JudgeStochasticPayment

func (c *Cashier) JudgeStochasticPayment(rawTx []byte) (*PaymentJudgment, error)

func (*Cashier) ProveCashTokensOwnership

func (c *Cashier) ProveCashTokensOwnership(txid string, vout uint32) (*CashTokensProof, error)

type ICashier

type ICashier interface {
	JudgeStochasticPayment(rawTx []byte) (*PaymentJudgment, error)
	ProveCashTokensOwnership(txid string, vout uint32) (*CashTokensProof, error)
	DecryptForTokenOwner(encodedMetaData []byte, encryptedData []byte, reencryptPubKey []byte,
		txid string, vout uint32) (*ReencryptedDataForTokenOwner, error)
	DecryptForPaidUser(encodedMetaData []byte, encryptedData []byte, reencryptPubKey []byte,
		rawTx []byte) (*ReencryptedDataForPaidUser, error)
}

type LogInfo

type LogInfo struct {
	ChainId   *hexutil.Big   `json:"chainId"`
	Timestamp *hexutil.Big   `json:"timestamp"`
	Address   common.Address `json:"address"`
	Topics    []common.Hash  `json:"topics"`
	Data      hexutil.Bytes  `json:"data"`
}

LogInfo is copied from ElfinGuard

func (*LogInfo) ToBytes

func (li *LogInfo) ToBytes() []byte

type PaymentJudgment

type PaymentJudgment struct {
	Prob16   uint16        `json:"prob16"`
	Rand16   uint16        `json:"rand16"`
	VrfAlpha hexutil.Bytes `json:"vrfAlpha"`
	VrfBeta  hexutil.Bytes `json:"vrfBeta"`
	VrfPi    hexutil.Bytes `json:"vrfPi"`
	LogInfo  hexutil.Bytes `json:"logInfo"`
	LogSig   hexutil.Bytes `json:"logSig"`
	LogRaw   LogInfo       `json:"rawLog"`
	// contains filtered or unexported fields
}

type ReencryptedDataForPaidUser

type ReencryptedDataForPaidUser struct {
	Data     hexutil.Bytes `json:"data"`
	VrfAlpha hexutil.Bytes `json:"vrfAlpha"`
	VrfBeta  hexutil.Bytes `json:"vrfBeta"`
	VrfPi    hexutil.Bytes `json:"vrfPi"`
}

type ReencryptedDataForTokenOwner

type ReencryptedDataForTokenOwner struct {
	Data hexutil.Bytes `json:"data"`
}

type TokenMetaData

type TokenMetaData struct {
	Amount        uint64 // 8 bytes
	Possibility   uint16 // 2 bytes
	TokenCategory []byte // 32 bytes
	NftCommitment []byte // 40 bytes
}

Jump to

Keyboard shortcuts

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