OCI-Wallet · API reference

The calls between participants

OCI-Wallet has four kinds of participant: issuers, the document exchange, wallet providers, and a trust registry that says who everyone is. This is what each one answers and what it sends. A person's own wallet app talks only to its own provider, and an issuer's staff only to their own console, so those endpoints are not here.

To see these calls in order, read how it works.

Before you call

Who calls whom

ParticipantCallsIs called by
IssuerIts home exchange, to send a documentIts home exchange only
Wallet providerIts home exchange, to find, fetch and ask statusIts home exchange only
ExchangeIts issuers and wallets, and another exchange onceIts issuers and wallets, and other exchanges
Trust registryNo oneEveryone: it lists each participant's keys, address and home exchange, and each country's document types

Every call is signed

The caller signs the exact body bytes with its Ed25519 key and sends the result in OCI-Signature: a detached compact JWS whose header carries the caller's registry id, the method and the full URL. The receiver finds the caller's key in the registry and refuses a signature more than two minutes old. It is the same signature OCI-Pay uses. There are no shared secrets between participants.

A document carries its own proof

A document is a compact JWS signed by its issuer (ES256, type oci-doc+jwt). Whoever holds it can check it against the issuer's published key, so nothing depends on trusting the exchange or the wallet that carried it.

Addresses

A document's URI is <issuer>-<TYPE>-<id>, such as transport.in-DRVLC-…. A wallet address is <name>@<provider>, such as asha@satchel. The exchange routes on these alone.

Errors have one shape

{"error": {"code": "…", "message": "…"}} with an HTTP status. The code is stable; the message is for people. Each call's own codes are in its specification.

StatusCodeWhen
401 SIGNATURE_MISSING The call has no OCI-Signature header.
401 SIGNATURE_INVALID The signature does not check out, or was made for another method or URL.
401 SIGNATURE_EXPIRED The signature's iat is more than two minutes from the receiver's clock.
401 UNKNOWN_PARTICIPANT The signer is not an active participant in the trust registry.
403 FORBIDDEN_PARTICIPANT The signer may not make this call: it is not a member, a peer or the home exchange the path is for.
422 VALIDATION_ERROR A field is missing or malformed. The message names it.

The exchange, for its members

Called by: an issuer or a wallet whose home exchange this is

An issuer and a wallet each have one home exchange, named in the trust registry, and make every call there. The exchange finds who serves the issuer or the wallet address, passes the call on, and returns the answer unchanged. It keeps no document and no person's details: its log holds who asked for which type, and when.

POST /v1/hello

Check the connection

A signed hello. The answer says who the exchange took the caller to be.

Request body

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.

Response

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.
you string The caller's registry id, as the receiver read it from the signature.
relation string What the caller is to the receiver: member, peer or home. One of: member, peer, home.
me string The receiver's own registry id.
at date-time The receiver's clock when it answered.
POST /v1/find

Find a person's documents at an issuer

A wallet asks an issuer, through the exchange, for one person's documents of one type. Only a wallet may ask.

The answer is the issuer's, passed back unchanged: /exchange/v1/find.

Request body

issuer string The issuer's registry id, such as transport.in.
doc_type string The document type: five capital letters from the country's list, such as DRVLC.
search object The search fields the document type asks for, such as the licence number.
person object Who the documents are for, as the wallet knows them. The person is shown this before it is sent.
↳ name string The person's name. It must be the name on the document when no number decides.
↳ national_id ? string The person's national ID number. Sent only when they have connected their national identity to the wallet.

Response

documents array The documents found. An empty list when there are none.
↳ uri string The document's permanent address.
↳ doc_type string The document's type.
↳ name string The document's name, as the issuer shows it.
↳ issued_on string The day it was issued.
↳ expires_on ? string The day it stops being valid, when it has one.
↳ status string Whether it is still good: active, suspended or revoked. One of: active, suspended.
POST /v1/fetch

Fetch a document

A wallet asks for the signed document behind a URI, with its printable copy.

The answer is the issuer's, passed back unchanged: /exchange/v1/fetch.

