identity

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IssuerRole is the role of an issuer
	IssuerRole RoleType = driver.IssuerRole
	// AuditorRole is the role of an auditor
	AuditorRole = driver.AuditorRole
	// OwnerRole is the role of an owner
	OwnerRole = driver.OwnerRole
	// CertifierRole is the role of a certifier
	CertifierRole = driver.CertifierRole
)

Variables

This section is empty.

Functions

func TypeToString

func TypeToString(t driver.IdentityType) string

TypeToString return a string identifier for the given identity type. If the type is unknown, it returns the string "Type (<t>)".

Types

type Deserializer

type Deserializer interface {
	DeserializeSigner(ctx context.Context, raw []byte) (driver.Signer, error)
}

type EnrollmentIDUnmarshaler

type EnrollmentIDUnmarshaler interface {
	// GetEnrollmentID returns the enrollment ID from the audit info
	GetEnrollmentID(ctx context.Context, identity driver.Identity, auditInfo []byte) (string, error)
	// GetRevocationHandler returns the revocation handle from the audit info
	GetRevocationHandler(ctx context.Context, identity driver.Identity, auditInfo []byte) (string, error)
	// GetEIDAndRH returns both enrollment ID and revocation handle
	GetEIDAndRH(ctx context.Context, identity driver.Identity, auditInfo []byte) (string, string, error)
}

EnrollmentIDUnmarshaler decodes an enrollment ID form an audit info

type Identity

type Identity = driver.Identity

func WrapWithType

func WrapWithType(idType Type, id Identity) (Identity, error)

type NetworkBinderService

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

type Provider

type Provider struct {
	Logger logging.Logger
	Binder NetworkBinderService
	// contains filtered or unexported fields
}

Provider implements the driver.IdentityProvider interface. Provider manages identity-related concepts like signature signers, verifiers, audit information, and so on.

func NewProvider

func NewProvider(
	logger logging.Logger,
	storage Storage,
	deserializer Deserializer,
	binder NetworkBinderService,
	enrollmentIDUnmarshaler EnrollmentIDUnmarshaler,
) *Provider

NewProvider returns a new instance of Provider

func (*Provider) AreMe

func (p *Provider) AreMe(ctx context.Context, identities ...driver.Identity) []string

AreMe returns the hashes of the passed identities that have a signer registered before. Each identity is resolved via the signer cache and configured storage. There is no secondary "is me" cache: a real cache would need careful handling for single-use identities (for example Idemix nyms) and is intentionally omitted here.

func (*Provider) Bind

func (p *Provider) Bind(ctx context.Context, longTerm driver.Identity, ephemeralIdentities ...driver.Identity) error

Bind binds longTerm to the passed ephemeral identities.

func (*Provider) GetAuditInfo

func (p *Provider) GetAuditInfo(ctx context.Context, identity driver.Identity) ([]byte, error)

GetAuditInfo returns the audit information associated to the passed identity, nil otherwise. The audit info is retrieved from the configured storage.

func (*Provider) GetEIDAndRH

func (p *Provider) GetEIDAndRH(ctx context.Context, identity driver.Identity, auditInfo []byte) (string, string, error)

GetEIDAndRH returns both enrollment ID and revocation handle

func (*Provider) GetEnrollmentID

func (p *Provider) GetEnrollmentID(ctx context.Context, identity driver.Identity, auditInfo []byte) (string, error)

GetEnrollmentID extracts the enrollment ID from the passed audit info

func (*Provider) GetRevocationHandler

func (p *Provider) GetRevocationHandler(ctx context.Context, identity driver.Identity, auditInfo []byte) (string, error)

GetRevocationHandler extracts the revocation handler from the passed audit info

func (*Provider) GetSigner

func (p *Provider) GetSigner(ctx context.Context, identity driver.Identity) (driver.Signer, error)

GetSigner returns a Signer for passed identity. If a signer cannot be retrieved an error is returned. Signers that can be reused are cached. If a signer is not found in cache, this provider tries to construct an instance of driver.Signer that produces valid signatures under that identity.

func (*Provider) IsMe

func (p *Provider) IsMe(ctx context.Context, identity driver.Identity) bool

