# OIP-0015: Participant credentials (W3C Verifiable Credentials 2.0)

| Field | Value |
|---|---|
| Status | DRAFT |
| Function | none added (the register keeps exactly twelve); cross-cutting under §3 (participant roles), used by `join`, `admit`, `federate` and `correct` |
| Affects | new §3.1 (CRED-1 to CRED-8, `OBS-CRED-0001` to `OBS-CRED-0009`); §4.2 (one row); new schemas `participant-credential`, `credential-status-list`, `credential-profile`; reference verifier `sdk/python/src/obsp/credentials.py`; vectors and test keys `conformance/vectors/credentials/`; generator `tools/gen_credential_vectors.py`; five invariants; cases CT-PROVIDER-065, CT-PROVIDER-066, CT-CONSUMER-065, CT-GRID-075 to CT-GRID-077 |
| Protocol version | obsp/0.1 |
| Relates to | OIP-0008 (signature envelope and algorithm register: the COSE header rules, the fully specified algorithm code points, the key record UNI as key id, and test keys 1 and 4 are reused); OIP-0005 (alert notices: an alerting authority credential is the evidence a relay can check for a notice's sender) |
| Last call | 90 days (new capability that every verifying participant implements) unless the editors rule otherwise |

## Problem

The protocol names roles (§3) but gives no portable way to prove that a participant holds one. An observer who
contributes to an observatory, the operator of that observatory, a conformance reviewer, an accreditor and an
alerting authority each need to show their role to another participant, possibly in another trust domain, offline,
without a central registry and without handing over personal data. Today each implementation would use its own
accounts or certificates, so a federation peer cannot check who issued a role, whether it was revoked, or whether an
alert sender is a recognised authority for the area.

## Change

### Normative text (new §3.1 "Participant credentials"; the exact text is in `patches/spec.patch`)

| Id | Requirement (summary) | Error codes |
|---|---|---|
| CRED-1 | VC 2.0 credential of exactly one of five types, subject with `id`, `role`, `displayName` and the claims of its type and of the operator's profile | `OBS-CRED-0001` |
| CRED-2 | Issuer authority chain to a trust anchor of the operator's profile, through issuer credentials that may issue the type and list the signing key, within `maxChainLength` | `0003`, `0005`, `0008` |
| CRED-3 | `validFrom` and `validUntil` required, within the profile's `maxValidity`; rejected outside the window at trusted time | `0004` |
| CRED-4 | Bitstring Status List entry (revocation) required; checked before use; fail closed when the list is missing, unverifiable, out of force or longer-lived than the profile allows; a cached list may serve offline while in force | `0006`, `0007` |
| CRED-5 | Secured per VC-JOSE-COSE: COSE_Sign1 (`application/vc+cose`, content type `application/vc`) or JWS (`vc+jwt`, `cty` `vc`) over the RFC 8785 bytes, detached, key record UNI as key id, algorithm accepted by the profile; Ed25519 accepted by every verifier | `0002`, `0009` |
| CRED-6 | No personal data beyond the role and the name the participant chose | |
| CRED-7 | Alerting authority: area (geocodes or closed polygons) and the register it was checked against, for example the WMO Register of Alerting Authorities, with entry and date | |
| CRED-8 | A credential states a role; it is not admission, qualification, certification or a conformance level, and it does not confer alerting authority | |

Default issuer rules (a profile may narrow them, never widen them):

| Type | Issued by |
|---|---|
| AccreditorCredential | a trust anchor of the operator |
| ObservatoryOperatorCredential | a trust anchor, or an accreditor whose `mayIssue` lists the type |
| ObserverCredential | the holder of an ObservatoryOperatorCredential for the same observatory |
| ConformanceReviewerCredential | an accreditor whose `mayIssue` lists the type |
| AlertingAuthorityCredential | an accreditor whose `mayIssue` lists the type |

An accreditor cannot create accreditors; only the operator's own trust anchors can (SOV-2: the operator generates
them). The verifier checks in a fixed order: structure and required claims, accepted algorithm, key, signature,
validity, status, then the issuer's authority (verifying the issuer's credential the same way).

### Contracts

| Schema | Holds | Rules the schema enforces |
|---|---|---|
| `participant-credential` | `credentialType`, `credential` (VC 2.0: `@context` with the VC 2.0 context only, `id`, `type`, `issuer`, `validFrom`, `validUntil`, `credentialSubject`, `credentialStatus`, optional `credentialSchema`), `securing` (`format`, `alg`, `kid`, `protected`, `signature`), `testOnly`, `recordedAt` | one subject definition per type with `additionalProperties: false` (no e-mail, birth date or other personal fields); `role` fixed per type; `displayName` at most 128 characters; public Ed25519 JWKs only; status purpose `revocation`; accreditors may issue only operator, reviewer and alerting authority types |
| `credential-status-list` | a `BitstringStatusListCredential` with `encodedList` (multibase base64url of the GZIP-compressed bitstring), secured the same way | purpose `revocation` only |
| `credential-profile` | `profileUni`, `operator`, `trustAnchors` (issuer, key id, public JWK), `credentialTypes` (required claims, issuers, `maxValidity`), `status` (`required`, `revocation`, `failClosed` all fixed), `securing` (formats, algorithm ids), `maxChainLength` (1 to 5) | at least one trust anchor; every type requires `id`, `role`, `displayName`; status cannot be optional or fail open |

The COSE protected header carries alg (label 1, the fully specified code point of the OIP-0008 register, -19 for
Ed25519), content type (label 3), kid (label 4) and typ (label 16, RFC 9596), deterministically encoded; the signature
is over the RFC 9052 Sig_structure with empty external data. The JWS protected header is the RFC 8785 form of
`{alg, kid, typ, cty}` with `alg` `Ed25519`; the signing input is the protected header and the base64url payload
(RFC 7515 Appendix F, detached content).

### Test keys and examples

All signatures in the examples, fixtures and vectors are real Ed25519 signatures made with published test keys, marked
`testOnly` everywhere: keys 1 and 4 of the OIP-0008 signature vectors (same labels, seed = SHA-256 of the label, same
public keys) and two new keys from labels of the same form. `tools/gen_credential_vectors.py` regenerates everything
from those labels (needs the optional `cryptography` package; Ed25519 is deterministic, so the output is identical on
every run). The reference verifier implements Ed25519 (RFC 8032), deterministic CBOR and the status list decoding in
plain Python, so verification needs no cryptographic package.

## Compatibility

Additive: three new schemas, new example documents, new cases. No existing schema changes. No function is added.
OIP-0008 is not a prerequisite for review; on acceptance of both, `securing.alg` names rows of its algorithm register
and CRED-5 points to §4.4 for the code points.

## Tests

| Requirement | Case | Kind and check |
|---|---|---|
| CRED-2, CRED-3, CRED-4, CRED-5 | CT-PROVIDER-065, CT-GRID-075 | `credential-chain-verifies` (each credential verifies with the set's profile, issuer credentials and status lists at the time it was recorded); `credential-status-checked` (status list present, same issuer, in force, bit clear) |
| CRED-1, CRED-6, CRED-8 | CT-PROVIDER-066 | `credential-claims-minimal` (type consistent, claims the profile requires, nothing outside the type's list) |
| CRED-3, CRED-4, CRED-7 | CT-CONSUMER-065 | chain and status invariants, `alerting-authority-register` (closed polygons, register checked no later than recorded) |
| CRED-2, CRED-8 | CT-GRID-076 | `credential-profile-rooted` (every type reachable from a trust anchor; no rule looser than §3.1; observers limited to their observatory) |
| CRED-1, CRED-6, CRED-7 | CT-GRID-077 | `credential-claims-minimal`, `alerting-authority-register` |
| CRED-1 to CRED-5 | vectors | 22 vectors (5 accepted, 17 rejected, every code except 0001 and 0008, which unit tests cover); `sdk/python/tests/test_credentials.py` runs them |

Vectors: accepted accreditor, operator (COSE_Sign1), observer in a chain of three (JWS), reviewer (JWS) and alerting
authority; rejected for a changed subject (0002), an altered protected header (0002), an unlisted key (0003), a missing
issuer credential (0003), after expiry and before validity (0004), validity longer than the profile allows (0004), an
accreditor, an operator or a trust anchor issuing a type it may not (0005), an observer for another observatory
(0005), a revoked issuer credential (0005), a revoked credential (0006), a missing, expired or altered status list
(0007), and an algorithm the profile does not accept (0009).

Positive fixtures: 7 (five credentials, one status list, one profile). Negative fixtures: 23, one broken rule each:
`participant-credential.subject-email`, `.subject-birth-date`, `.display-name-too-long`, `.no-status`,
`.status-purpose-suspension`, `.no-valid-until`, `.unknown-type`, `.role-mismatch`, `.observer-without-observatory`,
`.accreditor-may-issue-accreditor`, `.alerting-without-register`, `.alerting-without-area`,
`.private-key-in-authorized-key`, `.padded-signature`, `.kid-not-key-uni`, `.unknown-securing-format`,
`.context-not-vc2`; `credential-status-list.purpose-suspension`, `.encoded-list-not-multibase`;
`credential-profile.status-not-fail-closed`, `.no-trust-anchor`, `.claims-without-display-name`,
`.chain-length-zero`. Unit tests: 27 in `sdk/python/tests/test_credentials.py` (RFC 8032 test 1, agreement with an
independent Ed25519 library when installed, RFC 8949 CBOR known answers, status list round trip, the vectors, the
vector documents against their schemas, reuse of the OIP-0008 test keys, both securing formats, codes 0001 and 0008,
the profile's status list lifetime, each invariant passing on the three example sets and failing on one fault, and the generator reproducing every
committed file).

## Standards cited

| Standard | Edition and clause | Used for | Checked |
|---|---|---|---|
| W3C Verifiable Credentials Data Model v2.0 | W3C Recommendation, 2025; `@context`, `type`, `issuer`, `validFrom`, `validUntil`, `credentialSubject`, `credentialStatus`, `credentialSchema` | the credential | not checked |
| W3C Securing Verifiable Credentials using JOSE and COSE (VC-JOSE-COSE) | W3C Recommendation, 2025; media types `vc+jwt`, `application/vc+cose`, content types | securing | not checked |
| W3C Bitstring Status List v1.0 | W3C Recommendation, 2025; `BitstringStatusListEntry`, `BitstringStatusListCredential`, `encodedList` (GZIP, multibase base64url), bit order | revocation | not checked |
| RFC 9052 (COSE structures) | §4.2 COSE_Sign1, §4.4 Sig_structure | COSE securing | not checked |
| RFC 9596 (COSE "typ" header parameter) | label 16 | COSE securing | not checked |
| RFC 7515 (JWS) | §5, Appendix F (detached content) | JWS securing | not checked |
| RFC 8032 (EdDSA) | §5.1, §7.1 test 1 | Ed25519 | test 1 used as a known answer in the unit tests |
| RFC 8037 (OKP keys in JOSE) | §2 | public keys in `authorizedKeys` and trust anchors | not checked |
| RFC 8949 (CBOR) | §4.2.1 deterministic encoding, Appendix A | protected header | Appendix A values used as known answers |
| WMO Register of Alerting Authorities | register as published by WMO | example source register in CRED-7 | not checked |

Relation rows to add to `registers/relations.yaml` on acceptance (left out of the patches so that
`registers/implements-edges.json` stays in step with the other drafts; regenerate it with `python3 tools/build_edges.py`
after adding them):

```yaml
  - { id: EXT-VC2, standard: 'W3C Verifiable Credentials Data Model v2.0', kind: aligns-with, functions: [join, admit], schemas: [participant-credential, credential-status-list] }
  - { id: EXT-VC-JOSE-COSE, standard: 'W3C Securing Verifiable Credentials using JOSE and COSE', kind: aligns-with, schemas: [participant-credential, credential-status-list] }
  - { id: EXT-BITSTRING-STATUS, standard: 'W3C Bitstring Status List v1.0', kind: aligns-with, schemas: [participant-credential, credential-status-list, credential-profile] }
  - { id: EXT-WMO-RAA, standard: 'WMO Register of Alerting Authorities', kind: aligns-with, schemas: [participant-credential] }
```

## Open questions

1. Payload bytes. CRED-5 fixes the payload as the RFC 8785 form of the credential, carried detached. VC-JOSE-COSE
   carries the credential as an attached payload in its own serialization. Should the protocol carry the attached
   form for interoperability with existing VC stacks, keeping RFC 8785 only for the digest?
2. Algorithm names. The JWS header uses the fully specified `Ed25519` and the COSE header -19, following OIP-0008 and
   RFC 9864 as read for that proposal; existing VC stacks may emit `EdDSA` (-8). Accept the polymorphic names?
3. Issuer identifiers are UNIs. Should DIDs (W3C DID Core) be allowed as `issuer` and subject `id`, and how would a
   verifier resolve them offline?
4. Status list size and lifetime. The examples use 131072 entries (the minimum the Bitstring Status List draft
   recommends for privacy, as remembered, `checked: not checked`) and a 30-day list lifetime. Should the protocol fix
   a minimum size and a maximum lifetime?
5. Observer credentials and personal data. A `displayName` chosen by a person may still identify them. Should the
   protocol require that observers be told so, or allow credentials with no display name?
6. Should the issuer rules be a register (`registers/credential-types.yaml`) rather than a table in §3.1?
7. Validity measure. The reference verifier reads `maxValidity` in years, months, weeks and days with a year as 366
   days and a month as 31 days (an upper bound). Should the protocol define the measure?
8. Not checked against the sources: every row of "Standards cited" marked so, including the VC-JOSE-COSE media types
   and the Bitstring Status List bit order. The WMO register entry in the examples is fictitious.

Acceptance needs appointed editors and a last-call window. Until then this proposal stays at DRAFT.