Request body

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
person object Who the documents are for, as the wallet knows them. The person is shown this before it is sent.
↳ name string The person's name. It must be the name on the document when no number decides.
↳ national_id ? string The person's national ID number. Sent only when they have connected their national identity to the wallet.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
status string Whether the document is still good: active, suspended or revoked. One of: active, suspended.
document string The document: a compact JWS signed by the issuer.
pdf ? string The printable copy, base64.
POST /v1/status

Ask whether a document is still good

Asked before a document is shown as good.

The answer is the issuer's, passed back unchanged: /exchange/v1/status.

Request body

uri string The document's permanent address: <issuer>-<TYPE>-<id>.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
status string Whether the document is still good: active, suspended or revoked. One of: active, suspended, revoked.
POST /v1/push

Send a document to a wallet address

An issuer sends a document it issued to the address a person gave. The exchange delivers it to the wallet provider the address names. Only the document's own issuer may send it.

Request body

to string The person's wallet address: <name>@<provider>, such as asha@satchel.
uri string The document's permanent address: <issuer>-<TYPE>-<id>.
document string The document: a compact JWS signed by the issuer.
pdf ? string The printable copy, base64.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
to string The person's wallet address: <name>@<provider>, such as asha@satchel.
wallet string The registry id of the wallet provider that took the document.

The exchange, for another exchange

Called by: another accredited exchange

A country may accredit more than one exchange. When an issuer or a wallet has a different home exchange, the caller's exchange forwards the call once, to that home exchange. A forwarded call is never forwarded again.

POST /peer/v1/hello

Check the connection between two exchanges

A signed hello between exchanges.

Request body

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.

Response

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.
you string The caller's registry id, as the receiver read it from the signature.
relation string What the caller is to the receiver: member, peer or home. One of: member, peer, home.
me string The receiver's own registry id.
at date-time The receiver's clock when it answered.
POST /peer/v1/find

Find, forwarded

The same question as find, for an issuer whose home is this exchange.

The answer is the issuer's, passed back unchanged: /exchange/v1/find.

Request body

issuer string The issuer's registry id, such as transport.in.
doc_type string The document type: five capital letters from the country's list, such as DRVLC.
search object The search fields the document type asks for, such as the licence number.
person object Who the documents are for, as the wallet knows them. The person is shown this before it is sent.
↳ name string The person's name. It must be the name on the document when no number decides.
↳ national_id ? string The person's national ID number. Sent only when they have connected their national identity to the wallet.

Response

documents array The documents found. An empty list when there are none.
↳ uri string The document's permanent address.
↳ doc_type string The document's type.
↳ name string The document's name, as the issuer shows it.
↳ issued_on string The day it was issued.
↳ expires_on ? string The day it stops being valid, when it has one.
↳ status string Whether it is still good: active, suspended or revoked. One of: active, suspended.
POST /peer/v1/fetch

Fetch, forwarded

The same as fetch, for an issuer whose home is this exchange.

The answer is the issuer's, passed back unchanged: /exchange/v1/fetch.

Request body

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
person object Who the documents are for, as the wallet knows them. The person is shown this before it is sent.
↳ name string The person's name. It must be the name on the document when no number decides.
↳ national_id ? string The person's national ID number. Sent only when they have connected their national identity to the wallet.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
status string Whether the document is still good: active, suspended or revoked. One of: active, suspended.
document string The document: a compact JWS signed by the issuer.
pdf ? string The printable copy, base64.
POST /peer/v1/status

Status, forwarded

The same as status, for an issuer whose home is this exchange.

The answer is the issuer's, passed back unchanged: /exchange/v1/status.

Request body

uri string The document's permanent address: <issuer>-<TYPE>-<id>.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
status string Whether the document is still good: active, suspended or revoked. One of: active, suspended, revoked.
POST /peer/v1/push

Push, forwarded

A document from an issuer of the calling exchange, for a wallet whose home is this exchange.

Request body

