Documentation ¶
Index ¶
- Constants
- func RetrieveInputsFromTransferAction(t *TransferAction, ledger driver.Ledger) ([]*token2.Token, error)
- func TransferBalanceValidate(ctx *Context) error
- func TransferHTLCValidate(ctx *Context) error
- func TransferSignatureValidate(ctx *Context) error
- func UnmarshalIssueTransferActions(tr *driver.TokenRequest) ([]*IssueAction, []*TransferAction, error)
- type Context
- type Deserializer
- func (d *Deserializer) GetAuditorVerifier(id view.Identity) (driver.Verifier, error)
- func (d *Deserializer) GetIssuerVerifier(id view.Identity) (driver.Verifier, error)
- func (d *Deserializer) GetOwnerMatcher(raw []byte) (driver.Matcher, error)
- func (d *Deserializer) GetOwnerVerifier(id view.Identity) (driver.Verifier, error)
- type EnrollmentService
- type IssueAction
- func (i *IssueAction) Deserialize(raw []byte) error
- func (i *IssueAction) GetIssuer() []byte
- func (i *IssueAction) GetMetadata() map[string][]byte
- func (i *IssueAction) GetOutputs() []driver.Output
- func (i *IssueAction) GetSerializedOutputs() ([][]byte, error)
- func (i *IssueAction) IsAnonymous() bool
- func (i *IssueAction) NumOutputs() int
- func (i *IssueAction) Serialize() ([]byte, error)
- type KVS
- type Output
- type OutputMetadata
- type PublicParametersManager
- type PublicParams
- func (pp *PublicParams) AddAuditor(auditor view.Identity)
- func (pp *PublicParams) AddIssuer(issuer view.Identity)
- func (pp *PublicParams) AuditorIdentity() view.Identity
- func (pp *PublicParams) Auditors() []view.Identity
- func (pp *PublicParams) Bytes() ([]byte, error)
- func (pp *PublicParams) CertificationDriver() string
- func (pp *PublicParams) ComputeMaxTokenValue() uint64
- func (pp *PublicParams) Deserialize(raw []byte) error
- func (pp *PublicParams) GraphHiding() bool
- func (pp *PublicParams) Identifier() string
- func (pp *PublicParams) MaxTokenValue() uint64
- func (pp *PublicParams) Precision() uint64
- func (pp *PublicParams) Serialize() ([]byte, error)
- func (pp *PublicParams) String() string
- func (pp *PublicParams) TokenDataHiding() bool
- func (pp *PublicParams) Validate() error
- type PublicParamsLoader
- type QueryEngine
- type Service
- func (s *Service) AuditorCheck(tokenRequest *driver.TokenRequest, ...) error
- func (s *Service) Certify(wallet driver.CertifierWallet, ids []*token2.ID, tokens [][]byte, ...) ([][]byte, error)
- func (s *Service) ConfigManager() config.Manager
- func (s *Service) DeserializeIssueAction(raw []byte) (driver.IssueAction, error)
- func (s *Service) DeserializeToken(outputRaw []byte, tokenInfoRaw []byte) (*token2.Token, view.Identity, error)
- func (s *Service) DeserializeTransferAction(raw []byte) (driver.TransferAction, error)
- func (s *Service) GetAuditorVerifier(id view.Identity) (driver.Verifier, error)
- func (s *Service) GetIssuerVerifier(id view.Identity) (driver.Verifier, error)
- func (s *Service) GetOwnerMatcher(raw []byte) (driver.Matcher, error)
- func (s *Service) GetOwnerVerifier(id view.Identity) (driver.Verifier, error)
- func (s *Service) GetTokenInfo(meta *driver.TokenRequestMetadata, target []byte) ([]byte, error)
- func (s *Service) HistoryIssuedTokens() (*token2.IssuedTokens, error)
- func (s *Service) IdentityProvider() driver.IdentityProvider
- func (s *Service) Issue(issuerIdentity view.Identity, tokenType string, values []uint64, ...) (driver.IssueAction, *driver.IssueMetadata, error)
- func (s *Service) MarshalTokenRequestToSign(request *driver.TokenRequest, meta *driver.TokenRequestMetadata) ([]byte, error)
- func (s *Service) NewCertificationRequest(ids []*token2.ID) ([]byte, error)
- func (s *Service) PublicParamsManager() driver.PublicParamsManager
- func (s *Service) Transfer(txID string, wallet driver.OwnerWallet, ids []*token2.ID, ...) (driver.TransferAction, *driver.TransferMetadata, error)
- func (s *Service) Validator() (driver.Validator, error)
- func (s *Service) VerifyCertifications(ids []*token2.ID, certifications [][]byte) error
- func (s *Service) VerifyIssue(tr driver.IssueAction, tokenInfos [][]byte) error
- func (s *Service) VerifyTransfer(tr driver.TransferAction, outputsMetadata [][]byte) error
- type TokenLoader
- type TokenVault
- type TransferAction
- func (t *TransferAction) Deserialize(raw []byte) error
- func (t *TransferAction) GetInputs() ([]string, error)
- func (t *TransferAction) GetMetadata() map[string][]byte
- func (t *TransferAction) GetOutputs() []driver.Output
- func (t *TransferAction) GetSerializedOutputs() ([][]byte, error)
- func (t *TransferAction) IsGraphHiding() bool
- func (t *TransferAction) IsRedeemAt(index int) bool
- func (t *TransferAction) NumOutputs() int
- func (t *TransferAction) Serialize() ([]byte, error)
- func (t *TransferAction) SerializeOutputAt(index int) ([]byte, error)
- type ValidateTransferFunc
- type Validator
- func (v *Validator) UnmarshalActions(raw []byte) ([]interface{}, error)
- func (v *Validator) VerifyAuditorSignature(signatureProvider driver.SignatureProvider) error
- func (v *Validator) VerifyIssue(issue driver.IssueAction) error
- func (v *Validator) VerifyIssues(issues []*IssueAction, signatureProvider driver.SignatureProvider) error
- func (v *Validator) VerifyTokenRequest(ledger driver.Ledger, signatureProvider driver.SignatureProvider, ...) ([]interface{}, map[string][]byte, error)
- func (v *Validator) VerifyTokenRequestFromRaw(getState driver.GetStateFnc, anchor string, raw []byte) ([]interface{}, map[string][]byte, error)
- func (v *Validator) VerifyTransfer(ledger driver.Ledger, inputTokens []*token2.Token, tr driver.TransferAction, ...) error
- func (v *Validator) VerifyTransfers(ledger driver.Ledger, transferActions []*TransferAction, ...) error
- type VaultTokenLoader
- type VerifierDES
- type WalletService
- func (s *WalletService) AuditorWallet(id string) (driver.AuditorWallet, error)
- func (s *WalletService) AuditorWalletByIdentity(identity view.Identity) (driver.AuditorWallet, error)
- func (s *WalletService) CertifierWallet(id string) (driver.CertifierWallet, error)
- func (s *WalletService) CertifierWalletByIdentity(identity view.Identity) (driver.CertifierWallet, error)
- func (s *WalletService) GetAuditInfo(id view.Identity) ([]byte, error)
- func (s *WalletService) GetEnrollmentID(auditInfo []byte) (string, error)
- func (s *WalletService) GetRevocationHandler(auditInfo []byte) (string, error)
- func (s *WalletService) IssuerWallet(id string) (driver.IssuerWallet, error)
- func (s *WalletService) IssuerWalletByIdentity(identity view.Identity) (driver.IssuerWallet, error)
- func (s *WalletService) OwnerWallet(id string) (driver.OwnerWallet, error)
- func (s *WalletService) OwnerWalletByID(id interface{}) (driver.OwnerWallet, error)
- func (s *WalletService) OwnerWalletByIdentity(identity view.Identity) (driver.OwnerWallet, error)
- func (s *WalletService) OwnerWalletIDs() ([]string, error)
- func (s *WalletService) RegisterAuditInfo(id view.Identity, auditInfo []byte) error
- func (s *WalletService) RegisterIssuerWallet(id string, path string) error
- func (s *WalletService) RegisterOwnerWallet(id string, path string) error
- func (s *WalletService) RegisterRecipientIdentity(id view.Identity, auditInfo []byte, metadata []byte) error
- func (s *WalletService) SpentIDs(ids ...*token.ID) ([]string, error)
- func (s *WalletService) Wallet(identity view.Identity) driver.Wallet
- type WalletServiceBacked
Constants ¶
const ( // PublicParameters is the key to be used to look up fabtoken parameters PublicParameters = "fabtoken" DefaultPrecision = uint64(64) )
Variables ¶
This section is empty.
Functions ¶
func RetrieveInputsFromTransferAction ¶
func RetrieveInputsFromTransferAction(t *TransferAction, ledger driver.Ledger) ([]*token2.Token, error)
RetrieveInputsFromTransferAction retrieves from the passed ledger the inputs identified in TransferAction
func TransferBalanceValidate ¶
TransferBalanceValidate checks that the sum of the inputs is equal to the sum of the outputs
func TransferHTLCValidate ¶
TransferHTLCValidate checks the validity of the HTLC scripts, if any
func TransferSignatureValidate ¶
TransferSignatureValidate validates the signatures for the inputs spent by an action
func UnmarshalIssueTransferActions ¶
func UnmarshalIssueTransferActions(tr *driver.TokenRequest) ([]*IssueAction, []*TransferAction, error)
UnmarshalIssueTransferActions returns the deserialized issue and transfer actions contained in the passed TokenRequest
Types ¶
type Context ¶
type Context struct { PP *PublicParams Deserializer driver.Deserializer SignatureProvider driver.SignatureProvider Signatures [][]byte InputTokens []*token.Token Action *TransferAction Ledger driver.Ledger MetadataCounter map[string]int }
func (*Context) CountMetadataKey ¶
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 (*Deserializer) GetAuditorVerifier ¶ added in v0.3.0
GetAuditorVerifier deserializes the verifier for the passed auditor identity
func (*Deserializer) GetIssuerVerifier ¶ added in v0.3.0
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 is not needed in fabtoken, as identities are in the clear
func (*Deserializer) GetOwnerVerifier ¶ added in v0.3.0
GetOwnerVerifier deserializes the verifier for the passed owner identity
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)
func (*EnrollmentService) GetRevocationHandler ¶ added in v0.3.0
func (e *EnrollmentService) GetRevocationHandler(auditInfo []byte) (string, error)
GetRevocationHandler returns the revocation handler associated with the identity matched to the passed auditInfo
type IssueAction ¶
type IssueAction struct { // issuer's public key Issuer view.Identity // new tokens to be issued Outputs []*Output // metadata of the issue action Metadata map[string][]byte }
IssueAction encodes a fabtoken Issue
func UnmarshalIssueActions ¶
func UnmarshalIssueActions(raw [][]byte) ([]*IssueAction, error)
UnmarshalIssueActions returns an array of deserialized IssueAction from raw bytes
func (*IssueAction) Deserialize ¶
func (i *IssueAction) Deserialize(raw []byte) error
Deserialize un-marshals IssueAction
func (*IssueAction) GetIssuer ¶
func (i *IssueAction) GetIssuer() []byte
GetIssuer returns the issuer encoded in IssueAction
func (*IssueAction) GetMetadata ¶
func (i *IssueAction) GetMetadata() map[string][]byte
GetMetadata returns the IssueAction metadata
func (*IssueAction) GetOutputs ¶
func (i *IssueAction) GetOutputs() []driver.Output
GetOutputs returns the outputs in an IssueAction
func (*IssueAction) GetSerializedOutputs ¶
func (i *IssueAction) GetSerializedOutputs() ([][]byte, error)
GetSerializedOutputs returns the serialization of the outputs in an IssueAction
func (*IssueAction) IsAnonymous ¶
func (i *IssueAction) IsAnonymous() bool
IsAnonymous returns false, indicating that the identity of issuers in fabtoken is revealed during issue
func (*IssueAction) NumOutputs ¶
func (i *IssueAction) NumOutputs() int
NumOutputs returns the number of outputs in an IssueAction
func (*IssueAction) Serialize ¶
func (i *IssueAction) Serialize() ([]byte, error)
Serialize marshals IssueAction
type Output ¶
Output carries the output of an action
type OutputMetadata ¶
type OutputMetadata struct {
Issuer []byte
}
OutputMetadata contains a serialization of the issuer of the token. type, value and owner of token can be derived from the token itself.
func (*OutputMetadata) Deserialize ¶
func (m *OutputMetadata) Deserialize(b []byte) error
Deserialize un-marshals OutputMetadata
func (*OutputMetadata) Serialize ¶
func (m *OutputMetadata) Serialize() ([]byte, error)
Serialize marshals OutputMetadata
type PublicParametersManager ¶
type PublicParametersManager interface { driver.PublicParamsManager PublicParams() *PublicParams }
type PublicParams ¶
type PublicParams struct { // Label is the label associated with the PublicParams. // It can be used by the driver for versioning purpose. Label string // The precision of token quantities QuantityPrecision uint64 // This is set when audit is enabled Auditor []byte // This encodes the list of authorized issuers Issuers [][]byte // MaxToken is the maximum quantity a token can hold MaxToken uint64 }
PublicParams is the public parameters for fabtoken
func NewPublicParamsFromBytes ¶
func NewPublicParamsFromBytes(raw []byte, label string) (*PublicParams, error)
NewPublicParamsFromBytes deserializes the raw bytes into public parameters The resulting public parameters are labeled with the passed label
func (*PublicParams) AddAuditor ¶
func (pp *PublicParams) AddAuditor(auditor view.Identity)
AddAuditor sets the Auditor field in PublicParams to the passed identity
func (*PublicParams) AddIssuer ¶
func (pp *PublicParams) AddIssuer(issuer view.Identity)
AddIssuer adds the passed issuer to the array of Issuers in PublicParams
func (*PublicParams) AuditorIdentity ¶
func (pp *PublicParams) AuditorIdentity() view.Identity
AuditorIdentity returns the auditor identity encoded in PublicParams
func (*PublicParams) Auditors ¶
func (pp *PublicParams) Auditors() []view.Identity
Auditors returns the list of authorized auditors fabtoken only supports a single auditor
func (*PublicParams) Bytes ¶
func (pp *PublicParams) Bytes() ([]byte, error)
Bytes marshals PublicParams
func (*PublicParams) CertificationDriver ¶
func (pp *PublicParams) CertificationDriver() string
CertificationDriver returns the label of the PublicParams From the label, one can deduce what certification process will be used if any.
func (*PublicParams) ComputeMaxTokenValue ¶
func (pp *PublicParams) ComputeMaxTokenValue() uint64
func (*PublicParams) Deserialize ¶
func (pp *PublicParams) Deserialize(raw []byte) error
Deserialize un-marshals the passed bytes into PublicParams
func (*PublicParams) GraphHiding ¶
func (pp *PublicParams) GraphHiding() bool
GraphHiding indicates if the PublicParams corresponds to a driver that hides the transaction graph fabtoken does not hide the graph, hence, GraphHiding returns false
func (*PublicParams) Identifier ¶
func (pp *PublicParams) Identifier() string
Identifier returns the label associated with the PublicParams todo shall we used Identifier instead of Label?
func (*PublicParams) MaxTokenValue ¶
func (pp *PublicParams) MaxTokenValue() uint64
MaxTokenValue returns the maximum value that a token can hold according to PublicParams
func (*PublicParams) Precision ¶
func (pp *PublicParams) Precision() uint64
Precision returns the quantity precision encoded in PublicParams
func (*PublicParams) Serialize ¶
func (pp *PublicParams) Serialize() ([]byte, error)
Serialize marshals a wrapper around PublicParams (SerializedPublicParams)
func (*PublicParams) String ¶ added in v0.3.0
func (pp *PublicParams) String() string
func (*PublicParams) TokenDataHiding ¶
func (pp *PublicParams) TokenDataHiding() bool
TokenDataHiding indicates if the PublicParams corresponds to a driver that hides token data fabtoken does not hide token data, hence, TokenDataHiding returns false
func (*PublicParams) Validate ¶
func (pp *PublicParams) Validate() error
Validate validates the public parameters
type PublicParamsLoader ¶
type PublicParamsLoader struct { PublicParamsFetcher driver.PublicParamsFetcher PPLabel string }
PublicParamsLoader allows one to fetch the public parameters for fabtoken
func (*PublicParamsLoader) Fetch ¶
func (s *PublicParamsLoader) Fetch() ([]byte, error)
Fetch fetches the public parameters from the backend
func (*PublicParamsLoader) FetchParams ¶
func (s *PublicParamsLoader) FetchParams() (*PublicParams, error)
FetchParams fetches the public parameters from the backend and unmarshal them
type QueryEngine ¶
type QueryEngine interface { IsMine(id *token2.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, typ string) (driver.UnspentTokensIterator, error) ListAuditTokens(ids ...*token2.ID) ([]*token2.Token, error) ListHistoryIssuedTokens() (*token2.IssuedTokens, error) PublicParams() ([]byte, error) }
type Service ¶
type Service struct { *WalletService PPM PublicParametersManager TokenLoader TokenLoader QE QueryEngine CM config.Manager IP driver.IdentityProvider Deserializer driver.Deserializer }
func NewService ¶
func NewService(ws *WalletService, ppm PublicParametersManager, tokenLoader TokenLoader, qe QueryEngine, identityProvider driver.IdentityProvider, deserializer driver.Deserializer, cm config.Manager) *Service
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 fabtoken does not make use of AuditorCheck as the token request contains token information in the clear
func (*Service) Certify ¶
func (s *Service) Certify(wallet driver.CertifierWallet, ids []*token2.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 fabtoken does not make use of the certification service
func (*Service) ConfigManager ¶
func (*Service) DeserializeIssueAction ¶
func (s *Service) DeserializeIssueAction(raw []byte) (driver.IssueAction, error)
DeserializeIssueAction un-marshals the passed bytes into an IssueAction If unmarshalling fails, then DeserializeIssueAction returns an error
func (*Service) DeserializeToken ¶
func (s *Service) DeserializeToken(outputRaw []byte, tokenInfoRaw []byte) (*token2.Token, view.Identity, error)
DeserializeToken returns a deserialized token 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) GetAuditorVerifier ¶
GetAuditorVerifier deserializes the verifier for the passed auditor identity
func (*Service) GetIssuerVerifier ¶
GetIssuerVerifier deserializes the verifier for the passed issuer identity
func (*Service) GetOwnerMatcher ¶
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 ¶
GetOwnerVerifier deserializes the verifier for the passed owner identity
func (*Service) GetTokenInfo ¶ added in v0.3.0
func (*Service) HistoryIssuedTokens ¶
func (s *Service) HistoryIssuedTokens() (*token2.IssuedTokens, error)
HistoryIssuedTokens returns the list of all issued tokens An IssuedToken consists of the identity of the token issuer, the token unique identifier and information
func (*Service) IdentityProvider ¶
func (s *Service) IdentityProvider() driver.IdentityProvider
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 OutputMetadata 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 ¶
NewCertificationRequest creates a request to certify the tokens identified by the passed identifiers fabtoken does not make use of the certification service
func (*Service) PublicParamsManager ¶
func (s *Service) PublicParamsManager() driver.PublicParamsManager
func (*Service) Transfer ¶
func (s *Service) Transfer(txID string, wallet driver.OwnerWallet, ids []*token2.ID, Outputs []*token2.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) VerifyCertifications ¶
VerifyCertifications checks if the passed certifications are valid with respect to the tokens associated with the passed identifiers If not, VerifyCertifications returns an error fabtoken does not make use of the certification service
func (*Service) VerifyIssue ¶
func (s *Service) VerifyIssue(tr driver.IssueAction, tokenInfos [][]byte) error
VerifyIssue checks if the outputs of an IssueAction match the passed tokenInfos
func (*Service) VerifyTransfer ¶
func (s *Service) VerifyTransfer(tr driver.TransferAction, outputsMetadata [][]byte) error
VerifyTransfer checks the outputs in the TransferAction against the passed tokenInfos
type TokenLoader ¶
type TokenVault ¶
type TransferAction ¶
type TransferAction struct { // identifier of token to be transferred Inputs []string // outputs to be created as a result of the transfer Outputs []*Output // Metadata contains the transfer action's metadata Metadata map[string][]byte }
TransferAction encodes a fabtoken transfer
func UnmarshalTransferActions ¶
func UnmarshalTransferActions(raw [][]byte) ([]*TransferAction, error)
UnmarshalTransferActions returns an array of deserialized TransferAction from raw bytes
func (*TransferAction) Deserialize ¶
func (t *TransferAction) Deserialize(raw []byte) error
Deserialize un-marshals TransferAction
func (*TransferAction) GetInputs ¶
func (t *TransferAction) GetInputs() ([]string, error)
GetInputs returns inputs of the TransferAction
func (*TransferAction) GetMetadata ¶
func (t *TransferAction) GetMetadata() map[string][]byte
GetMetadata returns the transfer action's metadata
func (*TransferAction) GetOutputs ¶
func (t *TransferAction) GetOutputs() []driver.Output
GetOutputs returns the outputs in a TransferAction
func (*TransferAction) GetSerializedOutputs ¶
func (t *TransferAction) GetSerializedOutputs() ([][]byte, error)
GetSerializedOutputs returns the serialization of the outputs in a TransferAction
func (*TransferAction) IsGraphHiding ¶
func (t *TransferAction) IsGraphHiding() bool
IsGraphHiding returns false, indicating that fabtoken does not hide the transaction graph
func (*TransferAction) IsRedeemAt ¶
func (t *TransferAction) IsRedeemAt(index int) bool
IsRedeemAt returns true if the output at the specified index is a redeemed output todo update interface to account for nil t.outputs[index]
func (*TransferAction) NumOutputs ¶
func (t *TransferAction) NumOutputs() int
NumOutputs returns the number of outputs in an TransferAction
func (*TransferAction) Serialize ¶
func (t *TransferAction) Serialize() ([]byte, error)
Serialize marshals TransferAction
func (*TransferAction) SerializeOutputAt ¶
func (t *TransferAction) SerializeOutputAt(index int) ([]byte, error)
SerializeOutputAt marshals the output at the specified index in TransferAction
type ValidateTransferFunc ¶
ValidateTransferFunc is the prototype of a validation function for a transfer action
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator checks the validity of fabtoken TokenRequest
func NewValidator ¶
func NewValidator(pp *PublicParams, deserializer driver.Deserializer, extraValidators ...ValidateTransferFunc) (*Validator, error)
NewValidator initializes a Validator with the passed parameters
func (*Validator) UnmarshalActions ¶
UnmarshalActions returns the actions contained in the serialized token request
func (*Validator) VerifyAuditorSignature ¶
func (v *Validator) VerifyAuditorSignature(signatureProvider driver.SignatureProvider) error
VerifyAuditorSignature checks if the content of the token request concatenated with the anchor was signed by the authorized auditor
func (*Validator) VerifyIssue ¶
func (v *Validator) VerifyIssue(issue driver.IssueAction) error
VerifyIssue checks if all outputs in IssueAction are valid (no zero-value outputs)
func (*Validator) VerifyIssues ¶
func (v *Validator) VerifyIssues(issues []*IssueAction, signatureProvider driver.SignatureProvider) error
VerifyIssues checks if the issued tokens are valid and if the content of the token request concatenated with the anchor was signed by one of the authorized issuers
func (*Validator) VerifyTokenRequest ¶
func (v *Validator) VerifyTokenRequest(ledger driver.Ledger, signatureProvider driver.SignatureProvider, anchor string, tr *driver.TokenRequest) ([]interface{}, map[string][]byte, error)
VerifyTokenRequest validates the passed token request against data in the ledger, the signature provided and the anchor
func (*Validator) VerifyTokenRequestFromRaw ¶
func (v *Validator) VerifyTokenRequestFromRaw(getState driver.GetStateFnc, anchor string, raw []byte) ([]interface{}, map[string][]byte, error)
VerifyTokenRequestFromRaw validates the raw token request
func (*Validator) VerifyTransfer ¶
func (v *Validator) VerifyTransfer(ledger driver.Ledger, inputTokens []*token2.Token, tr driver.TransferAction, signatureProvider driver.SignatureProvider) error
VerifyTransfer checks that sum of inputTokens in TransferAction equals sum of outputs in TransferAction It also checks that all outputs and inputs have the same type
func (*Validator) VerifyTransfers ¶
func (v *Validator) VerifyTransfers(ledger driver.Ledger, transferActions []*TransferAction, signatureProvider driver.SignatureProvider) error
VerifyTransfers checks if the created output tokens are valid and if the content of the token request concatenated with the anchor was signed by the owners of the input tokens
type VaultTokenLoader ¶
type VaultTokenLoader struct {
TokenVault driver.QueryEngine
}
type VerifierDES ¶
VerifierDES is the interface for verifiers' deserializer 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 Deserializer driver.Deserializer 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, Deserializer driver.Deserializer, 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) 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) RegisterAuditInfo ¶ added in v0.3.0
func (s *WalletService) RegisterAuditInfo(id view.Identity, auditInfo []byte) 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
type WalletServiceBacked ¶ added in v0.3.0
type WalletServiceBacked interface { UnspentTokensIteratorBy(id, tokenType string) (driver.UnspentTokensIterator, error) ListHistoryIssuedTokens() (*token.IssuedTokens, error) }