presentation

package module
v0.0.0-...-f48f218 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACFormat

type ACFormat struct {
	ProofType []string `json:"proof_type,omitempty"`
	ProofAlg  []string `json:"proof_alg,omitempty"`
}

type AccessAuditEntry

type AccessAuditEntry struct {
	ID           string                 `json:"id"`
	RequesterDID string                 `json:"requesterDid"`
	CredentialID string                 `json:"credentialId"`
	Operation    string                 `json:"operation"`
	Timestamp    time.Time              `json:"timestamp"`
	IPAddress    string                 `json:"ipAddress"`
	UserAgent    string                 `json:"userAgent"`
	Success      bool                   `json:"success"`
	Error        string                 `json:"error,omitempty"`
	Metadata     map[string]interface{} `json:"metadata"`
}

AccessAuditEntry represents an access audit log entry

type AccessPolicy

type AccessPolicy struct {
	OwnerDID      string            `json:"ownerDid"`
	Permissions   []Permission      `json:"permissions"`
	EncryptionKey []byte            `json:"encryptionKey,omitempty"`
	ExpiresAt     *time.Time        `json:"expiresAt,omitempty"`
	Conditions    map[string]string `json:"conditions,omitempty"`
	Revocable     bool              `json:"revocable"`
	AuditTrail    bool              `json:"auditTrail"`
}

type AgeVerificationCircuit

type AgeVerificationCircuit struct {
	Age     frontend.Variable `gnark:",secret"` // Private: actual age
	MinAge  frontend.Variable `gnark:",public"` // Public: minimum required age
	IsValid frontend.Variable `gnark:",public"` // Public: 1 if age >= minAge
}

AgeVerificationCircuit represents a circuit for age verification proofs

func (*AgeVerificationCircuit) Define

func (avc *AgeVerificationCircuit) Define(api frontend.API) error

Define implements the gnark circuit interface for age verification

type AggregatedZKProof

type AggregatedZKProof struct {
	AggregationType AggregationType `json:"aggregationType"`
	ProofValue      []byte          `json:"proofValue"`
	CombinedInputs  []interface{}   `json:"combinedInputs"`
	VerificationKey []byte          `json:"verificationKey"`
	ProofCount      int             `json:"proofCount"`
}

type AggregationType

type AggregationType string
const (
	AggregationTypeSequential AggregationType = "sequential"
	AggregationTypeParallel   AggregationType = "parallel"
	AggregationTypeComposite  AggregationType = "composite"
)

type AllChainsStrategy

type AllChainsStrategy struct{}

AllChainsStrategy replicates to all available chains

func (*AllChainsStrategy) GetTargetChains

func (acs *AllChainsStrategy) GetTargetChains(sourceChain string) []string

func (*AllChainsStrategy) Replicate

func (acs *AllChainsStrategy) Replicate(ctx context.Context, data *ReplicationData) error

func (*AllChainsStrategy) Validate

func (acs *AllChainsStrategy) Validate(ctx context.Context, data *ReplicationData) error

type AnonymizedMetadata

type AnonymizedMetadata struct {
	*CredentialMetadata
	PrivacyApplied     map[string]PrivacyLevel `json:"privacyApplied"`
	AnonymizedFields   map[string]string       `json:"anonymizedFields"`
	AccessRestrictions []string                `json:"accessRestrictions"`
}

AnonymizedMetadata represents metadata with privacy protection applied

type AuditEvent

type AuditEvent struct {
	EventID   string                 `json:"eventId"`
	EventType string                 `json:"eventType"`
	Timestamp time.Time              `json:"timestamp"`
	Actor     string                 `json:"actor"`
	Action    string                 `json:"action"`
	Details   map[string]interface{} `json:"details"`
}

type AuthorizationCodeGrant

type AuthorizationCodeGrant struct {
	IssuerState         string `json:"issuer_state,omitempty"`
	AuthorizationServer string `json:"authorization_server,omitempty"`
}

AuthorizationCodeGrant represents standard OAuth2 authorization code flow

type AuthorizationRequest

type AuthorizationRequest struct {
	ClientID                  string                  `json:"client_id"`
	ResponseType              string                  `json:"response_type"`
	ResponseMode              string                  `json:"response_mode,omitempty"`
	ResponseURI               string                  `json:"response_uri,omitempty"`
	RedirectURI               string                  `json:"redirect_uri,omitempty"`
	Scope                     string                  `json:"scope"`
	State                     string                  `json:"state,omitempty"`
	Nonce                     string                  `json:"nonce,omitempty"`
	PresentationDefinition    *PresentationDefinition `json:"presentation_definition,omitempty"`
	PresentationDefinitionURI string                  `json:"presentation_definition_uri,omitempty"`
	ClientMetadata            *ClientMetadata         `json:"client_metadata,omitempty"`
	ClientMetadataURI         string                  `json:"client_metadata_uri,omitempty"`
}

AuthorizationRequest represents an OIDC4VP authorization request

type AuthorizationResponse

type AuthorizationResponse struct {
	VpToken                interface{}             `json:"vp_token"`
	PresentationSubmission *PresentationSubmission `json:"presentation_submission,omitempty"`
	State                  string                  `json:"state,omitempty"`
	Error                  string                  `json:"error,omitempty"`
	ErrorDescription       string                  `json:"error_description,omitempty"`
}

AuthorizationResponse represents the response to an authorization request

type BBSCredentialRequest

type BBSCredentialRequest struct {
	CredentialID    string   `json:"credentialId"`
	RevealedIndices []int    `json:"revealedIndices"`
	BlindingFactors [][]byte `json:"blindingFactors,omitempty"`
}

BBSCredentialRequest represents a credential for BBS+ presentation

type BBSCredentialSignature

type BBSCredentialSignature struct {
	Type         string    `json:"type"`        // "DataIntegrityProof"
	Cryptosuite  string    `json:"cryptosuite"` // "bbs-2023"
	Created      time.Time `json:"created"`
	ProofPurpose string    `json:"proofPurpose"`
	KeyID        string    `json:"verificationMethod"`
	ProofValue   []byte    `json:"proofValue"`
}

BBSCredentialSignature represents a BBS signature using W3C Data Integrity BBS Cryptosuites v1.0

type BBSKeyPair

type BBSKeyPair struct {
	PublicKey  *bbs12381g2pub.PublicKey  `json:"publicKey"`
	PrivateKey *bbs12381g2pub.PrivateKey `json:"privateKey"`
	KeyID      string                    `json:"keyId"`
	Created    time.Time                 `json:"created"`
	Type       string                    `json:"type"` // "Bls12381G2Key2020"
}

BBSKeyPair represents a BBS+ key pair using TrustBloc standards

type BBSManager

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

BBSManager handles BBS+ signature operations using TrustBloc bbs-signature-go

func NewBBSManager

func NewBBSManager(store KeyValueStore) *BBSManager

NewBBSManager creates a new BBS manager with TrustBloc bbs-signature-go integration

func (*BBSManager) CreateSelectiveDisclosureProof

func (bm *BBSManager) CreateSelectiveDisclosureProof(ctx context.Context, credential map[string]interface{}, revealedAttributes []string, challenge []byte, domain string) (*BBSSelectiveDisclosureProof, error)

CreateSelectiveDisclosureProof creates a BBS selective disclosure proof using W3C Data Integrity BBS Cryptosuites v1.0

func (*BBSManager) DeleteKeyPair

func (bm *BBSManager) DeleteKeyPair(keyID string) error

DeleteKeyPair deletes a stored key pair

func (*BBSManager) GenerateKeyPair

func (bm *BBSManager) GenerateKeyPair(ctx context.Context) (*BBSKeyPair, error)

GenerateKeyPair generates a new BBS+ key pair using bbs12381g2pub

func (*BBSManager) GetKeyPair

func (bm *BBSManager) GetKeyPair(keyID string) (*BBSKeyPair, error)

GetKeyPair retrieves a stored key pair

func (*BBSManager) ListKeyPairs

func (bm *BBSManager) ListKeyPairs() ([]*BBSKeyPair, error)

ListKeyPairs lists all stored key pairs

func (*BBSManager) SignCredential

func (bm *BBSManager) SignCredential(ctx context.Context, credential map[string]interface{}, keyPair *BBSKeyPair) (map[string]interface{}, error)

SignCredential signs a credential with BBS+ signature

func (*BBSManager) VerifyCredentialSignature

func (bm *BBSManager) VerifyCredentialSignature(ctx context.Context, credential map[string]interface{}) error

VerifyCredentialSignature verifies a BBS signature on a credential using W3C Data Integrity BBS Cryptosuites v1.0

func (*BBSManager) VerifySelectiveDisclosureProof

func (bm *BBSManager) VerifySelectiveDisclosureProof(ctx context.Context, proof *BBSSelectiveDisclosureProof, publicKey []byte, revealedMessages [][]byte) (bool, error)

VerifySelectiveDisclosureProof verifies a BBS selective disclosure proof using W3C Data Integrity BBS Cryptosuites v1.0

type BBSPresentationRequest

type BBSPresentationRequest struct {
	HolderDID   string                  `json:"holderDid"`
	Challenge   string                  `json:"challenge"`
	Domain      string                  `json:"domain,omitempty"`
	Credentials []*BBSCredentialRequest `json:"credentials"`
}

BBSPresentationRequest represents a request for BBS+ presentation

type BBSSelectiveDisclosureProof

type BBSSelectiveDisclosureProof struct {
	Type             string    `json:"type"`        // "DataIntegrityProof"
	Cryptosuite      string    `json:"cryptosuite"` // "bbs-2023"
	Created          time.Time `json:"created"`
	ProofPurpose     string    `json:"proofPurpose"`
	KeyID            string    `json:"verificationMethod"`
	ProofValue       []byte    `json:"proofValue"`
	RevealedMessages []string  `json:"revealedMessages"`
	Challenge        []byte    `json:"challenge,omitempty"`
	Domain           string    `json:"domain,omitempty"`
}

BBSSelectiveDisclosureProof represents a BBS selective disclosure proof using current standards

type ChainConnection

type ChainConnection struct {
	ChainID      string            `json:"chainId"`
	ChainName    string            `json:"chainName"`
	NetworkType  string            `json:"networkType"`
	NodeEndpoint string            `json:"nodeEndpoint"`
	Status       string            `json:"status"` // "connected", "disconnected", "syncing"
	LastPing     time.Time         `json:"lastPing"`
	Latency      time.Duration     `json:"latency"`
	BlockHeight  uint64            `json:"blockHeight"`
	Version      string            `json:"version"`
	Capabilities []string          `json:"capabilities"`
	Metadata     map[string]string `json:"metadata"`
}

ChainConnection represents a connection to a specific chain

type ChainInfo

type ChainInfo struct {
	ChainID         string    `json:"chainId"`
	ChainName       string    `json:"chainName"`
	NetworkType     string    `json:"networkType"`
	LastBlockHeight uint64    `json:"lastBlockHeight"`
	LastTxHash      string    `json:"lastTxHash"`
	CredentialCount int       `json:"credentialCount"`
	Status          string    `json:"status"`
	LastUpdated     time.Time `json:"lastUpdated"`
	NodeEndpoint    string    `json:"nodeEndpoint"`
	Latency         int64     `json:"latency"`
}

type ChainManager

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

ChainManager handles multi-chain operations for Lattica DIDs

func NewChainManager

func NewChainManager(nodeURL string) *ChainManager

NewChainManager creates a new chain manager

func (*ChainManager) AddChain

func (cm *ChainManager) AddChain(chainID, nodeEndpoint string) error

AddChain adds a new chain connection

func (*ChainManager) GetBackupChains

func (cm *ChainManager) GetBackupChains(primaryChain string) []string

GetBackupChains returns backup chains for a given primary chain

func (*ChainManager) GetStatus

func (cm *ChainManager) GetStatus(ctx context.Context, did string) (*ChainStatus, error)

GetStatus returns the cross-chain status for a DID

func (*ChainManager) RemoveChain

func (cm *ChainManager) RemoveChain(chainID string) error

RemoveChain removes a chain connection

func (*ChainManager) SyncDID

func (cm *ChainManager) SyncDID(ctx context.Context, did string) (*ChainStatus, error)

SyncDID synchronizes a DID's data across all chains

type ChainReplicator

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

ChainReplicator handles data replication across chains

func NewChainReplicator

func NewChainReplicator() *ChainReplicator

NewChainReplicator creates a new chain replicator

type ChainStatus

type ChainStatus struct {
	DID               string                `json:"did"`
	Chains            map[string]*ChainInfo `json:"chains"`
	PrimaryChain      string                `json:"primaryChain"`
	LastSyncTime      time.Time             `json:"lastSyncTime"`
	SyncStatus        string                `json:"syncStatus"`
	TotalCredentials  int                   `json:"totalCredentials"`
	CrossChainRefs    map[string][]string   `json:"crossChainRefs"`
	ReplicationPolicy *ReplicationPolicy    `json:"replicationPolicy,omitempty"`
}

