driver

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (
	IdentityRoleStrings = map[IdentityRoleType]string{
		IssuerRole:    "issuer",
		AuditorRole:   "auditor",
		OwnerRole:     "owner",
		CertifierRole: "certifier",
	}
)

Functions

This section is empty.

Types

type AuditInfo

type AuditInfo interface {
	EnrollmentID() string
	RevocationHandle() string
}

type AuditInfoDeserializer

type AuditInfoDeserializer interface {
	DeserializeAuditInfo([]byte) (AuditInfo, error)
}

type BinderService

type BinderService interface {
	Bind(ctx context.Context, longTerm driver.Identity, ephemeral driver.Identity, copyAll bool) error
}

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 Deserializer interface {
	DeserializeVerifier(raw []byte) (tdriver.Verifier, error)
	DeserializeSigner(raw []byte) (tdriver.Signer, error)
	Info(raw []byte, auditInfo []byte) (string, error)
}

type DeserializerManager

type DeserializerManager interface {
	AddDeserializer(deserializer Deserializer)
	DeserializeSigner(raw []byte) (tdriver.Signer, error)
}

type Identity added in v0.5.0

type Identity = driver.Identity

type IdentityConfiguration added in v0.5.0

type IdentityConfiguration = driver.IdentityConfiguration

type IdentityConfigurationIterator added in v0.5.0

type IdentityConfigurationIterator = Iterator[IdentityConfiguration]

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 {
	// RegisterAuditInfo binds the passed audit info to the passed identity
	RegisterAuditInfo(ctx context.Context, identity driver.Identity, info []byte) error

	// GetAuditInfo returns the audit info associated to the passed identity, nil if not found
	GetAuditInfo(ctx context.Context, identity driver.Identity) ([]byte, 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, 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)
	// Close closes the store
	Close() error
}

type Iterator added in v0.5.0

type Iterator[T any] interface {
	HasNext() bool
	Close() error
	Next() (T, error)
}

type Keystore added in v0.5.0

type Keystore interface {
	Put(id string, state interface{}) error
	Get(id string, state interface{}) error
}

type NetworkBinderService

type NetworkBinderService interface {
	Bind(ctx context.Context, longTerm driver.Identity, ephemeral driver.Identity) error
}

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 SigService

type SigService interface {
	IsMe(context.Context, driver.Identity) bool
	RegisterSigner(ctx context.Context, identity driver.Identity, signer driver.Signer, verifier driver.Verifier, signerInfo []byte) error
	RegisterVerifier(ctx context.Context, identity driver.Identity, v driver.Verifier) error
}

type StorageProvider added in v0.5.0

type StorageProvider interface {
	WalletStore(tmsID token.TMSID) (WalletStoreService, error)
	IdentityStore(tmsID token.TMSID) (IdentityStoreService, error)
	Keystore() (Keystore, error)
}

type WalletID added in v0.5.0

type WalletID = string

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
}

Jump to

Keyboard shortcuts

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