Documentation
¶
Index ¶
- Constants
- Variables
- type AuditInfo
- type AuditInfoDeserializer
- type Config
- type ConfiguredIdentity
- type Deserializer
- type Identity
- type IdentityConfiguration
- type IdentityConfigurationIterator
- type IdentityDescriptor
- type IdentityInfo
- type IdentityProvider
- type IdentityRoleType
- type IdentityStoreService
- type IdentityType
- type Keystore
- type NetworkBinderService
- type Role
- type SignerDeserializerManager
- type StorageProvider
- type TypedSignerDeserializer
- type WalletID
- type WalletLookupID
- type WalletStoreService
Constants ¶
const ( // IssuerRole is the role of an issuer IssuerRole = iota // AuditorRole is the role of an auditor AuditorRole // OwnerRole is the role of an owner OwnerRole // CertifierRole is the role of a certifier CertifierRole )
Variables ¶
var ( IdentityRoleStrings = map[IdentityRoleType]string{ IssuerRole: "issuer", AuditorRole: "auditor", OwnerRole: "owner", CertifierRole: "certifier", } )
Functions ¶
This section is empty.
Types ¶
type AuditInfoDeserializer ¶
type Config ¶
type Config interface {
// CacheSizeForOwnerID returns the cache size to be used for the given owner wallet.
// If not defined, the function returns -1
CacheSizeForOwnerID(id string) int
TranslatePath(path string) string
IdentitiesForRole(role IdentityRoleType) ([]*ConfiguredIdentity, error)
}
type ConfiguredIdentity ¶ added in v0.5.0
type ConfiguredIdentity struct {
ID string `yaml:"id"`
Default bool `yaml:"default,omitempty"`
Path string `yaml:"path"`
CacheSize int `yaml:"cacheSize"`
Type string `yaml:"type,omitempty"`
Opts interface{} `yaml:"opts,omitempty"`
}
func (*ConfiguredIdentity) String ¶ added in v0.5.0
func (i *ConfiguredIdentity) String() string
type Deserializer ¶
type IdentityConfiguration ¶ added in v0.5.0
type IdentityConfiguration = driver.IdentityConfiguration
type IdentityConfigurationIterator ¶ added in v0.5.0
type IdentityConfigurationIterator = iterators.Iterator[*IdentityConfiguration]
type IdentityDescriptor ¶ added in v0.7.0
type IdentityInfo ¶ added in v0.5.0
type IdentityInfo interface {
// ID returns the identifier of the Identity
ID() string
// EnrollmentID returns the enrollment ID of the Identity
EnrollmentID() string
// Remote is true if this identity info refers to an identify whose corresponding secret key is not known, it is external/remote
Remote() bool
// Get returns the identity and it is audit info.
// Get might return a different identity at each call depending on the implementation.
Get(ctx context.Context) (Identity, []byte, error)
// Anonymous is true if this identity supports anonymity
Anonymous() bool
}
IdentityInfo models a long-term identity inside the Identity Provider. An identity has an identifier (ID) and an Enrollment ID, unique identifier. An identity can be remote, meaning that the corresponding secret key is remotely available.
type IdentityProvider ¶
type IdentityProvider interface {
IsMe(context.Context, driver.Identity) bool
// Bind an ephemeral identity to another identity
Bind(ctx context.Context, longTerm driver.Identity, ephemeralIdentities ...driver.Identity) error
// RegisterIdentityDescriptor register the passed identity descriptor with an alias
RegisterIdentityDescriptor(ctx context.Context, identityDescriptor *IdentityDescriptor, alias driver.Identity) error
}
type IdentityRoleType ¶ added in v0.5.0
type IdentityRoleType int
IdentityRoleType is the role of an identity
type IdentityStoreService ¶ added in v0.5.0
type IdentityStoreService interface {
// AddConfiguration stores an identity and the path to the credentials relevant to this identity
AddConfiguration(ctx context.Context, wp IdentityConfiguration) error
// ConfigurationExists returns true if a configuration with the given id and type exists.
ConfigurationExists(ctx context.Context, id, typ, url string) (bool, error)
// IteratorConfigurations returns an iterator to all configurations stored
IteratorConfigurations(ctx context.Context, configurationType string) (IdentityConfigurationIterator, error)
// StoreIdentityData stores the passed identity and token information
StoreIdentityData(ctx context.Context, id []byte, identityAudit []byte, tokenMetadata []byte, tokenMetadataAudit []byte) error
// GetAuditInfo retrieves the audit info bounded to the given identity
GetAuditInfo(ctx context.Context, id []byte) ([]byte, error)
// GetTokenInfo returns the token information related to the passed identity
GetTokenInfo(ctx context.Context, id []byte) ([]byte, []byte, error)
// StoreSignerInfo stores the passed signer info and bound it to the given identity
StoreSignerInfo(ctx context.Context, id driver.Identity, info []byte) error
// GetExistingSignerInfo returns the hashes of the identities for which StoreSignerInfo was called
GetExistingSignerInfo(ctx context.Context, ids ...driver.Identity) ([]string, error)
// SignerInfoExists returns true if StoreSignerInfo was called on input the given identity
SignerInfoExists(ctx context.Context, id []byte) (bool, error)
// GetSignerInfo returns the signer info bound to the given identity
GetSignerInfo(ctx context.Context, id []byte) ([]byte, error)
RegisterIdentityDescriptor(ctx context.Context, descriptor *IdentityDescriptor, alias driver.Identity) error
// Close closes the store
Close() error
}
type IdentityType ¶ added in v0.7.0
type IdentityType = tdriver.IdentityType
IdentityType identifies the type of identity
type NetworkBinderService ¶
type Role ¶ added in v0.5.0
type Role interface {
// ID returns the identifier of this role
ID() IdentityRoleType
// MapToIdentity returns the long-term identity and its identifier for the given index.
// The index can be an identity or a label (string).
MapToIdentity(ctx context.Context, v WalletLookupID) (Identity, string, error)
// GetIdentityInfo returns the long-term identity info associated to the passed id
GetIdentityInfo(ctx context.Context, id string) (IdentityInfo, error)
// RegisterIdentity registers the given identity
RegisterIdentity(ctx context.Context, config IdentityConfiguration) error
// IdentityIDs returns the identifiers contained in this role
IdentityIDs() ([]string, error)
}
Role is a container of long-term identities. A long-term identity is then used to construct a wallet.
type SignerDeserializerManager ¶ added in v0.7.0
type SignerDeserializerManager interface {
AddTypedSignerDeserializer(typ IdentityType, d TypedSignerDeserializer)
DeserializeSigner(ctx context.Context, raw []byte) (tdriver.Signer, error)
}
type StorageProvider ¶ added in v0.5.0
type TypedSignerDeserializer ¶ added in v0.7.0
type WalletLookupID ¶ added in v0.5.0
type WalletLookupID = driver.WalletLookupID
WalletLookupID defines the type of identifiers that can be used to retrieve a given wallet. It can be a string, as the name of the wallet, or an identity contained in that wallet. Ultimately, it is the token driver to decide which types are allowed.
type WalletStoreService ¶ added in v0.5.0
type WalletStoreService interface {
// GetWalletID fetches a walletID that is bound to the identity passed
GetWalletID(ctx context.Context, identity token.Identity, roleID int) (WalletID, error)
// GetWalletIDs fetches all walletID's that have been stored so far without duplicates
GetWalletIDs(ctx context.Context, roleID int) ([]WalletID, error)
// StoreIdentity binds an identity to a walletID and its metadata
StoreIdentity(ctx context.Context, identity token.Identity, eID string, wID WalletID, roleID int, meta []byte) error
// IdentityExists checks whether an identity-wallet binding has already been stored
IdentityExists(ctx context.Context, identity token.Identity, wID WalletID, roleID int) bool
// LoadMeta returns the metadata stored for a specific identity
LoadMeta(ctx context.Context, identity token.Identity, wID WalletID, roleID int) ([]byte, error)
// Close closes the store
Close() error
}