idemix

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: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Any                bccsp.SignatureType = 100
	IdentityType                           = tdriver.IdemixIdentityType
	IdentityTypeString                     = tdriver.IdemixIdentityTypeString
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditInfoDeserializer

type AuditInfoDeserializer struct{}

func (*AuditInfoDeserializer) DeserializeAuditInfo

func (c *AuditInfoDeserializer) DeserializeAuditInfo(ctx context.Context, identity driver.Identity, raw []byte) (driver2.AuditInfo, error)

DeserializeAuditInfo deserializes a given raw AuditInfo into an AuditInfo

type Deserializer

type Deserializer struct {
	*crypto2.Deserializer
}

func NewDeserializer

func NewDeserializer(
	ipk []byte,
	curveID math.CurveID,
) (*Deserializer, error)

NewDeserializer returns a new deserializer for the idemix ExpectEidNymRhNym verification strategy

func NewDeserializerWithBCCSP

func NewDeserializerWithBCCSP(
	sm SchemaManager,
	schema Schema,
	ipk []byte,
	verType csp.VerificationType,
	nymEID []byte,
	cryptoProvider csp.BCCSP,
) (*Deserializer, error)

NewDeserializerWithBCCSP returns a new deserializer for the passed arguments given a crypto provider

func NewDeserializerWithProvider

func NewDeserializerWithProvider(
	sm SchemaManager,
	schema Schema,
	ipk []byte,
	verType csp.VerificationType,
	nymEID []byte,
	cryptoProvider csp.BCCSP,
) (*Deserializer, error)

NewDeserializerWithProvider returns a new deserializer for the passed arguments

func (*Deserializer) DeserializeAuditInfo

func (d *Deserializer) DeserializeAuditInfo(ctx context.Context, identity driver.Identity, raw []byte) (driver2.AuditInfo, error)

DeserializeAuditInfo deserializes a given raw AuditInfo into an AuditInfo

func (*Deserializer) DeserializeVerifier

func (d *Deserializer) DeserializeVerifier(ctx context.Context, id driver.Identity) (driver.Verifier, error)

DeserializeVerifier deserializes a given raw id into a new psudonym signature verifier with id's PK

func (*Deserializer) DeserializeVerifierAgainstNymEID

func (d *Deserializer) DeserializeVerifierAgainstNymEID(raw []byte, nymEID []byte) (driver.Verifier, error)

DeserializeVerifierAgainstNymEID deserializes a given raw id and create a new psudonym signature verifier with id's PK

func (*Deserializer) GetAuditInfoMatcher

func (d *Deserializer) GetAuditInfoMatcher(ctx context.Context, owner driver.Identity, auditInfo []byte) (driver.Matcher, error)

GetAuditInfoMatcher deserializes a given raw AuditInfo into a Matcher

func (*Deserializer) Info

func (d *Deserializer) Info(ctx context.Context, id []byte, auditInfoRaw []byte) (string, error)

Info returns a string that includes the given identity. If AuditInfo is also provided then the id is cryptographically verified against it and the Enrollment ID (EID) is extracted from the audit info and is printed as well.

func (*Deserializer) MatchIdentity

func (d *Deserializer) MatchIdentity(ctx context.Context, id driver.Identity, ai []byte) error

MatchIdentity deserializes the provided audit information (ai) and verify it matches the given identity (id) by verifying the related ZK proofs

func (*Deserializer) String

func (d *Deserializer) String() string

String returns the Issuer-PK as a string

type KeyManager

type KeyManager struct {
	*crypto.Deserializer

	SchemaManager SchemaManager
	Schema        string
	// contains filtered or unexported fields
}

KeyManager manages Idemix keys and deserializers

func NewKeyManager

func NewKeyManager(
	conf *crypto.Config,
	sigType bccsp.SignatureType,
	csp bccsp.BCCSP,
) (*KeyManager, error)

NewKeyManager creates a new KeyManager

func NewKeyManagerWithSchema

func NewKeyManagerWithSchema(
	conf *crypto.Config,
	sigType bccsp.SignatureType,
	csp bccsp.BCCSP,
	sm SchemaManager,
	schemaName string,
) (*KeyManager, error)

NewKeyManagerWithSchema creates a new KeyManager with the passed schema manager and schema name

func (*KeyManager) Anonymous

func (p *KeyManager) Anonymous() bool

Anonymous returns true if the identity is anonymous

func (*KeyManager) DeserializeSigner

func (p *KeyManager) DeserializeSigner(ctx context.Context, raw []byte) (tdriver.Signer, error)

DeserializeSigner deserializes a signer from the given raw bytes

func (*KeyManager) DeserializeSigningIdentity

func (p *KeyManager) DeserializeSigningIdentity(ctx context.Context, raw []byte) (tdriver.SigningIdentity, error)

DeserializeSigningIdentity deserializes a signing identity from the given raw bytes

func (*KeyManager) DeserializeVerifier

func (p *KeyManager) DeserializeVerifier(ctx context.Context, raw []byte) (tdriver.Verifier, error)

DeserializeVerifier deserializes a verifier from the given raw bytes

func (*KeyManager) EnrollmentID

func (p *KeyManager) EnrollmentID() string