type CircuitConstraint

type CircuitConstraint struct {
	ConstraintID string   `json:"constraintId"`
	Expression   string   `json:"expression"`
	Variables    []string `json:"variables"`
}

type CircuitDefinition

type CircuitDefinition struct {
	ID            string               `json:"id"`
	Name          string               `json:"name"`
	Description   string               `json:"description"`
	InputSchema   map[string]string    `json:"inputSchema"`
	OutputSchema  map[string]string    `json:"outputSchema"`
	Constraints   []*CircuitConstraint `json:"constraints"`
	SecurityLevel int                  `json:"securityLevel"`
}

type CircuitManager

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

func NewCircuitManager

func NewCircuitManager() *CircuitManager

type CircuitParameters

type CircuitParameters struct {
	CircuitID     string               `json:"circuitId"`
	PublicInputs  []interface{}        `json:"publicInputs"`
	PrivateInputs []interface{}        `json:"privateInputs"`
	Constraints   []*CircuitConstraint `json:"constraints"`
	WitnessSize   int                  `json:"witnessSize"`
}

type ClaimFormatDesignations

type ClaimFormatDesignations struct {
	JWT   *JWTFormat   `json:"jwt,omitempty"`
	JWTVC *JWTFormat   `json:"jwt_vc,omitempty"`
	JWTVP *JWTFormat   `json:"jwt_vp,omitempty"`
	LDP   *LDPFormat   `json:"ldp,omitempty"`
	LDPVC *LDPFormat   `json:"ldp_vc,omitempty"`
	LDPVP *LDPFormat   `json:"ldp_vp,omitempty"`
	SDJWT *SDJWTFormat `json:"sd_jwt,omitempty"`
	AC    *ACFormat    `json:"ac,omitempty"`
	MSO   *MSOFormat   `json:"mso,omitempty"`
}

type ClaimFormatMap

type ClaimFormatMap struct {
	Jwt     *JwtFormat     `json:"jwt,omitempty"`
	JwtVc   *JwtFormat     `json:"jwt_vc,omitempty"`
	JwtVp   *JwtFormat     `json:"jwt_vp,omitempty"`
	Ldp     *LdpFormat     `json:"ldp,omitempty"`
	LdpVc   *LdpFormat     `json:"ldp_vc,omitempty"`
	LdpVp   *LdpFormat     `json:"ldp_vp,omitempty"`
	MsoMdoc *MsoMdocFormat `json:"mso_mdoc,omitempty"`
}

ClaimFormatMap specifies supported credential formats

type ClientMetadata

type ClientMetadata struct {
	ClientName                        string          `json:"client_name,omitempty"`
	LogoURI                           string          `json:"logo_uri,omitempty"`
	ClientURI                         string          `json:"client_uri,omitempty"`
	PolicyURI                         string          `json:"policy_uri,omitempty"`
	TosURI                            string          `json:"tos_uri,omitempty"`
	JwksURI                           string          `json:"jwks_uri,omitempty"`
	VpFormats                         *ClaimFormatMap `json:"vp_formats,omitempty"`
	AuthorizationEncryptedResponseAlg string          `json:"authorization_encrypted_response_alg,omitempty"`
	AuthorizationEncryptedResponseEnc string          `json:"authorization_encrypted_response_enc,omitempty"`
}

ClientMetadata represents verifier metadata

type ComparisonAssertion

type ComparisonAssertion struct {
	CompareValue   interface{}    `json:"compareValue"`
	Tolerance      *big.Int       `json:"tolerance,omitempty"`
	ComparisonType ComparisonType `json:"comparisonType"`
}

type ComparisonCircuit

type ComparisonCircuit struct {
	TargetValue frontend.Variable `gnark:",secret"` // Private: the actual value
	Threshold   frontend.Variable `gnark:",public"` // Public: the threshold to compare against
	IsValid     frontend.Variable `gnark:",public"` // Public: 1 if comparison is valid, 0 otherwise
}

ComparisonCircuit represents a circuit for comparison proofs (>, <, >=, <=)

func (*ComparisonCircuit) Define

func (cc *ComparisonCircuit) Define(api frontend.API) error

Define implements the gnark circuit interface for comparison

type ComparisonType

type ComparisonType string
const (
	ComparisonTypeExact       ComparisonType = "exact"
	ComparisonTypeApproximate ComparisonType = "approximate"
)

type CompiledCircuit

type CompiledCircuit struct {
	ID               string `json:"id"`
	ProvingKey       []byte `json:"provingKey"`
	VerifyingKey     []byte `json:"verifyingKey"`
	WitnessSize      int    `json:"witnessSize"`
	PublicInputCount int    `json:"publicInputCount"`
	ConstraintCount  int    `json:"constraintCount"`
}

type ComplianceEngine

type ComplianceEngine struct{}

type ComplianceMetadata

type ComplianceMetadata struct {
	DataMinimization  bool           `json:"dataMinimization"`
	PurposeLimitation bool           `json:"purposeLimitation"`
	DataRetention     *time.Duration `json:"dataRetention,omitempty"`
	ConsentProof      []byte         `json:"consentProof,omitempty"`
	AuditTrail        []*AuditEvent  `json:"auditTrail"`
}

type CompositePresentationRequest

type CompositePresentationRequest struct {
	HolderDID              string                   `json:"holderDid"`
	Challenge              string                   `json:"challenge"`
	Domain                 string                   `json:"domain,omitempty"`
	CredentialRequirements []*CredentialRequirement `json:"credentialRequirements"`
	PrivacyRequirements    *PrivacyRequirements     `json:"privacyRequirements,omitempty"`
}

CompositePresentationRequest represents a request for composite presentation

type ConstraintValidator

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

Missing types from credential_matcher.go

func NewConstraintValidator

func NewConstraintValidator() *ConstraintValidator

NewConstraintValidator creates a new constraint validator

func (*ConstraintValidator) ValidateFilter

func (cv *ConstraintValidator) ValidateFilter(value interface{}, filter *Filter) bool

ValidateFilter validates a field value against a JSON Schema filter

func (*ConstraintValidator) ValidateHolderBinding

func (cv *ConstraintValidator) ValidateHolderBinding(credential map[string]interface{}, relators []Relator) error

ValidateHolderBinding validates holder binding constraints

func (*ConstraintValidator) ValidateLimitDisclosure

func (cv *ConstraintValidator) ValidateLimitDisclosure(credential map[string]interface{}, constraint LimitDisclosure) error

ValidateLimitDisclosure validates limit disclosure constraints

func (*ConstraintValidator) ValidateSameSubject

func (cv *ConstraintValidator) ValidateSameSubject(credential map[string]interface{}, relators []Relator) error

ValidateSameSubject validates same-subject constraints

func (*ConstraintValidator) ValidateStatusConstraints

func (cv *ConstraintValidator) ValidateStatusConstraints(credential map[string]interface{}, statuses *Statuses) error

ValidateStatusConstraints validates credential status constraints

func (*ConstraintValidator) ValidateSubjectIsIssuer

func (cv *ConstraintValidator) ValidateSubjectIsIssuer(credential map[string]interface{}, constraint SubjectIsIssuer) error

ValidateSubjectIsIssuer validates subject-is-issuer constraint

type Constraints

type Constraints struct {
	LimitDisclosure *LimitDisclosure `json:"limit_disclosure,omitempty"`
	SubjectIsIssuer *SubjectIsIssuer `json:"subject_is_issuer,omitempty"`
	IsHolder        []Relator        `json:"is_holder,omitempty"`
	SameSubject     []Relator        `json:"same_subject,omitempty"`
	Fields          []Field          `json:"fields,omitempty"`
	Statuses        *Statuses        `json:"statuses,omitempty"`
}

type CreatePresentationRequest

type CreatePresentationRequest struct {
	HolderDID           string                           `json:"holderDid"`
	HolderPrivateKey    string                           `json:"holderPrivateKey"`
	Challenge           string                           `json:"challenge"`
	Domain              string                           `json:"domain,omitempty"`
	Credentials         []*CredentialPresentationRequest `json:"credentials"`
	PrivacyRequirements *PrivacyRequirements             `json:"privacyRequirements,omitempty"`
}

CreatePresentationRequest represents a request to create a presentation

type Credential

type Credential = W3CVerifiableCredential

Basic credential type used by manager files (alias for compatibility)

type CredentialDefinition

type CredentialDefinition struct {
	Type              []string               `json:"type"`
	CredentialSubject map[string]interface{} `json:"credentialSubject,omitempty"`
	Context           []interface{}          `json:"@context,omitempty"`
}

CredentialDefinition defines the structure of a credential

type CredentialDescriptor

type CredentialDescriptor struct {
	Format                               string                 `json:"format"`
	Types                                []string               `json:"types,omitempty"`
	CredentialDefinition                 *CredentialDefinition  `json:"credential_definition,omitempty"`
	CryptographicBindingMethodsSupported []string               `json:"cryptographic_binding_methods_supported,omitempty"`
	CredentialSigningAlgValuesSupported  []string               `json:"credential_signing_alg_values_supported,omitempty"`
	ProofTypesSupported                  map[string]interface{} `json:"proof_types_supported,omitempty"`
}

CredentialDescriptor describes a credential that can be issued

type CredentialEncryptor

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

CredentialEncryptor handles encryption and decryption of credentials

func NewCredentialEncryptor

func NewCredentialEncryptor() *CredentialEncryptor

NewCredentialEncryptor creates a new credential encryptor

func (*CredentialEncryptor) Decrypt

func (ce *CredentialEncryptor) Decrypt(encryptedData []byte, did string) ([]byte, error)

Decrypt decrypts credential data using a DID-derived key

func (*CredentialEncryptor) DecryptWithKey

func (ce *CredentialEncryptor) DecryptWithKey(encryptedData []byte, key []byte) ([]byte, error)

DecryptWithKey decrypts data using a provided decryption key

func (*CredentialEncryptor) DeriveKeyFromPassword

func (ce *CredentialEncryptor) DeriveKeyFromPassword(password string, salt []byte) []byte

DeriveKeyFromPassword derives an encryption key from a password

func (*CredentialEncryptor) Encrypt

func (ce *CredentialEncryptor) Encrypt(data []byte, did string) ([]byte, error)

Encrypt encrypts credential data using a DID-derived key

func (*CredentialEncryptor) EncryptWithKey

func (ce *CredentialEncryptor) EncryptWithKey(data []byte, key []byte) ([]byte, error)

EncryptWithKey encrypts data using a provided encryption key

func (*CredentialEncryptor) GenerateKey

func (ce *CredentialEncryptor) GenerateKey() ([]byte, error)

GenerateKey generates a new encryption key

type CredentialIndexer

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

CredentialIndexer handles indexing and searching of credentials

func NewCredentialIndexer

func NewCredentialIndexer() *CredentialIndexer

NewCredentialIndexer creates a new credential indexer

func (*CredentialIndexer) GetCredentialMetadata

func (ci *CredentialIndexer) GetCredentialMetadata(ctx context.Context, did string, credentialID string) (*CredentialMetadata, error)

GetCredentialMetadata retrieves metadata for a specific credential

func (*CredentialIndexer) IndexCredential

func (ci *CredentialIndexer) IndexCredential(ctx context.Context, metadata *CredentialMetadata) error

IndexCredential adds a credential to all relevant indexes

func (*CredentialIndexer) IndexPrivateCredential

func (ci *CredentialIndexer) IndexPrivateCredential(ctx context.Context, metadata *CredentialMetadata, accessPolicy *AccessPolicy) error

IndexPrivateCredential indexes a credential with privacy controls

func (*CredentialIndexer) ListCredentials

func (ci *CredentialIndexer) ListCredentials(ctx context.Context, did string) ([]*CredentialMetadata, error)

ListCredentials lists all credentials for a DID

func (*CredentialIndexer) QueryCredentials

func (ci *CredentialIndexer) QueryCredentials(ctx context.Context, query *CredentialQuery) ([]*CredentialMetadata, error)

QueryCredentials performs complex queries on the credential index

func (*CredentialIndexer) RemoveCredential

func (ci *CredentialIndexer) RemoveCredential(ctx context.Context, did string, credentialID string) error

RemoveCredential removes a credential from all indexes

func (*CredentialIndexer) SearchCredentials

func (ci *CredentialIndexer) SearchCredentials(ctx context.Context, did string, searchTerm string, limit int) ([]*SearchResult, error)

SearchCredentials performs full-text search on credentials

func (*CredentialIndexer) SetStore

func (ci *CredentialIndexer) SetStore(store KeyValueStore)

SetStore sets the key-value store for persistence