IsMe returns true if a signer was ever registered for the passed identity

func (*Provider) RegisterIdentityDescriptor

func (p *Provider) RegisterIdentityDescriptor(ctx context.Context, identityDescriptor *idriver.IdentityDescriptor, alias driver.Identity) error

RegisterIdentityDescriptor stores the given identity descriptor in the configured storage. If alias is not nil, the alias can be used as an alternative to `idriver.IdentityDescriptor#Identity`.

func (*Provider) RegisterRecipientData

func (p *Provider) RegisterRecipientData(ctx context.Context, data *driver.RecipientData) error

RegisterRecipientData stores the passed recipient data in the configured storage.

func (*Provider) RegisterRecipientIdentity

func (p *Provider) RegisterRecipientIdentity(ctx context.Context, id driver.Identity) error

RegisterRecipientIdentity registers the passed identity as a third-party recipient identity. The wallet layer performs matching and persistence; this provider records nothing here.

func (*Provider) RegisterSigner

func (p *Provider) RegisterSigner(ctx context.Context, identity driver.Identity, signer driver.Signer, verifier driver.Verifier, signerInfo []byte, ephemeral bool) error

RegisterSigner registers a Signer and a Verifier for passed identity. This is implemented via an invocation of RegisterIdentityDescriptor using an IdentityDescriptor with empty AuditInfo. The audit info might or might not be already stored.

func (*Provider) RollbackPartialRecipientRegistration

func (p *Provider) RollbackPartialRecipientRegistration(ctx context.Context, id driver.Identity)

RollbackPartialRecipientRegistration implements RecipientRegistrationRollback. This provider does not keep partial recipient-registration marks in memory; the hook remains for other IdentityProvider implementations.

type RecipientRegistrationRollback

type RecipientRegistrationRollback interface {
	RollbackPartialRecipientRegistration(ctx context.Context, id driver.Identity)
}

RecipientRegistrationRollback is implemented by identity providers that record side effects in RegisterRecipientIdentity before RegisterRecipientData. If RegisterRecipientData never succeeds, the implementation should undo those effects so the node is not left in a half-registered state.

type RoleType

type RoleType = driver.IdentityRoleType

RoleType is the role of an identity

type SignerEntry

type SignerEntry struct {
	Signer     driver.Signer
	DebugStack []byte
}

type Storage

type Storage interface {
	GetAuditInfo(ctx context.Context, id []byte) ([]byte, error)
	StoreIdentityData(ctx context.Context, id []byte, identityAudit []byte, tokenMetadata []byte, tokenMetadataAudit []byte) error
	StoreSignerInfo(ctx context.Context, id driver.Identity, info []byte) error
	GetExistingSignerInfo(ctx context.Context, ids ...driver.Identity) ([]string, error)
	SignerInfoExists(ctx context.Context, id []byte) (bool, error)
	GetSignerInfo(ctx context.Context, identity []byte) ([]byte, error)
	RegisterIdentityDescriptor(ctx context.Context, descriptor *idriver.IdentityDescriptor, alias driver.Identity) error
}

type StorageProvider

type StorageProvider = idriver.StorageProvider

StorageProvider returns storage services scoped to a specific token management system (TMS) identified by token.TMSID. Callers request the concrete store service for the given TMS and use the returned service to access persisted wallet, identity, or keystore data.

type Type

type Type = driver.IdentityType

type TypedIdentity

type TypedIdentity struct {
	// Type encodes the type of the identity
	Type Type `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,json=type,proto3"`
	// Identity encodes the identity itself
	Identity Identity `json:"identity,omitempty" protobuf:"bytes,2,opt,name=identity,proto3"`
}

TypedIdentity encodes an identity with a type.

func UnmarshalTypedIdentity

func UnmarshalTypedIdentity(id Identity) (*TypedIdentity, error)

func (TypedIdentity) Bytes

func (i TypedIdentity) Bytes() ([]byte, error)

Directories

Path Synopsis
Package boolpolicy provides an identity type whose ownership is governed by a boolean expression over a set of component identities.
Package boolpolicy provides an identity type whose ownership is governed by a boolean expression over a set of component identities.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
nym
interop
htlc/mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
crypto/mocks
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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