v1

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportedTokenFormat

func SupportedTokenFormat(precision uint64) (token.Format, error)

Types

type AuditorService

type AuditorService struct {
	Logger                  logging.Logger
	PublicParametersManager common.PublicParametersManager[*setup.PublicParams]
	Deserializer            driver.Deserializer
	QueryEngine             driver.QueryEngine

	// Limits are the configured resource limits threaded into the auditor so the
	// audit path enforces the same policy as the validator (issue #2028).
	Limits driver.ResourceLimits

	// AuditTokensNumRetries and AuditTokensRetryDelay control how AuditorCheck's
	// token lookup tolerates the pending-transaction read-timing race (issue #2105).
	// They default to common.DefaultAuditTokensNumRetries / DefaultAuditTokensRetryDelay
	// and can be tuned per TMS.
	AuditTokensNumRetries int
	AuditTokensRetryDelay time.Duration
	// contains filtered or unexported fields
}

AuditorService is a service that handles auditing of token requests.

func NewAuditorService

func NewAuditorService(
	logger logging.Logger,
	publicParametersManager common.PublicParametersManager[*setup.PublicParams],
	deserializer driver.Deserializer,
	queryEngine driver.QueryEngine,
	tracerProvider trace.TracerProvider,
	retryConfig common.AuditRetryConfig,
	limits driver.ResourceLimits,
) *AuditorService

NewAuditorService returns a new instance of AuditorService.

retryConfig sets the audit-token retry/backoff behavior of AuditorCheck; pass common.DefaultAuditRetryConfig() for the built-in defaults or common.LoadAuditRetryConfig(tmsConfig) to honor the per-TMS configuration file.

limits are the configured resource limits; they are threaded into the auditor so the audit path enforces the same policy as the validator (issue #2028).

func (*AuditorService) AuditorCheck

func (s *AuditorService) AuditorCheck(ctx context.Context, request *driver.TokenRequest, metadata *driver.TokenRequestMetadata, anchor driver.TokenRequestAnchor) error

AuditorCheck verifies if the passed tokenRequest matches the tokenRequestMetadata. For fabtoken, this performs structural validation, duplicate token ID checks, and validates that token types and amounts match between metadata and audit tokens.

type IssueService

type IssueService struct {
	PublicParamsManager driver.PublicParamsManager
	WalletService       driver.WalletService
	Deserializer        driver.Deserializer
}

func NewIssueService

func NewIssueService(publicParamsManager driver.PublicParamsManager, walletService driver.WalletService, deserializer driver.Deserializer) *IssueService

func (*IssueService) DeserializeIssueAction

func (s *IssueService) DeserializeIssueAction(raw []byte) (driver.IssueAction, error)

DeserializeIssueAction un-marshals the passed bytes into an IssueAction If unmarshalling fails, then DeserializeIssueAction returns an error

func (*IssueService) Issue

func (s *IssueService) Issue(ctx context.Context, issuerIdentity driver.Identity, tokenType token2.Type, values []uint64, owners [][]byte, opts *driver.IssueOptions) (driver.IssueAction, *driver.IssueMetadata, error)

Issue returns an IssueAction as a function of the passed arguments Issue also returns a serialization OutputMetadata associated with issued tokens and the identity of the issuer

func (*IssueService) VerifyIssue

func (s *IssueService) VerifyIssue(ctx context.Context, ia driver.IssueAction, metadata []*driver.IssueOutputMetadata) error

VerifyIssue checks if the outputs of an IssueAction match the passed tokenInfos

type Service

type Service struct {
	*common.Service[*setup.PublicParams]
}

func NewService

func NewService(
	logger logging.Logger,
	ws driver.WalletService,
	ppm common.PublicParametersManager[*setup.PublicParams],
	identityProvider driver.IdentityProvider,
	deserializer driver.Deserializer,
	configuration driver.Configuration,
	issueService driver.IssueService,
	transferService driver.TransferService,
	auditorService driver.AuditorService,
	tokensService driver.TokensService,
	tokensUpgradeService driver.TokensUpgradeService,
	authorization driver.Authorization,
	validator driver.Validator,
) (*Service, error)

type TokenLoader

type TokenLoader interface {
	GetTokens(ctx context.Context, ids []*token.ID) ([]*token.Token, error)
}

type TokensService

type TokensService struct {
	IdentityDeserializer driver.Deserializer
	OutputTokenFormat    token.Format
}

func NewTokensService

func NewTokensService(pp *setup.PublicParams, identityDeserializer driver.Deserializer) (*TokensService, error)

func (*TokensService) Deobfuscate

Deobfuscate returns a deserialized token and the identity of its issuer

func (*TokensService) Recipients

func (s *TokensService) Recipients(output driver.TokenOutput) ([]driver.Identity, error)

func (*TokensService) SupportedTokenFormats

func (s *TokensService) SupportedTokenFormats() []token.Format

type TokensUpgradeService

type TokensUpgradeService struct{}

func (*TokensUpgradeService) CheckUpgradeProof

func (*TokensUpgradeService) GenUpgradeProof

func (*TokensUpgradeService) NewUpgradeChallenge

func (s *TokensUpgradeService) NewUpgradeChallenge() (driver.TokensUpgradeChallenge, error)

type TransferService

type TransferService struct {
	Logger                  logging.Logger
	PublicParametersManager common.PublicParametersManager[*setup.PublicParams]
	WalletService           driver.WalletService
	TokenLoader             TokenLoader
	Deserializer            driver.Deserializer
}

func NewTransferService

func NewTransferService(
	logger logging.Logger,
	publicParametersManager common.PublicParametersManager[*setup.PublicParams],
	walletService driver.WalletService,
	tokenLoader TokenLoader,
	deserializer driver.Deserializer,
) *TransferService

func (*TransferService) DeserializeTransferAction

func (s *TransferService) DeserializeTransferAction(raw []byte) (driver.TransferAction, error)

DeserializeTransferAction un-marshals a TransferAction from the passed array of bytes. DeserializeTransferAction returns an error, if the un-marshalling fails.

func (*TransferService) Transfer

Transfer returns a TransferAction as a function of the passed arguments It also returns the corresponding TransferMetadata

func (*TransferService) VerifyTransfer

func (s *TransferService) VerifyTransfer(ctx context.Context, tr driver.TransferAction, outputMetadata []*driver.TransferOutputMetadata) error

VerifyTransfer checks the outputs in the TransferAction against the passed tokenInfos

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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