Two countries, four banks, and a payments operator (NPC) in each country running its switch. People prove who they are with a token from an OCI-ID. Banks and switches prove who they are by signing every request. Money moves bank → switch → bank, and the switch keeps the running tally of who owes whom. A payment app such as Wren can issue addresses of its own, which point at accounts people connect; the use cases show how. Part 1 covers sign-in and permissions, Part 2 payments and settlement.
A bank issues a payment address with the account (asha@sbi). A payment address can also stand apart from the bank: a payment app such as Wren issues the address, called a PayID here (asha@wren), and the person connects it to a bank account. The part after the @ names the app, never the bank.
Every use case is drawn on the same map as "Who talks to whom", without the OCI-IDs, and runs beside it: press Run or Next step, and the call in focus lights up on the map with its number. Grey lines are connections the use case does not use. An indented step (↳) is a request made while the step above it is being handled: its answer is needed before the one above can answer. A call to a bank's own core stays inside the bank.
An app only ever calls the switch it is registered with (Wren: India's), and a bank only its own country's switch; the switch calls the other side. An account in the other country is reached through the home switch, over the link. The app never holds money and never sees the PIN. A bank is also an app for its own customers, so asha@sbi keeps working.
Asha, signed in to Wren, connects her SBI account and picks a PayID.
Asha pays ravi@wren 120.00 INR. Ravi's account is at HDFC, which Asha never needs to know.
Quickstep Rewards, a shop that banks with HDFC, asks asha@wren for 499.00 INR from HDFC's app. Asha approves it in Wren.
| Use case | What happens |
|---|---|
| Check a balance | Wren → switch → bank, with the account reference and the encrypted PIN. The balance is shown and not stored by the app. |
| Pay across a border | Use case 2 with a quote first: exact amount, rate and fee are shown before the PIN. The payer's switch hands the credit to the other country's switch over their link. |
| A second app on the same account | Asha connects SBI in another app and gets a second PayID. Both move money in the same account; each app shows only its own payments and requests. |
| Change the bank behind a PayID | Asha connects HDFC and points asha@wren at it. People who pay her change nothing. |
| Disconnect a bank | From the app or from the bank. The consent is ended and the account reference is refused from then on. |
| Shop checkout | The shop shows a QR with amount and order number (use case 2) or sends a request to the buyer's PayID (use case 3). The shop is told the result either way. |
| A payment that fails midway | The held money is released. A timeout is retried with the same key and can never pay twice. |
| Set or change the PIN | With the bank, through the app and the switch, encrypted to the bank. Neither the app nor the switch can read it. |
| Refund | The shop sends a new payment back to the buyer's PayID, linked to the original. Not designed yet. |
| Block a sender | The app stops showing requests from an address. Not designed yet. |
There are three kinds of caller, and each proves itself a different way. OCI-ID answers who a person is. The bank or switch answers what that person may do.
| Caller | Proves identity with | The API maps it to | Then allowed |
|---|---|---|---|
| Operator (bank or NPC staff), in a console | OCI-ID access token issued to <app>-app | a row in the app's operators table, by verified email or phone | the actions of that row's role |
| Customer, in a wallet | OCI-ID access token plus the account PIN for payments | a bank account, through an identity link (issuer + subject + client) | their own account only |
| Bank or switch | OCI-Signature on every request | a participant in the trust registry | bank routes for the country's banks; link routes for the peer switch |
OpenID Connect authorization code flow with PKCE. The console is a public client, so it holds no secret; the PKCE verifier ties the code to the browser that started the sign-in.
sequenceDiagram
autonumber
actor O as Operator
participant C as Console in browser
participant I as The organisation's own OCI-ID
participant A as App API (bank or switch)
O->>C: Open the console
C->>I: GET /authorize · client_id, redirect_uri, PKCE S256 challenge, state, nonce
I->>O: Sign-in page
O->>I: Phone or email + one-time code (or password, Google)
I->>O: Consent · share name, phone, email
I-->>C: Redirect to /auth/callback with a code (valid 60 s)
C->>I: POST /token · code + PKCE verifier
I-->>C: Access token (ES256, 15 min) + refresh token (30 days)
C->>A: GET /api/auth/me · Bearer token
A->>I: GET /.well-known/jwks.json (cached 5 min)
A->>I: GET /userinfo (first time it sees this person)
A-->>C: Name, organisation, role
C->>A: GET /api/rbac/permissions
A-->>C: The actions this role allows
typ is at+jwt. An ID token is not a pass to an API.client_id is this app's own client and appears in aud. A token another app obtained is refused.Failures: 401 means sign in again; 403 means signed in but not allowed; 502 means the OCI-ID could not be reached, which does not sign anyone out.
| Action | owner | ops | viewer |
|---|---|---|---|
settlement.view | yes | yes | yes |
payments.view | yes | yes | yes |
settlement.run | yes | yes | no |
payments.retry | yes | yes | no |
team.manage | yes | no | no |
In the bank console the owner sees customers, payments, the ledger check and the team; the viewer sees the ledger check only.
No shared secrets and no tokens. Each request carries an OCI-Signature header: a detached JWS signed with the sender's Ed25519 key over the exact body bytes.
sequenceDiagram
autonumber
participant S as Sender (bank or switch)
participant R as Receiver
participant T as Trust registry
Note over S: Sign the body · header carries alg EdDSA, kid, iss, iat, htm, htu
S->>R: POST … · OCI-Signature + Idempotency-Key
Note over R: iat within 120 s · htm and htu match this exact request
R->>T: GET /participants/{iss}
T-->>R: Kind, country, status, address suffix, key address
Note over R: Active · right kind for this route (own country's bank, or the peer switch)
R->>S: GET /.well-known/jwks.json
Note over R: Signature verifies with the key named by kid (one forced refresh for a rotated key)
R-->>S: Result
Example: Asha at SBI pays Ravi at HDFC 120.00 INR. The address suffix (@hdfc) tells the switch which bank to credit.
sequenceDiagram autonumber actor P as Payer's wallet participant PB as Payer's bank participant S as Switch participant RB as Payee's bank P->>PB: GET /v1/keys/pin P->>PB: POST /v1/payments · Bearer token, PIN as JWE, Idempotency-Key Note over PB: Token → account · PIN correct · enough balance
Place a hold · payment is pending PB->>S: POST /v1/payments · signed Note over S: Signature ok · sender owns the paying address
State: received S->>RB: POST /switch/v1/credit · signed Note over RB: Signature ok · book the money in to the payee RB-->>S: Credited, payee's name Note over S: received → credited → completed
Positions: payer's bank −120.00, payee's bank +120.00 S-->>PB: completed Note over PB: Capture the hold · book customer → settlement account PB-->>P: completed
At the switch:
At the payer's bank, and what a caller sees:
The PIN travels encrypted to the bank's own key (ECDH-ES, A256GCM) with a one-use nonce. Five wrong PINs lock the account for 15 minutes.
payments.retry).Example: Asha at SBI (IN) pays Lena at Chase (US). She sends 248.00 INR, pays a 20.00 INR fee, and Lena receives 20.00 USD at the fixed rate of 12.40 INR per USD. A quote comes first, so the payer sees the exact amounts before entering the PIN.
sequenceDiagram autonumber participant PB as Payer's bank (IN) participant SX as Switch IN participant SC as Switch US participant RB as Payee's bank (US) PB->>SX: POST /v1/quotes · signed SX->>SC: POST /link/v1/quotes · signed SC->>RB: POST /switch/v1/lookup · signed SC-->>SX: Payee's name, receive amount, rate SX-->>PB: Quote · send, receive, fee, total debit · valid 10 min PB->>SX: POST /v1/payments with quote_id · signed Note over SX: Quote unused, unexpired, same amounts · mark it used SX->>SC: POST /link/v1/payments · signed Note over SC: Sender is the peer switch · amounts match the fixed rate SC->>RB: POST /switch/v1/credit · signed, with the exchange details RB-->>SC: Credited Note over SC: Positions: payee's bank +20.00 USD, link to IN −20.00 USD SC-->>SX: completed Note over SX: Positions: payer's bank −248.00 and −20.00 fee,
link to US +248.00, fees +20.00 SX-->>PB: completed
Every completed payment adds rows to the switch's positions, and each payment's rows sum to zero. An open position is the net of all payments since the last cycle. These were switch IN's positions after the four test payments of 24 November, before a cycle was run that evening.
settlement.run presses "Run settlement cycle".A cycle is bookkeeping. It records the net amounts each bank must pay or receive; it does not itself move funds between banks. In this simulation that final transfer is not modelled.
The trust registry runs in its own store (oci-gpc). If it stops, signatures cannot be checked and payments between banks stop.