nogh

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 30 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

func NewDeserializer

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

NewDeserializer returns a deserializer

func NewEnrollmentIDDeserializer

func NewEnrollmentIDDeserializer() *enrollmentService

NewEnrollmentIDDeserializer returns an enrollmentService

Types

type AuditDES

type AuditDES interface {
	DeserializeAuditInfo(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 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 KVS

type KVS interface {
	Exists(id string) bool
	Put(id string, state interface{}) error
	Get(id string, state interface{}) error
}

type PublicParametersManager

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

type QueryEngine

type QueryEngine interface {
	IsMine(id *token3.ID) (bool, error)
	// UnspentTokensIteratorBy returns an iterator of unspent tokens owned by the passed id and whose type is the passed on.
	// The token type can be empty. In that case, tokens of any type are returned.
	UnspentTokensIteratorBy(id, tokenType string) (driver.UnspentTokensIterator, error)
	ListAuditTokens(ids ...*token3.ID) ([]*token3.Token, error)
	ListHistoryIssuedTokens() (*token3.IssuedTokens, error)
}

type Service

type Service struct {
	SP                    view2.ServiceProvider
	TMSID                 token2.TMSID
	PP                    *crypto.PublicParams
	PPM                   PublicParametersManager
	PPLabel               string
	PublicParamsFetcher   driver.PublicParamsFetcher
	TokenLoader           TokenLoader
	TokenCommitmentLoader TokenCommitmentLoader
	QE                    QueryEngine
	DeserializerProvider  DeserializerProviderFunc

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

func NewTokenService

func NewTokenService(
	sp view2.ServiceProvider,
	tmsID token2.TMSID,
	PPM PublicParametersManager,
	tokenLoader TokenLoader,
	tokenCommitmentLoader TokenCommitmentLoader,
	queryEngine QueryEngine,
	identityProvider driver.IdentityProvider,
	deserializerProvider DeserializerProviderFunc,
	ppLabel string,
	configManager config.Manager,
	kvs KVS,
) (*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) AuditorWallet

func (s *Service) AuditorWallet(id string) driver.AuditorWallet

func (*Service) AuditorWalletByIdentity

func (s *Service) AuditorWalletByIdentity(id view.Identity) driver.AuditorWallet

func (*Service) CertifierWallet

func (s *Service) CertifierWallet(id string) driver.CertifierWallet

func (*Service) CertifierWalletByIdentity

func (s *Service) CertifierWalletByIdentity(id view.Identity) driver.CertifierWallet

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) FetchPublicParams

func (s *Service) FetchPublicParams() error

func (*Service) GetAuditInfo

func (s *Service) GetAuditInfo(id view.Identity) ([]byte, 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) GetEnrollmentID

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

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) 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, typ string, values []uint64, owners [][]byte, opts *driver.IssueOptions) (driver.IssueAction, [][]byte, view.Identity, 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) IssuerWallet

func (s *Service) IssuerWallet(id string) driver.IssuerWallet

func (*Service) IssuerWalletByIdentity

func (s *Service) IssuerWalletByIdentity(id view.Identity) driver.IssuerWallet

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) OwnerWallet

func (s *Service) OwnerWallet(walletID string) driver.OwnerWallet

func (*Service) OwnerWalletByID

func (s *Service) OwnerWalletByID(id interface{}) driver.OwnerWallet

func (*Service) OwnerWalletByIdentity

func (s *Service) OwnerWalletByIdentity(identity view.Identity) driver.OwnerWallet

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) RegisterIssuerWallet

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

func (*Service) RegisterOwnerWallet

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

func (*Service) RegisterRecipientIdentity

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

func (*Service) SpentIDs

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

SpentIDs returns the spend ids for the passed token ids

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

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

func (*Service) Wallet

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

type SigningIdentity

type SigningIdentity interface {
	driver.SigningIdentity
}

type TokenCommitmentLoader

type TokenCommitmentLoader interface {
	GetTokenCommitments(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 {
	PublicParams() ([]byte, error)
	GetTokenInfoAndCommitments(ids []*token3.ID, callback driver.QueryCallback2Func) error
	GetTokenCommitments(ids []*token3.ID, callback driver.QueryCallbackFunc) error
}

type VaultPublicParamsLoader

type VaultPublicParamsLoader struct {
	PublicParamsFetcher driver.PublicParamsFetcher
	PPLabel             string
}

func NewVaultPublicParamsLoader

func NewVaultPublicParamsLoader(publicParamsFetcher driver.PublicParamsFetcher, PPLabel string) *VaultPublicParamsLoader

func (*VaultPublicParamsLoader) Fetch

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

Fetch fetches the public parameters from the backend

func (*VaultPublicParamsLoader) FetchParams

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

FetchParams fetches the public parameters from the backend and unmarshal them

type VaultTokenCommitmentLoader

type VaultTokenCommitmentLoader struct {
	TokenVault TokenVault
}

func (*VaultTokenCommitmentLoader) GetTokenCommitments

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

GetTokenCommitments takes an array of token identifiers (txID, index) and returns the corresponding tokens

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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