owned this note
owned this note
Published
Linked with GitHub
# Anoncreds 2.0 Data Models
Data models can be encoded in human friendly text formats (json, yaml) and binary formats (cbor, bare).
Unless otherwise noted, data types are encoded the same for both.
Human friendly text formats are denoted as `text`. Binary formats are denoted as `bin`.
### Claim Schemas
Properties:
- **claim_type**(required): The type of data the claim represents.
- Enumeration \[Hashed, Numeric, Scalar\]
- String(text)
- Unsigned Byte(bin)
- **Hashed**: claim data is hashed before signing.
- Properties:
- **alg**(required): The hash algorithm that converts the claim data to a cryptographically signable value.
- String(text)
- Unsigned Byte(bin)
- **Numeric**: claim data is zero centered before signing.
- Properties:
- **zero**(required): The value that represents zero. Used for zero centering to allow for negative numbers
- Unsigned 64-bit Integer
- **Scalar**: claim data is already a cryptographic value. Equivalent to a null hash.
- **label**(required): Human friendly text label for the claim.
- String
- Must match the regular expression `^[a-zA-Z]\w*$`.
- **human_friendly**(optional): Is the claim data human readable.
- Boolean
- `True` or `False`
- Default: `True`
- **validators**(optional): A list of validators the claim data must pass before signing is allowed.
- List\[ClaimValidators\]
### Claim Validators
Validators determine data validity in order to be signed.
#### TODO: Add blindly signed claim validators
Properties:
- **type**(required): The claim validator type
- Enumeration \[Length, Range, Regex, AnyOne\]
- String(text)
- Unsigned Byte(bin)
- **Length**
- Properties:
- **min**(optional): The minimum length for the claim data.
- Unsigned 64-bit Integer
- Default: 0
- **max**(optional): The maximum length for the claim data.
- Unsigned 64-bit Integer
- Default: u64::MAX
- **Range**
- Properties:
- **min**(optional): The minimum inclusive value for the claim data.
- Signed 64-bit Integer
- Default: i64::MIN
- **max**(optional): The maximum inclusive value for the claim data.
- Signed 64-bit Integer
- Default: i64::MAX
- **Regex**
- Properties:
- **pattern**(required): The regular expression the claim data must match.
- String
- **AnyOne**
- Properties:
- **values**(required): A list of expected claim values that the claim data must match.
- List\[ClaimData\]
### Claim Data
The type of claim data that can be signed
Properties:
- **type**(required): The claim data type
- Enumeration: \[Hashed, Numeric, Scalar\]
- **value**(required): The claim data
- Hashed
- String(text)
- HexString or Base64UrlString(text but not human friendly)
- List\[Byte\](bin)
- Numeric
- Signed 64-bit Integer
- Scalar
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
### Credential Schema
A credential schema is composed of one or more ordered claim schemas and metadata surrounding it.
Properties:
- **label**(optional): Human friendly text label for the schema.
- String
- Must match the regular expression `^[a-zA-Z]\w*$`.
- **description**(optional): A human friendly longer text description for the schema.
- **blindly_signed_claims**(required): The claims allowed to be signed blindly
- List\[String\]
- The claim schema labels as entries
- **claims**(required): The ordered list of claim schemas
- List\[ClaimSchema\]
### Credential Definition
A credential schema and the associated verification keys for the issuer.
Properties:
- **verifying_key**(required): The issuer's verifying key for validating signatures.
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **revocation_verifying_key**(required): The issuer's verifying key for checking revocation.
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **verifiable_encryption_key**(optional): The issuer's key for encrypting verifiable ciphertexts.
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **schema**(required): The credential schema associated with this definition
- CredentialSchema
- **revocation_registry**(required): The revocation registry information.
### Revocation Registry
Depending on the use case, the revocation registry data model can come in different forms. This section only covers the privacy respecting version as implemented by accumulators.
Properties:
- **type**(required):
- Enumeration: \[Accumulator, PKI, List\]
- String
- **value**(required): The accumulator digest value
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
### Credential
A credential represents the signed claims and cryptographic material bundled together. This design should map easily to W3C Verifiable Credentials Spec.
Properties:
- **claims**(required):
- List\[ClaimData\]
- **signature**(required):
- Object
- **revocation_handle**(optional):
- Object
For anonymous credentials a signature can look like the following
#### CL
Properties:
- **type**(required): CL
- String
- **value**(required):
- **a**:
- String(text)
- List\[Byte\](bin)
- **e**
- String(text)
- List\[Byte\](bin)
- **v**
- String(text)
- List\[Byte\](bin)
#### PS
Properties:
- **type**(required): PS
- String
- **value**(required):
- **s1**:
- String(text)
- List\[Byte\](bin)
- **s2**:
- String(text)
- List\[Byte\](bin)
### Statements
Statements are used to define what requirements a prover must satisfy and how. Each statement provides all the public information necessary to indicate to a prover how it is satisfied and computed.
#### Signature
Signature statements require a prover to demonstrate they possess a signature from a specific issuer. Depending on the signature type, it may or may not support selective disclosure and zero-knowledge signature proofs of knowledge.
Properties:
- **id**(required): The statement unique identifier.
- String
- **disclosed**(required): A list of claim labels found in the credential schema. These claims are revealed to the verifier in plain text.
- List\[String\]
- **issuer**: Object
- Issuers Public Key
- Revocation Information
- Credential Schema
#### Equality
Equality statements are a zero-knowledge proof that proves claims across multiple signatures are the same without revealing them.
Properties:
- **id**(required): The statement unique identifier
- **reference_statement_id_to_claim**(required):
- List\[(String, List\[String\])\]
- 1st: Statement Id
- 2nd: Claim Label(s)
#### Membership / Nonmembership
This can be computed in two ways in zero-knowledge: Accumulators or R1CS. The result is a proof that demonstrates a value is in a set (or not) without revealing the set element.
**Accumulator** based Properties
- **id**(required): The statement unique identifier
- **type**(required):
- Enumeration: \[Membership, Nonmembership\]
- String
- **reference_signature_statement_id**(required): The signature statement to reference for the claim value
- String
- **claim_label**(required): The claim label from the signature statement to use for matching the claim value.
- String
- **accumulator**(required): The accumulator value
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **verification_key**(required): The accumulator verification key
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **parameters**(optional): Any other parameters that might be necessary
- Object
#### Commitment
Proves two commitments hide the same value. For example, the first commitment might be a signature like CL, BBS+, or PS, and the other in stand alone commitment. The result is a proof that shows the same secret is equal in both. One use case is to attach a claim value to a Bulletproof which requires commitments as input instead of schnorr proofs.
Properties:
- **id**(required): The statement unique identifier
- String
- **reference_signature_statement_id**(required): The signature statement to reference for the claim value
- String
- **claim_label**(required): The claim label from the signature statement to use for matching the claim value.
- String
- **claim_generator**: The generator used for the claim value
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **randomizer_generator**: The generator used for the commitment randomizer
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
#### Verifiable Encryption
Creates a verifiable ciphertext that proves the the ciphertext was done using a specified public key and the value encrypted is the same as in a commitment similar to the `Commitment` statement.
Properties:
- **id**(required): The statement unique identifier
- String
- **reference_signature_statement_id**(required): The signature statement to reference for the claim value
- String
- **claim_label**(required): The claim label from the signature statement to use for matching the claim value.
- String
- **claim_generator**: The generator used for the claim value
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
- **encryption_key**: The encryption key used to encrypt this verifiable ciphertext
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
#### Range
Proves a claim value lies between a lower and upper bound. Here is an example done for Bulletproofs
Properties:
- **id**(required): The statement unique identifier
- String
- **reference_signature_statement_id**(required): The signature statement to reference for the claim value
- String
- **claim_label**(required): The claim label from the signature statement to use for matching the claim value.
- String
- **reference_commitment_statement_id**(required): The commitment statement to reference for the commitment value to be used by the circuit
- String
- **lower**(optional): The lower bound to test against if set
- Number
- **upper**(optional): The upper bound to test against if set
- Number
### PresentationRequestSchema
The collection of statements that must all be satisfied.
Properties:
- **statements**(required)
- List\[Statement\]
### Proofs
Proofs are cryptographic material that demonstrate zero-knowledge about known or hidden values.
#### Signature
Properties:
- **id**(required): The statement id that this proof satisfies.
- String
- **disclosed_claims**(required): The disclosed claims
- List\[ClaimData\]
- **proof**(required): The signature proof of knowledge and hidden claims
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
### Equality,
Properties:
- **id**(required): The statement id that this proof satisfies.
- String
### SetMembership, Commitment, VerifiableEncryption, Range
Properties:
- **id**(required): The statement id that this proof satisfies.
- String
- **proof**(required): The cryptographic proof material
- HexString or Base64UrlString(text)
- List\[Byte\](bin)
### Presentation
The collected proofs and data for a full presentation.
Properties:
- ****