func (*CredentialIndexer) UpdateMetadata

func (ci *CredentialIndexer) UpdateMetadata(ctx context.Context, metadata *CredentialMetadata) error

UpdateMetadata updates metadata for an existing credential

type CredentialIssuer

type CredentialIssuer struct {
	ID   string                 `json:"id"`
	Name string                 `json:"name,omitempty"`
	URL  string                 `json:"url,omitempty"`
	Meta map[string]interface{} `json:"meta,omitempty"`
}

CredentialIssuer represents the issuer of a credential

type CredentialMatch

type CredentialMatch struct {
	InputDescriptorID string                 `json:"input_descriptor_id"`
	CredentialIndex   int                    `json:"credential_index"`
	Credential        map[string]interface{} `json:"credential"`
	Matches           bool                   `json:"matches"`
	FieldMatches      map[string]FieldMatch  `json:"field_matches"`
	Warnings          []string               `json:"warnings"`
	Errors            []string               `json:"errors"`
}

type CredentialMatcher

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

CredentialMatcher handles matching credentials against Input Descriptors

func NewCredentialMatcher

func NewCredentialMatcher() *CredentialMatcher

NewCredentialMatcher creates a new credential matcher

func (*CredentialMatcher) FilterBestMatches

func (cm *CredentialMatcher) FilterBestMatches(matches []CredentialMatch, maxResults int) []CredentialMatch

FilterBestMatches returns only the best matching credentials

func (*CredentialMatcher) GetCredentialScore

func (cm *CredentialMatcher) GetCredentialScore(match *CredentialMatch) float64

GetCredentialScore calculates a matching score for a credential

func (*CredentialMatcher) MatchCredentials

func (cm *CredentialMatcher) MatchCredentials(
	ctx context.Context,
	inputDescriptors []InputDescriptor,
	credentials []map[string]interface{},
	globalFormat *ClaimFormatDesignations,
) (map[string][]CredentialMatch, error)

MatchCredentials matches a list of credentials against input descriptors

func (*CredentialMatcher) SortCredentialMatches

func (cm *CredentialMatcher) SortCredentialMatches(matches []CredentialMatch) []CredentialMatch

SortCredentialMatches sorts credential matches by score (highest first)

type CredentialMetadata

type CredentialMetadata struct {
	ID             string                 `json:"id"`
	Type           []string               `json:"type"`
	Issuer         string                 `json:"issuer"`
	Subject        string                 `json:"subject"`
	IssuanceDate   time.Time              `json:"issuanceDate"`
	ExpirationDate *time.Time             `json:"expirationDate,omitempty"`
	Schema         string                 `json:"schema,omitempty"`
	Tags           []string               `json:"tags,omitempty"`
	StoredAt       time.Time              `json:"storedAt"`
	LastAccessed   time.Time              `json:"lastAccessed"`
	AccessCount    int                    `json:"accessCount"`
	ChainID        string                 `json:"chainId"`
	BlockHeight    uint64                 `json:"blockHeight"`
	TxHash         string                 `json:"txHash"`
	Size           int                    `json:"size"`
	Encrypted      bool                   `json:"encrypted"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
}

Missing types from lattica_storage_manager.go

type CredentialOffer

type CredentialOffer struct {
	CredentialIssuer           string                 `json:"credential_issuer"`
	Credentials                []CredentialDescriptor `json:"credentials"`
	Grants                     *Grants                `json:"grants,omitempty"`
	UserPinRequired            bool                   `json:"user_pin_required,omitempty"`
	CredentialConfigurationIds []string               `json:"credential_configuration_ids,omitempty"`
}

CredentialOffer represents an OIDC4VCI credential offer

type CredentialPredicateCircuit

type CredentialPredicateCircuit struct {
	ClaimValue frontend.Variable `gnark:",secret"` // Private: actual claim value
	Predicate  frontend.Variable `gnark:",public"` // Public: predicate to satisfy
	IsValid    frontend.Variable `gnark:",public"` // Public: 1 if predicate is satisfied
}

CredentialPredicateCircuit represents a circuit for credential predicate proofs

func (*CredentialPredicateCircuit) Define

func (cpc *CredentialPredicateCircuit) Define(api frontend.API) error

Define implements the gnark circuit interface for credential predicates

type CredentialPresentationRequest

type CredentialPresentationRequest struct {
	CredentialID    string              `json:"credentialId"`
	RevealedClaims  []string            `json:"revealedClaims,omitempty"`
	HiddenClaims    []string            `json:"hiddenClaims,omitempty"`
	PredicateProofs []*PredicateRequest `json:"predicateProofs,omitempty"`
}

CredentialPresentationRequest represents a credential to include in presentation

type CredentialProcessResult

type CredentialProcessResult struct {
	Credential *PrivacyPreservingCredential `json:"credential,omitempty"`
	Proofs     []*PresentationProof         `json:"proofs"`
}

Missing result types for compilation

type CredentialProcessingResult

type CredentialProcessingResult struct {
	Credential *PrivacyPreservingCredential `json:"credential,omitempty"`
	Proofs     []*PresentationProof         `json:"proofs"`
	Error      error                        `json:"error,omitempty"`
}

CredentialProcessingResult represents the result of processing a credential

type CredentialProof

type CredentialProof struct {
	Type               string    `json:"type"`
	Created            time.Time `json:"created"`
	VerificationMethod string    `json:"verificationMethod"`
	ProofPurpose       string    `json:"proofPurpose"`
	Jws                string    `json:"jws,omitempty"`
	ProofValue         string    `json:"proofValue,omitempty"`
	Challenge          string    `json:"challenge,omitempty"`
	Domain             string    `json:"domain,omitempty"`
	ProofType          string    `json:"proof_type"`
	JWT                string    `json:"jwt,omitempty"`
	CWT                string    `json:"cwt,omitempty"`
	LdpVp              string    `json:"ldp_vp,omitempty"`
}

CredentialProof represents a cryptographic proof for credentials

type CredentialQuery

type CredentialQuery struct {
	DID         string                 `json:"did"`
	Type        []string               `json:"type,omitempty"`
	Issuer      string                 `json:"issuer,omitempty"`
	Schema      string                 `json:"schema,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	DateRange   *DateRange             `json:"dateRange,omitempty"`
	Limit       int                    `json:"limit,omitempty"`
	Offset      int                    `json:"offset,omitempty"`
	SortBy      string                 `json:"sortBy,omitempty"`
	SortOrder   string                 `json:"sortOrder,omitempty"`
	Filters     map[string]interface{} `json:"filters,omitempty"`
	ChainFilter []string               `json:"chainFilter,omitempty"`
}

type CredentialRequest

type CredentialRequest struct {
	Format                       string                        `json:"format"`
	CredentialDefinition         *CredentialDefinition         `json:"credential_definition,omitempty"`
	Types                        []string                      `json:"types,omitempty"`
	Proof                        *CredentialProof              `json:"proof,omitempty"`
	CredentialResponseEncryption *CredentialResponseEncryption `json:"credential_response_encryption,omitempty"`
}

CredentialRequest represents a request to issue a credential

type CredentialRequirement

type CredentialRequirement struct {
	CredentialID       string                 `json:"credentialId"`
	PrivacyTechnique   PrivacyTechnique       `json:"privacyTechnique"`
	RevealedClaims     []string               `json:"revealedClaims,omitempty"`
	HiddenClaims       []string               `json:"hiddenClaims,omitempty"`
	PredicateProofs    []*PredicateRequest    `json:"predicateProofs,omitempty"`
	ZKStatements       []*ZKStatement         `json:"zkStatements,omitempty"`
	BBSRevealedIndices []int                  `json:"bbsRevealedIndices,omitempty"`
	Parameters         map[string]interface{} `json:"parameters,omitempty"`
}

CredentialRequirement represents requirements for a credential in composite presentation

type CredentialResponse

type CredentialResponse struct {
	Format          string      `json:"format,omitempty"`
	Credential      interface{} `json:"credential,omitempty"`
	TransactionID   string      `json:"transaction_id,omitempty"`
	CNonce          string      `json:"c_nonce,omitempty"`
	CNonceExpiresIn int         `json:"c_nonce_expires_in,omitempty"`
	NotificationID  string      `json:"notification_id,omitempty"`
}

CredentialResponse represents the response from credential issuance

type CredentialResponseEncryption

type CredentialResponseEncryption struct {
	Jwk                map[string]interface{} `json:"jwk"`
	AlgValuesSupported []string               `json:"alg_values_supported"`
	EncValuesSupported []string               `json:"enc_values_supported"`
}

CredentialResponseEncryption specifies response encryption

type CredentialStatus

type CredentialStatus struct {
	ID                   string `json:"id"`
	Type                 string `json:"type"`
	StatusPurpose        string `json:"statusPurpose,omitempty"`
	StatusListIndex      string `json:"statusListIndex,omitempty"`
	StatusListCredential string `json:"statusListCredential,omitempty"`
}

CredentialStatus represents the status information for a credential

type CredentialVerificationResult

type CredentialVerificationResult struct {
	CredentialID string    `json:"credentialId"`
	Valid        bool      `json:"valid"`
	Issues       []string  `json:"issues"`
	Timestamp    time.Time `json:"timestamp"`
}

CredentialVerificationResult represents verification result for a credential

type CustomPredicateLogic

type CustomPredicateLogic struct {
	LogicExpression string                 `json:"logicExpression"`
	Variables       map[string]interface{} `json:"variables"`
	Constraints     []*LogicConstraint     `json:"constraints"`
}

type DIDDocument

type DIDDocument struct {
	Context              []string             `json:"@context"`
	ID                   string               `json:"id"`
	AlsoKnownAs          []string             `json:"alsoKnownAs,omitempty"`
	Controller           []string             `json:"controller,omitempty"`
	VerificationMethod   []VerificationMethod `json:"verificationMethod,omitempty"`
	Authentication       []interface{}        `json:"authentication,omitempty"`
	AssertionMethod      []interface{}        `json:"assertionMethod,omitempty"`
	KeyAgreement         []interface{}        `json:"keyAgreement,omitempty"`
	CapabilityInvocation []interface{}        `json:"capabilityInvocation,omitempty"`
	CapabilityDelegation []interface{}        `json:"capabilityDelegation,omitempty"`
	Service              []Service            `json:"service,omitempty"`
	Created              time.Time            `json:"created"`
	Updated              time.Time            `json:"updated"`
	VersionID            string               `json:"versionId"`
	NextUpdate           *time.Time           `json:"nextUpdate,omitempty"`
	Proof                []DataIntegrityProof `json:"proof,omitempty"`
}

type DataIntegrityProof

type DataIntegrityProof struct {
	Type               string    `json:"type"`
	Cryptosuite        string    `json:"cryptosuite"`
	Created            time.Time `json:"created"`
	VerificationMethod string    `json:"verificationMethod"`
	ProofPurpose       string    `json:"proofPurpose"`
	ProofValue         string    `json:"proofValue"`
	Challenge          string    `json:"challenge,omitempty"`
	Domain             string    `json:"domain,omitempty"`
	PreviousProof      string    `json:"previousProof,omitempty"`
}

type DateRange

type DateRange struct {
	From *time.Time `json:"from,omitempty"`
	To   *time.Time `json:"to,omitempty"`
}

type DisclosedCredential

type DisclosedCredential struct {
	ID                string                 `json:"id"`
	Type              []string               `json:"type"`
	Issuer            string                 `json:"issuer"`
	IssuanceDate      time.Time              `json:"issuanceDate"`
	DisclosedSubject  map[string]interface{} `json:"credentialSubject"`
	HiddenClaimsCount int                    `json:"hiddenClaimsCount"`
	Proof             []*PresentationProof   `json:"proof"`
}

type DisclosureFrame

type DisclosureFrame struct {
	CredentialID    string              `json:"credentialId"`
	RevealedClaims  []string            `json:"revealedClaims"`
	HiddenClaims    []string            `json:"hiddenClaims"`
	PredicateProofs []*PredicateRequest `json:"predicateProofs,omitempty"`
	BlindingFactors [][]byte            `json:"blindingFactors"`
}

DisclosureFrame represents a frame for selective disclosure

type EncryptedCredential

type EncryptedCredential struct {
	Data       []byte              `json:"data"`
	Metadata   *EncryptionMetadata `json:"metadata"`
	AccessHint string              `json:"accessHint,omitempty"`
}

EncryptedCredential represents an encrypted credential with metadata

type EncryptionMetadata

type EncryptionMetadata struct {
	Algorithm     string `json:"algorithm"`
	KeyDerivation string `json:"keyDerivation"`
	Salt          []byte `json:"salt"`
	Nonce         []byte `json:"nonce"`
	KeyLength     int    `json:"keyLength"`
	Iterations    int    `json:"iterations"`
}

EncryptionMetadata contains metadata about encrypted credentials

type Evidence

type Evidence struct {
	Type string                 `json:"type"`
	ID   string                 `json:"id,omitempty"`
	Meta map[string]interface{} `json:"meta,omitempty"`
}

Evidence represents evidence supporting the credential

type Field

type Field struct {
	Path           []string   `json:"path"`
	ID             string     `json:"id,omitempty"`
	Purpose        string     `json:"purpose,omitempty"`
	Filter         *Filter    `json:"filter,omitempty"`
	Predicate      *Predicate `json:"predicate,omitempty"`
	Name           string     `json:"name,omitempty"`
	Optional       bool       `json:"optional,omitempty"`
	IntentToRetain bool       `json:"intent_to_retain,omitempty"`
}

type FieldMatch

type FieldMatch struct {
	FieldID        string        `json:"field_id"`
	Matches        bool          `json:"matches"`
	Values         []interface{} `json:"values"`
	PredicateValid bool          `json:"predicate_valid,omitempty"`
	Errors         []string      `json:"errors"`
}

type Filter

type Filter struct {
	Type      string                   `json:"type,omitempty"`
	Format    string                   `json:"format,omitempty"`
	Pattern   string                   `json:"pattern,omitempty"`
	Minimum   *float64                 `json:"minimum,omitempty"`
	Maximum   *float64                 `json:"maximum,omitempty"`
	MinLength *int                     `json:"minLength,omitempty"`
	MaxLength *int                     `json:"maxLength,omitempty"`
	Const     interface{}              `json:"const,omitempty"`
	Enum      []interface{}            `json:"enum,omitempty"`
	Contains  map[string]interface{}   `json:"contains,omitempty"`
	Not       map[string]interface{}   `json:"not,omitempty"`
	AllOf     []map[string]interface{} `json:"allOf,omitempty"`
	AnyOf     []map[string]interface{} `json:"anyOf,omitempty"`
	OneOf     []map[string]interface{} `json:"oneOf,omitempty"`
}

Missing types from constraint_validator.go

type FormatChecker

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

FormatChecker validates credential formats

func NewFormatChecker

func NewFormatChecker() *FormatChecker

NewFormatChecker creates a new format checker

func (*FormatChecker) ValidateFormat

func (fc *FormatChecker) ValidateFormat(credentialFormat string, formatDesignations *ClaimFormatDesignations) bool

ValidateFormat validates a format against format designations

type Grants

type Grants struct {
	AuthorizationCode *AuthorizationCodeGrant `json:"authorization_code,omitempty"`
	PreAuthorizedCode *PreAuthorizedCodeGrant `json:"urn:ietf:params:oauth:grant-type:pre-authorized_code,omitempty"`
}

Grants specifies authorization grant types

type HolderSubject

type HolderSubject struct {
	FieldID   []string `json:"field_id"`
	Directive string   `json:"directive"`
}

type Index

type Index struct {
	Name        string                   `json:"name"`
	Type        string                   `json:"type"` // "btree", "hash", "fulltext"
	Fields      []string                 `json:"fields"`
	Unique      bool                     `json:"unique"`
	Entries     map[string][]*IndexEntry `json:"entries"`
	Created     time.Time                `json:"created"`
	LastUpdated time.Time                `json:"lastUpdated"`
	Size        int                      `json:"size"`
}

Index represents a searchable index for credentials

type IndexEntry

type IndexEntry struct {
	Key          string                 `json:"key"`
	CredentialID string                 `json:"credentialId"`
	DID          string                 `json:"did"`
	Value        interface{}            `json:"value"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
	Created      time.Time              `json:"created"`
}

IndexEntry represents an entry in an index

type InputDescriptor

type InputDescriptor struct {
	ID          string                   `json:"id"`
	Name        string                   `json:"name,omitempty"`
	Purpose     string                   `json:"purpose,omitempty"`
	Format      *ClaimFormatDesignations `json:"format,omitempty"`
	Constraints *Constraints             `json:"constraints,omitempty"`
	Group       []string                 `json:"group,omitempty"`
}

type InputDescriptorMapping

type InputDescriptorMapping struct {
	ID         string                  `json:"id"`
	Format     string                  `json:"format"`
	Path       string                  `json:"path"`
	PathNested *InputDescriptorMapping `json:"path_nested,omitempty"`
}

InputDescriptorMapping maps Input Descriptors to credentials in submission

type IssueSeverity

type IssueSeverity string

IssueSeverity represents the severity of a verification issue

const (
	IssueSeverityLow      IssueSeverity = "low"
	IssueSeverityMedium   IssueSeverity = "medium"
	IssueSeverityHigh     IssueSeverity = "high"
	IssueSeverityCritical IssueSeverity = "critical"
)

type IssueType

type IssueType string

IssueType represents the type of verification issue

const (
	IssueTypeStructural IssueType = "structural"
	IssueTypeSignature  IssueType = "signature"
	IssueTypeExpiration IssueType = "expiration"
	IssueTypeRevocation IssueType = "revocation"
	IssueTypeChallenge  IssueType = "challenge"
	IssueTypeDomain     IssueType = "domain"
	IssueTypeCredential IssueType = "credential"
	IssueTypeProof      IssueType = "proof"
	IssueTypePrivacy    IssueType = "privacy"
)

type IssuerMetadata

type IssuerMetadata struct {
	CredentialIssuer                  string                          `json:"credential_issuer"`
	AuthorizationServers              []string                        `json:"authorization_servers,omitempty"`
	CredentialEndpoint                string                          `json:"credential_endpoint"`
	BatchCredentialEndpoint           string                          `json:"batch_credential_endpoint,omitempty"`
	DeferredCredentialEndpoint        string                          `json:"deferred_credential_endpoint,omitempty"`
	NotificationEndpoint              string                          `json:"notification_endpoint,omitempty"`
	CredentialResponseEncryption      *CredentialResponseEncryption   `json:"credential_response_encryption,omitempty"`
	CredentialConfigurationsSupported map[string]CredentialDescriptor `json:"credential_configurations_supported"`
	Display                           []interface{}                   `json:"display,omitempty"`
}

IssuerMetadata represents credential issuer metadata

type Iterator

type Iterator interface {
	Next() bool
	Value() []byte
	Close() error
}

type JWTFormat

type JWTFormat struct {
	Alg []string `json:"alg,omitempty"`
}

type JwtFormat

type JwtFormat struct {
	Alg []string `json:"alg,omitempty"`
}

JwtFormat specifies JWT format requirements

type KeyValueStore

type KeyValueStore interface {
	Get(key []byte) ([]byte, error)
	Put(key, value []byte) error
	Delete(key []byte) error
	Iterator(start, end []byte) (Iterator, error)
}

storage interface to resolve dependency

type LDPFormat

type LDPFormat struct {
	ProofType []string `json:"proof_type,omitempty"`
}

type LatticeStorage

type LatticeStorage interface {
	// Core Storage Operations
	StoreCredential(ctx context.Context, did string, credential *W3CVerifiableCredential) error
	RetrieveCredential(ctx context.Context, did string, credentialID string) (*W3CVerifiableCredential, error)
	ListCredentials(ctx context.Context, did string) ([]*CredentialMetadata, error)
	DeleteCredential(ctx context.Context, did string, credentialID string) error

	// Advanced Query Operations
	QueryCredentials(ctx context.Context, query *CredentialQuery) ([]*W3CVerifiableCredential, error)
	QueryBySchema(ctx context.Context, did string, schemaID string) ([]*W3CVerifiableCredential, error)
	QueryByIssuer(ctx context.Context, did string, issuerDID string) ([]*W3CVerifiableCredential, error)
	QueryBySubject(ctx context.Context, subjectDID string) ([]*W3CVerifiableCredential, error)

	// Privacy-Preserving Operations
	StorePrivateCredential(ctx context.Context, did string, credential *W3CVerifiableCredential, accessPolicy *AccessPolicy) error
	QueryWithPrivacy(ctx context.Context, query *PrivateQuery) ([]*PrivateCredentialResult, error)

	// DID Resolution
	ResolveDID(ctx context.Context, did string) (*DIDDocument, error)
	StoreDIDDocument(ctx context.Context, didDoc *DIDDocument) error
	UpdateDIDDocument(ctx context.Context, didDoc *DIDDocument) error

	// Cross-Chain Operations
	SyncAcrossChains(ctx context.Context, did string) error
	GetChainStatus(ctx context.Context, did string) (*ChainStatus, error)
}

LatticeStorage provides decentralized storage integration for Lattica DIDs

type LatticeStorageManager

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

LatticeStorageManager implements the LatticeStorage interface

func NewLatticeStorageManager

func NewLatticeStorageManager(nodeURL string, resolverURL string) *LatticeStorageManager

NewLatticeStorageManager creates a new Lattica storage manager

func (*LatticeStorageManager) DeleteCredential

func (lsm *LatticeStorageManager) DeleteCredential(ctx context.Context, did string, credentialID string) error

DeleteCredential removes a credential from storage

func (*LatticeStorageManager) GetChainStatus

func (lsm *LatticeStorageManager) GetChainStatus(ctx context.Context, did string) (*ChainStatus, error)

GetChainStatus returns the status of a DID across chains

func (*LatticeStorageManager) ListCredentials

func (lsm *LatticeStorageManager) ListCredentials(ctx context.Context, did string) ([]*CredentialMetadata, error)

ListCredentials returns metadata for all credentials stored for a DID

func (*LatticeStorageManager) QueryByIssuer

func (lsm *LatticeStorageManager) QueryByIssuer(ctx context.Context, did string, issuerDID string) ([]*W3CVerifiableCredential, error)

QueryByIssuer queries credentials by issuer DID

func (*LatticeStorageManager) QueryBySchema

func (lsm *LatticeStorageManager) QueryBySchema(ctx context.Context, did string, schemaID string) ([]*W3CVerifiableCredential, error)

QueryBySchema queries credentials by schema ID

func (*LatticeStorageManager) QueryBySubject

func (lsm *LatticeStorageManager) QueryBySubject(ctx context.Context, subjectDID string) ([]*W3CVerifiableCredential, error)

QueryBySubject queries credentials by subject DID

func (*LatticeStorageManager) QueryCredentials

func (lsm *LatticeStorageManager) QueryCredentials(ctx context.Context, query *CredentialQuery) ([]*W3CVerifiableCredential, error)

QueryCredentials performs advanced querying with filtering and sorting

func (*LatticeStorageManager) QueryWithPrivacy

func (lsm *LatticeStorageManager) QueryWithPrivacy(ctx context.Context, query *PrivateQuery) ([]*PrivateCredentialResult, error)

QueryWithPrivacy performs privacy-preserving queries

func (*LatticeStorageManager) ResolveDID

func (lsm *LatticeStorageManager) ResolveDID(ctx context.Context, did string) (*DIDDocument, error)

ResolveDID resolves a DID to its DID document

func (*LatticeStorageManager) RetrieveCredential

func (lsm *LatticeStorageManager) RetrieveCredential(ctx context.Context, did string, credentialID string) (*W3CVerifiableCredential, error)

RetrieveCredential retrieves a specific credential for a DID

func (*LatticeStorageManager) StoreCredential

func (lsm *LatticeStorageManager) StoreCredential(ctx context.Context, did string, credential *W3CVerifiableCredential) error

StoreCredential stores a verifiable credential for a DID in Lattica

func (*LatticeStorageManager) StoreDIDDocument

func (lsm *LatticeStorageManager) StoreDIDDocument(ctx context.Context, didDoc *DIDDocument) error

StoreDIDDocument stores a DID document

func (*LatticeStorageManager) StorePrivateCredential

func (lsm *LatticeStorageManager) StorePrivateCredential(ctx context.Context, did string, credential *W3CVerifiableCredential, accessPolicy *AccessPolicy) error

StorePrivateCredential stores a credential with privacy controls and encryption

func (*LatticeStorageManager) SyncAcrossChains

func (lsm *LatticeStorageManager) SyncAcrossChains(ctx context.Context, did string) error

SyncAcrossChains synchronizes a DID's data across all configured chains

func (*LatticeStorageManager) UpdateDIDDocument

func (lsm *LatticeStorageManager) UpdateDIDDocument(ctx context.Context, didDoc *DIDDocument) error

UpdateDIDDocument updates a DID document

type LdpFormat

type LdpFormat struct {
	ProofType []string `json:"proof_type,omitempty"`
}

LdpFormat specifies Linked Data Proof format requirements

type LimitDisclosure

type LimitDisclosure string
const (
	LimitDisclosureRequired  LimitDisclosure = "required"
	LimitDisclosurePreferred LimitDisclosure = "preferred"
)

type LinkabilityOptions

type LinkabilityOptions struct {
	Type               LinkabilityType `json:"type"`
	PseudonymScope     string          `json:"pseudonymScope,omitempty"`
	SessionID          string          `json:"sessionId,omitempty"`
	UnlinkabilityLevel PrivacyLevel    `json:"unlinkabilityLevel"`
}

type LinkabilityProof

type LinkabilityProof struct {
	Type               LinkabilityType `json:"type"`
	PseudonymValue     []byte          `json:"pseudonymValue"`
	UnlinkabilityProof []byte          `json:"unlinkabilityProof"`
	SessionBinding     []byte          `json:"sessionBinding,omitempty"`
	Created            time.Time       `json:"created"`
}

type LinkabilityProtection

type LinkabilityProtection struct {
	Enabled              bool          `json:"enabled"`
	TokenizationLevel    int           `json:"tokenizationLevel"`
	RotationInterval     time.Duration `json:"rotationInterval"`
	BlindingFactorLength int           `json:"blindingFactorLength"`
	NonceLength          int           `json:"nonceLength"`
}

LinkabilityProtection represents linkability protection configuration

type LinkabilityType

type LinkabilityType string
const (
	LinkabilityNone       LinkabilityType = "none"
	LinkabilityPseudonym  LinkabilityType = "pseudonym"
	LinkabilitySession    LinkabilityType = "session"
	LinkabilityUnlinkable LinkabilityType = "unlinkable"
)

type LogicConstraint

type LogicConstraint struct {
	Variable   string      `json:"variable"`
	Constraint string      `json:"constraint"`
	Value      interface{} `json:"value"`
}

type MSOFormat

type MSOFormat struct {
	Alg     []string `json:"alg,omitempty"`
	DocType []string `json:"doc_type,omitempty"`
}

type MembershipAssertion

type MembershipAssertion struct {
	Set            []interface{}  `json:"set"`
	SetType        string         `json:"setType"`
	MembershipType MembershipType `json:"membershipType"`
}

type MembershipCircuit

type MembershipCircuit struct {
	Element frontend.Variable `gnark:",secret"` // Private: element to prove membership
	SetHash frontend.Variable `gnark:",public"` // Public: hash of the set
	IsValid frontend.Variable `gnark:",public"` // Public: 1 if element is in set
}

MembershipCircuit represents a circuit for membership proofs

func (*MembershipCircuit) Define

func (mc *MembershipCircuit) Define(api frontend.API) error

Define implements the gnark circuit interface for membership

type MembershipType

type MembershipType string
const (
	MembershipTypeInclusion MembershipType = "inclusion"
	MembershipTypeExclusion MembershipType = "exclusion"
)

type MsoMdocFormat

type MsoMdocFormat struct {
	Alg []string `json:"alg,omitempty"`
}

MsoMdocFormat specifies mDL/mdoc format requirements

type OIDC4VCIManager

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

OIDC4VCIManager handles credential issuance flows

func NewOIDC4VCIManager

func NewOIDC4VCIManager(issuerURL, clientID, redirectURI string) *OIDC4VCIManager

NewOIDC4VCIManager creates a new OIDC4VCI manager

func (*OIDC4VCIManager) CreateProofOfPossession

func (m *OIDC4VCIManager) CreateProofOfPossession(ctx context.Context, cNonce, audience string, keyID string) (*CredentialProof, error)

CreateProofOfPossession creates a proof of possession for credential request

func (*OIDC4VCIManager) ExchangeCodeForToken

func (m *OIDC4VCIManager) ExchangeCodeForToken(ctx context.Context, code string, pkceParams *PKCEParams, issuerURL string) (*TokenResponse, error)

ExchangeCodeForToken exchanges authorization code for access token

func (*OIDC4VCIManager) ExchangePreAuthorizedCode

func (m *OIDC4VCIManager) ExchangePreAuthorizedCode(ctx context.Context, preAuthCode, userPin, issuerURL string) (*TokenResponse, error)

ExchangePreAuthorizedCode exchanges pre-authorized code for access token

func (*OIDC4VCIManager) GetIssuerMetadata

func (m *OIDC4VCIManager) GetIssuerMetadata(ctx context.Context, issuerURL string) (*IssuerMetadata, error)

GetIssuerMetadata retrieves issuer metadata from well-known endpoint

func (*OIDC4VCIManager) InitiateAuthorizationCodeFlow

func (m *OIDC4VCIManager) InitiateAuthorizationCodeFlow(ctx context.Context, offer *CredentialOffer, scope string) (string, *PKCEParams, error)

InitiateAuthorizationCodeFlow initiates the OAuth2 authorization code flow

func (*OIDC4VCIManager) ParseCredentialOffer

func (m *OIDC4VCIManager) ParseCredentialOffer(ctx context.Context, offerURI string) (*CredentialOffer, error)

ParseCredentialOffer parses a credential offer from a credential offer URI

func (*OIDC4VCIManager) RequestCredential

func (m *OIDC4VCIManager) RequestCredential(ctx context.Context, accessToken string, credReq *CredentialRequest, issuerURL string) (*CredentialResponse, error)

RequestCredential requests a credential from the issuer

type OIDC4VPManager

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

OIDC4VPManager handles verifiable presentation flows

func NewOIDC4VPManager

func NewOIDC4VPManager(bbsManager *BBSManager, zkpManager *ZKProofManager) *OIDC4VPManager

NewOIDC4VPManager creates a new OIDC4VP manager

func (*OIDC4VPManager) ParseAuthorizationRequest

func (m *OIDC4VPManager) ParseAuthorizationRequest(ctx context.Context, requestURI string) (*AuthorizationRequest, error)

ParseAuthorizationRequest parses an OIDC4VP authorization request

func (*OIDC4VPManager) ProcessPresentationRequest

func (m *OIDC4VPManager) ProcessPresentationRequest(ctx context.Context, authReq *AuthorizationRequest, holderDID string, credentials []map[string]interface{}) (*AuthorizationResponse, error)

ProcessPresentationRequest processes a presentation request and creates a response

func (*OIDC4VPManager) SubmitPresentationResponse

func (m *OIDC4VPManager) SubmitPresentationResponse(ctx context.Context, authReq *AuthorizationRequest, response *AuthorizationResponse) error

SubmitPresentationResponse submits the presentation response to the verifier

func (*OIDC4VPManager) ValidatePresentationDefinition

func (m *OIDC4VPManager) ValidatePresentationDefinition(ctx context.Context, presentationDef *PresentationDefinition) error

ValidatePresentationDefinition validates a presentation definition

type PKCEParams

type PKCEParams struct {
	CodeVerifier  string
	CodeChallenge string
	Method        string
}

PKCE (Proof Key for Code Exchange) parameters

type Permission

type Permission struct {
	Entity    string     `json:"entity"`
	Actions   []string   `json:"actions"`
	ChainIDs  []string   `json:"chainIds,omitempty"`
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`
}