EnrollmentID returns the enrollment ID

func (*KeyManager) Identity

func (p *KeyManager) Identity(ctx context.Context, auditInfo []byte) (*idriver.IdentityDescriptor, error)

Identity returns the identity descriptor for the given audit information

func (*KeyManager) IdentityType

func (p *KeyManager) IdentityType() idriver.IdentityType

IdentityType returns the type of the identity

func (*KeyManager) Info

func (p *KeyManager) Info(ctx context.Context, raw []byte, auditInfo []byte) (string, error)

Info returns a string that includes the given identity. If AuditInfo is also provided then the id is cryptographically verified against it and the Enrollment ID (EID) is extracted from the audit info and is printed as well.

func (*KeyManager) IsRemote

func (p *KeyManager) IsRemote() bool

IsRemote returns true if the user key is not available locally

func (*KeyManager) String

func (p *KeyManager) String() string

String returns a string representation of the KeyManager including the issuer PK

type KeyManagerProvider

type KeyManagerProvider struct {
	// contains filtered or unexported fields
}

func NewKeyManagerProvider

func NewKeyManagerProvider(
	issuerPublicKey []byte,
	curveID math.CurveID,
	keyStore bccsp.KeyStore,
	config idriver.Config,
	cacheSize int,
	ignoreVerifyOnlyWallet bool,
	metricsProvider metrics.Provider,
) *KeyManagerProvider

func NewKeyManagerProviderWithKeyManagerFactory

func NewKeyManagerProviderWithKeyManagerFactory(
	issuerPublicKey []byte,
	curveID math.CurveID,
	keyStore bccsp.KeyStore,
	config idriver.Config,
	cacheSize int,
	ignoreVerifyOnlyWallet bool,
	metricsProvider metrics.Provider,
	newKeyManager NewKeyManagerFunc,
) *KeyManagerProvider

func (*KeyManagerProvider) Get

type NewKeyManagerFunc

type NewKeyManagerFunc = func(
	conf *crypto2.Config,
	sigType bccsp.SignatureType,
	csp bccsp.BCCSP,
) (membership.KeyManager, error)

type SKI

type SKI = []byte

SKI implies Subject Key Identifier

type SKIProvider

type SKIProvider struct{}

SKIProvider implements the TypedSKIProvider interface for Idemix identities. It extracts the Subject Key Identifier (SKI) from Idemix identities by computing the SHA-256 hash of the pseudonym public key (NymPublicKey) contained within the serialized identity.

This provider is designed to be registered with the cleanup.SKIExtractor for identity type "idemix" to enable proper SKI extraction during keystore cleanup.

func NewSKIProvider

func NewSKIProvider() *SKIProvider

NewSKIProvider creates a new Idemix SKI provider

func (*SKIProvider) GetSKIsFromIdentity

func (p *SKIProvider) GetSKIsFromIdentity(ctx context.Context, identity []byte) ([]string, error)

GetSKIsFromIdentity extracts the SKI from an Idemix identity. It uses the existing SKIFromIdentity function to compute the SHA-256 hash of the NymPublicKey and returns it as a hexadecimal string.

Parameters:

  • ctx: Context for cancellation and tracing (currently unused but required by interface)
  • identity: Raw bytes of the serialized Idemix identity

Returns:

  • []string: A single-element slice containing the SKI in hexadecimal format
  • error: An error if the identity cannot be parsed or is invalid

The function returns (nil, nil) for empty identities to allow graceful handling.

type Schema

type Schema = string

SKI implies Subject Key Identifier

type SchemaManager

type SchemaManager interface {
	// PublicKeyImportOpts returns the options that `schema` uses to import its public keys
	PublicKeyImportOpts(schema string) (*bccsp.IdemixIssuerPublicKeyImportOpts, error)
	// SignerOpts returns the options for the passed arguments
	SignerOpts(schema string) (*bccsp.IdemixSignerOpts, error)
	// NymSignerOpts returns the options that `schema` uses to verify a nym signature
	NymSignerOpts(schema string) (*bccsp.IdemixNymSignerOpts, error)
	// EidNymAuditOpts returns the options that `sid` must use to audit an EIDNym
	EidNymAuditOpts(schema string, attrs [][]byte) (*bccsp.EidNymAuditOpts, error)
	// RhNymAuditOpts returns the options that `sid` must use to audit an RhNym
	RhNymAuditOpts(schema string, attrs [][]byte) (*bccsp.RhNymAuditOpts, error)
}

SchemaManager handles the various credential schemas. A credential schema contains information about the number of attributes, which attributes must be disclosed when creating proofs, the format of the attributes etc.

type SignerService

type SignerService interface {
	RegisterSigner(ctx context.Context, identity tdriver.Identity, signer tdriver.Signer, verifier tdriver.Verifier, info []byte) error
}

SignerService defines the interface for registering a signer

type WrappedKeyManager

type WrappedKeyManager struct {
	membership.KeyManager
	// contains filtered or unexported fields
}

func (*WrappedKeyManager) Identity

func (k *WrappedKeyManager) Identity(ctx context.Context, auditInfo []byte) (*idriver.IdentityDescriptor, error)

Directories

Path Synopsis
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