nogh

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: 31 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditDES

type AuditDES interface {
	GetOwnerMatcher(raw []byte) (driver.Matcher, error)
}

AuditDES deserializes raw bytes into a matcher, which allows an auditor to match an identity to an enrollment ID

type Deserializer added in v0.3.0

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

Deserializer deserializes verifiers associated with issuers, owners, and auditors

func NewDeserializer

func NewDeserializer(pp *crypto.PublicParams) (*Deserializer, error)

NewDeserializer returns a deserializer

func (*Deserializer) GetAuditorVerifier added in v0.3.0

func (d *Deserializer) GetAuditorVerifier(id view.Identity) (driver.Verifier, error)

GetAuditorVerifier deserializes the verifier for the passed auditor identity

func (*Deserializer) GetIssuerVerifier added in v0.3.0

func (d *Deserializer) GetIssuerVerifier(id view.Identity) (driver.Verifier, error)

GetIssuerVerifier deserializes the verifier for the passed issuer identity

func (*Deserializer) GetOwnerMatcher added in v0.3.0

func (d *Deserializer) GetOwnerMatcher(raw []byte) (driver.Matcher, error)

GetOwnerMatcher returns a matcher that allows auditors to match an identity to an enrollment ID

func (*Deserializer) GetOwnerVerifier added in v0.3.0

func (d *Deserializer) GetOwnerVerifier(id view.Identity) (driver.Verifier, error)

GetOwnerVerifier deserializes the verifier for the passed owner identity

type DeserializerProvider

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

DeserializerProvider provides the deserializer matching zkatdlog public parameters

func NewDeserializerProvider

func NewDeserializerProvider() *DeserializerProvider

NewDeserializerProvider returns a DeserializerProvider

func (*DeserializerProvider) Deserialize

func (d *DeserializerProvider) Deserialize(params *crypto.PublicParams) (driver.Deserializer, error)

Deserialize returns the deserializer matching the passed public parameters

type DeserializerProviderFunc

type DeserializerProviderFunc = func(params *crypto.PublicParams) (driver.Deserializer, error)

type EnrollmentService added in v0.3.0

type EnrollmentService struct {
}

EnrollmentService returns enrollment IDs behind the owners of token

func NewEnrollmentIDDeserializer

func NewEnrollmentIDDeserializer() *EnrollmentService

NewEnrollmentIDDeserializer returns an enrollmentService

func (*EnrollmentService) GetEnrollmentID added in v0.3.0

func (e *EnrollmentService) GetEnrollmentID(auditInfo []byte) (string, error)

GetEnrollmentID returns the enrollmentID associated with the identity matched to the passed auditInfo

func (*EnrollmentService) GetRevocationHandler added in v0.3.0

func (e *EnrollmentService) GetRevocationHandler(auditInfo []byte) (string, error)

GetRevocationHandler returns the recoatopn handle associated with the identity matched to the passed auditInfo

type KVS

type KVS interface {
	Exists(id string) bool
	Put(id string, state interface{}) error
	Get(id string, state interface{}) error
	GetByPartialCompositeID(prefix string, attrs []string) (kvs.Iterator, error)
}

type PublicParametersManager

type PublicParametersManager interface {
	driver.PublicParamsManager
	PublicParams() *crypto.PublicParams
}

type PublicParamsLoader added in v0.2.0

type PublicParamsLoader struct {
	PublicParamsFetcher driver.PublicParamsFetcher
	PPLabel             string
}

func NewPublicParamsLoader added in v0.2.0

func NewPublicParamsLoader(publicParamsFetcher driver.PublicParamsFetcher, PPLabel string) *PublicParamsLoader

func (*PublicParamsLoader) Fetch added in v0.2.0

func (s *PublicParamsLoader) Fetch() ([]byte, error)

Fetch fetches the public parameters from the backend

func (*PublicParamsLoader) FetchParams added in v0.2.0