type PolicyRule

type PolicyRule struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Condition   string                 `json:"condition"`
	Action      string                 `json:"action"`
	Parameters  map[string]interface{} `json:"parameters,omitempty"`
}

PolicyRule represents a custom policy rule

type PreAuthorizedCodeGrant

type PreAuthorizedCodeGrant struct {
	PreAuthorizedCode string `json:"pre-authorized_code"`
	UserPinRequired   bool   `json:"user_pin_required,omitempty"`
}

PreAuthorizedCodeGrant represents pre-authorized code flow

type Predicate

type Predicate struct {
	Required  bool   `json:"required,omitempty"`
	Directive string `json:"directive"` // "required", "allowed", "disallowed"
}

Predicate defines predicate-based constraints (for ZK proofs)

type PredicateAssertion

type PredicateAssertion struct {
	ID          string                `json:"id"`
	Type        PredicateType         `json:"type"`
	Claim       string                `json:"claim"`
	Operator    PredicateOperator     `json:"operator"`
	Value       interface{}           `json:"value"`
	Range       *RangeAssertion       `json:"range,omitempty"`
	Membership  *MembershipAssertion  `json:"membership,omitempty"`
	Comparison  *ComparisonAssertion  `json:"comparison,omitempty"`
	CustomLogic *CustomPredicateLogic `json:"customLogic,omitempty"`
}

type PredicateOperator

type PredicateOperator string

PredicateOperator represents predicate operators

const (
	PredicateOperatorEqual              PredicateOperator = "eq"
	PredicateOperatorNotEqual           PredicateOperator = "ne"
	PredicateOperatorGreaterThan        PredicateOperator = "gt"
	PredicateOperatorGreaterThanOrEqual PredicateOperator = "gte"
	PredicateOperatorLessThan           PredicateOperator = "lt"
	PredicateOperatorLessThanOrEqual    PredicateOperator = "lte"
	PredicateOperatorIn                 PredicateOperator = "in"
	PredicateOperatorNotIn              PredicateOperator = "not_in"
	PredicateOperatorContains           PredicateOperator = "contains"
	PredicateOperatorNotContains        PredicateOperator = "not_contains"
)

type PredicateProof

type PredicateProof struct {
	Type      PredicateType          `json:"type"`
	ClaimName string                 `json:"claimName"`
	Operator  PredicateOperator      `json:"operator"`
	ProofData []byte                 `json:"proofData"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

PredicateProof represents a predicate proof

type PredicateProofManager

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

func NewPredicateProofManager

func NewPredicateProofManager(
	store KeyValueStore,
	zkManager *ZKManager,
) *PredicateProofManager

func (*PredicateProofManager) CreatePredicateProof

func (ppm *PredicateProofManager) CreatePredicateProof(
	ctx context.Context,
	req *PredicateProofRequest,
) (*PredicateProofResponse, error)

func (*PredicateProofManager) VerifyPredicateProof

func (ppm *PredicateProofManager) VerifyPredicateProof(
	ctx context.Context,
	proofID string,
	challenge string,
) (*VerificationResult, error)

type PredicateProofRequest

type PredicateProofRequest struct {
	CredentialID  string                 `json:"credentialId"`
	Predicates    []*PredicateAssertion  `json:"predicates"`
	Challenge     string                 `json:"challenge"`
	PrivacyLevel  PrivacyLevel           `json:"privacyLevel"`
	ProofType     ZKProofType            `json:"proofType"`
	CircuitParams *CircuitParameters     `json:"circuitParams,omitempty"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
}

type PredicateProofResponse

type PredicateProofResponse struct {
	ProofID              string                 `json:"proofId"`
	PredicateProofs      []*ZKPredicateProof    `json:"predicateProofs"`
	AggregatedProof      *AggregatedZKProof     `json:"aggregatedProof,omitempty"`
	PublicOutputs        map[string]interface{} `json:"publicOutputs"`
	VerificationMetadata *VerificationMetadata  `json:"verificationMetadata"`
	Created              time.Time              `json:"created"`
}

type PredicateRequest

type PredicateRequest struct {
	ID        string            `json:"id"`
	Type      PredicateType     `json:"type"`
	ClaimName string            `json:"claimName"`
	Operator  PredicateOperator `json:"operator"`
	Value     interface{}       `json:"value"`
	Proof     *PredicateProof   `json:"proof,omitempty"`
}

PredicateRequest represents a predicate to prove

type PredicateType

type PredicateType string

Missing predicate type used in several files

const (
	PredicateTypeRange      PredicateType = "range"
	PredicateTypeMembership PredicateType = "membership"
	PredicateTypeEquality   PredicateType = "equality"
	PredicateTypeComparison PredicateType = "comparison"
	PredicateTypeAge        PredicateType = "age"
	PredicateTypeCustom     PredicateType = "custom"
)

type PresentationConfig

type PresentationConfig struct {
	// Privacy settings
	EnableSelectiveDisclosure bool          `json:"enableSelectiveDisclosure"`
	EnableZeroKnowledgeProofs bool          `json:"enableZeroKnowledgeProofs"`
	EnablePredicateProofs     bool          `json:"enablePredicateProofs"`
	DefaultExpirationTime     time.Duration `json:"defaultExpirationTime"`
	MaxPresentationSize       int           `json:"maxPresentationSize"`

	// BBS+ settings
	BBSKeySize        int  `json:"bbsKeySize"`
	BBSSignatureSize  int  `json:"bbsSignatureSize"`
	EnableBBSBlinding bool `json:"enableBBSBlinding"`

	// ZK proof settings
	DefaultCircuitType       string        `json:"defaultCircuitType"`
	ProofGenerationTimeout   time.Duration `json:"proofGenerationTimeout"`
	ProofVerificationTimeout time.Duration `json:"proofVerificationTimeout"`

	// Privacy preservation
	EnableLinkabilityProtection bool `json:"enableLinkabilityProtection"`
	EnableRevocationPrivacy     bool `json:"enableRevocationPrivacy"`
	MinimalDisclosureMode       bool `json:"minimalDisclosureMode"`

	// Security settings
	RequireProofOfPossession  bool          `json:"requireProofOfPossession"`
	EnableTimestampValidation bool          `json:"enableTimestampValidation"`
	MaxClaimAge               time.Duration `json:"maxClaimAge"`
}