to string The person's wallet address: <name>@<provider>, such as asha@satchel.
uri string The document's permanent address: <issuer>-<TYPE>-<id>.
document string The document: a compact JWS signed by the issuer.
pdf ? string The printable copy, base64.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
to string The person's wallet address: <name>@<provider>, such as asha@satchel.
wallet string The registry id of the wallet provider that took the document.

An issuer

Called by: the issuer's home exchange only

An issuer signs documents and answers for them. It decides whether a document is the asking person's: by the national ID number when the document records one and the wallet sent one, otherwise by the name.

POST /exchange/v1/hello

Check the connection

A signed hello from the home exchange.

Request body

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.

Response

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.
you string The caller's registry id, as the receiver read it from the signature.
relation string What the caller is to the receiver: member, peer or home. One of: member, peer, home.
me string The receiver's own registry id.
at date-time The receiver's clock when it answered.
POST /exchange/v1/find

Find a person's documents of one type

The issuer answers with the URIs of the documents that are this person's.

Request body

doc_type string The document type: five capital letters from the country's list, such as DRVLC.
search object The search fields the document type asks for, such as the licence number.
person object Who the documents are for, as the wallet knows them. The person is shown this before it is sent.
↳ name string The person's name. It must be the name on the document when no number decides.
↳ national_id ? string The person's national ID number. Sent only when they have connected their national identity to the wallet.

Response

documents array The documents found. An empty list when there are none.
↳ uri string The document's permanent address.
↳ doc_type string The document's type.
↳ name string The document's name, as the issuer shows it.
↳ issued_on string The day it was issued.
↳ expires_on ? string The day it stops being valid, when it has one.
↳ status string Whether it is still good: active, suspended or revoked. One of: active, suspended.
POST /exchange/v1/fetch

Fetch a document by its URI

The signed document and its printable copy, given only when it is this person's.

Request body

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
person object Who the documents are for, as the wallet knows them. The person is shown this before it is sent.
↳ name string The person's name. It must be the name on the document when no number decides.
↳ national_id ? string The person's national ID number. Sent only when they have connected their national identity to the wallet.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
status string Whether the document is still good: active, suspended or revoked. One of: active, suspended.
document string The document: a compact JWS signed by the issuer.
pdf ? string The printable copy, base64.
POST /exchange/v1/status

Say whether a document is still good

Active, suspended or revoked. Says nothing else about the document.

Request body

uri string The document's permanent address: <issuer>-<TYPE>-<id>.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
status string Whether the document is still good: active, suspended or revoked. One of: active, suspended, revoked.

A wallet provider

Called by: the wallet's home exchange only

A wallet provider keeps each person's documents and gives each person an address. It checks a pushed document the way it checks one it fetched: the issuer's signature, and that the issuer may issue that type. It asks the issuer for the document's status afterwards.

POST /exchange/v1/hello

Check the connection

A signed hello from the home exchange.

Request body

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.

Response

nonce string Any text. It comes back unchanged, so the caller knows the answer is to this call.
you string The caller's registry id, as the receiver read it from the signature.
relation string What the caller is to the receiver: member, peer or home. One of: member, peer, home.
me string The receiver's own registry id.
at date-time The receiver's clock when it answered.
POST /exchange/v1/push

Take a document sent to one of this wallet's addresses

The wallet refuses an address it did not give out, and a document that records another person's national ID number.

Request body

to string The person's wallet address: <name>@<provider>, such as asha@satchel.
uri string The document's permanent address: <issuer>-<TYPE>-<id>.
document string The document: a compact JWS signed by the issuer.
pdf ? string The printable copy, base64.

Response

uri string The document's permanent address: <issuer>-<TYPE>-<id>.
to string The person's wallet address: <name>@<provider>, such as asha@satchel.
wallet string The registry id of the wallet provider that took the document.

A field marked ? may be left out. Field names and types are generated from the reference implementation (ociwallet-exchange-api@46f650d, ociwallet-issuer-api@f2bc6d9, ociwallet-api@9551e4d); the rules for each call are in the OCI-WALLET specifications.