func (s *PublicParamsLoader) FetchParams() (*crypto.PublicParams, error)

FetchParams fetches the public parameters from the backend and unmarshal them

type Service

type Service struct {
	*WalletService
	PPM                   PublicParametersManager
	TokenLoader           TokenLoader
	TokenCommitmentLoader TokenCommitmentLoader
	DeserializerProvider  DeserializerProviderFunc
	// contains filtered or unexported fields
}

func NewTokenService

func NewTokenService(ws *WalletService, PPM PublicParametersManager, tokenLoader TokenLoader, tokenCommitmentLoader TokenCommitmentLoader, identityProvider driver.IdentityProvider, deserializerProvider DeserializerProviderFunc, configManager config.Manager) (*Service, error)

func (*Service) AuditorCheck

func (s *Service) AuditorCheck(tokenRequest *driver.TokenRequest, tokenRequestMetadata *driver.TokenRequestMetadata, txID string) error

AuditorCheck verifies if the passed tokenRequest matches the tokenRequestMetadata

func (*Service) Certify

func (s *Service) Certify(wallet driver.CertifierWallet, ids []*token.ID, tokens [][]byte, request []byte) ([][]byte, error)

Certify returns an array of serialized certifications, such that the i^th certification asserts that the i^th passed token corresponds to the token associated with the i^th passed identifier zkatdlog does not make use of the certification service

func (*Service) ConfigManager

func (s *Service) ConfigManager() config.Manager

ConfigManager returns the configuration manager associated with the service

func (*Service) DeserializeIssueAction

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

DeserializeIssueAction un-marshals raw bytes into a zkatdlog IssueAction

func (*Service) DeserializeToken

func (s *Service) DeserializeToken(tok []byte, infoRaw []byte) (*token3.Token, view.Identity, error)

DeserializeToken un-marshals a token and token info from raw bytes It checks if the un-marshalled token matches the token info. If not, it returns an error. Else it returns the token in cleartext and the identity of its issuer

func (*Service) DeserializeTransferAction

func (s *Service) 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 (*Service) Deserializer

func (s *Service) Deserializer() (driver.Deserializer, error)

func (*Service) GetAuditorVerifier

func (s *Service) GetAuditorVerifier(id view.Identity) (driver.Verifier, error)

GetAuditorVerifier deserializes the verifier for the passed auditor identity

func (*Service) GetIssuerVerifier

func (s *Service) GetIssuerVerifier(id view.Identity) (driver.Verifier, error)

GetIssuerVerifier deserializes the verifier for the passed issuer identity

func (*Service) GetOwnerMatcher

func (s *Service) GetOwnerMatcher(raw []byte) (driver.Matcher, error)

GetOwnerMatcher deserializes the passed bytes into a Matcher The Matcher can be used later to match an identity to its audit information

func (*Service) GetOwnerVerifier

func (s *Service) GetOwnerVerifier(id view.Identity) (driver.Verifier, error)

GetOwnerVerifier deserializes the verifier for the passed owner identity

func (*Service) GetTokenInfo added in v0.3.0

func (s *Service) GetTokenInfo(meta *driver.TokenRequestMetadata, target []byte) ([]byte, error)

func (*Service) IdentityProvider

func (s *Service) IdentityProvider() driver.IdentityProvider

IdentityProvider returns the identity provider associated with the service

func (*Service) Issue

