audit

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuditInfoForIssues

func GetAuditInfoForIssues(issues [][]byte, metadata []driver.IssueMetadata) ([][]*AuditableToken, error)

GetAuditInfoForIssues returns an array of AuditableToken for each issue action It takes a deserializer, an array of serialized issue actions and an array of issue metadata.

func GetAuditInfoForTransfers

func GetAuditInfoForTransfers(transfers [][]byte, metadata []driver.TransferMetadata, inputs [][]*token.Token) ([][]*AuditableToken, [][]*AuditableToken, error)

GetAuditInfoForTransfers returns an array of AuditableToken for each transfer action. It takes a deserializer, an array of serialized transfer actions and an array of transfer metadata.

func InspectTokenOwner

func InspectTokenOwner(des Deserializer, token *AuditableToken, index int) error

InspectTokenOwner verifies that the audit info matches the token owner

Types

type AuditableToken

type AuditableToken struct {
	Token *token.Token
	Data  *TokenDataOpening
	Owner *OwnerOpening
}

AuditableToken contains a zkat token and the information that allows an auditor to learn its content.

func NewAuditableToken

func NewAuditableToken(token *token.Token, ownerInfo []byte, tokenType string, value *math.Zr, bf *math.Zr) (*AuditableToken, error)

type Auditor

type Auditor struct {
	// Owner Identity Deserializer
	Des Deserializer
	// Auditor's signing identity
	Signer SigningIdentity
	// Pedersen generators used to compute TokenData
	PedersenParams []*math.G1
	// SigningIdentity parameters (e.g., pseudonym parameters)
	NYMParams []byte
	// Elliptic curve
	Curve *math.Curve

	// InspectTokenOwnerFunc is a function that inspects the owner field
	InspectTokenOwnerFunc        InspectTokenOwnerFunc
	GetAuditInfoForIssuesFunc    GetAuditInfoForIssuesFunc
	GetAuditInfoForTransfersFunc GetAuditInfoForTransfersFunc
}

Auditor inspects zkat tokens and their owners.

func NewAuditor

func NewAuditor(des Deserializer, pp []*math.G1, nymparams []byte, signer SigningIdentity, c *math.Curve) *Auditor

func (*Auditor) Check

func (a *Auditor) Check(tokenRequest *driver.TokenRequest, tokenRequestMetadata *driver.TokenRequestMetadata, inputTokens [][]*token.Token, txID string) error

Check validates TokenRequest against TokenRequestMetadata

func (*Auditor) CheckIssueRequests

func (a *Auditor) CheckIssueRequests(outputsFromIssue [][]*AuditableToken, txID string) error

CheckIssueRequests verifies that the commitments in issue outputs match the information provided in the clear.

func (*Auditor) CheckTransferRequests

func (a *Auditor) CheckTransferRequests(inputs [][]*AuditableToken, outputsFromTransfer [][]*AuditableToken, txID string) error

CheckTransferRequests verifies that the commitments in transfer inputs and outputs match the information provided in the clear.

func (*Auditor) Endorse

func (a *Auditor) Endorse(tokenRequest *driver.TokenRequest, txID string) ([]byte, error)

Endorse is called to sign a valid token request

func (*Auditor) InspectInputs

func (a *Auditor) InspectInputs(inputs []*AuditableToken) error

InspectInputs verifies that the commitments in an array of inputs matches the information provided in the clear.

func (*Auditor) InspectOutput

func (a *Auditor) InspectOutput(output *AuditableToken, index int) error

InspectOutput verifies that the commitments in an output token of a given index match the information provided in the clear.

func (*Auditor) InspectOutputs

func (a *Auditor) InspectOutputs(tokens []*AuditableToken) error

InspectOutputs verifies that the commitments in an array of outputs matches the information provided in the clear.

type Deserializer

type Deserializer interface {
	// GetOwnerMatcher returns the owner matcher for the given audit info
	GetOwnerMatcher(auditInfo []byte) (driver.Matcher, error)
}

Deserializer deserialize audit information

type GetAuditInfoForIssuesFunc

type GetAuditInfoForIssuesFunc = func(issues [][]byte, metadata []driver.IssueMetadata) ([][]*AuditableToken, error)

GetAuditInfoForIssuesFunc models a function to get auditable tokens from issue actions

type GetAuditInfoForTransfersFunc

type GetAuditInfoForTransfersFunc = func(transfers [][]byte, metadata []driver.TransferMetadata, inputs [][]*token.Token) ([][]*AuditableToken, [][]*AuditableToken, error)

GetAuditInfoForTransfersFunc models a function to get auditable tokens from transfer actions

type InspectTokenOwnerFunc

type InspectTokenOwnerFunc = func(des Deserializer, token *AuditableToken, index int) error

InspectTokenOwnerFunc models a function to inspect the owner field

type OwnerOpening

type OwnerOpening struct {
	OwnerInfo []byte
}

OwnerOpening contains the information that allows the auditor to identify the owner.

type SigningIdentity

type SigningIdentity interface {
	driver.SigningIdentity
}

SigningIdentity models a signing identity

type TokenDataOpening

type TokenDataOpening struct {
	TokenType string
	Value     *math.Zr
	BF        *math.Zr
}

TokenDataOpening contains the opening of the TokenData. TokenData is a Pedersen commitment to token type and Value.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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