Credentials and issuers
What a person brings to enroll, how its fields are signed, and which issuers count.
A credential is what a person brings to enroll: an issuer's signed statement that it checked this person, issued to a key only the person's device holds. Once accepts credentials from issuers in its issuer registry and never stores one. The credential stays on the person's device, encrypted under the unlock.
What a credential holds
A credential is a W3C Verifiable Credential. Its subject is the person: a subject ID, name, date of birth, place of birth, sex and nationality, plus the holder public key, the BabyJubJub key the device derives from the wallet's unlock signature. The credential also carries the issuer's ID and public key, a validity interval (validFrom, validUntil) and the issuer's proof: the Merkle root of the fields and the signature over it.
How the fields are signed
Circuits work over field elements, so the issuer signs numbers, not JSON. Each field becomes one value:
| Slot | Value |
|---|---|
| 0 to 6 | Subject ID, name, date of birth, place of birth, sex, nationality, original valid-from time |
| 7 | Valid-until time |
| 8, 9 | Holder public key, x then y |
| 10, 11 | Issuer ID, credential type |
| 12 to 15 | Zero |
A string is encoded as UTF-8 exactly as given, hashed with SHA-256, and its first 31 bytes are read as a big-endian integer, which keeps it below the BN254 field modulus. Times are Unix seconds in UTC.
Leaf i of the credential's tree is Poseidon(i + 1, value[i]). Pairs of leaves are hashed left to right through four levels into a root of 16 leaves, and the issuer signs that root with BabyJubJub EdDSA over Poseidon. Inside a circuit the device rebuilds the root from the values and checks the signature, so no field can change without breaking it.
HashID
The private identifier is the Poseidon hash of slots 0 to 6:
HashID = Poseidon(subjectId, name, dob, placeOfBirth, sex, nationality, validFrom)It is computed on the device and never sent anywhere. Publishing it, or any plain hash of it, would give anyone who can guess a name and a birth date a way to test their guess. Once instead turns HashID into the person secret s through the threshold OPRF.
Because s comes from these seven fields, an issuer that reissues a credential to the same person keeps them byte for byte, including the original valid-from time. A renewal can change the valid-until time and the holder key, so a person who moves to a new wallet keeps the same s, the same person nullifier and the same scope nullifiers.
The issuer registry
The program keeps one account per issuer key, at the address derived from ["issuer", x, y], holding the key and an active flag. The admin adds or retires an issuer with set_issuer. Two checks use the registry:
- Each OPRF node answers only for a credential whose issuer key is trusted, read from the
authorizeproof's public signals. enrollreads the issuer account passed to it and refuses withUnknownIssuerwhen the account is absent or the key is retired.
The issuer key is public at enrollment, as one of the accounts of the enroll transaction.
Validity
The OPRF nodes refuse an expired credential, enroll refuses one whose valid-until time has passed (CredentialExpired), and a claim proves that valid-until falls after the scope's closing time. The expiry also goes into the person's leaf in the person tree, so the claim circuit reads it from the same leaf it proves membership of.
Issuers on the localnet
On the localnet a demo issuer signs credentials after a stand-in check, to whatever holder key the form gives it, through POST /v1/issuer/credentials in the API. Which issuers the mainnet registry holds is set at launch. Become an issuer covers running an issuer of your own.