1. Core Value Types #
Reuse DIDValue from W3C.DID for representing JSON-like values.
2. Context and Type Definitions #
Credentials use JSON-LD contexts and types for semantic meaning.
Equations
- W3C.instReprContext = { reprPrec := W3C.reprContext✝ }
Equations
- W3C.instReprCredentialType = { reprPrec := W3C.reprCredentialType✝ }
3. Temporal Properties #
Credentials have temporal validity constraints.
Equations
- W3C.instReprDateTime = { reprPrec := W3C.reprDateTime✝ }
DateTime Parsing and Comparison #
ISO 8601 datetime parsing and comparison functions. Supports simplified format: YYYY-MM-DDTHH:MM:SSZ
Equations
- W3C.instReprDateTimeComponents = { reprPrec := W3C.reprDateTimeComponents✝ }
Parse ISO 8601 datetime string (simplified format: YYYY-MM-DDTHH:MM:SSZ)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compare two DateTimes (returns true if dt1 < dt2)
Equations
- W3C.dateTimeBefore dt1 dt2 = match W3C.parseDateTime dt1, W3C.parseDateTime dt2 with | some c1, some c2 => decide (W3C.dateTimeToSeconds c1 < W3C.dateTimeToSeconds c2) | x, x_1 => false
Instances For
Compare two DateTimes (returns true if dt1 > dt2)
Equations
- W3C.dateTimeAfter dt1 dt2 = match W3C.parseDateTime dt1, W3C.parseDateTime dt2 with | some c1, some c2 => decide (W3C.dateTimeToSeconds c1 > W3C.dateTimeToSeconds c2) | x, x_1 => false
Instances For
Compare two DateTimes (returns true if dt1 ≤ dt2)
Equations
- W3C.dateTimeBeforeOrEqual dt1 dt2 = match W3C.parseDateTime dt1, W3C.parseDateTime dt2 with | some c1, some c2 => decide (W3C.dateTimeToSeconds c1 ≤ W3C.dateTimeToSeconds c2) | x, x_1 => false
Instances For
Compare two DateTimes (returns true if dt1 ≥ dt2)
Equations
- W3C.dateTimeAfterOrEqual dt1 dt2 = match W3C.parseDateTime dt1, W3C.parseDateTime dt2 with | some c1, some c2 => decide (W3C.dateTimeToSeconds c1 ≥ W3C.dateTimeToSeconds c2) | x, x_1 => false
Instances For
4. Issuer #
The issuer can be a URI or an object with additional properties.
Equations
- W3C.instReprIssuer = { reprPrec := W3C.reprIssuer✝ }
Extract issuer ID from Issuer
Equations
- (W3C.Issuer.uri a).getId = a
- (W3C.Issuer.object a a_1).getId = a
Instances For
5. Credential Subject #
The subject of the credential (entity about which claims are made).
Equations
- W3C.instReprCredentialSubject = { reprPrec := W3C.reprCredentialSubject✝ }
6. Credential Status #
Information about the credential's revocation or suspension status.
Equations
- W3C.instReprCredentialStatus = { reprPrec := W3C.reprCredentialStatus✝ }
7. Credential Schema #
Reference to a schema for validating credential structure.
Equations
- W3C.instReprCredentialSchema = { reprPrec := W3C.reprCredentialSchema✝ }
8. Evidence #
Supporting evidence for the claims in a credential.
Equations
- W3C.instReprEvidence = { reprPrec := W3C.reprEvidence✝ }
9. Terms of Use #
Defines terms under which the credential can be used.
Equations
- W3C.instReprTermsOfUse = { reprPrec := W3C.reprTermsOfUse✝ }
10. Refresh Service #
Mechanism for refreshing the credential.
Equations
- W3C.instReprRefreshService = { reprPrec := W3C.reprRefreshService✝ }
11. Proof #
Cryptographic proof that makes credentials and presentations verifiable.
Proof purpose (why the proof was created)
- authentication : ProofPurpose
- assertionMethod : ProofPurpose
- keyAgreement : ProofPurpose
- capabilityInvocation : ProofPurpose
- capabilityDelegation : ProofPurpose
Instances For
Equations
- W3C.instReprProofPurpose = { reprPrec := W3C.reprProofPurpose✝ }
Cryptographic proof (embedded or enveloping)
- type_ : String
REQUIRED: Proof type
OPTIONAL: Cryptosuite identifier
OPTIONAL: Timestamp of proof creation
OPTIONAL: Verification method URI
OPTIONAL: Purpose of the proof
OPTIONAL: The cryptographic proof value
OPTIONAL: Challenge for preventing replay attacks
OPTIONAL: Domain for binding to specific verifier
Additional proof-specific properties
Instances For
Equations
- W3C.instReprProof = { reprPrec := W3C.reprProof✝ }
12. Credential #
A credential is a set of claims made by an issuer about a subject. This is the base structure before securing with proof.
Credential (before securing with proof)
REQUIRED: JSON-LD context (first must be v2 context)
- type_ : List CredentialType
REQUIRED: Credential type (must include "VerifiableCredential")
OPTIONAL: Credential identifier
OPTIONAL: Human-readable name
OPTIONAL: Human-readable description
- issuer : Issuer
REQUIRED: Issuer of the credential
OPTIONAL: When credential becomes valid
OPTIONAL: When credential expires
- credentialSubject : List CredentialSubject
REQUIRED: Subject(s) of the credential
- credentialStatus : Option CredentialStatus
OPTIONAL: Status information
- credentialSchema : Option CredentialSchema
OPTIONAL: Schema reference
OPTIONAL: Supporting evidence
- termsOfUse : List TermsOfUse
OPTIONAL: Terms of use
- refreshService : Option RefreshService
OPTIONAL: Refresh service
Additional properties (extensibility)
Instances For
Equations
- W3C.instReprCredential = { reprPrec := W3C.reprCredential✝ }
13. Credential with Proof #
A credential with proofs attached, but not yet verified. This is an intermediate structure before verification.
Credential with attached proofs (not yet verified)
- credential : Credential
The underlying credential
REQUIRED: One or more proofs
Instances For
Equations
- W3C.instReprCredentialWithProof = { reprPrec := W3C.reprCredentialWithProof✝ }
14. Valid and Invalid Verifiable Credentials #
Valid Verifiable Credential
A credential whose cryptographic proof has been successfully verified. The issuer's signature is valid and the credential has not been tampered with.
Abstraction:
- Does not expose cryptographic details (Ed25519, BBS+, etc.)
- Protocol-level abstraction: "cryptographically valid credential"
- Construction implies successful verification
- credentialWithProof : CredentialWithProof
The credential with verified proof
Instances For
Equations
- W3C.instReprValidVC = { reprPrec := W3C.reprValidVC✝ }
Invalid Verifiable Credential
A credential whose cryptographic proof verification has failed. Reasons include:
- Signature verification failure
- Tampered credential content
- Invalid issuer key
- Malformed proof
- credentialWithProof : CredentialWithProof
The credential with invalid proof
OPTIONAL: Reason for invalidity (for debugging)
Instances For
Equations
- W3C.instReprInvalidVC = { reprPrec := W3C.reprInvalidVC✝ }
Verifiable Credential
Sum type of valid and invalid credentials. Represents the result of cryptographic verification.
Design Pattern:
valid: Proof verification succeededinvalid: Proof verification failed- Verification function is a simple pattern match
- Enables formal verification of protocol properties
- valid : ValidVC → VerifiableCredential
- invalid : InvalidVC → VerifiableCredential
Instances For
Equations
- W3C.instReprVerifiableCredential = { reprPrec := W3C.reprVerifiableCredential✝ }
Get the underlying credential with proof
Equations
Instances For
Get the underlying credential (without proof)
Equations
Instances For
Get the subjects of the credential
Equations
Instances For
Verify cryptographic signature
Design Core:
valid: Always returns true (proof already verified at construction)invalid: Always returns false (proof verification failed)
This simple definition enables formal reasoning about verification without exposing cryptographic implementation details.
Equations
Instances For
Check if a verifiable credential is valid
Equations
- vc.isValid = (vc.verifySignature = true)
Instances For
Check if a verifiable credential has expired
Equations
- vc.hasExpired now = match vc.getCredential.validUntil with | none => False | some validUntil => W3C.dateTimeAfter now validUntil = true
Instances For
Check if a verifiable credential is not yet valid
Equations
- vc.notYetValid now = match vc.getCredential.validFrom with | none => False | some validFrom => W3C.dateTimeBefore now validFrom = true
Instances For
15. Holder #
Entity that possesses and presents credentials.
Equations
- W3C.instReprHolder = { reprPrec := W3C.reprHolder✝ }
Extract holder ID from Holder
Equations
- (W3C.Holder.uri a).getId = a
- (W3C.Holder.object a a_1).getId = a
Instances For
16. Presentation #
A presentation is data derived from credentials for a specific verifier.
Presentation (before securing with proof)
REQUIRED: JSON-LD context
- type_ : List CredentialType
REQUIRED: Presentation type (must include "VerifiablePresentation")
OPTIONAL: Presentation identifier
OPTIONAL: Holder of the credentials
- verifiableCredential : List VerifiableCredential
OPTIONAL: Verifiable credentials being presented
Additional properties (extensibility)
Instances For
Equations
- W3C.instReprPresentation = { reprPrec := W3C.reprPresentation✝ }
17. Presentation with Proof #
A presentation with proofs attached, but not yet verified.
Presentation with attached proofs (not yet verified)
- presentation : Presentation
The underlying presentation
REQUIRED: One or more proofs
Instances For
Equations
18. Valid and Invalid Verifiable Presentations #
Valid Verifiable Presentation
A presentation whose cryptographic proof has been successfully verified. The holder's signature is valid and the presentation has not been tampered with.
- presentationWithProof : PresentationWithProof
The presentation with verified proof
Instances For
Equations
- W3C.instReprValidVP = { reprPrec := W3C.reprValidVP✝ }
Invalid Verifiable Presentation
A presentation whose cryptographic proof verification has failed.
- presentationWithProof : PresentationWithProof
The presentation with invalid proof
OPTIONAL: Reason for invalidity (for debugging)
Instances For
Equations
- W3C.instReprInvalidVP = { reprPrec := W3C.reprInvalidVP✝ }
Verifiable Presentation
Sum type of valid and invalid presentations. Same design pattern as VerifiableCredential.
- valid : ValidVP → VerifiablePresentation
- invalid : InvalidVP → VerifiablePresentation
Instances For
Equations
Get the underlying presentation with proof
Equations
Instances For
Get the underlying presentation (without proof)
Equations
Instances For
Get the credentials in the presentation
Equations
Instances For
Verify cryptographic signature
Equations
Instances For
Check if a verifiable presentation is valid
Equations
- vp.isValid = (vp.verifySignature = true)
Instances For
19. Constants #
W3C defined constants.
The required v2 context URI
Equations
- W3C.requiredContextV2 = "https://www.w3.org/ns/credentials/v2"
Instances For
The required credential type
Equations
- W3C.requiredCredentialType = "VerifiableCredential"
Instances For
The required presentation type
Equations
- W3C.requiredPresentationType = "VerifiablePresentation"
Instances For
20. Structural Validation Predicates #
Validation checks that don't depend on cryptography.
Check if context list has the required v2 context as first element
Equations
- W3C.hasValidContext [] = False
- W3C.hasValidContext (ctx :: tail) = (ctx.value = W3C.requiredContextV2)
Instances For
Check if type list includes required type
Equations
Instances For
Check if credential subject has at least one claim
Equations
- W3C.hasAtLeastOneClaim subject = (subject.claims.length > 0)
Instances For
All credential subjects must have at least one claim
Equations
- W3C.allSubjectsHaveClaims subjects = (subjects.length > 0 ∧ ∀ (s : W3C.CredentialSubject), s ∈ subjects → W3C.hasAtLeastOneClaim s)
Instances For
Credential status must have id and type if present
Equations
Instances For
Credential schema must have id and type if present
Equations
Instances For
A credential is structurally valid if it satisfies all MUST requirements
Equations
- One or more equations did not get rendered due to their size.
Instances For
A credential with proof must have at least one proof
Equations
- W3C.hasProofs cwp = (cwp.proof.length > 0)
Instances For
A presentation is structurally valid if it satisfies all MUST requirements
Equations
Instances For
A presentation with proof must have at least one proof
Equations
- W3C.hasPresentationProofs pwp = (pwp.proof.length > 0)
Instances For
21. Complete Validation and Verification #
Combines structural validation with cryptographic verification.
Complete validation of a verifiable credential
Equations
Instances For
Complete validation of a verifiable presentation
Equations
- One or more equations did not get rendered due to their size.
Instances For
22. Temporal Validity #
Check if credentials are within their validity period.
Equations
- W3C.instReprVerificationTime = { reprPrec := W3C.reprVerificationTime✝ }
Check if a credential is temporally valid at a given time
Equations
- W3C.isTemporallyValid vc time = (¬vc.hasExpired time.now ∧ ¬vc.notYetValid time.now)
Instances For
23. Security Properties #
Issuer Binding: A valid credential is cryptographically bound to its issuer
Instances For
Holder Binding: A valid presentation is cryptographically bound to its holder
Instances For
Non-Repudiation: An issuer cannot deny issuing a valid credential
Equations
- W3C.nonRepudiation vc = (vc.isValid → W3C.issuerBinding vc)
Instances For
Credential Integrity: Valid credentials maintain their integrity
Equations
- W3C.credentialIntegrity vc = (W3C.isValidCredential vc → W3C.issuerBinding vc)
Instances For
Presentation Integrity: Valid presentations maintain their integrity
Equations
- W3C.presentationIntegrity vp = (W3C.isValidPresentation vp → ∀ (vc : W3C.VerifiableCredential), vc ∈ vp.getCredentials → W3C.credentialIntegrity vc)
Instances For
24. Privacy Properties #
Formal privacy properties for credentials and presentations.
Selective Disclosure: Ability to reveal only specific claims
Equations
Instances For
Unlinkability: Credentials should not be trivially linkable across uses
Equations
Instances For
25. DateTime Comparison Properties #
DateTime comparison is reflexive for valid datetimes
If dt1 is before dt2, then dt2 is after dt1
Transitivity of dateTimeBefore
26. Core Theorems #
Valid credentials always pass signature verification
Invalid credentials always fail signature verification
Valid presentations always pass signature verification
Invalid presentations always fail signature verification
Valid credentials satisfy issuer binding
Valid presentations satisfy holder binding (if holder present)
26. Example Credentials and Presentations #
Example credential type
Equations
Instances For
Example credential subject
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example proof
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example credential
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example credential with proof
Equations
- W3C.exampleCredentialWithProof = { credential := W3C.exampleCredential, proof := [W3C.exampleProof] }
Instances For
Example valid verifiable credential
Equations
- W3C.exampleValidVC = { credentialWithProof := W3C.exampleCredentialWithProof }
Instances For
Example verifiable credential
Instances For
Example presentation
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example presentation with proof
Equations
- W3C.examplePresentationWithProof = { presentation := W3C.examplePresentation, proof := [W3C.exampleProof] }
Instances For
Example valid verifiable presentation
Equations
- W3C.exampleValidVP = { presentationWithProof := W3C.examplePresentationWithProof }
Instances For
Example verifiable presentation
Instances For
27. DateTime Comparison Examples #
These examples demonstrate the DateTime parsing and comparison functions.
Test credential with validFrom and validUntil
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- W3C.testCredentialWithProof = { credential := W3C.testCredentialWithDates, proof := [W3C.exampleProof] }
Instances For
Equations
- W3C.testValidVC = { credentialWithProof := W3C.testCredentialWithProof }