OCI-WALLET · how it works

From the issuer's signature to the person's wallet

Every call between two organisations is signed and checked against the trust registry. The people and organisations below are the reference implementation's own, and all of them are made up.

Who talks to whom

COUNTRY INOCI-ID INDIA · THE COUNTRY'S IDENTITYTRANSPORT DEPARTMENT · ISSUERNDX · DOCUMENT EXCHANGESATCHEL · WALLET PROVIDERTrust registryparticipants · keys · document typesOCI-IDresidents · consentIssuer connectorsigns the ID cardIssuer connectorsigns licencesIssuer consolestaff issue · revokeExchangeroutes · keeps no documentAnother exchangeif the country accredits oneWallet appon Asha's phoneWalletkeeps · checks each documentIts own OCI-IDsign-in to the walletissue · sendsessionsignedsignedforwarded oncefind · fetch · status · pushsessiontokensconnect: sign in · agree
A person's sign-in, token or app sessionMachine-to-machine request carrying an OCI-SignatureRegistry lookup
An issuer never calls a wallet, and a wallet never calls an issuer: each calls its home exchange, which passes the call on and keeps no document. A document is signed by its issuer, so the wallet can check it without trusting the exchange. Where a country accredits more than one exchange, a call is forwarded once, to the other party's home exchange. The person connects the country's identity to their wallet themselves; their ID card is then sent to their wallet address. How documents reach a wallet →

An issuer signs a document

A member of the transport department's staff issues Asha's driving licence in the issuer console. Nothing leaves the issuer yet: the document waits there, signed, until a wallet asks for it or the issuer sends it.

sequenceDiagram
  autonumber
  actor S as Staff
  participant C as Issuer console
  participant I as Issuer connector
  participant R as Trust registry
  S->>C: fill in the licence
  C->>I: issue (staff session)
  I->>R: may I issue this type?
  R-->>I: the country's document types
  I->>I: sign · give it a URI · make the printable copy
  I-->>C: transport.in-DRVLC-…, active
FromToWhatWhat proves it
Staff Issuer console Fill in the document's details The staff member's sign-in at the issuer's own OCI-ID
Issuer console Issuer connector POST /admin/v1/documents The staff session, and the role to issue
Issuer connector Trust registry The country's document types Read; the issuer issues only types listed for it
Issuer connector itself Signs the document, gives it its URI, makes the printable copy The issuer's signing key, published in the registry

The URI is <issuer>-<TYPE>-<id>. It is permanent and says nothing about Asha.

A person finds and keeps a document

In her wallet, Asha picks the transport department and Driving licence, sees which of her details will be sent, and searches. The wallet never calls the issuer: both call the exchange.

sequenceDiagram
  autonumber
  actor A as Asha
  participant W as Wallet (Satchel)
  participant X as Exchange (NDX)
  participant I as Issuer (Transport)
  A->>W: look for my driving licence
  W->>X: POST /v1/find · signed
  X->>I: POST /exchange/v1/find · signed
  I-->>X: the URIs that are hers
  X-->>W: the same answer, unchanged
  A->>W: keep this one
  W->>X: POST /v1/fetch · signed
  X->>I: POST /exchange/v1/fetch · signed
  I-->>W: the signed document + printable copy (through the exchange)
  W->>W: check signature · issuer may issue the type
  W->>X: POST /v1/status
  X-->>W: active (the issuer's answer)
  W-->>A: Driving licence · signature checked
FromToWhatWhat proves it
Wallet Exchange POST /v1/find {issuer, doc_type, search, person} OCI-Signature; the wallet is a member of this exchange
Exchange Issuer POST /exchange/v1/find OCI-Signature; the exchange is the issuer's home
Issuer Wallet The URIs of the documents that are this person's Matched on the national ID number when both sides have one, otherwise on the name
Wallet Exchange → Issuer POST /v1/fetch {uri, person} Signed, hop by hop
Wallet itself Checks the issuer's signature and that the issuer may issue this type Keys and document types from the trust registry
Wallet Exchange → Issuer POST /v1/status {uri} Signed; asked again each time the document is opened

The exchange's log holds: Satchel asked Transport for a DRVLC, and when. Not the name, the number or the document.

Connecting the national identity, and the ID card arrives

Asha signs in to her wallet with the wallet's own account, then connects her country's identity to it, the way one connects an account elsewhere. Her ID card is then sent to her wallet address.

sequenceDiagram
  autonumber
  actor A as Asha
  participant W as Wallet (Satchel)
  participant N as OCI-ID India
  participant I as Its issuer connector
  participant X as Exchange (NDX)
  A->>W: Connect OCI-ID
  W-->>A: go to OCI-ID India (scope national_id, wallet_address, PKCE)
  A->>N: sign in · see what is shared · agree
  N-->>W: back to the wallet, with a code
  W->>N: POST /token (the code)
  N-->>W: ID token (who signed in, no number) + access token
  W->>N: GET /userinfo (the access token)
  N-->>W: her number, date of birth
  W-->>A: connected · number ending 0001
  N->>I: issue her ID card (once), then send it to asha@satchel
  I->>X: POST /v1/push · signed
  X->>W: POST /exchange/v1/push · signed
  W->>W: check signature · type · whose it is
  W-->>A: OCI-ID Card, in her wallet
FromToWhatWhat proves it
Wallet app Wallet POST /v1/national-identity/start Asha's sign-in at the wallet
Asha's browser OCI-ID India GET /authorize, scope openid national_id, wallet_address=asha@satchel PKCE. Only a registered wallet provider may ask for this scope, and only for its own addresses
Asha OCI-ID India Signs in, sees what will be shared and where her card will go, and agrees Her own sign-in. Cancel shares nothing
Wallet OCI-ID India POST /token The code and its PKCE verifier; the wallet checks the ID token's signature. The ID token says who signed in and never carries the number
Wallet OCI-ID India GET /userinfo The access token from that sign-in. The answer must be for the same person as the ID token; the number is taken from here only
OCI-ID India Its issuer connector Issue the ID card (once per resident), then push it to her address Inside one organisation
Issuer connector Exchange POST /v1/push {to, uri, document, pdf} OCI-Signature; an issuer pushes only its own documents
Exchange Wallet POST /exchange/v1/push OCI-Signature; the exchange is the wallet's home. The wallet is found from the address alone

The number is never part of the sign-in itself: the wallet's server fetches it afterwards, and it stays there: the app shows its last four characters. The wallet asks the issuer for the card's status when Asha next lists or opens her documents. She can disconnect, and the wallet forgets the number.

When the issuer and the wallet have different exchanges

A country may accredit more than one exchange. Each issuer and each wallet has one home exchange, named in the trust registry. A call is forwarded once, from the caller's home to the other party's home.

sequenceDiagram
  autonumber
  participant W as Wallet
  participant X1 as Its home exchange
  participant X2 as The issuer's home exchange
  participant I as Issuer
  W->>X1: POST /v1/find · signed
  X1->>X2: POST /peer/v1/find · signed
  X2->>I: POST /exchange/v1/find · signed
  I-->>W: the answer, passed back unchanged
FromToWhatWhat proves it
Wallet Its home exchange POST /v1/find OCI-Signature, as a member
Home exchange The issuer's home exchange POST /peer/v1/find OCI-Signature, as a peer. A forwarded call is never forwarded again
The issuer's home exchange Issuer POST /exchange/v1/find OCI-Signature, as its home

Fetch, status and push follow the same rule. With one exchange in a country, there is simply no second hop.

Every field of these calls is in the API reference →; the rules are in the protocols →