PresentationConfig holds configuration for presentation protocols

type PresentationDefinition

type PresentationDefinition struct {
	ID                     string                   `json:"id"`
	Name                   string                   `json:"name,omitempty"`
	Purpose                string                   `json:"purpose,omitempty"`
	Format                 *ClaimFormatDesignations `json:"format,omitempty"`
	SubmissionRequirements []SubmissionRequirement  `json:"submission_requirements,omitempty"`
	InputDescriptors       []InputDescriptor        `json:"input_descriptors"`
	Frame                  map[string]interface{}   `json:"frame,omitempty"`
}

PresentationDefinition represents a Presentation Definition as per DIF PE v2.0

type PresentationEngine

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

PresentationEngine handles privacy-preserving credential presentations

func NewPresentationEngine

func NewPresentationEngine(
	store KeyValueStore,
	config *PresentationConfig,
) *PresentationEngine

NewPresentationEngine creates a new privacy-preserving presentation engine

func (*PresentationEngine) CreateBBSPresentation

func (pe *PresentationEngine) CreateBBSPresentation(ctx context.Context, req *BBSPresentationRequest) (*PresentationResponse, error)

CreateBBSPresentation creates a BBS+ signature-based presentation

func (*PresentationEngine) CreateCompositePresentation

func (pe *PresentationEngine) CreateCompositePresentation(ctx context.Context, req *CompositePresentationRequest) (*PresentationResponse, error)

CreateCompositePresentation creates a presentation combining multiple privacy techniques

func (*PresentationEngine) CreatePredicateProofPresentation

func (pe *PresentationEngine) CreatePredicateProofPresentation(ctx context.Context, req *PredicateProofRequest) (*PresentationResponse, error)

CreatePredicateProofPresentation creates a presentation with predicate proofs

func (*PresentationEngine) CreatePresentation

CreatePresentation creates a privacy-preserving verifiable presentation

func (*PresentationEngine) CreateSelectiveDisclosurePresentation

func (pe *PresentationEngine) CreateSelectiveDisclosurePresentation(ctx context.Context, req *SelectiveDisclosureRequest) (*PresentationResponse, error)

CreateSelectiveDisclosurePresentation creates a presentation with selective disclosure

func (*PresentationEngine) CreateZeroKnowledgePresentation

func (pe *PresentationEngine) CreateZeroKnowledgePresentation(ctx context.Context, req *ZeroKnowledgeRequest) (*PresentationResponse, error)

CreateZeroKnowledgePresentation creates a presentation with zero-knowledge proofs

func (*PresentationEngine) VerifyPresentation

VerifyPresentation verifies a privacy-preserving presentation

type PresentationExchangeProcessor

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

PresentationExchangeProcessor handles DIF PE v2.0 processing

func NewPresentationExchangeProcessor

func NewPresentationExchangeProcessor() *PresentationExchangeProcessor

NewPresentationExchangeProcessor creates a new PEX processor

func (*PresentationExchangeProcessor) ProcessPresentationDefinition

func (pex *PresentationExchangeProcessor) ProcessPresentationDefinition(
	ctx context.Context,
	definition *PresentationDefinition,
	availableCredentials []map[string]interface{},
) (*PresentationProcessingResult, error)

ProcessPresentationDefinition processes a Presentation Definition

type PresentationMetadata

type PresentationMetadata struct {
	GeneratedAt     time.Time     `json:"generatedAt"`
	ExpiresAt       time.Time     `json:"expiresAt"`
	PrivacyLevel    PrivacyLevel  `json:"privacyLevel"`
	DisclosureCount int           `json:"disclosureCount"`
	ProofTypes      []string      `json:"proofTypes"`
	SecurityLevel   SecurityLevel `json:"securityLevel"`
}

PresentationMetadata contains metadata about the presentation

type PresentationPerformance

type PresentationPerformance struct {
	AverageCreationTime     time.Duration `json:"averageCreationTime"`
	AverageVerificationTime time.Duration `json:"averageVerificationTime"`
	CreationSuccessRate     float64       `json:"creationSuccessRate"`
	VerificationSuccessRate float64       `json:"verificationSuccessRate"`
	ThroughputPerSecond     float64       `json:"throughputPerSecond"`
}

PresentationPerformance represents performance metrics for presentations

type PresentationPolicy

type PresentationPolicy struct {
	ID                           string             `json:"id"`
	Name                         string             `json:"name"`
	Description                  string             `json:"description"`
	AllowedTechniques            []PrivacyTechnique `json:"allowedTechniques"`
	ForbiddenTechniques          []PrivacyTechnique `json:"forbiddenTechniques"`
	MinPrivacyLevel              PrivacyLevel       `json:"minPrivacyLevel"`
	MaxDisclosureCount           int                `json:"maxDisclosureCount"`
	RequireLinkabilityProtection bool               `json:"requireLinkabilityProtection"`
	RequireRevocationPrivacy     bool               `json:"requireRevocationPrivacy"`
	AllowedIssuers               []string           `json:"allowedIssuers,omitempty"`
	MaxAge                       time.Duration      `json:"maxAge,omitempty"`
	CustomRules                  []*PolicyRule      `json:"customRules,omitempty"`
}

PresentationPolicy represents policies for presentation creation and verification

type PresentationProcessingResult

type PresentationProcessingResult struct {
	DefinitionID string                       `json:"definition_id"`
	Valid        bool                         `json:"valid"`
	Matches      map[string][]CredentialMatch `json:"matches"`
	Warnings     []string                     `json:"warnings"`
	Errors       []string                     `json:"errors"`
}

Result types

type PresentationProof

type PresentationProof struct {
	Type         ProofType              `json:"type"`
	ProofPurpose ProofPurpose           `json:"proofPurpose"`
	Challenge    string                 `json:"challenge,omitempty"`
	Domain       string                 `json:"domain,omitempty"`
	CreatedAt    time.Time              `json:"created"`
	ProofValue   []byte                 `json:"proofValue"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

PresentationProof represents a cryptographic proof for presentations

type PresentationRegistry

type PresentationRegistry struct {
	Templates []*PresentationTemplate `json:"templates"`
	Policies  []*PresentationPolicy   `json:"policies"`
}

PresentationRegistry represents a registry for managing presentations

type PresentationResponse

type PresentationResponse struct {
	Presentation *PrivacyPreservingPresentation `json:"presentation"`
	Metadata     *PresentationMetadata          `json:"metadata"`
}

PresentationResponse represents the response from creating a presentation

type PresentationStats

type PresentationStats struct {
	TotalPresentations       int                      `json:"totalPresentations"`
	PresentationsByType      map[string]int           `json:"presentationsByType"`
	PresentationsByTechnique map[string]int           `json:"presentationsByTechnique"`
	AveragePrivacyLevel      float64                  `json:"averagePrivacyLevel"`
	AverageDisclosureCount   float64                  `json:"averageDisclosureCount"`
	VerificationSuccessRate  float64                  `json:"verificationSuccessRate"`
	CommonIssues             map[string]int           `json:"commonIssues"`
	PerformanceMetrics       *PresentationPerformance `json:"performanceMetrics"`
	Timestamp                time.Time                `json:"timestamp"`
}

PresentationStats represents statistics about presentations

type PresentationSubmission

type PresentationSubmission struct {
	ID            string                   `json:"id"`
	DefinitionID  string                   `json:"definition_id"`
	DescriptorMap []InputDescriptorMapping `json:"descriptor_map"`
}

PresentationSubmission represents the response to a Presentation Definition

type PresentationTemplate

type PresentationTemplate struct {
	ID                  string                   `json:"id"`
	Name                string                   `json:"name"`
	Description         string                   `json:"description"`
	RequiredCredentials []*CredentialRequirement `json:"requiredCredentials"`
	PrivacyRequirements *PrivacyRequirements     `json:"privacyRequirements"`
	ProofRequirements   []*ProofRequirement      `json:"proofRequirements"`
	ExpirationTime      time.Duration            `json:"expirationTime"`
	CreatedAt           time.Time                `json:"createdAt"`
	UpdatedAt           time.Time                `json:"updatedAt"`
}

PresentationTemplate represents a template for creating presentations

type PrimaryBackupStrategy

type PrimaryBackupStrategy struct{}

PrimaryBackupStrategy uses primary-backup replication

func (*PrimaryBackupStrategy) GetTargetChains

func (pbs *PrimaryBackupStrategy) GetTargetChains(sourceChain string) []string

func (*PrimaryBackupStrategy) Replicate

func (pbs *PrimaryBackupStrategy) Replicate(ctx context.Context, data *ReplicationData) error

func (*PrimaryBackupStrategy) Validate

func (pbs *PrimaryBackupStrategy) Validate(ctx context.Context, data *ReplicationData) error

type PrivacyLevel

type PrivacyLevel int

PrivacyLevel defines different levels of privacy protection

const (
	PrivacyLevelPublic PrivacyLevel = iota
	PrivacyLevelRestricted
	PrivacyLevelPrivate
	PrivacyLevelConfidential
	PrivacyLevelLow
	PrivacyLevelMedium
	PrivacyLevelHigh
	PrivacyLevelMaximum
)

type PrivacyManager

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

PrivacyManager handles privacy-preserving operations for credentials

func NewPrivacyManager

func NewPrivacyManager() *PrivacyManager

NewPrivacyManager creates a new privacy manager

func (*PrivacyManager) AnonymizeValue

func (pm *PrivacyManager) AnonymizeValue(value interface{}, field string) interface{}

AnonymizeValue anonymizes a value based on its type

func (*PrivacyManager) ApplyPrivacyFilters

func (pm *PrivacyManager) ApplyPrivacyFilters(results []*CredentialMetadata, requesterDID string, accessPolicies map[string]*AccessPolicy) []*CredentialMetadata

ApplyPrivacyFilters applies privacy filters to query results

func (*PrivacyManager) CheckDataMinimization

func (pm *PrivacyManager) CheckDataMinimization(metadata *CredentialMetadata, purpose string) *CredentialMetadata

CheckDataMinimization ensures only necessary data is included

func (*PrivacyManager) CreateAccessAuditLog

func (pm *PrivacyManager) CreateAccessAuditLog(requesterDID string, metadata *CredentialMetadata, operation string) *AccessAuditEntry

CreateAccessAuditLog creates an audit log entry for access

func (*PrivacyManager) CreatePrivateMetadata

func (pm *PrivacyManager) CreatePrivateMetadata(metadata *CredentialMetadata, accessPolicy *AccessPolicy) *CredentialMetadata

CreatePrivateMetadata creates privacy-aware metadata from standard metadata

func (*PrivacyManager) GeneratePseudonym

func (pm *PrivacyManager) GeneratePseudonym(value string, salt string) string

GeneratePseudonym generates a consistent pseudonym for a value

func (*PrivacyManager) ValidatePrivacyCompliance

func (pm *PrivacyManager) ValidatePrivacyCompliance(operation string, metadata *CredentialMetadata, accessPolicy *AccessPolicy) error

ValidatePrivacyCompliance validates that operations comply with privacy policies

type PrivacyMetadata

type PrivacyMetadata struct {
	PrivacyLevel          PrivacyLevel       `json:"privacyLevel"`
	TechniquesUsed        []PrivacyTechnique `json:"techniquesUsed"`
	DisclosedClaims       []string           `json:"disclosedClaims,omitempty"`
	HiddenClaims          []string           `json:"hiddenClaims,omitempty"`
	BlindingFactors       [][]byte           `json:"blindingFactors,omitempty"`
	LinkabilityProtection bool               `json:"linkabilityProtection"`
	RevocationPrivacy     bool               `json:"revocationPrivacy"`
}

PrivacyMetadata contains metadata about privacy preservation techniques

type PrivacyPreservingCredential

type PrivacyPreservingCredential struct {
	ID                string                 `json:"id"`
	Type              []string               `json:"type"`
	Context           []string               `json:"@context"`
	Issuer            string                 `json:"issuer"`
	IssuanceDate      time.Time              `json:"issuanceDate"`
	ExpirationDate    *time.Time             `json:"expirationDate,omitempty"`
	CredentialSubject map[string]interface{} `json:"credentialSubject"`
	PrivacyMetadata   *PrivacyMetadata       `json:"privacyMetadata,omitempty"`
	Proof             []*CredentialProof     `json:"proof,omitempty"`
}

PrivacyPreservingCredential represents a credential with privacy preservation

type PrivacyPreservingPresentation

type PrivacyPreservingPresentation struct {
	ID          string                         `json:"id"`
	Type        []string                       `json:"type"`
	Context     []string                       `json:"@context"`
	Holder      string                         `json:"holder"`
	Challenge   string                         `json:"challenge,omitempty"`
	Domain      string                         `json:"domain,omitempty"`
	CreatedAt   time.Time                      `json:"created"`
	ExpiresAt   time.Time                      `json:"expires"`
	Credentials []*PrivacyPreservingCredential `json:"verifiableCredential,omitempty"`
	Proofs      []*PresentationProof           `json:"proof"`
	Metadata    map[string]interface{}         `json:"metadata,omitempty"`
}

PrivacyPreservingPresentation represents a verifiable presentation with privacy features

type PrivacyProof

type PrivacyProof struct {
	Type             ProofType        `json:"type"`
	Value            []byte           `json:"value"`
	PrivacyTechnique PrivacyTechnique `json:"privacyTechnique"`
	DisclosureMap    map[string]bool  `json:"disclosureMap"`
	ZKParameters     *ZKParameters    `json:"zkParameters,omitempty"`
	Created          time.Time        `json:"created"`
}

type PrivacyRequirements

type PrivacyRequirements struct {
	MinPrivacyLevel       PrivacyLevel       `json:"minPrivacyLevel"`
	RequiredTechniques    []PrivacyTechnique `json:"requiredTechniques,omitempty"`
	ForbiddenTechniques   []PrivacyTechnique `json:"forbiddenTechniques,omitempty"`
	LinkabilityProtection bool               `json:"linkabilityProtection"`
	RevocationPrivacy     bool               `json:"revocationPrivacy"`
	MinimalDisclosure     bool               `json:"minimalDisclosure"`
	MaxDisclosureCount    int                `json:"maxDisclosureCount,omitempty"`
}

PrivacyRequirements represents privacy requirements for presentations

type PrivacyRule

type PrivacyRule struct {
	Field        string        `json:"field"`
	Level        PrivacyLevel  `json:"level"`
	Anonymize    bool          `json:"anonymize"`
	Pseudonymize bool          `json:"pseudonymize"`
	Encrypt      bool          `json:"encrypt"`
	TTL          time.Duration `json:"ttl,omitempty"`
	AccessLog    bool          `json:"accessLog"`
}

PrivacyRule defines rules for data handling

type PrivacyTechnique

type PrivacyTechnique string

PrivacyTechnique represents a privacy preservation technique

const (
	PrivacyTechniqueNone                PrivacyTechnique = "none"
	PrivacyTechniqueSelectiveDisclosure PrivacyTechnique = "selective_disclosure"
	PrivacyTechniqueZeroKnowledge       PrivacyTechnique = "zero_knowledge"
	PrivacyTechniqueBBS                 PrivacyTechnique = "bbs_plus"
	PrivacyTechniquePredicate           PrivacyTechnique = "predicate_proof"
	PrivacyTechniqueRangeProof          PrivacyTechnique = "range_proof"
	PrivacyTechniqueMerkleProof         PrivacyTechnique = "merkle_proof"
	// Additional techniques used in manager files
	PrivacyTechniqueBBSSignatures   PrivacyTechnique = "bbs_signatures"
	PrivacyTechniqueHashCommitments PrivacyTechnique = "hash_commitments"
	PrivacyTechniqueBasic           PrivacyTechnique = "basic"
)

type PrivateCredentialResult

type PrivateCredentialResult struct {
	CredentialID    string                 `json:"credentialId"`
	DisclosedClaims map[string]interface{} `json:"disclosedClaims"`
	ZKProofs        []*ZKProofExtended     `json:"zkProofs,omitempty"`
	Metadata        *CredentialMetadata    `json:"metadata"`
	AccessGranted   bool                   `json:"accessGranted"`
	AccessReason    string                 `json:"accessReason,omitempty"`
}

type PrivateQuery

type PrivateQuery struct {
	CredentialQuery
	RequesterDID        string                 `json:"requesterDid"`
	Purpose             string                 `json:"purpose"`
	ZKProofParams       map[string]interface{} `json:"zkProofParams,omitempty"`
	SelectiveDisclosure bool                   `json:"selectiveDisclosure"`
	MaxResults          int                    `json:"maxResults"`
}

type ProofPurpose

type ProofPurpose string

ProofPurpose represents the purpose of a proof

const (
	ProofPurposeAuthentication       ProofPurpose = "authentication"
	ProofPurposeAssertion            ProofPurpose = "assertionMethod"
	ProofPurposeKeyAgreement         ProofPurpose = "keyAgreement"
	ProofPurposeCapabilityInvocation ProofPurpose = "capabilityInvocation"
	ProofPurposeCapabilityDelegation ProofPurpose = "capabilityDelegation"
)

type ProofRequest

type ProofRequest struct {
	Circuit      string                 `json:"circuit"`
	Statement    string                 `json:"statement"`
	Witnesses    map[string]interface{} `json:"witnesses"`
	PublicInputs map[string]interface{} `json:"publicInputs"`
}

ProofRequest represents a request for generating a zero-knowledge proof

type ProofRequirement

type ProofRequirement struct {
	Type       ProofType              `json:"type"`
	Purpose    ProofPurpose           `json:"purpose"`
	Required   bool                   `json:"required"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

ProofRequirement represents requirements for proofs in presentations

type ProofType

type ProofType string

ProofType represents the type of cryptographic proof

const (
	ProofTypeAuthentication      ProofType = "Ed25519Signature2020"
	ProofTypeSelectiveDisclosure ProofType = "BbsBlsSignature2020"
	ProofTypeZeroKnowledge       ProofType = "Groth16Proof2021"
	ProofTypeBBS                 ProofType = "BbsBlsSignatureProof2020"
	ProofTypePredicate           ProofType = "PredicateProof2021"
	ProofTypeRangeProof          ProofType = "BulletProof2021"
	ProofTypeMerkleProof         ProofType = "MerkleProof2021"
	ProofTypeProofOfPossession   ProofType = "ProofOfPossession2021"
	// Additional proof types used in manager files
	ProofTypeBBSPlus              ProofType = "BbsBlsSignature2020"
	ProofTypeEd25519Signature2018 ProofType = "Ed25519Signature2018"
)
const (
	ProofTypeEd25519Signature        ProofType = "Ed25519Signature"
	ProofTypeEcdsaSecp256k1Signature ProofType = "EcdsaSecp256k1Signature"
)

Additional proof types for compilation

type ProofVerifier

type ProofVerifier interface {
	VerifyProof(proof []byte, publicInputs []interface{}, verificationKey []byte) (bool, error)
}

type RangeAssertion

type RangeAssertion struct {
	MinValue  *big.Int `json:"minValue"`
	MaxValue  *big.Int `json:"maxValue"`
	Inclusive bool     `json:"inclusive"`
	Unit      string   `json:"unit,omitempty"`
}

type RangeCircuit

type RangeCircuit struct {
	Value frontend.Variable `gnark:",secret"`
	Min   int64             `gnark:",public"`
	Max   int64             `gnark:",public"`
}

RangeCircuit represents a circuit for range proofs

func (*RangeCircuit) Define

func (rc *RangeCircuit) Define(api frontend.API) error

Define implements the gnark circuit interface

type RefreshService

type RefreshService struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

RefreshService represents a service for refreshing credentials

type Relator

type Relator struct {
	Directive string   `json:"directive"` // "required", "preferred"
	Fields    []string `json:"fields"`
}

type ReplicationData

type ReplicationData struct {
	DID          string                 `json:"did"`
	CredentialID string                 `json:"credentialId"`
	Data         []byte                 `json:"data"`
	Metadata     map[string]interface{} `json:"metadata"`
	SourceChain  string                 `json:"sourceChain"`
	Timestamp    time.Time              `json:"timestamp"`
	Signature    []byte                 `json:"signature"`
}

ReplicationData contains data to be replicated

type ReplicationPolicy

type ReplicationPolicy struct {
	Strategy         string   `json:"strategy"`
	TargetChains     []string `json:"targetChains"`
	MinReplicas      int      `json:"minReplicas"`
	ConsistencyLevel string   `json:"consistencyLevel"`
	AutoSync         bool     `json:"autoSync"`
	SyncInterval     string   `json:"syncInterval"`
}

type ReplicationStrategy

type ReplicationStrategy interface {
	Replicate(ctx context.Context, data *ReplicationData) error
	Validate(ctx context.Context, data *ReplicationData) error
	GetTargetChains(sourceChain string) []string
}

ReplicationStrategy defines how data is replicated

type ResolverClient

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

ResolverClient provides HTTP client access to the centralized resolver-go/ service This replaces the embedded DIDResolver to ensure single source of truth

func NewDIDResolver

func NewDIDResolver(resolverURL string) *ResolverClient

NewDIDResolver creates a new DID resolver client (compatibility function) This replaces the old NewDIDResolver constructor to use the centralized service

func NewResolverClient

func NewResolverClient(resolverURL string) *ResolverClient

NewResolverClient creates a new resolver client

func (*ResolverClient) DeactivateDID

func (rc *ResolverClient) DeactivateDID(ctx context.Context, did string) error

DeactivateDID deactivates a DID using the centralized resolver service

func (*ResolverClient) GetCrossChainStatus

func (rc *ResolverClient) GetCrossChainStatus(ctx context.Context, did string) (*ChainStatus, error)

GetCrossChainStatus gets cross-chain status using the centralized resolver service

func (*ResolverClient) Resolve

func (rc *ResolverClient) Resolve(ctx context.Context, did string) (*DIDDocument, error)

Resolve resolves a DID using the centralized resolver service

func (*ResolverClient) RetrieveCredential

func (rc *ResolverClient) RetrieveCredential(ctx context.Context, did string, credentialID string) (*W3CVerifiableCredential, error)

RetrieveCredential retrieves a credential using the centralized resolver service

func (*ResolverClient) Store

func (rc *ResolverClient) Store(ctx context.Context, didDoc *DIDDocument) error

Store stores a DID document using the centralized resolver service

func (*ResolverClient) StoreCredential

func (rc *ResolverClient) StoreCredential(ctx context.Context, did string, credential *W3CVerifiableCredential) error

StoreCredential stores a credential using the centralized resolver service

func (*ResolverClient) SyncAcrossChains

func (rc *ResolverClient) SyncAcrossChains(ctx context.Context, did string) error

SyncAcrossChains synchronizes a DID across chains using the centralized resolver service

func (*ResolverClient) Update

func (rc *ResolverClient) Update(ctx context.Context, didDoc *DIDDocument) error

Update updates a DID document using the centralized resolver service

type RevocationPrivacy

type RevocationPrivacy struct {
	Enabled                bool          `json:"enabled"`
	AccumulatorType        string        `json:"accumulatorType"`
	WitnessUpdateInterval  time.Duration `json:"witnessUpdateInterval"`
	PrivacyPreservingCheck bool          `json:"privacyPreservingCheck"`
}

RevocationPrivacy represents revocation privacy configuration

type SDJWTFormat

type SDJWTFormat struct {
	Alg   []string   `json:"alg,omitempty"`
	KbJWT *JWTFormat `json:"kb-jwt,omitempty"`
}

type SearchResult

type SearchResult struct {
	Metadata  *CredentialMetadata `json:"metadata"`
	Score     float64             `json:"score"`
	Relevance string              `json:"relevance"` // "exact", "partial", "fuzzy"
	Matches   []string            `json:"matches"`   // Fields that matched
}

SearchResult represents a search result with relevance scoring

type SecurityLevel

type SecurityLevel string

SecurityLevel represents the security level of a presentation

const (
	SecurityLevelLow     SecurityLevel = "low"
	SecurityLevelMedium  SecurityLevel = "medium"
	SecurityLevelHigh    SecurityLevel = "high"
	SecurityLevelMaximum SecurityLevel = "maximum"
)

type SelectiveDisclosureManager

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

func NewSelectiveDisclosureManager

func NewSelectiveDisclosureManager(
	store KeyValueStore,
	bbsManager *BBSManager,
	zkManager *ZKManager,
	complianceEngine *ComplianceEngine,
) *SelectiveDisclosureManager

func (*SelectiveDisclosureManager) CreateSelectiveDisclosure

func (*SelectiveDisclosureManager) VerifySelectiveDisclosure

func (sdm *SelectiveDisclosureManager) VerifySelectiveDisclosure(
	ctx context.Context,
	presentationID string,
	challenge string,
) (*VerificationResult, error)

type SelectiveDisclosureRequest

type SelectiveDisclosureRequest struct {
	CredentialID       string                 `json:"credentialId"`
	DisclosedClaims    []string               `json:"disclosedClaims"`
	HiddenClaims       []string               `json:"hiddenClaims"`
	Challenge          string                 `json:"challenge"`
	PrivacyLevel       PrivacyLevel           `json:"privacyLevel"`
	LinkabilityOptions *LinkabilityOptions    `json:"linkabilityOptions,omitempty"`
	Metadata           map[string]interface{} `json:"metadata,omitempty"`
}

type SelectiveDisclosureResponse

type SelectiveDisclosureResponse struct {
	PresentationID      string               `json:"presentationId"`
	DisclosedCredential *DisclosedCredential `json:"disclosedCredential"`
	PrivacyProof        *PrivacyProof        `json:"privacyProof"`
	LinkabilityProof    *LinkabilityProof    `json:"linkabilityProof,omitempty"`
	ComplianceMetadata  *ComplianceMetadata  `json:"complianceMetadata"`
	Created             time.Time            `json:"created"`
}

type SelectiveStrategy

type SelectiveStrategy struct{}

SelectiveStrategy replicates based on criteria

func (*SelectiveStrategy) GetTargetChains

func (ss *SelectiveStrategy) GetTargetChains(sourceChain string) []string

func (*SelectiveStrategy) Replicate

func (ss *SelectiveStrategy) Replicate(ctx context.Context, data *ReplicationData) error

func (*SelectiveStrategy) Validate

func (ss *SelectiveStrategy) Validate(ctx context.Context, data *ReplicationData) error

type Service

type Service struct {
	ID              string                 `json:"id"`
	Type            string                 `json:"type"`
	ServiceEndpoint string                 `json:"serviceEndpoint"`
	Properties      map[string]interface{} `json:"properties,omitempty"`
}

type SignatureData

type SignatureData struct {
	Algorithm string `json:"algorithm"`
	Data      []byte `json:"data"`
	Message   []byte `json:"message"`
}

SignatureData represents parsed signature information

type StatusConstraint

type StatusConstraint struct {
	Directive string `json:"directive"` // "required", "allowed", "disallowed"
}

type StatusObject

type StatusObject struct {
	Directive string `json:"directive"` // "required", "allowed", "disallowed"
}

type Statuses

type Statuses struct {
	Active    *StatusConstraint `json:"active,omitempty"`
	Revoked   *StatusConstraint `json:"revoked,omitempty"`
	Suspended *StatusConstraint `json:"suspended,omitempty"`
}

type SubjectIsIssuer

type SubjectIsIssuer string
const (
	SubjectIsIssuerRequired  SubjectIsIssuer = "required"
	SubjectIsIssuerPreferred SubjectIsIssuer = "preferred"
)

type SubmissionRequirement

type SubmissionRequirement struct {
	Name       string                  `json:"name,omitempty"`
	Purpose    string                  `json:"purpose,omitempty"`
	Rule       string                  `json:"rule"` // "all", "pick"
	Count      *int                    `json:"count,omitempty"`
	Min        *int                    `json:"min,omitempty"`
	Max        *int                    `json:"max,omitempty"`
	From       string                  `json:"from,omitempty"`
	FromNested []SubmissionRequirement `json:"from_nested,omitempty"`
}

SubmissionRequirement defines how Input Descriptors should be combined

type SyncJob

type SyncJob struct {
	ID           string            `json:"id"`
	DID          string            `json:"did"`
	SourceChain  string            `json:"sourceChain"`
	TargetChains []string          `json:"targetChains"`
	Status       string            `json:"status"` // "pending", "running", "completed", "failed"
	Progress     float64           `json:"progress"`
	StartTime    time.Time         `json:"startTime"`
	EndTime      *time.Time        `json:"endTime,omitempty"`
	Error        string            `json:"error,omitempty"`
	Retries      int               `json:"retries"`
	Metadata     map[string]string `json:"metadata"`
}

SyncJob represents a synchronization job

type SyncManager

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

SyncManager handles synchronization across chains

func NewSyncManager

func NewSyncManager() *SyncManager

NewSyncManager creates a new sync manager

type TermsOfUse

type TermsOfUse struct {
	Type string                 `json:"type"`
	ID   string                 `json:"id,omitempty"`
	Meta map[string]interface{} `json:"meta,omitempty"`
}

TermsOfUse represents terms of use for a credential

type TokenRequest

type TokenRequest struct {
	GrantType         string `json:"grant_type"`
	Code              string `json:"code,omitempty"`
	PreAuthorizedCode string `json:"pre-authorized_code,omitempty"`
	UserPin           string `json:"user_pin,omitempty"`
	CodeVerifier      string `json:"code_verifier,omitempty"`
	ClientID          string `json:"client_id,omitempty"`
	RedirectURI       string `json:"redirect_uri,omitempty"`
}

TokenRequest represents an OIDC4VCI token request

type TokenResponse

type TokenResponse struct {
	AccessToken          string        `json:"access_token"`
	TokenType            string        `json:"token_type"`
	ExpiresIn            int           `json:"expires_in,omitempty"`
	RefreshToken         string        `json:"refresh_token,omitempty"`
	CNonce               string        `json:"c_nonce,omitempty"`
	CNonceExpiresIn      int           `json:"c_nonce_expires_in,omitempty"`
	AuthorizationDetails []interface{} `json:"authorization_details,omitempty"`
}

TokenResponse represents an OIDC4VCI token response

type VerifiablePresentation

type VerifiablePresentation struct {
	Context              []interface{} `json:"@context"`
	Type                 []string      `json:"type"`
	ID                   string        `json:"id,omitempty"`
	Holder               string        `json:"holder,omitempty"`
	VerifiableCredential []interface{} `json:"verifiableCredential,omitempty"`
	Proof                []interface{} `json:"proof,omitempty"`
}

VerifiablePresentation represents a W3C Verifiable Presentation

type VerificationEngine

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

func NewVerificationEngine

func NewVerificationEngine() *VerificationEngine

type VerificationIssue

type VerificationIssue struct {
	Type        IssueType     `json:"type"`
	Severity    IssueSeverity `json:"severity"`
	Description string        `json:"description"`
	Details     interface{}   `json:"details,omitempty"`
}

VerificationIssue represents an issue found during verification

type VerificationMetadata

type VerificationMetadata struct {
	VerificationTime time.Duration   `json:"verificationTime"`
	ProofSize        int             `json:"proofSize"`
	SecurityLevel    int             `json:"securityLevel"`
	TrustedSetup     bool            `json:"trustedSetup"`
	ComplianceChecks map[string]bool `json:"complianceChecks"`
}

type VerificationMethod

type VerificationMethod struct {
	ID                 string                 `json:"id"`
	Type               string                 `json:"type"`
	Controller         string                 `json:"controller"`
	PublicKeyMultibase string                 `json:"publicKeyMultibase,omitempty"`
	PublicKeyJwk       map[string]interface{} `json:"publicKeyJwk,omitempty"`
}

type VerificationResponse

type VerificationResponse struct {
	Valid        bool                            `json:"valid"`
	Timestamp    time.Time                       `json:"timestamp"`
	Results      []*CredentialVerificationResult `json:"results"`
	Issues       []*VerificationIssue            `json:"issues"`
	PrivacyScore float64                         `json:"privacyScore"`
}

VerificationResponse represents the response from verifying a presentation

type VerificationResult

type VerificationResult struct {
	Valid          bool            `json:"valid"`
	PresentationID string          `json:"presentationId"`
	Checks         map[string]bool `json:"checks"`
	Errors         []string        `json:"errors"`
	Timestamp      time.Time       `json:"timestamp"`
}

Verification result type for presentations

type VerifyPresentationRequest

type VerifyPresentationRequest struct {
	Presentation      *PrivacyPreservingPresentation `json:"presentation"`
	Challenge         string                         `json:"challenge,omitempty"`
	Domain            string                         `json:"domain,omitempty"`
	ExpectedChallenge string                         `json:"expectedChallenge,omitempty"`
	ExpectedDomain    string                         `json:"expectedDomain,omitempty"`
	VerificationTime  time.Time                      `json:"verificationTime,omitempty"`
}

VerifyPresentationRequest represents a request to verify a presentation

type W3CVerifiableCredential

type W3CVerifiableCredential struct {
	Context           []string               `json:"@context"`
	ID                string                 `json:"id"`
	Type              []string               `json:"type"`
	Issuer            CredentialIssuer       `json:"issuer"`
	IssuanceDate      time.Time              `json:"issuanceDate"`
	ExpirationDate    *time.Time             `json:"expirationDate,omitempty"`
	CredentialSubject map[string]interface{} `json:"credentialSubject"`
	Proof             []CredentialProof      `json:"proof,omitempty"`
	CredentialStatus  *CredentialStatus      `json:"credentialStatus,omitempty"`
	TermsOfUse        []TermsOfUse           `json:"termsOfUse,omitempty"`
	Evidence          []Evidence             `json:"evidence,omitempty"`
	RefreshService    *RefreshService        `json:"refreshService,omitempty"`
}

W3CVerifiableCredential represents a full W3C Verifiable Credential

type ZKConstraint

type ZKConstraint struct {
	Type       string                 `json:"type"`
	Expression string                 `json:"expression"`
	Parameters map[string]interface{} `json:"parameters"`
}

ZKConstraint represents a constraint in a zero-knowledge proof

type ZKManager

type ZKManager struct{}

Missing ZK and Privacy types

type ZKParameters

type ZKParameters struct{}

type ZKPredicateProof

type ZKPredicateProof struct {
	PredicateID        string        `json:"predicateId"`
	ProofType          ZKProofType   `json:"proofType"`
	ProofValue         []byte        `json:"proofValue"`
	PublicInputs       []interface{} `json:"publicInputs"`
	VerificationKey    []byte        `json:"verificationKey"`
	CircuitID          string        `json:"circuitId,omitempty"`
	WitnessCommitment  []byte        `json:"witnessCommitment,omitempty"`
	SatisfiedAssertion bool          `json:"satisfiedAssertion"`
	Created            time.Time     `json:"created"`
}

type ZKProof

type ZKProof struct {
	Type         ZKProofType            `json:"type"`
	ProofData    []byte                 `json:"proofData"`
	PublicInputs map[string]interface{} `json:"publicInputs"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

ZKProof represents a zero-knowledge proof

type ZKProofExtended

type ZKProofExtended struct {
	ZKProof
	Created   time.Time `json:"created"`
	Challenge []byte    `json:"challenge,omitempty"`
}

type ZKProofManager

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

ZKProofManager handles zero-knowledge proof generation and verification

func NewZKProofManager

func NewZKProofManager(store KeyValueStore) *ZKProofManager

NewZKProofManager creates a new ZK proof manager

func (*ZKProofManager) GenerateProof

func (zkm *ZKProofManager) GenerateProof(ctx context.Context, req *ZKProofRequest) (*ZKProofExtended, error)

GenerateProof generates a zero-knowledge proof for the given request

func (*ZKProofManager) VerifyProof

func (zkm *ZKProofManager) VerifyProof(ctx context.Context, proof *ZKProofExtended) (bool, error)

VerifyProof verifies a zero-knowledge proof

type ZKProofRequest

type ZKProofRequest struct {
	Type         ZKProofType            `json:"type"`
	PrivateValue interface{}            `json:"privateValue"`
	PublicParams map[string]interface{} `json:"publicParams"`
	Challenge    []byte                 `json:"challenge,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

type ZKProofType

type ZKProofType string

ZK Proof types used by manager files

const (
	ZKProofTypeGroth16     ZKProofType = "groth16"
	ZKProofTypePlonk       ZKProofType = "plonk"
	ZKProofTypeBulletproof ZKProofType = "bulletproof"
	ZKProofTypeStark       ZKProofType = "stark"
)
const (
	ZKProofTypeRange      ZKProofType = "range"      // Prove value is within a range
	ZKProofTypeMembership ZKProofType = "membership" // Prove value is in a set
	ZKProofTypeEquality   ZKProofType = "equality"   // Prove two values are equal
	ZKProofTypeComparison ZKProofType = "comparison" // Prove value comparison
	ZKProofTypeAge        ZKProofType = "age"        // Prove age is above/below threshold
	ZKProofTypeCustom     ZKProofType = "custom"     // Custom predicate logic
)

Extended ZK proof types for predicate proofs

type ZKStatement

type ZKStatement struct {
	ID           string                 `json:"id"`
	CircuitType  string                 `json:"circuitType"`
	Statement    string                 `json:"statement"`
	PublicInputs map[string]interface{} `json:"publicInputs"`
	Constraints  []*ZKConstraint        `json:"constraints"`
}

ZKStatement represents a zero-knowledge statement

type ZeroKnowledgeRequest

type ZeroKnowledgeRequest struct {
	HolderDID   string                         `json:"holderDid"`
	Challenge   string                         `json:"challenge"`
	Domain      string                         `json:"domain,omitempty"`
	Statements  []*ZKStatement                 `json:"statements"`
	Credentials []*PrivacyPreservingCredential `json:"credentials"`
	Witnesses   map[string]interface{}         `json:"witnesses"`
}

ZeroKnowledgeRequest represents a request for zero-knowledge presentation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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