Documentation
¶
Index ¶
- type CallbackFunc
- type Config
- type ConfigService
- type NamedFactory
- type PPManagerFactoryService
- type PublicParameters
- type PublicParametersStorage
- type TMSDriverService
- type TMSProvider
- func (m *TMSProvider) GetTokenManagerService(opts driver.ServiceOptions) (service driver.TokenManagerService, err error)
- func (m *TMSProvider) NewTokenManagerService(opts driver.ServiceOptions) (driver.TokenManagerService, error)
- func (m *TMSProvider) SetCallback(callback CallbackFunc)
- func (m *TMSProvider) Update(opts driver.ServiceOptions) (err error)
- type TokenDriverIdentifier
- type TokenDriverService
- type ValidatorDriverService
- type WalletServiceFactoryService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackFunc ¶
type CallbackFunc func(tms driver.TokenManagerService, network, channel, namespace string) error
CallbackFunc defines a function signature for a callback invoked after a new TMS is created.
type Config ¶
type Config interface {
// ID returns the TMS identifier.
ID() driver.TMSID
// TranslatePath translates the passed path relative to the config path.
TranslatePath(path string) string
// UnmarshalKey unmarshals the configuration value associated with the key into rawVal.
UnmarshalKey(key string, rawVal any) error
}
Config defines the configuration interface for a Token Management Service (TMS).
type ConfigService ¶
type ConfigService interface {
// Configurations returns all available TMS configurations.
Configurations() ([]driver.Configuration, error)
// ConfigurationFor returns the TMS configuration for the specified network, channel, and namespace.
ConfigurationFor(network string, channel string, namespace string) (driver.Configuration, error)
}
ConfigService defines the interface for retrieving TMS configurations.
type NamedFactory ¶
type NamedFactory[T any] struct { Name TokenDriverIdentifier Driver T }
NamedFactory associates a token driver identifier with its corresponding driver factory.
type PPManagerFactoryService ¶
type PPManagerFactoryService struct {
// contains filtered or unexported fields
}
PPManagerFactoryService manages factories for creating public parameters managers and validators.
func NewPPManagerFactoryService ¶
func NewPPManagerFactoryService(instantiators ...NamedFactory[driver.PPMFactory]) *PPManagerFactoryService
NewPPManagerFactoryService creates a new PPManagerFactoryService with the provided factories.
func (*PPManagerFactoryService) NewPublicParametersManager ¶
func (s *PPManagerFactoryService) NewPublicParametersManager(pp driver.PublicParameters) (driver.PublicParamsManager, error)
NewPublicParametersManager returns a new instance of driver.PublicParamsManager for the passed parameters. If no driver is registered for the public params' identifier, it returns an error.
func (PPManagerFactoryService) PublicParametersFromBytes ¶
func (s PPManagerFactoryService) PublicParametersFromBytes(params []byte) (driver.PublicParameters, error)
PublicParametersFromBytes unmarshals the bytes to a driver.PublicParameters instance. The passed bytes are expected to encode a driver.SerializedPublicParameters instance. If no driver is registered for the public params' identifier, it returns an error. It is responsibility of the caller to validate the unmarshalled public parameters.
type PublicParameters ¶
type PublicParameters struct {
// Path is the filesystem path to the public parameters.
Path string `yaml:"path"`
}
PublicParameters represents the configuration for public parameters path.
type PublicParametersStorage ¶
type PublicParametersStorage interface {
// PublicParams returns the public parameters for the specified network, channel, and namespace.
PublicParams(ctx context.Context, networkID string, channel string, namespace string) ([]byte, error)
}
PublicParametersStorage defines the interface for retrieving public parameters from a storage.
type TMSDriverService ¶
type TMSDriverService struct {
// contains filtered or unexported fields
}
TMSDriverService manages factories for creating token manager services.
func NewTokenDriverService ¶
func NewTokenDriverService(factories []NamedFactory[driver.Driver]) *TMSDriverService
NewTokenDriverService creates a new TMSDriverService with the provided factories.
func (*TMSDriverService) NewTokenService ¶
func (s *TMSDriverService) NewTokenService(tmsID driver.TMSID, publicParamsRaw []byte) (driver.TokenManagerService, error)
NewTokenService returns a new instance of driver.TokenManagerService for the passed TMSID and public parameters. If no driver is registered for the public params' identifier, it returns an error.
func (TMSDriverService) PublicParametersFromBytes ¶
func (s TMSDriverService) PublicParametersFromBytes(params []byte) (driver.PublicParameters, error)
PublicParametersFromBytes unmarshals the bytes to a driver.PublicParameters instance. The passed bytes are expected to encode a driver.SerializedPublicParameters instance. If no driver is registered for the public params' identifier, it returns an error. It is responsibility of the caller to validate the unmarshalled public parameters.
type TMSProvider ¶
type TMSProvider struct {
// contains filtered or unexported fields
}
TMSProvider is a token management service provider. It is responsible for creating and caching token management services for different networks.
func NewTMSProvider ¶
func NewTMSProvider( configService ConfigService, pps PublicParametersStorage, tokenDriverService *TokenDriverService, ) *TMSProvider
func (*TMSProvider) GetTokenManagerService ¶
func (m *TMSProvider) GetTokenManagerService(opts driver.ServiceOptions) (service driver.TokenManagerService, err error)
GetTokenManagerService returns a driver.TokenManagerService instance for the passed parameters. If a TokenManagerService is not available, it creates one by first fetching the public parameters using the passed driver.PublicParamsFetcher. If no driver is registered for the public params identifier, it returns an error.
func (*TMSProvider) NewTokenManagerService ¶
func (m *TMSProvider) NewTokenManagerService(opts driver.ServiceOptions) (driver.TokenManagerService, error)
NewTokenManagerService creates a new driver.TokenManagerService instance for the passed parameters. It does not cache the created service.
func (*TMSProvider) SetCallback ¶
func (m *TMSProvider) SetCallback(callback CallbackFunc)
SetCallback sets the callback function to be invoked when a new TMS is created.
func (*TMSProvider) Update ¶
func (m *TMSProvider) Update(opts driver.ServiceOptions) (err error)
Update updates the public parameters for the specified TMS. If the service is already cached and the public parameters are different, it unloads the old service and reloads it.
type TokenDriverIdentifier ¶
type TokenDriverIdentifier string
TokenDriverIdentifier is the token driver identifier It is a string representation of the token driver name and version.
func DriverIdentifier ¶
func DriverIdentifier(name driver.TokenDriverName, ver driver.TokenDriverVersion) TokenDriverIdentifier
DriverIdentifier returns the token driver identifier for the passed name and version. The token driver name has the form <name>.v<ver>.
func DriverIdentifierFromPP ¶
func DriverIdentifierFromPP(pp driver.PublicParameters) TokenDriverIdentifier
DriverIdentifierFromPP returns the token driver identifier for the passed public parameters. The token driver identifier has the form <token driver name>.v<token driver version>.
type TokenDriverService ¶
type TokenDriverService = TMSDriverService
TokenDriverService is an alias for TMSDriverService for backward compatibility.
type ValidatorDriverService ¶
type ValidatorDriverService struct {
// contains filtered or unexported fields
}
ValidatorDriverService manages factories for creating validators.
func NewValidatorDriverService ¶
func NewValidatorDriverService(factories ...NamedFactory[driver.ValidatorDriver]) *ValidatorDriverService
NewValidatorDriverService creates a new ValidatorDriverService with the provided factories.
func (*ValidatorDriverService) NewValidator ¶
func (s *ValidatorDriverService) NewValidator(pp driver.PublicParameters) (driver.Validator, error)
NewValidator returns a new instance of driver.Validator for the passed public parameters. If no driver is registered for the public params' identifier, it returns an error.
func (ValidatorDriverService) PublicParametersFromBytes ¶
func (s ValidatorDriverService) PublicParametersFromBytes(params []byte) (driver.PublicParameters, error)
PublicParametersFromBytes unmarshals the bytes to a driver.PublicParameters instance. The passed bytes are expected to encode a driver.SerializedPublicParameters instance. If no driver is registered for the public params' identifier, it returns an error. It is responsibility of the caller to validate the unmarshalled public parameters.
type WalletServiceFactoryService ¶
type WalletServiceFactoryService struct {
// contains filtered or unexported fields
}
WalletServiceFactoryService manages factories for creating wallet services.
func NewWalletServiceFactoryService ¶
func NewWalletServiceFactoryService(fs ...NamedFactory[driver.WalletServiceFactory]) *WalletServiceFactoryService
NewWalletServiceFactoryService creates a new WalletServiceFactoryService with the provided factories.
func (*WalletServiceFactoryService) NewWalletService ¶
func (s *WalletServiceFactoryService) NewWalletService(tmsConfig driver.Configuration, ppRaw []byte) (driver.WalletService, error)
NewWalletService returns a new instance of driver.WalletService for the passed configuration and public parameters. If no driver is registered for the public params' identifier, it returns an error.
func (WalletServiceFactoryService) PublicParametersFromBytes ¶
func (s WalletServiceFactoryService) PublicParametersFromBytes(params []byte) (driver.PublicParameters, error)
PublicParametersFromBytes unmarshals the bytes to a driver.PublicParameters instance. The passed bytes are expected to encode a driver.SerializedPublicParameters instance. If no driver is registered for the public params' identifier, it returns an error. It is responsibility of the caller to validate the unmarshalled public parameters.
Directories
¶
| Path | Synopsis |
|---|---|
|
driver
Package driver defines common interfaces and type aliases used by token driver implementations.
|
Package driver defines common interfaces and type aliases used by token driver implementations. |
|
driver/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
fabtoken
|
|
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
zkatdlog
|
|
|
nogh/v1/audit/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
nogh/v1/crypto/common
Package common provides utility helpers used by the zkatdlog no-GH crypto implementation (serialization and hashing helpers for math.G1 elements).
|
Package common provides utility helpers used by the zkatdlog no-GH crypto implementation (serialization and hashing helpers for math.G1 elements). |
|
nogh/v1/crypto/upgrade/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
nogh/v1/issue/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
nogh/v1/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
nogh/v1/transfer/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |