← Specifications

OCI-WALLET-2 Document Exchange

Version 0.1.0 · 2026-11-30 · Draft Changes
StatusDraft.
Version0.1.0, 2026-11-30
Profile ofNone: an OCI protocol
Depends onOCI-0 Core, OCI-1 Trust Registry, OCI-PAY-2 Payments Switch (§4, OCI-Signature only), OCI-WALLET-1 Documents and Addressing
Used byOCI-WALLET-3 Wallets
Reference implementationociwallet-exchange-api (the exchange), ociwallet-issuer-api (an issuer’s side), ociwallet-api (a wallet’s side)

1. Purpose

In OCI-Wallet a person keeps verified documents (a driving licence, an ID card) in a wallet they choose. The documents come from issuers. Issuers and wallets do not call each other. Each one is registered with one document exchange, and every call between organisations goes through exchanges.

OCI-WALLET-2 says how those calls work. It covers five kinds of traffic:

  1. Hello. A signed connection check between two participants.
  2. Find. A wallet asks an issuer which documents of one type it has issued to the person the wallet has signed in.
  3. Fetch. A wallet asks an issuer for one document, by its URI.
  4. Status. A wallet asks an issuer whether a document is still good.
  5. Push. An issuer sends a document to the wallet address a person gave it.

For each, this spec fixes who may call which path, how the signature is checked, how an exchange finds the issuer or the wallet a call is for, what it passes on unchanged, what it writes in its log, and how failures are answered.

An exchange carries documents and keeps none. It does not open a document, check the issuer’s signature on it, or match a document to a person. Those belong to the issuer and the wallet.

OCI-WALLET-2 does not repeat what other specs define. The document URI, document types, the signed document, document status as a concept, the wallet address, how a document is matched to a person, and the participant kinds are in OCI-WALLET-1. What a wallet does for its person, including what it checks before it keeps a document, is in OCI-WALLET-3. The OCI-Signature header is in OCI-PAY-2 §4.

The reference deployment has one exchange (NDX, exchange:ndx), one issuer (the Transport Department, issuer:transport) and one wallet provider (Satchel, wallet:satchel). This text uses them as its examples.

2. Conventions and terms

The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY and OPTIONAL are to be read as described in RFC 2119 and RFC 8174, and only when they appear in capitals. Every normative clause has an ID such as WEX-3.1.

TermMeaning
ParticipantAn organisation’s service with an entry in the trust registry (OCI-1): an id, a kind, a country, a status, a base_url, a jwks_url and, for a member, a home.
ExchangeA participant of kind doc_exchange. It routes document calls and keeps no document. A country may have one or several.
IssuerA participant of kind doc_issuer. It signs documents and answers for them.
WalletA participant of kind wallet: a wallet provider’s server. It keeps documents for the people who use it.
RequesterA participant of kind doc_requester. In this version it can only say hello (§6).
Home exchangeThe one exchange an issuer, a wallet or a requester is registered with: the home of its registry entry.
MemberAn issuer, a wallet or a requester, as seen from its home exchange.
PeerAnother exchange, as seen from one exchange.
RelationHow the caller of a call stands to the receiver: member, peer or home (§3).
Document URI<issuer>-<TYPE>-<id>, as OCI-WALLET-1 defines it. Example: transport-DRVLC-KA0120230001.
Document typeA five-letter code a country registered, with the issuers accredited for it (OCI-WALLET-1). Example: DRVLC.
Wallet address<handle>@<provider>, as OCI-WALLET-1 defines it. Example: asha@satchel.
PersonIn a find or a fetch: who the wallet has signed in and is asking for.
HopOne call from one exchange to another.

3. Participants and relations

Who may make a call is decided by the caller’s relation to the receiver. The relation is read from the trust registry on every call. A route accepts exactly one relation.

  • WEX-3.1 A receiver MUST work out the caller’s relation from two registry entries: the caller’s (found by the iss of its signature, §4) and its own. It MUST NOT take the relation, the caller’s kind or the caller’s home from the request.
  • WEX-3.2 When the receiver is an exchange, the caller is its member when the caller’s kind is doc_issuer, wallet or doc_requester and the caller’s home equals the exchange’s id.
  • WEX-3.3 When the receiver is an exchange, the caller is its peer when the caller’s kind is doc_exchange. A peer may be in the same country or in another.
  • WEX-3.4 When the receiver is not an exchange, the caller is its home when the caller’s kind is doc_exchange and the receiver’s own home equals the caller’s id.
  • WEX-3.5 In every other case the caller has no relation. A participant has no relation to itself, even with a valid signature.
  • WEX-3.6 A receiver MUST refuse a call whose caller has no relation, or a relation the path does not accept, with 403 FORBIDDEN_PARTICIPANT. The paths and the relation each accepts are:
Served byPathsRelation acceptedFurther limit on the caller
An exchangePOST /v1/hellomembernone: an issuer, a wallet or a requester
An exchangePOST /v1/find, /v1/fetch, /v1/statusmemberkind wallet only (WEX-3.7)
An exchangePOST /v1/pushmemberkind doc_issuer only (WEX-3.8)
An exchangePOST /peer/v1/hello, /peer/v1/find, /peer/v1/fetch, /peer/v1/status, /peer/v1/pushpeernone
An issuerPOST /exchange/v1/hello, /exchange/v1/find, /exchange/v1/fetch, /exchange/v1/statushomenone
A walletPOST /exchange/v1/hello, /exchange/v1/pushhomenone
  • WEX-3.7 An exchange MUST refuse /v1/find, /v1/fetch and /v1/status from a member that is not a wallet, with 403 FORBIDDEN_PARTICIPANT.
  • WEX-3.8 An exchange MUST refuse /v1/push from a member that is not an issuer, with 403 FORBIDDEN_PARTICIPANT.
  • WEX-3.9 An issuer or a wallet MUST accept calls only from its home exchange. A call from another exchange, from another member of the same exchange, or from any other participant MUST be refused under WEX-3.6. Anything from elsewhere reaches it through its home exchange.
  • WEX-3.10 An issuer or a wallet MUST send its document calls only to its home exchange, at /v1/*. When its registry entry names no home, or the home is not an active participant of kind doc_exchange, it MUST make no call.
  • WEX-3.11 The relation follows the registry. When a member’s home changes to another exchange, the old exchange MUST refuse it and the new one MUST serve it, with no other step. A receiver MAY act on a cached copy of the registry (WEX-4.9), so a change can take that long to show.

4. The signature

Every call in this spec is signed with OCI-Signature, as OCI-PAY-2 §4 defines it: a compact JWS with detached content over the exact body bytes, alg EdDSA, a protected header with alg, kid, iss, iat, htm and htu, a 120-second window on iat, and keys taken only from the sender’s registry entry. This section states only what differs here, and the codes a receiver answers.

  • WEX-4.1 Every call to a path in WEX-3.6 MUST carry an OCI-Signature header and MUST be verified as OCI-PAY-2 §4 requires, with the differences in WEX-4.2 to WEX-4.9. Only GET /health and GET /.well-known/jwks.json are served without one.
  • WEX-4.2 iss MUST be the sender’s participant id in the trust registry. The ids of this family (exchange:<name>, issuer:<name>, wallet:<name>) are defined in OCI-WALLET-1. An exchange’s id does not carry its country, unlike a payments switch’s.
  • WEX-4.3 htu MUST equal the base_url the trust registry lists for the receiver, without a trailing slash, followed by the request path, with no query string. The receiver MUST compare it as an exact string with its own registry base_url plus the path it received. A receiver uses a configured address only when its registry entry lists none. (OCI-PAY-4 compares against a configured address.)
  • WEX-4.4 A receiver MUST itself be an active participant in the trust registry. When it is not registered or is suspended, it MUST refuse every signed call with 503 NOT_REGISTERED.
  • WEX-4.5 A receiver MUST take the sender’s keys from the jwks_url of the sender’s registry entry. This version does not use keys held inline in the registry.
  • WEX-4.6 A receiver MUST make the checks in this order and answer the first that fails:
#CheckAnswer when it fails
1The header is present401 SIGNATURE_MISSING
2It has three parts with an empty middle part; the protected header decodes; iss and kid are strings and iat is an integer; alg is EdDSA401 SIGNATURE_INVALID
3iat is within 120 seconds of the receiver’s clock401 SIGNATURE_EXPIRED
4The receiver is an active participant (WEX-4.4)503 NOT_REGISTERED
5htm is the request method and htu is as WEX-4.3 requires401 SIGNATURE_INVALID
6iss is an active participant401 UNKNOWN_PARTICIPANT
7A key from the sender’s jwks_url verifies the signature over the body bytes401 SIGNATURE_INVALID
8The caller’s relation (WEX-3.1 to WEX-3.6)403 FORBIDDEN_PARTICIPANT
9The body (WEX-5.3)422 VALIDATION_ERROR
10Where the path is for one kind of member only (WEX-3.7, WEX-3.8), the member’s kind403 FORBIDDEN_PARTICIPANT
  • WEX-4.7 The signature and the relation MUST be checked before the body is parsed. A caller with no relation the path accepts is told 403, never what was wrong with its body. A member of the wrong kind for a path is told 403 once its body is well formed.
  • WEX-4.8 When the trust registry or the sender’s key set cannot be fetched, the receiver MUST refuse the call with 502 TRUST_REGISTRY_UNAVAILABLE. It MUST NOT accept the call.
  • WEX-4.9 A receiver MAY cache the registry’s participant list and its document types. The reference caches each for 60 seconds, and a sender’s key set for 300 seconds with the single refetch OCI-PAY-2 §4 describes (at most once every 30 seconds per sender).
  • WEX-4.10 A signature covers one hop. An exchange that passes a call on MUST sign the new call with its own key, as its own iss, for the next receiver’s htu. It MUST NOT pass on the signature it received.
  • WEX-4.11 There is no Idempotency-Key in this version. Find, fetch and status change nothing. A repeated push is handled as §14 says.
  • WEX-4.12 Answers are not signed, as in OCI-PAY-2 §4. A document in an answer carries its issuer’s own signature (OCI-WALLET-1), which does not depend on the path it took.

5. Common rules

  • WEX-5.1 Every call is POST with a JSON body, sent server to server.
  • WEX-5.2 Every error MUST use the body {"error": {"code": "<CODE>", "message": "<one sentence>"}} with the matching HTTP status, as OCI-PAY-2 does. Callers branch on code. The codes are listed in §15.
  • WEX-5.3 A body that is not JSON, or does not match the call’s shape, MUST be refused with 422 VALIDATION_ERROR. For find, fetch, status and push, a member the call does not define MUST be refused the same way: nothing unknown is passed on.
  • WEX-5.4 A document type on the wire is five capital letters (^[A-Z]{5}$). A document URI matches ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$ and is at most 100 characters. An issuer id in a find matches ^issuer:[a-z0-9][a-z0-9._]{0,62}$. A wallet address matches ^[a-z0-9][a-z0-9._-]{0,62}@[a-z0-9][a-z0-9._-]{0,62}$ and is at most 127 characters. What each part means is in OCI-WALLET-1.
  • WEX-5.5 A document’s status on the wire is one of active, suspended, revoked.
  • WEX-5.6 person is an object with name (REQUIRED, 1 to 120 characters) and national_id (OPTIONAL, 1 to 40 characters), and no other member. It says who the wallet has signed in. A wallet sends national_id only for a person who has connected their national identity (OCI-WALLET-3). How an issuer uses the two to decide whose a document is, is the matching rule of OCI-WALLET-1.

6. Hello

Hello is the connection check. It proves that a call signed by one participant reaches the other, and that the other sees it in the expected relation. Each of the three doors has one.

  • WEX-6.1 The request MUST carry nonce: 8 to 64 characters from A-Z a-z 0-9 _ -. The caller SHOULD use a fresh random value each time.
  • WEX-6.2 The receiver MUST answer 200 with nonce (the value it was sent), you (the caller’s participant id, as the signature proved it), relation (the caller’s relation: member, peer or home), me (the receiver’s own participant id) and at (the receiver’s time, RFC 3339).
  • WEX-6.3 A caller MUST treat a hello as passed only when nonce is the one it sent, you is its own id, me is the participant it meant to reach, and relation is the one it expects: member from its home exchange, peer from another exchange, home from a member.
  • WEX-6.4 An exchange MUST log a hello it answers (§13), with no issuer and no document type.
POST /v1/hello Check the connection to the home exchange · served by an exchange

A signed hello. The exchange answers who it saw and in what relation. Called by an issuer, a wallet or a requester, at its home exchange. Defined in WEX-3.2, WEX-6.1, WEX-6.2, WEX-6.3, WEX-6.4.

RequestTypeRequiredMeaningClause
noncestringyesAny fresh value. It comes back in the answer, which shows the body arrived as signed. (pattern ^[A-Za-z0-9_-]+$; at most 64 characters; at least 8)WEX-6.1
ResponseTypeRequiredMeaningClause
noncestringyesThe nonce the caller sent.WEX-6.2
youstringyesThe caller's participant id, as its signature proved it.WEX-6.2
relation"member" | "peer" | "home"yesHow the caller stands to the receiver.WEX-6.2
mestringyesThe receiver's own participant id.WEX-6.2
atstring, date-timeyesThe receiver's time.WEX-6.2

Errors

A member checks the connection to its home exchange. This is the only call a requester can make in this version.

POST /peer/v1/hello Check the connection between two exchanges · served by an exchange

A signed hello from one exchange to another. Called by Another exchange. Defined in WEX-3.3, WEX-6.1, WEX-6.2, WEX-6.3, WEX-6.4.

RequestTypeRequiredMeaningClause
noncestringyesAny fresh value. It comes back in the answer, which shows the body arrived as signed. (pattern ^[A-Za-z0-9_-]+$; at most 64 characters; at least 8)WEX-6.1
ResponseTypeRequiredMeaningClause
noncestringyesThe nonce the caller sent.WEX-6.2
youstringyesThe caller's participant id, as its signature proved it.WEX-6.2
relation"member" | "peer" | "home"yesHow the caller stands to the receiver.WEX-6.2
mestringyesThe receiver's own participant id.WEX-6.2
atstring, date-timeyesThe receiver's time.WEX-6.2

Errors

One exchange checks the connection to another.

POST /exchange/v1/hello Check the connection from the home exchange to an issuer · served by an issuer

A signed hello from an exchange to one of its member issuers. Called by the issuer's home exchange. Defined in WEX-3.4, WEX-3.9, WEX-6.1, WEX-6.2, WEX-6.3.

RequestTypeRequiredMeaningClause
noncestringyesAny fresh value. It comes back in the answer, which shows the body arrived as signed. (pattern ^[A-Za-z0-9_-]+$; at most 64 characters; at least 8)WEX-6.1
ResponseTypeRequiredMeaningClause
noncestringyesThe nonce the caller sent.WEX-6.2
youstringyesThe caller's participant id, as its signature proved it.WEX-6.2
relation"member" | "peer" | "home"yesHow the caller stands to the receiver.WEX-6.2
mestringyesThe receiver's own participant id.WEX-6.2
atstring, date-timeyesThe receiver's time.WEX-6.2

Errors

POST /exchange/v1/hello Check the connection from the home exchange to a wallet · served by a wallet

A signed hello from an exchange to one of its member wallets. Called by the wallet's home exchange. Defined in WEX-3.4, WEX-3.9, WEX-6.1, WEX-6.2, WEX-6.3.

RequestTypeRequiredMeaningClause
noncestringyesAny fresh value. It comes back in the answer, which shows the body arrived as signed. (pattern ^[A-Za-z0-9_-]+$; at most 64 characters; at least 8)WEX-6.1
ResponseTypeRequiredMeaningClause
noncestringyesThe nonce the caller sent.WEX-6.2
youstringyesThe caller's participant id, as its signature proved it.WEX-6.2
relation"member" | "peer" | "home"yesHow the caller stands to the receiver.WEX-6.2
mestringyesThe receiver's own participant id.WEX-6.2
atstring, date-timeyesThe receiver's time.WEX-6.2

Errors

An exchange checks the connection to one of its members. An issuer and a wallet serve the same call.

7. Routing a call to its issuer

Find, fetch and status are each for one issuer. This section is the rule that takes them there. It is the same at /v1/* and at /peer/v1/*, except for the last step.

  • WEX-7.1 The exchange takes the issuer and the document type from the request. For a find they are issuer and doc_type. For a fetch or a status they are read from the URI: the issuer’s participant id is issuer: followed by the URI’s first part, and the type is its second part (OCI-WALLET-1).
  • WEX-7.2 The issuer MUST be an active participant of kind doc_issuer. If not, the exchange MUST answer 404 ISSUER_NOT_FOUND and call nobody.
  • WEX-7.3 The issuer MUST be accredited for the document type in the issuer’s own country, as the trust registry lists it (OCI-WALLET-1). If not, the exchange MUST answer 403 ISSUER_NOT_ACCREDITED and call nobody. This covers a type that does not exist, a type that is another issuer’s, and a type of another country.
  • WEX-7.4 When the issuer’s home is this exchange, the exchange MUST call the issuer directly at /exchange/v1/find, /exchange/v1/fetch or /exchange/v1/status.
  • WEX-7.5 When the issuer’s home is another exchange and the call came from a member, the exchange MUST send it to that exchange at /peer/v1/find, /peer/v1/fetch or /peer/v1/status. That exchange MUST be an active participant of kind doc_exchange. If the issuer has no home, or its home is not one, the exchange MUST answer 502 ISSUER_UNREACHABLE.
  • WEX-7.6 The one-hop rule. When the issuer’s home is another exchange and the call came from a peer, the exchange MUST answer 404 ISSUER_NOT_HERE and call nobody. A call that arrives from a peer is only ever for a member. No call crosses more than one hop between exchanges.
  • WEX-7.7 The exchange that receives a call from a peer MUST make the checks of WEX-7.2 and WEX-7.3 itself. It does not rely on the first exchange having made them.
  • WEX-7.8 The exchange MUST find the issuer, its home and its address in the trust registry on each call. It MUST NOT keep its own list of issuers.

7.1 What is passed on

  • WEX-7.9 The exchange MUST pass the request on with the same members and values it received, and add nothing. To a peer it sends the whole body. To a member issuer it sends the whole body, except that a find is sent without issuer: an issuer is not told its own name. The bytes are the exchange’s own serialisation, signed again (WEX-4.10).
  • WEX-7.10 person.national_id MUST be passed on when the wallet sent one, and MUST NOT appear when the wallet sent none or sent null. An exchange never adds, fills in or changes anything about a person.
  • WEX-7.11 When the next receiver answers with status 200, 403, 404, 410 or 422 and a JSON body, the exchange MUST answer its caller with the same status and the same JSON, unchanged. This holds for a success and for a refusal, and for an answer from a member issuer and from a peer alike. Members the exchange does not know MUST be passed back too.
  • WEX-7.12 Any other outcome is the route’s failure, not the caller’s fault: another status (including 401, 500, 502 and 503), an answer that is not JSON, a timeout or a failed connection. The exchange MUST answer 502 ISSUER_UNAVAILABLE. It MUST NOT pass on the body of such an answer.
  • WEX-7.13 The exchange MUST NOT read a passed-back answer for meaning. It does not check that a found URI belongs to the issuer asked, that a fetched document is the one asked for, or that a document’s signature is good. The wallet makes those checks (OCI-WALLET-3, on finding and keeping a document).

8. Find

A wallet asks which documents of one type an issuer has issued to the person it has signed in.

POST /v1/find Find a person's documents of one type at an issuer · served by an exchange

The exchange routes the call to the issuer and passes the issuer's answer back unchanged. Called by a wallet, at its home exchange. Defined in WEX-3.7, WEX-8.1, WEX-8.2, WEX-8.3, WEX-7.11, WEX-8.10.

RequestTypeRequiredMeaningClause
issuerstringyesThe issuer to ask, as its participant id (issuer:transport). (pattern ^issuer:[a-z0-9][a-z0-9._]{0,62}$)WEX-8.1
doc_typestringyesThe document type, as the issuer's country registered it (DRVLC). (pattern ^[A-Z]{5}$)WEX-5.4
searchobjectyesThe type's search fields and the person's answers. The fields are declared per document type (OCI-WALLET-1). May be empty only when person.national_id is present (WEX-8.10).WEX-8.1
personobjectyesWho the wallet has signed in and is asking for. An issuer answers only for documents issued to them. An exchange passes it on and keeps none of it.WEX-5.6
person.namestringyesThe person's name, as the wallet's identity gives it. (at most 120 characters; at least 1)WEX-5.6
person.national_idstring, nullThe person's number in the country's identity system. Sent only when the person has connected their national identity to the wallet. An exchange passes it on only when it was sent. (at most 40 characters; at least 1)WEX-7.10
ResponseTypeRequiredMeaningClause
documentsarray of objectyesThe documents of this type issued to the person that match every search field given and are not revoked. Empty when there are none.WEX-8.8
documents[].uristringyesThe document's URI.WEX-8.9
documents[].doc_typestringyesThe document type.WEX-8.9
documents[].namestringyesThe document type's name (Driving Licence).WEX-8.9
documents[].issued_onstring, dateyesThe day the document was issued.WEX-8.9
documents[].expires_onstring, null, dateyesThe day the document expires, or null when it does not.WEX-8.9
documents[].status"active" | "suspended"yesHow the document stands today. A revoked document is not listed.WEX-8.9

Errors

  • WEX-8.1 The request MUST carry issuer (the issuer’s participant id), doc_type, search and person (WEX-5.6). search is an object of at most 10 members, each a string: the type’s search fields and the person’s answers (search fields are defined per document type in OCI-WALLET-1).
  • WEX-8.2 A wallet MUST set person from its own record of who is signed in. A find without person MUST be refused (422 VALIDATION_ERROR).
  • WEX-8.3 The exchange MUST route the call as §7 says and answer as WEX-7.11 and WEX-7.12 say.
POST /peer/v1/find Find documents at an issuer that is a member here · served by an exchange

The same call, one hop on. It is delivered only to a member issuer. Called by Another exchange, for one of its member wallets. Defined in WEX-8.4, WEX-7.6, WEX-7.7, WEX-8.10.

RequestTypeRequiredMeaningClause
issuerstringyesThe issuer to ask, as its participant id (issuer:transport). (pattern ^issuer:[a-z0-9][a-z0-9._]{0,62}$)WEX-8.1
doc_typestringyesThe document type, as the issuer's country registered it (DRVLC). (pattern ^[A-Z]{5}$)WEX-5.4
searchobjectyesThe type's search fields and the person's answers. The fields are declared per document type (OCI-WALLET-1). May be empty only when person.national_id is present (WEX-8.10).WEX-8.1
personobjectyesWho the wallet has signed in and is asking for. An issuer answers only for documents issued to them. An exchange passes it on and keeps none of it.WEX-5.6
person.namestringyesThe person's name, as the wallet's identity gives it. (at most 120 characters; at least 1)WEX-5.6
person.national_idstring, nullThe person's number in the country's identity system. Sent only when the person has connected their national identity to the wallet. An exchange passes it on only when it was sent. (at most 40 characters; at least 1)WEX-7.10
ResponseTypeRequiredMeaningClause
documentsarray of objectyesThe documents of this type issued to the person that match every search field given and are not revoked. Empty when there are none.WEX-8.8
documents[].uristringyesThe document's URI.WEX-8.9
documents[].doc_typestringyesThe document type.WEX-8.9
documents[].namestringyesThe document type's name (Driving Licence).WEX-8.9
documents[].issued_onstring, dateyesThe day the document was issued.WEX-8.9
documents[].expires_onstring, null, dateyesThe day the document expires, or null when it does not.WEX-8.9
documents[].status"active" | "suspended"yesHow the document stands today. A revoked document is not listed.WEX-8.9

Errors

  • WEX-8.4 The request and the answer are those of /v1/find, with issuer kept. The receiving exchange MUST deliver it only to a member issuer (WEX-7.6).
POST /exchange/v1/find Find the documents issued to a person · served by an issuer

The issuer answers with the documents of one type issued to the person that match every search field given. Called by the issuer's home exchange. Defined in WEX-8.5, WEX-8.6, WEX-8.7, WEX-8.8, WEX-8.9, WEX-8.10.

RequestTypeRequiredMeaningClause
doc_typestringyesThe document type, as the issuer's country registered it (DRVLC). (pattern ^[A-Z]{5}$)WEX-5.4
searchobjectyesThe type's search fields and the person's answers. The fields are declared per document type (OCI-WALLET-1). May be empty only when person.national_id is present (WEX-8.10).WEX-8.1
personobjectyesWho the wallet has signed in and is asking for. An issuer answers only for documents issued to them. An exchange passes it on and keeps none of it.WEX-5.6
person.namestringyesThe person's name, as the wallet's identity gives it. (at most 120 characters; at least 1)WEX-5.6
person.national_idstring, nullThe person's number in the country's identity system. Sent only when the person has connected their national identity to the wallet. An exchange passes it on only when it was sent. (at most 40 characters; at least 1)WEX-7.10
ResponseTypeRequiredMeaningClause
documentsarray of objectyesThe documents of this type issued to the person that match every search field given and are not revoked. Empty when there are none.WEX-8.8
documents[].uristringyesThe document's URI.WEX-8.9
documents[].doc_typestringyesThe document type.WEX-8.9
documents[].namestringyesThe document type's name (Driving Licence).WEX-8.9
documents[].issued_onstring, dateyesThe day the document was issued.WEX-8.9
documents[].expires_onstring, null, dateyesThe day the document expires, or null when it does not.WEX-8.9
documents[].status"active" | "suspended"yesHow the document stands today. A revoked document is not listed.WEX-8.9

Errors

  • WEX-8.5 The request carries doc_type, search and person, and no issuer.
  • WEX-8.6 The issuer MUST be accredited for doc_type in the trust registry at the time of the call. If it is not, it MUST answer 403 NOT_ACCREDITED.
  • WEX-8.7 The issuer MUST refuse a search member that the type does not declare (422 UNKNOWN_SEARCH_FIELD), and a find that leaves out, or leaves blank, a search field the type marks as required (422 SEARCH_FIELD_MISSING).
  • WEX-8.8 The issuer MUST answer 200 with documents: the documents of that type that were issued to person (the matching rule of OCI-WALLET-1), that match every search field given, and that are not revoked. When there are none it answers 200 with an empty list, never an error. A wrong search value and a document issued to someone else look the same to the caller.
  • WEX-8.9 Each entry MUST carry uri, doc_type, name (the document type’s name), issued_on (a date), expires_on (a date or null) and status (active or suspended). It MUST NOT carry the document itself, its number or anything about the person.
  • WEX-8.10 search MAY be empty ({}) when, and only when, person.national_id is present: the person is asking by their national ID number alone (OCI-WALLET-1 WDOC-4.14). An exchange MUST pass an empty search on like any other, and MUST NOT add to it. An issuer answers it as WDOC-4.14 requires, and refuses an empty search without a person.national_id with 422 SEARCH_FIELD_MISSING.

9. Fetch

A wallet asks for one document by its URI.

POST /v1/fetch Fetch a document by its URI · served by an exchange

The exchange routes the call by the URI and passes the issuer's answer back unchanged. Called by a wallet, at its home exchange. Defined in WEX-3.7, WEX-9.1, WEX-9.2, WEX-7.11.

RequestTypeRequiredMeaningClause
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-5.4
personobjectyesWho the wallet has signed in and is asking for. An issuer answers only for documents issued to them. An exchange passes it on and keeps none of it.WEX-5.6
person.namestringyesThe person's name, as the wallet's identity gives it. (at most 120 characters; at least 1)WEX-5.6
person.national_idstring, nullThe person's number in the country's identity system. Sent only when the person has connected their national identity to the wallet. An exchange passes it on only when it was sent. (at most 40 characters; at least 1)WEX-7.10
ResponseTypeRequiredMeaningClause
uristringyesThe URI asked for.WEX-9.7
status"active" | "suspended"yesHow the document stands today. A revoked document is refused, not sent.WEX-9.7
documentstringyesThe signed document: a compact JWS signed by the issuer, exactly as it was signed. Defined in OCI-WALLET-1.WEX-9.7
pdfstring, nullyesThe printable copy, base64, or null when there is none.WEX-9.7

Errors

  • WEX-9.1 The request MUST carry uri and person (WEX-5.6). A fetch without person MUST be refused (422 VALIDATION_ERROR). A URI is not a secret: knowing one is not enough to read the document.
  • WEX-9.2 The exchange MUST route the call by the URI as §7 says and answer as WEX-7.11 and WEX-7.12 say.
POST /peer/v1/fetch Fetch a document from an issuer that is a member here · served by an exchange

The same call, one hop on. It is delivered only to a member issuer. Called by Another exchange, for one of its member wallets. Defined in WEX-9.3, WEX-7.6, WEX-7.7.

RequestTypeRequiredMeaningClause
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-5.4
personobjectyesWho the wallet has signed in and is asking for. An issuer answers only for documents issued to them. An exchange passes it on and keeps none of it.WEX-5.6
person.namestringyesThe person's name, as the wallet's identity gives it. (at most 120 characters; at least 1)WEX-5.6
person.national_idstring, nullThe person's number in the country's identity system. Sent only when the person has connected their national identity to the wallet. An exchange passes it on only when it was sent. (at most 40 characters; at least 1)WEX-7.10
ResponseTypeRequiredMeaningClause
uristringyesThe URI asked for.WEX-9.7
status"active" | "suspended"yesHow the document stands today. A revoked document is refused, not sent.WEX-9.7
documentstringyesThe signed document: a compact JWS signed by the issuer, exactly as it was signed. Defined in OCI-WALLET-1.WEX-9.7
pdfstring, nullyesThe printable copy, base64, or null when there is none.WEX-9.7

Errors

  • WEX-9.3 The request and the answer are those of /v1/fetch. The receiving exchange MUST deliver it only to a member issuer (WEX-7.6).
POST /exchange/v1/fetch Send a document to the person it was issued to · served by an issuer

The issuer answers with the signed document and its printable copy, only for the person it was issued to. Called by the issuer's home exchange. Defined in WEX-9.4, WEX-9.5, WEX-9.6, WEX-9.7.

RequestTypeRequiredMeaningClause
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-5.4
personobjectyesWho the wallet has signed in and is asking for. An issuer answers only for documents issued to them. An exchange passes it on and keeps none of it.WEX-5.6
person.namestringyesThe person's name, as the wallet's identity gives it. (at most 120 characters; at least 1)WEX-5.6
person.national_idstring, nullThe person's number in the country's identity system. Sent only when the person has connected their national identity to the wallet. An exchange passes it on only when it was sent. (at most 40 characters; at least 1)WEX-7.10
ResponseTypeRequiredMeaningClause
uristringyesThe URI asked for.WEX-9.7
status"active" | "suspended"yesHow the document stands today. A revoked document is refused, not sent.WEX-9.7
documentstringyesThe signed document: a compact JWS signed by the issuer, exactly as it was signed. Defined in OCI-WALLET-1.WEX-9.7
pdfstring, nullyesThe printable copy, base64, or null when there is none.WEX-9.7

Errors

  • WEX-9.4 The issuer MUST answer 404 DOCUMENT_NOT_FOUND when the URI names another issuer, when it has no such document, and when the document was not issued to person (the matching rule of OCI-WALLET-1). The three cases MUST be answered alike.
  • WEX-9.5 The issuer MUST answer 403 NOT_ACCREDITED when it is no longer accredited for the URI’s document type.
  • WEX-9.6 The issuer MUST answer 410 DOCUMENT_REVOKED for a revoked document, and MUST NOT send it.
  • WEX-9.7 Otherwise the issuer MUST answer 200 with uri (as asked), status (active or suspended), document (the signed document, a compact JWS as OCI-WALLET-1 defines it, exactly as it was signed) and pdf (the printable copy, base64, or null when there is none). A suspended document is sent, with its status.

10. Status

A wallet asks whether a document is still good. The signed document carries no status, so status is always asked of the issuer.

POST /v1/status Ask whether a document is still good · served by an exchange

The exchange routes the call by the URI and passes the issuer's answer back unchanged. The call names no person. Called by a wallet, at its home exchange. Defined in WEX-3.7, WEX-10.1, WEX-10.2, WEX-7.11.

RequestTypeRequiredMeaningClause
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-5.4
ResponseTypeRequiredMeaningClause
uristringyesThe URI asked for.WEX-10.4
status"active" | "suspended" | "revoked"yesHow the document stands today.WEX-10.4

Errors

  • WEX-10.1 The request MUST carry uri and nothing else. It carries no person: the answer says nothing about anyone. A status call that carries person MUST be refused (422 VALIDATION_ERROR).
  • WEX-10.2 The exchange MUST route the call by the URI as §7 says and answer as WEX-7.11 and WEX-7.12 say.
POST /peer/v1/status Ask an issuer that is a member here how a document stands · served by an exchange

The same call, one hop on. It is delivered only to a member issuer. Called by Another exchange, for one of its member wallets. Defined in WEX-10.3, WEX-7.6, WEX-7.7.

RequestTypeRequiredMeaningClause
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-5.4
ResponseTypeRequiredMeaningClause
uristringyesThe URI asked for.WEX-10.4
status"active" | "suspended" | "revoked"yesHow the document stands today.WEX-10.4

Errors

  • WEX-10.3 The request and the answer are those of /v1/status. The receiving exchange MUST deliver it only to a member issuer (WEX-7.6).
POST /exchange/v1/status Say how a document stands today · served by an issuer

The issuer answers active, suspended or revoked. Called by the issuer's home exchange. Defined in WEX-10.4, WEX-10.5.

RequestTypeRequiredMeaningClause
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-5.4
ResponseTypeRequiredMeaningClause
uristringyesThe URI asked for.WEX-10.4
status"active" | "suspended" | "revoked"yesHow the document stands today.WEX-10.4

Errors

  • WEX-10.4 The issuer MUST answer 200 with uri and status: active, suspended or revoked. A revoked document is answered 200 with revoked, not 410.
  • WEX-10.5 The issuer MUST answer 404 DOCUMENT_NOT_FOUND when the URI names another issuer or it has no such document, and 403 NOT_ACCREDITED when it is no longer accredited for the URI’s type.

11. Push

An issuer sends a document to the wallet address a person gave it. A push travels the other way from a fetch, by the same rules: the home exchange first, one hop at most, then the wallet.

POST /v1/push Send a document to a person's wallet address · served by an exchange

The exchange checks who may send what, finds the wallet from the address and delivers the document. It keeps nothing. Called by an issuer, at its home exchange. Defined in WEX-3.8, WEX-11.1, WEX-11.2, WEX-11.3, WEX-11.4, WEX-11.5, WEX-11.6, WEX-11.7, WEX-11.9, WEX-11.10, WEX-11.11.

RequestTypeRequiredMeaningClause
tostringyesThe person's wallet address: <handle>@<provider> (asha@satchel). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._-]{0,62}@[a-z0-9][a-z0-9._-]{0,62}$; at most 127 characters)WEX-11.1
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-11.1
documentstringyesThe signed document: a compact JWS signed by the issuer. The exchange does not open it. (at most 200000 characters; at least 1)WEX-11.1
pdfstring, nullThe printable copy, base64, or null when there is none. (at most 20000000 characters)WEX-11.1
ResponseTypeRequiredMeaningClause
uristringyesThe URI that was pushed.WEX-11.9
tostringyesThe wallet address it was pushed to.WEX-11.9
walletstringyesThe participant id of the wallet provider that took the document (wallet:satchel).WEX-11.9

Errors

  • WEX-11.1 The request MUST carry to (a wallet address), uri, document (the signed document, 1 to 200,000 characters) and MAY carry pdf (the printable copy, base64, at most 20,000,000 characters, or null).
  • WEX-11.2 An issuer pushes only what it issued. The exchange MUST check that the URI’s issuer is the caller. If not, it MUST answer 403 NOT_YOUR_DOCUMENT.
  • WEX-11.3 The exchange MUST check that the issuer is accredited for the URI’s document type, as in WEX-7.3. If not, it MUST answer 403 ISSUER_NOT_ACCREDITED.
  • WEX-11.4 The exchange MUST find the wallet from the address alone: the participant id is wallet: followed by the part after the last @ (OCI-WALLET-1, the wallet address). That participant MUST be active and of kind wallet. If not, the exchange MUST answer 404 WALLET_NOT_FOUND. The exchange does not know, and MUST NOT try to learn, whether the handle exists.
  • WEX-11.5 When the wallet’s home is this exchange, the exchange MUST call the wallet at /exchange/v1/push.
  • WEX-11.6 When the wallet’s home is another exchange and the call came from a member, the exchange MUST send it to that exchange at /peer/v1/push. That exchange MUST be an active participant of kind doc_exchange. If the wallet has no home, or its home is not one, the exchange MUST answer 502 WALLET_UNREACHABLE.
  • WEX-11.7 The exchange MUST pass on to, uri, document and pdf with the values it received, pdf as null when the issuer sent none, and add nothing.
  • WEX-11.8 The exchange MUST NOT open the document. It does not check the issuer’s signature on it, that it is the document the URI names, or who it was issued to. The wallet does (OCI-WALLET-3, on taking a pushed document).
  • WEX-11.9 When the next receiver answers 200 with a JSON body, the exchange MUST answer 200 with uri and to as it received them and wallet: the wallet’s participant id, as it worked it out under WEX-11.4. This answer is the exchange’s own. It is not the wallet’s answer passed back.
  • WEX-11.10 When the next receiver answers 403, 404, 409, 410 or 422 with an error body (WEX-5.2), the exchange MUST answer its caller with the same status, code and message. The refusal is the issuer’s to hear.
  • WEX-11.11 Any other outcome is unknown (§14): another status, a 200 that is not JSON, one of the statuses of WEX-11.10 without an error body, a timeout or a failed connection. The exchange MUST answer 502 WALLET_UNAVAILABLE.
POST /peer/v1/push Deliver a document to a wallet that is a member here · served by an exchange

The same call, one hop on. It is taken only for the calling exchange's own issuers and delivered only to a member wallet. Called by Another exchange, for one of its member issuers. Defined in WEX-11.12, WEX-11.13, WEX-11.14, WEX-11.15.

RequestTypeRequiredMeaningClause
tostringyesThe person's wallet address: <handle>@<provider> (asha@satchel). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._-]{0,62}@[a-z0-9][a-z0-9._-]{0,62}$; at most 127 characters)WEX-11.1
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-11.1
documentstringyesThe signed document: a compact JWS signed by the issuer. The exchange does not open it. (at most 200000 characters; at least 1)WEX-11.1
pdfstring, nullThe printable copy, base64, or null when there is none. (at most 20000000 characters)WEX-11.1
ResponseTypeRequiredMeaningClause
uristringyesThe URI that was pushed.WEX-11.9
tostringyesThe wallet address it was pushed to.WEX-11.9
walletstringyesThe participant id of the wallet provider that took the document (wallet:satchel).WEX-11.9

Errors

  • WEX-11.12 The request and the answer are those of /v1/push.
  • WEX-11.13 An exchange forwards a push only for its own issuers. The receiving exchange MUST check that the URI’s issuer is in the trust registry and that its home is the calling exchange. If not, it MUST answer 403 ISSUER_NOT_YOURS.
  • WEX-11.14 The receiving exchange MUST then make the checks of WEX-11.3 and WEX-11.4 itself, and MUST answer 404 ISSUER_NOT_FOUND when the URI’s issuer is not an active participant of kind doc_issuer.
  • WEX-11.15 The one-hop rule. The receiving exchange MUST deliver the push only to a member wallet. When the wallet’s home is another exchange, it MUST answer 404 WALLET_NOT_HERE and call nobody.
POST /exchange/v1/push Take a document an issuer is sending to one of this wallet's addresses · served by a wallet

The wallet checks the document and keeps it for the person the address is. What it checks is OCI-WALLET-3. Called by the wallet's home exchange. Defined in WEX-11.16, WEX-11.17, WEX-11.18.

RequestTypeRequiredMeaningClause
tostringyesThe person's wallet address: <handle>@<provider> (asha@satchel). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._-]{0,62}@[a-z0-9][a-z0-9._-]{0,62}$; at most 127 characters)WEX-11.1
uristringyesThe document's URI: <issuer>-<TYPE>-<id> (transport-DRVLC-KA0120230001). Defined in OCI-WALLET-1. (pattern ^[a-z0-9][a-z0-9._]{0,62}-[A-Z]{5}-[A-Za-z0-9]{1,20}$; at most 100 characters)WEX-11.1
documentstringyesThe signed document: a compact JWS signed by the issuer. The exchange does not open it. (at most 200000 characters; at least 1)WEX-11.1
pdfstring, nullThe printable copy, base64, or null when there is none. (at most 20000000 characters)WEX-11.1
ResponseTypeRequiredMeaningClause
uristringyesThe URI that was pushed.WEX-11.17
tostringyesThe wallet address it was pushed to.WEX-11.17
walletstringyesThe participant id of the wallet provider that took the document (wallet:satchel).WEX-11.17

Errors

  • WEX-11.16 The request is that of /v1/push. The wallet MUST accept it only from its home exchange (WEX-3.9).
  • WEX-11.17 On success the wallet MUST answer 200 with uri and to as it received them and wallet: its own participant id.
  • WEX-11.18 The wallet’s refusals on this call are 404 NO_SUCH_ADDRESS (the address is not at this provider, or nobody here has that handle), 422 DOCUMENT_NOT_GENUINE (the document does not check out), 403 NOT_THEIR_DOCUMENT (it was issued to someone else) and 410 DOCUMENT_EXPIRED. When each applies, and what the wallet does with a document it takes, is OCI-WALLET-3 (taking a pushed document). This spec fixes only that these are the codes on the wire and that they reach the issuer unchanged (WEX-11.10).
  • WEX-11.19 An issuer MUST treat a push as delivered only on a 200 whose body carries wallet. It SHOULD record the URI, the address and that wallet id as the delivery.

12. What an exchange never keeps

  • WEX-12.1 An exchange MUST NOT store a document, a printable copy, a document URI, a search value, a person’s name, a national ID number or a wallet address. They pass through memory for the length of one call.
  • WEX-12.2 An exchange MUST NOT store any part of an answer it passes back.
  • WEX-12.3 The only record an exchange keeps of a call is its log entry (§13).
  • WEX-12.4 An exchange MUST NOT put a URI’s id part, a search value, a person’s name or number, or a wallet address’s handle into an error it writes itself. The reference names only participant ids and document types in its own messages.

13. The log

  • WEX-13.1 An exchange MUST log every call it accepts at /v1/* and /peer/v1/*: one entry per call, written before the call is routed, so a call the route then fails is still in the log.
  • WEX-13.2 An entry MUST hold exactly: the caller’s participant id, the caller’s relation (member or peer), the method, the path, the issuer the call was about, the document type it was about, and the time. For a hello the issuer and type are empty. For a fetch, a status and a push, the issuer and type are the URI’s.
  • WEX-13.3 An entry MUST NOT hold a URI, a search value, anything in person, a wallet address, a document, a printable copy, or any part of an answer.
  • WEX-13.4 A call refused before routing is not logged in the reference: a bad signature, a caller with no relation or the wrong kind, a malformed body, NOT_YOUR_DOCUMENT and ISSUER_NOT_YOURS. The outcome of a logged call is not recorded either. See §21.

14. Unknown outcomes

  • WEX-14.1 An exchange makes each onward call once. It MUST NOT retry on its own, and it keeps no queue: a call that is not answered is over.
  • WEX-14.2 A caller MUST tell three classes of answer apart by status and code, never by message:
ClassAnswersWhat the caller may conclude
Answered200It happened.
Refused403, 404, 409, 410, 422, and 502 ISSUER_UNREACHABLE / 502 WALLET_UNREACHABLEIt did not happen. Repeating the same call will give the same answer until something changes in the registry or at the issuer or wallet.
Unknown502 ISSUER_UNAVAILABLE, 502 WALLET_UNAVAILABLE, 502 TRUST_REGISTRY_UNAVAILABLE, 503 NOT_REGISTERED, a timeout, no answerNothing.

A caller MAY treat any 502 as unknown without reading its code, as the reference issuer does on a push: that only delays a conclusion, and never draws a wrong one.

  • WEX-14.3 Find, fetch and status change nothing at the issuer. After an unknown outcome a wallet MAY repeat the call.
  • WEX-14.4 After an unknown outcome of a push, the wallet may or may not hold the document. The issuer MUST NOT record it as delivered (WEX-11.19) and MAY push it again. A repeat is safe because a wallet that is sent a document it already holds keeps one copy (OCI-WALLET-3, taking a pushed document).
  • WEX-14.5 An exchange MUST answer a timeout of its onward call as unknown (WEX-7.12, WEX-11.11), never as a refusal. The reference waits 15 seconds for each onward call.
  • WEX-14.6 An unknown outcome on the second hop reaches the first exchange as a 502, which it answers as unknown in turn (WEX-7.12, WEX-11.11). A refusal on the second hop reaches the caller as that refusal (WEX-7.11, WEX-11.10).

15. Errors

Errors use the body of WEX-5.2.

StatusCodeAnswered byWhen
401SIGNATURE_MISSING, SIGNATURE_INVALID, SIGNATURE_EXPIRED, UNKNOWN_PARTICIPANTany receiverWEX-4.6
403FORBIDDEN_PARTICIPANTany receiverWEX-3.6, WEX-3.7, WEX-3.8
422VALIDATION_ERRORany receiverWEX-5.3
502TRUST_REGISTRY_UNAVAILABLEany receiverWEX-4.8, and when an exchange cannot read the registry while routing
503NOT_REGISTEREDany receiverWEX-4.4
404ISSUER_NOT_FOUNDexchangeWEX-7.2, WEX-11.14
403ISSUER_NOT_ACCREDITEDexchangeWEX-7.3, WEX-11.3
404ISSUER_NOT_HEREexchange, to a peerWEX-7.6
502ISSUER_UNREACHABLEexchangeWEX-7.5
502ISSUER_UNAVAILABLEexchangeWEX-7.12
403NOT_YOUR_DOCUMENTexchangeWEX-11.2
403ISSUER_NOT_YOURSexchange, to a peerWEX-11.13
404WALLET_NOT_FOUNDexchangeWEX-11.4
404WALLET_NOT_HEREexchange, to a peerWEX-11.15
502WALLET_UNREACHABLEexchangeWEX-11.6
502WALLET_UNAVAILABLEexchangeWEX-11.11
502PARTICIPANT_UNAVAILABLEexchangethe next receiver stopped being an active participant between the routing check and the call
403NOT_ACCREDITEDissuerWEX-8.6, WEX-9.5, WEX-10.5
422UNKNOWN_SEARCH_FIELD, SEARCH_FIELD_MISSINGissuerWEX-8.7
404DOCUMENT_NOT_FOUNDissuerWEX-9.4, WEX-10.5
410DOCUMENT_REVOKEDissuerWEX-9.6
404NO_SUCH_ADDRESSwalletWEX-11.18
422DOCUMENT_NOT_GENUINEwalletWEX-11.18
403NOT_THEIR_DOCUMENTwalletWEX-11.18
410DOCUMENT_EXPIREDwalletWEX-11.18
  • WEX-15.1 A caller of /v1/find, /v1/fetch or /v1/status MUST expect the issuer’s codes and a peer exchange’s codes as well as its home exchange’s, because they are passed back unchanged (WEX-7.11). A caller of /v1/push MUST expect the wallet’s codes and a peer exchange’s codes, for the same reason (WEX-11.10).
  • WEX-15.2 A wallet that cannot fetch the issuer’s keys while checking a pushed document answers 502 ISSUER_UNAVAILABLE. The exchange answers that as 502 WALLET_UNAVAILABLE (WEX-11.11), so the issuer sees an unknown outcome and may push again.

16. Worked example

Asha Rao uses Satchel. Her wallet address is asha@satchel. Satchel (wallet:satchel) and the Transport Department (issuer:transport) are both members of NDX (exchange:ndx). India registered DRVLC (Driving Licence) with issuer:transport accredited for it, searched by number and date_of_birth.

1. Find. Asha is signed in at Satchel and asks for her driving licence. Satchel asks its home exchange:

wallet:satchel -> exchange:ndx   POST /v1/find
OCI-Signature: eyJhbGciOiJFZERTQSIsImtpZCI6ImsxIiwiaXNzIjoid2FsbGV0OnNhdGNoZWwiLCJpYXQiOjE3OTYwMjkyMDAsImh0bSI6IlBPU1QiLCJodHUiOiJodHRwczovL25keC5leGFtcGxlL3YxL2ZpbmQifQ..<signature>
{ "issuer": "issuer:transport", "doc_type": "DRVLC",
  "search": { "number": "KA0120230001", "date_of_birth": "1990-04-12" },
  "person": { "name": "Asha Rao" } }

The protected header decodes to {"alg":"EdDSA","kid":"k1","iss":"wallet:satchel","iat":1796029200,"htm":"POST","htu":"https://ndx.example/v1/find"}, where https://ndx.example is the base_url the registry lists for NDX.

NDX checks the signature, sees Satchel is its member and a wallet, logs (wallet:satchel, member, POST, /v1/find, issuer:transport, DRVLC), finds issuer:transport active, accredited for DRVLC and its own member, and calls it, signed as exchange:ndx, without issuer:

exchange:ndx -> issuer:transport   POST /exchange/v1/find
{ "doc_type": "DRVLC", "search": { "number": "KA0120230001", "date_of_birth": "1990-04-12" },
  "person": { "name": "Asha Rao" } }

The Transport Department answers, and NDX passes the answer back unchanged:

{ "documents": [ { "uri": "transport-DRVLC-KA0120230001", "doc_type": "DRVLC", "name": "Driving Licence",
                   "issued_on": "2023-01-10", "expires_on": "2043-01-09", "status": "active" } ] }

2. Fetch. Asha has connected her national identity at Satchel, so the wallet now sends her number too. The number shown is synthetic.

wallet:satchel -> exchange:ndx   POST /v1/fetch
{ "uri": "transport-DRVLC-KA0120230001", "person": { "name": "Asha Rao", "national_id": "9999 0000 0001" } }

NDX reads issuer:transport and DRVLC from the URI, routes as before, and sends the same body to /exchange/v1/fetch. The answer comes back unchanged:

{ "uri": "transport-DRVLC-KA0120230001", "status": "active",
  "document": "eyJhbGciOiJFUzI1NiIsInR5cCI6Im9jaS1kb2Mrand0Iiwia2lkIjoiLi4uIn0.eyJpc3MiOiJpc3N1ZXI6dHJhbnNwb3J0IiwuLi59.<signature>",
  "pdf": "JVBERi0xLjQK..." }

Had Ravi Menon’s wallet sent the same URI, the Transport Department would have answered 404 DOCUMENT_NOT_FOUND, and NDX would have passed that on.

3. Status.

wallet:satchel -> exchange:ndx -> issuer:transport   POST /v1/status, then POST /exchange/v1/status
{ "uri": "transport-DRVLC-KA0120230001" }
{ "uri": "transport-DRVLC-KA0120230001", "status": "active" }

4. Push. Asha gave the Transport Department her wallet address. It sends her renewed licence:

issuer:transport -> exchange:ndx   POST /v1/push
{ "to": "asha@satchel", "uri": "transport-DRVLC-KA0120260007", "document": "eyJ...", "pdf": "JVBERi0xLjQK..." }

NDX checks the caller is an issuer, that the URI is its own, that it is accredited for DRVLC, and that wallet:satchel is an active wallet and its member. It logs (issuer:transport, member, POST, /v1/push, issuer:transport, DRVLC) and sends the same body to Satchel at /exchange/v1/push. Satchel checks the document and answers 200. NDX answers the issuer:

{ "uri": "transport-DRVLC-KA0120260007", "to": "asha@satchel", "wallet": "wallet:satchel" }

Had nobody at Satchel had the handle asha, Satchel would have answered 404 NO_SUCH_ADDRESS, and the issuer would have received the same status, code and message.

5. Two exchanges. Suppose Satchel’s home were a second exchange, exchange:east. The find of step 1 goes wallet:satchel -> exchange:east at /v1/find, then exchange:east -> exchange:ndx at /peer/v1/find with the whole body including issuer, then exchange:ndx -> issuer:transport at /exchange/v1/find. Each exchange logs its own call. The push of step 4 goes issuer:transport -> exchange:ndx at /v1/push, exchange:ndx -> exchange:east at /peer/v1/push, then exchange:east -> wallet:satchel at /exchange/v1/push. If exchange:east were asked by a peer for an issuer that is not its member, it would answer 404 ISSUER_NOT_HERE.

6. An unknown outcome. If Satchel does not answer the push within the exchange’s wait, NDX answers 502 WALLET_UNAVAILABLE. The Transport Department records no delivery and pushes again later. Satchel keeps one copy however many times it arrives.

17. Security considerations

  • Three doors, one relation each. A caller is never checked by hand: a path accepts one relation, read from the registry (§3). A member cannot use the peer door, a peer cannot use the members’ door, and an issuer or a wallet has one caller only. A compromised member can reach nothing but its own home exchange.
  • The registry decides. Relations, issuer accreditation and addresses all come from the trust registry, cached for up to 60 seconds in the reference (WEX-4.9). A suspension takes that long to bite. A wrong home or base_url in the registry sends calls to the wrong place, so who may change an entry matters as much as any key.
  • An exchange is trusted for its own members. A receiving exchange cannot see which wallet a peer’s find or fetch is for: the call is signed by the peer and names no wallet. It relies on the peer having checked that its caller is a wallet (WEX-3.7). For a push it can check more: that the issuer belongs to the calling exchange (WEX-11.13).
  • An exchange can read what it carries. Calls are signed hop by hop and not encrypted end to end. An exchange sees search values, the person’s name and number, and the document. WEX-12 forbids keeping them; nothing in the protocol makes it impossible. A changed document is caught by the issuer’s signature, which the wallet checks. A changed person or search is not caught by anything.
  • Passed-back answers are the other side’s words. An answer under WEX-7.11 can carry whatever an issuer or a peer wrote. A wallet MUST check a found or fetched document itself (OCI-WALLET-3) and MUST NOT treat a passed-back message as its home exchange’s statement.
  • A URI is not a secret. Status can be asked by any wallet for any URI (WEX-10.1), and tells only how the document stands. Reading a document needs the person it was issued to (WEX-9.4).
  • Replay. A signature is good for 120 seconds and carries no jti (OCI-PAY-2 §4). A replayed find, fetch or status reads again. A replayed push delivers a document the wallet already holds.
  • Refusals that say little. An issuer answers a wrong person, a wrong issuer and a missing document alike (WEX-9.4), and a find with no match as an empty list (WEX-8.8), so a caller cannot probe which documents exist. 404 NO_SUCH_ADDRESS does tell an issuer whether a handle exists at a wallet provider.
  • Size. A push may carry up to 20,000,000 characters of printable copy. A receiver should bound request bodies at its edge before it verifies the signature over them.

18. Privacy considerations

  • The person chooses the wallet and starts every find and fetch. A wallet sends an issuer only the search answers the person gave, their name, and their national ID number once they have connected it (OCI-WALLET-3).
  • An exchange keeps no document, no URI, no search value, no name, no number and no wallet address (WEX-12.1). Its log says which wallet provider asked which issuer about which document type, and when (WEX-13.2). That still shows how often a provider’s people ask a given issuer for a given type.
  • The log never ties a call to a person. An exchange cannot answer “which documents did Asha fetch”. The person sees their own history in their wallet (OCI-WALLET-3).
  • A push tells the exchange, in passing, that an issuer has a document for an address. It is not written down (WEX-13.3).
  • An issuer learns which exchange called it, never which wallet provider: the call it receives is signed by its home exchange and names no wallet.
  • With two exchanges, both see the whole call. Each logs its own entry under the same limits.
  • Error messages name participants and document types only (WEX-12.4).

19. Changes this spec needs in other OCI specs

  • OCI-1 Trust Registry. A participant entry needs home: the id of a member’s home exchange. The registry should refuse a home that is not an active doc_exchange; today only the services check. It also needs the kinds doc_exchange, doc_issuer, wallet and doc_requester, and the list of document types with accredited issuers (both specified in OCI-WALLET-1).
  • OCI-PAY-2 Payments Switch. §4 should become a shared definition of OCI-Signature that both families cite, with the receiver’s address rule (WEX-4.3) and the error codes settled once. OCI-PAY-2 already notes that its switch and its bank connectors answer different codes for the same failure; this family uses the connector’s set (SIGNATURE_MISSING, FORBIDDEN_PARTICIPANT, 502 TRUST_REGISTRY_UNAVAILABLE).
  • OCI-0 Core. CORE-9.1 gives another error body. This spec uses the body of OCI-PAY-2 (WEX-5.2), the same exception OCI-PAY-2 records.
  • OCI-0 Core. OCI-Signature uses EdDSA, the same exception to CORE-5 that OCI-PAY-2 records.

20. Conformance

An exchange conforms to OCI-WALLET-2 0.1 when it passes the tests of ociwallet-exchange-api. An issuer’s side conforms when it passes the exchange-facing tests of ociwallet-issuer-api. A wallet’s side conforms when it passes the exchange-facing tests of ociwallet-api.

ClausesChecked by
WEX-3.2 to 3.6, 3.11exchange test_exchange.py: test_a_member_is_answered_and_the_call_is_logged, test_another_exchange_is_a_peer_in_the_same_country_or_another, test_a_caller_with_no_business_here_is_refused, test_a_member_that_moves_to_another_exchange_is_no_longer_served, test_it_cannot_call_itself
WEX-3.7, 3.8exchange test_routing.py: test_only_a_wallet_finds_and_fetches, test_a_member_cannot_use_the_peer_door_nor_a_peer_the_members; test_push.py: test_who_may_push_what
WEX-3.9, 3.10issuer test_issuer.py: test_anyone_but_the_home_exchange_is_refused, test_moving_to_another_exchange_changes_who_may_call, test_its_calls_go_to_its_home_exchange_signed, test_without_an_active_home_exchange_it_calls_nobody; issuer test_documents.py: test_only_the_home_exchange_may_find_fetch_or_ask_status; wallet test_national.py: test_only_the_home_exchange_may_push
WEX-4.1 to 4.9exchange test_exchange.py: test_an_unsigned_call_is_refused, test_the_signature_is_checked_before_the_body, test_someone_elses_key_does_not_verify, test_a_changed_body_does_not_verify, test_an_old_or_future_signature_is_refused, test_a_signature_for_a_different_request_is_refused, test_a_malformed_signature_header_is_refused, test_a_suspended_or_unknown_caller_is_refused, test_an_exchange_that_is_suspended_or_unregistered_serves_nobody, test_a_rotated_key_is_picked_up_by_one_refetch, test_the_registry_being_down_is_not_the_callers_fault. The issuer and the wallet repeat them in test_issuer.py and test_wallet.py.
WEX-5.3, 6.1exchange test_exchange.py: test_a_signed_body_that_is_not_a_hello_is_a_validation_error; test_routing.py: test_a_malformed_call_is_a_validation_error
WEX-6.2 to 6.4exchange test_exchange.py: test_a_member_is_answered_and_the_call_is_logged, test_check_greets_its_members_and_every_other_exchange_with_signed_calls
WEX-7.1, 7.4, 7.9exchange test_routing.py: test_a_call_for_a_member_issuer_goes_straight_to_it
WEX-7.2, 7.3test_an_unknown_issuer_is_not_found, test_a_suspended_issuer_is_not_found, test_an_issuer_is_only_asked_for_types_it_is_accredited_for
WEX-7.5, 7.6test_a_call_for_another_exchanges_issuer_goes_through_that_exchange, test_a_peers_call_is_delivered_only_to_a_member_here, test_an_issuer_with_no_active_home_exchange_cannot_be_reached
WEX-7.10exchange test_push.py: test_a_person_may_carry_a_national_id_and_it_is_passed_on
WEX-7.11 to 7.13exchange test_routing.py: test_the_issuers_own_refusal_is_passed_on_unchanged, test_an_issuer_that_fails_is_unavailable_not_the_callers_fault, test_a_document_passes_through_untouched
WEX-8.5 to 8.9issuer test_documents.py: test_find_matches_every_field_given, test_find_says_what_it_found_and_no_more, test_find_takes_only_the_types_search_fields, test_find_is_only_for_types_the_issuer_is_accredited_for, test_a_document_is_found_and_fetched_only_by_the_person_it_was_issued_to
WEX-9.4 to 9.7, 10.4, 10.5issuer test_documents.py: test_a_document_that_is_not_this_issuers_is_not_found, test_a_malformed_uri_is_a_validation_error, test_suspend_restore_and_revoke, test_an_issued_document_is_the_certificate_signed_by_the_issuer, test_the_printable_copy_is_a_pdf_in_the_issuers_storage
WEX-11.1 to 11.7, 11.9exchange test_push.py: test_a_push_for_a_member_wallet_goes_straight_to_it, test_a_push_for_another_exchanges_wallet_goes_through_that_exchange, test_who_may_push_what, test_an_address_at_no_wallet_provider
WEX-11.10, 11.11test_the_wallets_refusal_reaches_the_issuer_and_a_failure_does_not
WEX-11.13 to 11.15test_a_push_from_another_exchange_is_delivered_to_a_member_wallet, test_a_push_never_takes_two_hops, test_who_may_push_what
WEX-11.16 to 11.18wallet test_national.py: test_a_pushed_document_lands_in_the_persons_wallet, test_only_the_home_exchange_may_push, test_an_address_nobody_has, test_a_pushed_document_is_checked_like_any_other, test_a_connected_person_is_not_sent_someone_elses_document
WEX-11.19issuer test_documents.py: test_a_document_is_pushed_to_a_wallet_address_through_the_home_exchange, test_a_push_the_wallet_refuses_is_said_as_it_was_given
WEX-12.x, 13.xexchange test_routing.py: test_the_log_never_holds_what_was_searched_for_or_which_document; test_push.py: test_the_log_holds_neither_the_address_nor_the_document

Each service states how it meets every clause in its conformance.json, and tests/test_clauses.py in each names its tests by clause. The current results are in conformance/results/.

21. Open questions

  • Who a peer’s call is for. /peer/v1/find, /peer/v1/fetch and /peer/v1/status do not name the wallet that asked, and the receiving exchange cannot check that a wallet asked at all. Should the first exchange name its member in the body, as /peer/v1/push lets the receiver check the issuer (WEX-11.13)? The logs of the two exchanges cannot be joined to one call today.
  • Which exchanges are peers. Any active doc_exchange in the registry is a peer, in any country (WEX-3.3). Plan 012 expected peering across countries only between exchanges the two countries recognise (OCI-1 §6). The code has no such check.
  • What the log is for. It records accepted calls before routing, not refusals and not outcomes (WEX-13.4). It has no retention rule and no way to read it but the database. Should refusals be logged? Should the outcome class (answered, refused, unknown) be? Who may read it?
  • Both exchanges log, neither tells the person. No part of the exchange log reaches the person. Should a person be able to ask an exchange who asked for their document types? The log holds nothing that identifies them, so today it cannot answer.
  • 409 on a push. WEX-11.10 passes a wallet’s 409 back, but the reference wallet answers no 409 on a push. Keep it reserved, or drop it?
  • A 200 from the wallet is not read. The exchange takes any 200 with a JSON body as delivery and builds its own answer (WEX-11.9). Should it check the wallet’s uri, to and wallet?
  • A passed-back refusal is not read either. For find, fetch and status, any JSON body with status 403, 404, 410 or 422 goes back as it is (WEX-7.11), even if it is not an error body. For a push the exchange rebuilds the error from code and message (WEX-11.10). Should the two behave alike?
  • A peer’s refusals look like the issuer’s. 404 ISSUER_NOT_HERE, 403 ISSUER_NOT_YOURS and 404 WALLET_NOT_HERE mean the two exchanges read the registry differently at that moment. They reach the wallet or the issuer as refusals (WEX-14.2), though a repeat a minute later may succeed. Should they be answered as unknown?
  • Nested waits. Every hop waits 15 seconds in the reference, and so does the member. With two exchanges, the member can give up while the second hop is still waiting. Should the waits shrink hop by hop, or the first hop’s be longer?
  • Idempotency for push. A push has no key (WEX-4.11) and relies on the wallet keeping one copy per URI. Is that enough once a document can be re-issued under the same URI, or pushed to several wallets?
  • Find semantics on the wire. WEX-8.7 and WEX-8.8 state what the issuer answers. How a search value is compared with a document (the reference ignores case and spacing) is in OCI-WALLET-1 §4 (WDOC-4.3, WDOC-4.4).
  • Hello and unknown members. Find, fetch, status and push refuse unknown members (WEX-5.3). Hello accepts and ignores them. Accidental, or the forward-compatible choice for a check call?
  • person with national_id: null. An exchange accepts it and passes on a person without the member (WEX-7.10). Should a wallet be told to omit it rather than send null?
  • Suspended exchanges and cached entries. A registry change shows after up to 60 seconds (WEX-4.9). Should a suspension be pushed to exchanges, or the cache be shorter for status?
  • Size of a push. 20,000,000 characters of base64 in one signed JSON body is heavy to sign, verify and hold in memory at each hop. Should the printable copy travel another way?
  • Not in this version. Requesters: a doc_requester is a member and can say hello, and nothing else. Sharing a document with a requester under consent would be OCI-WALLET-4. Also not built: connecting a wallet at an issuer (a second factor or a QR code), which is how an issuer would learn the address it pushes to; copies encrypted so that only the person can read them, which would change WEX-11.8 and the security notes; pushing again after a document is re-issued; listing issuers or document types through an exchange (they are read from the trust registry); and searching every exchange for a person whose wallet is not registered.

Changes

VersionDateWhat changed
0.1.02026-11-30First version, extracted from the reference implementation.