func (s *Service) Issue(issuerIdentity view.Identity, tokenType string, 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 TokenInformation associated with issued tokens and the identity of the issuer

func (*Service) MarshalTokenRequestToSign

func (s *Service) MarshalTokenRequestToSign(request *driver.TokenRequest, meta *driver.TokenRequestMetadata) ([]byte, error)

func (*Service) NewCertificationRequest

func (s *Service) NewCertificationRequest(ids []*token.ID) ([]byte, error)

NewCertificationRequest creates a request to certify the tokens identified by the passed identifiers zkatdlog does not make use of the certification service

func (*Service) PublicParams

func (s *Service) PublicParams() *crypto.PublicParams

PublicParams returns the public parameters associated with the service

func (*Service) PublicParamsManager

func (s *Service) PublicParamsManager() driver.PublicParamsManager

PublicParamsManager returns the manager of the public parameters associated with the service

func (*Service) Transfer

func (s *Service) Transfer(txID string, wallet driver.OwnerWallet, ids []*token3.ID, outputTokens []*token3.Token, opts *driver.TransferOptions) (driver.TransferAction, *driver.TransferMetadata, error)

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

func (*Service) Validator

func (s *Service) Validator() (driver.Validator, error)

Validator returns the validator associated with the service

func (*Service) VerifyCertifications

func (s *Service) VerifyCertifications(ids []*token.ID, certifications [][]byte) error

VerifyCertifications checks if the passed certifications are valid with respect to the tokens associated with the passed identifiers If not, VerifyCertifications returns an error zkatdlog does not make use of the certification service

func (*Service) VerifyIssue

func (s *Service) VerifyIssue(ia driver.IssueAction, outputsMetadata [][]byte) error

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

func (*Service) VerifyTransfer

func (s *Service) VerifyTransfer(action driver.TransferAction, outputsMetadata [][]byte) error

VerifyTransfer checks the outputs in the TransferAction against the passed metadata

type SigningIdentity

type SigningIdentity interface {
	driver.SigningIdentity
}

type TokenCommitmentLoader

type TokenCommitmentLoader interface {
	GetTokenOutputs(ids []*token3.ID) ([]*token.Token, error)
}

type TokenLoader

type TokenLoader interface {
	LoadTokens(ids []*token3.ID) ([]string, []*token.Token, []*token.Metadata, []view.Identity, error)
}

type TokenVault

type TokenVault interface {
	IsPending(id *token3.ID) (bool, error)
	GetTokenInfoAndOutputs(ids []*token3.ID, callback driver.QueryCallback2Func) error
	GetTokenOutputs(ids []*token3.ID, callback driver.QueryCallbackFunc) error
}

type VaultTokenCommitmentLoader

type VaultTokenCommitmentLoader struct {
	TokenVault TokenVault
	// Variables used to control retry condition
	NumRetries int
	RetryDelay time.Duration
}

func NewVaultTokenCommitmentLoader added in v0.3.0

func NewVaultTokenCommitmentLoader(tokenVault TokenVault, numRetries int, retryDelay time.Duration) *VaultTokenCommitmentLoader

func (*VaultTokenCommitmentLoader) GetTokenOutputs added in v0.3.0

func (s *VaultTokenCommitmentLoader) GetTokenOutputs(ids []*token3.ID) ([]*token.Token, error)

GetTokenOutputs takes an array of token identifiers (txID, index) and returns the corresponding token outputs

type VaultTokenLoader

type VaultTokenLoader struct {
	TokenVault TokenVault
}

func (*VaultTokenLoader) LoadTokens

func (s *VaultTokenLoader) LoadTokens(ids []*token3.ID) ([]string, []*token.Token, []*token.Metadata, []view.Identity, error)

LoadTokens takes an array of token identifiers (txID, index) and returns the keys in the vault matching the token identifiers, the corresponding zkatdlog tokens, the information of the tokens in clear text and the identities of their owners LoadToken returns an error in case of failure

type VerifierDES

type VerifierDES interface {
	DeserializeVerifier(id view.Identity) (driver.Verifier, error)
}

VerifierDES deserializes verifiers A verifier checks the validity of a signature against the identity associated with the verifier

type WalletService added in v0.3.0

type WalletService struct {
	SP view2.ServiceProvider

	WalletServiceBacked  WalletServiceBacked
	PPM                  PublicParametersManager
	DeserializerProvider DeserializerProviderFunc

	OwnerWalletsRegistry   *identity.WalletsRegistry
	IssuerWalletsRegistry  *identity.WalletsRegistry
	AuditorWalletsRegistry *identity.WalletsRegistry
	// contains filtered or unexported fields
}

func NewWalletService added in v0.3.0

func NewWalletService(
	tmsID token2.TMSID,
	SP view2.ServiceProvider,
	identityProvider driver.IdentityProvider,
	walletServiceBacked WalletServiceBacked,
	PPM PublicParametersManager,
	deserializerProvider DeserializerProviderFunc,
	configManager config.Manager,
	kvs KVS,
) *WalletService

func (*WalletService) AuditorWallet added in v0.3.0

func (s *WalletService) AuditorWallet(id string) (driver.AuditorWallet, error)

func (*WalletService) AuditorWalletByIdentity added in v0.3.0

func (s *WalletService) AuditorWalletByIdentity(identity view.Identity) (driver.AuditorWallet, error)

func (*WalletService) CertifierWallet added in v0.3.0

func (s *WalletService) CertifierWallet(id string) (driver.CertifierWallet, error)

func (*WalletService) CertifierWalletByIdentity added in v0.3.0

func (s *WalletService) CertifierWalletByIdentity(identity view.Identity) (driver.CertifierWallet, error)

func (*WalletService) Deserializer added in v0.3.0

func (s *WalletService) Deserializer() (driver.Deserializer, error)

func (*WalletService) GetAuditInfo added in v0.3.0

func (s *WalletService) GetAuditInfo(id view.Identity) ([]byte, error)

func (*WalletService) GetEnrollmentID added in v0.3.0

func (s *WalletService) GetEnrollmentID(auditInfo []byte) (string, error)

func (*WalletService) GetRevocationHandler added in v0.3.0

func (s *WalletService) GetRevocationHandler(auditInfo []byte) (string, error)

func (*WalletService) IssuerWallet added in v0.3.0

func (s *WalletService) IssuerWallet(id string) (driver.IssuerWallet, error)

func (*WalletService) IssuerWalletByIdentity added in v0.3.0

func (s *WalletService) IssuerWalletByIdentity(identity view.Identity) (driver.IssuerWallet, error)

func (*WalletService) OwnerWallet added in v0.3.0

func (s *WalletService) OwnerWallet(id string) (driver.OwnerWallet, error)

func (*WalletService) OwnerWalletByID added in v0.3.0

func (s *WalletService) OwnerWalletByID(id interface{}) (driver.OwnerWallet, error)

func (*WalletService) OwnerWalletByIdentity added in v0.3.0

func (s *WalletService) OwnerWalletByIdentity(identity view.Identity) (driver.OwnerWallet, error)

func (*WalletService) OwnerWalletIDs added in v0.3.0

func (s *WalletService) OwnerWalletIDs() ([]string, error)

func (*WalletService) RegisterIssuerWallet added in v0.3.0

func (s *WalletService) RegisterIssuerWallet(id string, path string) error

func (*WalletService) RegisterOwnerWallet added in v0.3.0

func (s *WalletService) RegisterOwnerWallet(id string, path string) error

func (*WalletService) RegisterRecipientIdentity added in v0.3.0

func (s *WalletService) RegisterRecipientIdentity(id view.Identity, auditInfo []byte, metadata []byte) error

func (*WalletService) SpentIDs added in v0.3.0

func (s *WalletService) SpentIDs(ids ...*token.ID) ([]string, error)

SpentIDs returns the spend ids for the passed token ids

func (*WalletService) Wallet added in v0.3.0

func (s *WalletService) Wallet(identity view.Identity) driver.Wallet

type WalletServiceBacked added in v0.3.0

type WalletServiceBacked interface {
	UnspentTokensIteratorBy(id, tokenType string) (driver.UnspentTokensIterator, error)
	ListHistoryIssuedTokens() (*token.IssuedTokens, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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