audit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auditor

type Auditor struct {
	Logger logging.Logger
	Tracer trace.Tracer
	// Owner Identity InfoMatcher
	InfoMatcher InfoMatcher
	// Auditor's signing identity
	Signer SigningIdentity
	// Pedersen generators used to compute TokenData
	PedersenParams []*math.G1
	// Elliptic curve
	Curve *math.Curve
}

Auditor inspects zkat tokens and their owners.

func NewAuditor

func NewAuditor(logger logging.Logger, tracer trace.Tracer, infoMatcher InfoMatcher, pp []*math.G1, signer SigningIdentity, c *math.Curve) *Auditor

func (*Auditor) Check

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

Check validates TokenRequest against TokenRequestMetadata

func (*Auditor) CheckIssueRequests

func (a *Auditor) CheckIssueRequests(outputsFromIssue [][]*InspectableToken, txID driver.TokenRequestAnchor) error

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

func (*Auditor) CheckTransferRequests

func (a *Auditor) CheckTransferRequests(inputs [][]*InspectableToken, outputsFromTransfer [][]*InspectableToken, txID driver.TokenRequestAnchor) 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) GetAuditInfoForIssues

func (a *Auditor) GetAuditInfoForIssues(issues [][]byte, issueMetadata []*driver.IssueMetadata) ([][]*InspectableToken, []InspectableIdentity, error)

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

func (*Auditor) GetAuditInfoForTransfers

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

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

func (*Auditor) InspectIdentity

func (a *Auditor) InspectIdentity(matcher InfoMatcher, identity *InspectableIdentity, index int) error

InspectIdentity verifies that the audit info matches the token owner

func (*Auditor) InspectInputs

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

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

func (*Auditor) InspectOutput

func (a *Auditor) InspectOutput(output *InspectableToken, 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 []*InspectableToken) error

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

type InfoMatcher

type InfoMatcher interface {
	MatchIdentity(id driver.Identity, ai []byte) error
}

InfoMatcher deserialize audit information

type InspectableData

type InspectableData struct {
	Data      *math.G1
	TokenType token2.Type
	Value     *math.Zr
	BF        *math.Zr
}

type InspectableIdentity

type InspectableIdentity struct {
	Identity         driver.Identity
	IdentityFromMeta driver.Identity
	AuditInfo        []byte
}

type InspectableToken

type InspectableToken struct {
	Identity InspectableIdentity
	Data     InspectableData
}

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

func NewInspectableToken

func NewInspectableToken(
	token *token.Token,
	ownerAuditInfo []byte,
	tokenType token2.Type,
	value *math.Zr,
	bf *math.Zr,
) (*InspectableToken, error)

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 token2.Type
	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