Cross-Provider eKYC: Integration and Implementation Guide
Audience: business, compliance, and engineering teams at organisations joining the Cross-Provider eKYC network as a Provider, a Requester, or both. Version: 1.0 · Owner: Techo Startup Center Short version: see Integration Quick-start for the condensed plan.
This guide covers the complete path from network design to production operation. It explains what the system does, how its components fit together, how personal data is protected, and how your organisation deploys the sidecar within its own infrastructure.
How to read it
| If you are… | Read |
|---|---|
| A decision-maker or product owner | Part A (Concept) and Part C (Data privacy) |
| A compliance, risk, or security officer | Part C (Data privacy and security) and Part D (Dashboards and audit) |
| A solution architect | Parts B, C, and E |
| An engineer implementing the integration | Part E (Implementation plan) and Part F (Reference) |
Part A: Concept
The problem
Digital services repeatedly perform the same identity checks: name, date of birth, national ID, document photos, and selfie verification. A customer already verified by their bank must repeat the entire onboarding process when opening an e-wallet, telecom account, or microfinance loan.
- Customers spend time re-submitting documents and abandon onboarding flows.
- Organisations pay repeatedly for identity verification that has already been completed elsewhere.
- Regulators see identity assurance duplicated across disconnected systems.
The solution in one paragraph
Cross-Provider eKYC enables a customer verified at one organisation (the Provider, such as a bank) to share that verified identity with another organisation (the Requester, such as an e-wallet). The customer scans a QR code with the Provider's mobile app and taps Allow. Verified data then transfers directly from the Provider's systems to the Requester's systems over CamDX, the government's secure data exchange. Each payload is digitally signed so the Requester can verify its issuer and integrity, without any central party storing or reading personal data.
Each organisation deploys its own copy of the open-source sidecar beside its existing core systems rather than relying on a hosted central data store.
The customer journey (Mr. Somnang)
- Mr. Somnang taps Sign up in a new e-wallet (the Requester).
- The e-wallet redirects him to the shared Auth Portal, which displays a QR code.
- He scans the QR code with his bank's mobile app (the Provider), where he has already completed full KYC.
- The bank app displays who is requesting data and which fields are included. He taps Allow.
- The e-wallet receives his verified, signed profile directly from the bank over CamDX, verifies the signature, and pre-fills his registration form.
- He reviews and confirms his details to complete onboarding.
Participants and roles
| Participant | Description | Systems operated |
|---|---|---|
| Customer (data subject) | The person whose identity is shared; grants or denies consent | Uses the Provider's existing mobile app |
| Provider | An organisation that has already verified the customer (bank, MFI, telco) and shares verified data after consent | Core system, mobile app, and its own sidecar |
| Requester | An organisation onboarding the customer (e-wallet, insurer, fintech) that receives verified data | Core system and its own sidecar |
| Bidirectional member | An organisation acting as both Provider and Requester | A single sidecar deployment serving both roles |
| Auth Portal operator | Runs the central portal that displays the QR code and relays consent metadata; never receives personal data | The Auth Portal (one central instance per network) |
| CamDX | Cambodia Data Exchange; carries all organisation-to-organisation and sidecar-to-portal traffic | Each member operates a CamDX Security Server |
| CamDL | Cambodia's blockchain document layer; records hashes of invalidated attestations (termed revocation in OpenAttestation) | Operated nationally by TSC (which funds Provider wallets); each Provider deploys its own Document Store |
| Network governance | Admits members, defines tier rules, and handles disputes and suspensions | Auth Portal backoffice and member agreements |
Design principles
- Bilateral data residency. Only the Provider (as source) and the Requester (as chosen destination) hold readable personal data. The Auth Portal, CamDX, and CamDL handle only tokens, session metadata, or cryptographic hashes.
- Explicit customer consent. Every exchange begins with the customer scanning a QR code and approving a specific request in an app they already trust.
- Cryptographic verification. Every token and data package is digitally signed. Organisations publish public keys in DNS so recipients verify signatures without shared secrets.
- Data minimisation. Requests specify a data tier (T0 to T3). Fields above the approved tier are cryptographically obfuscated while preserving signature validity.
- Self-hosted and open source. Each member operates its own sidecar without vendor lock-in or a central database of customer identities.
- Mutual auditability. Both sides maintain an append-only transaction log containing no personal data.
Glossary
The two tokens (both are ES512-signed JWTs; neither contains personal data)
| Token | Issued by | Purpose | Lifetime |
|---|---|---|---|
| Login Token | Requester sidecar | Specifies the Requester, requested data tier, and callback URL; encoded directly in the Auth Portal's QR code | 15 minutes by default (REQUEST_TOKEN_EXPIRY_MINUTES) |
| Auth Token | Provider sidecar | Single-use proof of customer consent, bound to one Requester (aud) and one tier | 5 minutes, single use |
Other terms
| Term | Meaning |
|---|---|
| Sidecar | The open-source service deployed next to your core system to manage protocol tokens, signatures, encryption, CamDX routing, and audit logs. |
| Core system | Your existing backend (core banking, wallet platform, CRM) that calls your sidecar over its internal REST API. |
| Attestation | A signed digital document containing the customer's verified KYC data in the OpenAttestation format. Each field is salted and hashed into a Merkle tree so higher-tier fields can be hidden without invalidating the signature. |
| Data tier | The scope of shared KYC fields: T0 (basic identity) up to T3 (full identity with document images). See Data tiers. |
| Member code | Your organisation's CamDX identifier used for addressing across the exchange. |
| Issuer domain | The domain (for example ekyc.yourbank.com.kh) where you publish public keys in DNS and identify your sidecar in signed tokens. |
| Allowlist | The per-member list of enabled partners and authorised roles stored in your sidecar's database. |
Part B: Architecture
System overview
Each organisation owns and operates its own sidecar and PostgreSQL database. Shared infrastructure is limited to the Auth Portal (consent brokerage), CamDX (transport), public DNS (key discovery), and CamDL (revocation hashes).
Components
Sidecar server (apps/server)
A single Node.js (TypeScript, Express) service deployed by every member. One instance can act as Provider, Requester, or both depending on configuration and partner permissions.
| Area | Responsibility |
|---|---|
| Requester API | Issues login tokens, redeems auth tokens over CamDX, verifies and stores received attestations, checks attestation status. |
| Provider API | Verifies login tokens, creates signed attestations, issues auth tokens, serves data to authorised Requesters, invalidates attestations, and answers status queries. |
| Cryptography | ES512 signing and verification, AES-256-GCM encryption at rest, OpenAttestation wrapping, and tier-based field obfuscation. |
| Trust | DNS public-key discovery, partner allowlist enforcement, registered domain validation, and CamDX member-code checks. |
| Audit | Request/provide sessions, consent records, and an append-only transaction log. |
| Admin API | Partners, admin users, core-system API keys, statistics, attestation status views, and activity log. |
| API docs | Interactive OpenAPI reference at /reference. |
Sidecar backoffice (apps/web)
A Next.js web console for your operations team covering the dashboard, analytics, session and transaction logs, Attestations (invalidated attestations and CamDL publications), Received attestations, partner allowlist management, admin users, and user profile settings. See Part D.
Sidecar database
PostgreSQL, owned and hosted inside your network. Main tables:
| Table | Contents | Personal data? |
|---|---|---|
partners, partner_domains | Partner allowlist: code, EN/KH names, CamDX member code, roles, maximum tier, registered domains | No |
kyc_cache | Signed attestation per customer (Provider side) | Yes, encrypted (AES-256-GCM) |
kyc_blobs | Face and ID images split out of the attestation | Yes, encrypted (AES-256-GCM) |
consents | Customer reference, Requester, approved tier, grant time, revocation time | Customer reference ID only |
provide_sessions, request_sessions | State of each exchange on each side, including auth-token ID and expiry for single-use enforcement | Customer reference ID only |
transactions | Append-only audit and settlement log | No |
admins, admin_activities, service_api_keys | Backoffice staff accounts, activity audit log, and hashed core-system API keys | No (staff accounts only) |
Auth Portal (cross-provider-ekyc-auth-portal)
Operated centrally for the network and composed of three parts:
- Auth service (API): receives the Requester's login token (
POST /api/v1/auth-portal/intake), validates it against the Requester's DNS keys and member registry, creates a consent session, receives the Provider's consent and auth token (POST /api/v1/provider/consent), and exposes session verification (GET /api/v1/auth-portal/sessions/:id/verify). - Portal web app: the customer-facing page showing the QR code (encoding the login token), supported Providers, and Requester branding.
- Portal backoffice: member registration and approval, member types and roles, consent and request logs, and network-wide traffic dashboards.
Stored data consists strictly of session metadata (Requester, Provider, template or tier, status, expiry), consent decisions, and auth tokens with their hashes. It has no schema fields for personal data.
Partner core system and mobile app (built by you)
The sidecar complements rather than replaces your existing systems:
- Requester: add a sign-up option (such as "Verify with my bank"), redirect to the Auth Portal, handle the return callback, and call your sidecar to fetch the verified profile.
- Provider: add QR scanning and deep-link handling to your mobile app, render the consent screen with step-up authentication, and integrate your backend with the sidecar API.
CamDX
All sidecar-to-sidecar and sidecar-to-portal traffic routes through CamDX Security Servers, providing mutual TLS between members, message signing, member-code addressing, and exchange logging. Your sidecar connects to your own Security Server (CAMDX_SECURITY_SERVER) and addresses target members in the request path.
CamDL
Providers publishing on-chain status deploy an OpenAttestation Document Store on CamDL and record attestation invalidations (termed revocation in OpenAttestation) there. Each attestation embeds its Document Store address and chain metadata, so Requesters require no per-Provider store configuration. Issuance requires no on-chain transaction; only invalidation writes to CamDL, with TSC funding Provider wallets as chain owner.
Attestation status checks
Each attestation declares in its signed metadata which status checks it supports (camdl, camdx, both, or none), controlled on the Provider by ATTESTATION_STATUS_CHECKS. For CamDX checks, the Provider publishes a kyc-status-v1 service on its Security Server. A Requester sidecar runs the declared checks on demand and reports current, invalidated, unknown, or not_supported. Status checks are optional and never block sharing; unavailable checks report unknown, and attestations without status metadata report not_supported. Attestations do not expire and remain active until invalidated by the Provider.
Demo partner portal (eykc-web-portal)
A reference Next.js application supporting both modes (APP_MODE=PROVIDER or APP_MODE=REQUESTER) to demonstrate a working sidecar integration.
End-to-end protocol
The exchange has three stages and typically completes within a minute.
Stage 1: Initiate
The Requester's core system requests a login token from its sidecar, specifying the tier required and the callback URL.
If the Requester is not an active member or its signature fails verification, the Auth Portal rejects the request and does not display a QR code.
Stage 2: Consent and authorisation
The Provider's app must show the customer who is requesting data (the Requester's registered name and verified domain) and what will be shared (the tier and field list). This screen protects the customer against phishing (see Threat model summary).
Stage 3: Data retrieval and validation
Verified KYC data travels directly from the Provider's sidecar to the Requester's sidecar over CamDX. The Auth Portal never receives it.
Data tiers
The Requester requests a tier, the Provider's partner record caps the maximum tier it will serve (maxTier), and the customer approves the request. Before returning the attestation, the Provider sidecar obfuscates all fields above the approved tier; hidden fields are replaced with hashes so the Merkle root signature remains valid.
| Tier | Portal template | Fields shared |
|---|---|---|
| T0 | LOGIN | Phone number, first name, last name, document type, document ID |
| T1 | T1_KYC | T0 + email (optional), date of birth, gender, nationality, ID issue and expiry dates, place of birth, current address (village to province, with codes) |
| T2 | T2_KYC | T1 + face image (with SHA-256 integrity hash) |
| T3 | T3_KYC | T2 + ID document images (front and back) |
Tier definitions are set by network governance. The field lists above reflect the current code (
packages/dto/src/kyc.dto.tsandobfuscateForTier).
Session lifecycle (Provider side)
The Auth Portal tracks its own session states: CONSENT_PENDING, AUTHORIZED, CONSENT_REJECTED, and EXPIRED.
Part C: Data privacy and security
Privacy by design: bilateral data exchange
Personal data is held only by the Provider (as source) and the Requester (after consent), with no central identity store in between.
Who can see what
| Party | Customer's personal data | Attestation contents | Consent record | Metadata (who asked whom, when) |
|---|---|---|---|---|
| Customer | Yes (own record) | Yes (own record) | Yes | Shown in Provider app |
| Provider | Yes (source of truth) | Yes | Yes | Yes |
| Requester | Yes, only after consent, restricted to approved tier | Approved tier only | Own requests | Yes |
| Auth Portal operator | No | No | Consent decision | Yes |
| CamDX operator | No (encrypted and signed in transit) | No | No | Member codes and timestamps |
| CamDL | No | No (hash only) | No | No |
| Other network members | No | No | No | No |
Key protections
- No central identity database: customer PII is never stored on a central server.
- Reference-only tokens: tokens traversing the Auth Portal and customer browser contain only identifiers (
ref_id,consent_id, tier,iss_code,aud), never names, ID numbers, or images. - Consent-bound transfer: data transfers solely from the Provider's sidecar to the Requester's sidecar after customer approval, once per auth token, and truncated to the approved tier.
- Data residency: each member stores customer records inside its own infrastructure, supporting consent, data-minimisation, and data-residency requirements under Cambodia's data-protection framework and sector regulations (such as NBC circulars).
Encryption and signing in transit
Data in transit is protected by multiple independent transport and cryptographic controls:
| Control | Protects against |
|---|---|
| CamDX mutual TLS | Network eavesdropping and tampering |
| CamDX addressing and signing | Unauthorised callers and spoofed senders; the Provider verifies that X-Road-Client matches the Requester in the token |
| ES512 token signatures | Forged login or auth tokens (symmetric algorithms are rejected) |
| Requester signature on redemption | Redemption of an intercepted auth token without the Requester's private key |
| Single-use auth tokens (5 min) | Replay of captured tokens |
| OpenAttestation signature | Post-issuance tampering; provides cryptographic proof of the issuing Provider |
Internal traffic (core ↔ sidecar, backoffice ↔ sidecar) stays inside your private network; terminate TLS via a reverse proxy or service mesh according to your internal security standards.
Encryption at rest
On the Provider side, verified KYC payloads and images are encrypted before persistence.
| Item | Detail |
|---|---|
| Cipher | AES-256-GCM (authenticated encryption; ciphertext tampering fails decryption) |
| Key | PII_ENCRYPTION_KEY, exactly 32 UTF-8 bytes (256-bit), stored outside the database |
| IV / nonce | Random 12 bytes per record, stored alongside the ciphertext |
| Encrypted fields | Full attestation (kyc_cache.data) and split media (kyc_blobs.data) |
| Unencrypted metadata | Operational metadata only: customer reference ID, tier, timestamps, Merkle root hash, and audit logs |
| Invalidation | POST /kyc/invalidate marks the cached attestation invalidated and clears its encrypted payload and images; retained status rows hold no personal data |
| Requester copy | The Requester sidecar stores each received attestation encrypted with the same cipher and key until deleted via DELETE /kyc/{ekyc_ref} |
Operator security controls:
- Store
PII_ENCRYPTION_KEY,JWT_PRIVATE_KEY, and the attestation wallet in a secret manager (HashiCorp Vault, encrypted Kubernetes Secrets, or a cloud KMS); never bake secrets into images or commit them to Git. - Enable disk or tablespace encryption and encrypted backups for PostgreSQL.
- Separate database hosts and key-management boundaries so a database backup cannot be decrypted without access to the secret store.
- On the Requester side, handle persisted customer profiles under your existing KYC data-retention and security policy.
Identity and trust: DNS key discovery and allowlists
Members do not exchange pre-shared secrets. Each member publishes its public keys in DNS on its issuer domain:
| TXT record | Purpose | Example |
|---|---|---|
ekyc_pub=<base64 compressed P-521 point> | Verifies protocol JWTs and request signatures. Multiple records can coexist during key rotation. | ekyc_pub=AgFx… |
openatts a=dns-did; p=did:ethr:0x…#controller | Binds your domain to the wallet that signs attestations (OpenAttestation DNS-DID). | openatts a=dns-did; p=did:ethr:0xAbC…#controller |
Trust is enforced in layers:
- Network membership. The Auth Portal accepts requests only from members with status
ACTIVE. - Partner allowlist. Your sidecar interacts only with enabled partners in
partnersthat are authorised for the required role (isProviderorisRequester), up to their configuredmaxTier. - Cryptographic signature. Every JWT and resolve/status request must verify against a public key published on a domain registered to that partner.
- CamDX identity. The
X-Road-Clientmember code must match the partner record.
Consent and attestation invalidation
- Each approval creates a consent record capturing customer reference, Requester, tier, login-token reference, and timestamp.
- An auth token is bound to one consent, one Requester (
aud), and one tier. - A Provider invalidates a cached attestation (
POST /kyc/invalidate) whenever underlying verified customer information changes (for example, re-KYC or profile updates). Consent records and attestation lifecycles are managed independently. - Invalidation requires no Requester login token. Invalidate the active attestation before submitting a replacement; calling
kyc/submitwhile an active attestation exists returns409. - Attestations do not expire; each stays active until invalidated by its Provider.
- Requesters can query whether a received attestation remains valid (
GET /kyc/{ekyc_ref}/status) using the CamDL or CamDX checks declared in the attestation. Status checks are optional and never block sharing; unavailable checks returnunknown. - Check frequency and handling of
invalidated,unknown, andnot_supportedresults, as well as storage retention viaDELETE /kyc/{ekyc_ref}, are governed by the Requester's own compliance policy.
Threat model summary
| # | Threat | Primary mitigations |
|---|---|---|
| T1 | Forged login token | DNS-key signature verification, registered domain check, and partner allowlist (enabled, correct role) |
| T2 | Replayed auth token | Single-use enforcement, 5-minute expiry, and Requester request signature on redemption |
| T3 | Phishing portal or QR | Consent screen displays verified Requester identity; auth token is redeemable only by the named Requester |
| T4 | Provider issues inaccurate data | Signed OpenAttestation record provides non-repudiation; disputes handled under network governance |
| T5 | Network interception | CamDX mutual TLS and message signing; application-layer ES512 and OpenAttestation signatures |
| T6 | Private key compromise | DNS key rotation; disable partner immediately in the backoffice; store keys in a secret manager |
| T7 | DNS spoofing | DNSSEC required at onboarding |
| T8 | Unauthorised consent claim | Consent audit trail; customer step-up authentication before approval |
| T9 | Backoffice compromise | RBAC (super_admin, admin, editor, viewer); admin activity log; admin JWTs isolated from protocol keys |
| T10 | Database compromise | AES-256-GCM on all cached PII; encryption key stored outside the database |
| T11 | Audit log tampering | Append-only transaction logs on both sides, reconcilable via ref_id |
| T12 | Token leakage in logs | Short token lifetimes; single-use redemption; never log auth tokens or secrets |
Part D: Dashboards, transactions and audit
Two levels of visibility
| Console | Operated by | Scope |
|---|---|---|
| Sidecar backoffice | Each member | Own sessions, attestations, transactions, partner allowlist, and staff accounts |
| Auth Portal backoffice | Network operator | Member registry, consent and request logs, and network-wide traffic |
Neither console displays customer personal data.
Sidecar backoffice (your own dashboard)
| Page | Purpose |
|---|---|
| Dashboard | Summary counts for provided and requested sessions, success/failure totals, and recent activity (/admin/stats/dashboard) |
| Analytics | Time-series trends by direction, status, partner, and tier (/admin/stats/analytics) |
| Sessions | Exchange history filterable by direction (provided or requested), partner, status, and date, with per-session timelines and error codes (/admin/sessions, /admin/sessions/:direction/:id) |
| Attestations | Invalidated Provider attestations and CamDL revocation publication states (pending, confirmed, failed), with manual retry for failed publications (/admin/attestations/invalidated, /admin/camdl-publications) |
| Received attestations | Requester view of stored attestations and last recorded status without exposing PII (/admin/received-attestations) |
| Partners | Allowlist management: add, edit, enable/disable partners, set roles, maxTier, registered domains, and CamDX member code, plus Ping connectivity tests |
| Admin users | Staff accounts and role assignments |
| Profile | Self-service profile and password updates |
Admin API-only endpoints: API keys (/api/v1/admin/api-keys) and the Activity log (/api/v1/admin/activities) are managed through the Admin API rather than dedicated backoffice UI pages.
Roles: super_admin (full access including destructive actions), admin (users, API keys, activity log), editor (partners, retry failed CamDL publications), and viewer (read-only).
The transaction record
Every completed or failed exchange writes one row on each sidecar. Rows contain no personal data and support settlement and dispute reconciliation.
- Direction indicates whether your sidecar provided data to a partner or requested data from one.
- Billing:
billableandbilled_atsupport inter-member settlement by partner and tier. - Reconciliation: matching exchanges on both sides share the login-token reference (
ref_id) for cross-organisation audit. - Retention: retain transaction logs in accordance with your regulatory requirements (typically 5 to 7 years for financial institutions), archiving older records while keeping them queryable.
Auth Portal backoffice (network dashboard)
Operated by the network operator and governance body:
| Page | Contents |
|---|---|
| Dashboard | Network-wide metrics and charts covering Provider traffic and Requester traffic per member |
| Members | Organisation registry: create, review, approve (PENDING → ACTIVE), or suspend (SUSPENDED) members |
| Consents | Log of consent decisions (approved or rejected, method, Provider, timestamp) |
| Requests | Log of inbound Requester intakes and fetch status |
| Users | Portal staff accounts (ADMIN, MANAGER, VIEWER) |
| Configuration | Reference data for member types and member roles |
Part E: Implementation plan
This section outlines the end-to-end onboarding plan for an organisation joining the network. Indicative durations assume one integration team and existing or in-progress CamDX membership.
Onboarding timeline
| Phase | Objective | Typical effort | Exit criteria |
|---|---|---|---|
| 0 Prerequisites | Select roles and tiers; complete agreements | 1 week | Signed member agreement; named owners |
| 1 Registration | Register in the Auth Portal | 1–2 weeks (including approval) | Member status ACTIVE in Auth Portal |
| 2 Infrastructure | Provision host, PostgreSQL, network, and CamDX | 1 week | Host and database reachable; Security Server ready |
| 3 Keys and DNS | Generate keys and publish DNS TXT records | 2–3 days | Public TXT records resolve via dig |
| 4 Deploy | Deploy sidecar server and backoffice | 3–4 days | /health returns OK; admin sign-in works |
| 5 Allowlist | Configure and verify partner allowlist | 1–2 days | CamDX Ping succeeds for each partner |
| 6 Integration | Integrate core system (and mobile app for Providers) | 2–3 weeks | End-to-end UAT flow succeeds |
| 7 Testing | Complete functional, security, and partner testing | 1–2 weeks | Test checklist signed off |
| 8 Go-live | Cut over to production and enable monitoring | 1–2 weeks | Stable production traffic |
Phase 0: Prerequisites and decisions
Decisions
- Role: Provider, Requester, or both.
- Tiers: tiers to request (Requester) and maximum tier to serve (
maxTier, Provider). - Issuer domain: domain controlled by your organisation for DNS key publication (for example
ekyc.yourorg.com.kh), with DNSSEC enabled. - Hosting: on-premises, private cloud, or Kubernetes within your security perimeter.
- Owners: named business owner, technical lead, security contact, and support contact for registration.
Agreements and compliance
- Sign the network member agreement with the governance body.
- Obtain or confirm CamDX membership and your CamDX member code.
- Update privacy notices and consent copy (Providers: consent screen; Requesters: downstream processing notice).
- Complete a data protection impact assessment against the privacy architecture in Part C.
- Confirm sector-specific regulatory compliance (for example NBC for banks and MFIs, MPTC for telcos).
Phase 1: Register with the Auth Portal
Membership is managed centrally in the Auth Portal backoffice. Active registration makes your organisation selectable on the portal (as a Provider) and authorises your login tokens (as a Requester).
Information required for the member record:
| Group | Fields |
|---|---|
| Identity | Legal name, short name, member type, role (Requester, Provider, or bidirectional), registration number and date, tax ID, regulatory authority |
| Technical | CamDX member code, issuer domain (owner issuer, allowed issuer), OAuth/callback base URL, mobile deep-link scheme (Providers, used by the portal to open your app) |
| Branding | Organisation logo (displayed on the portal and consent screens) |
| Legal | Business and head-office address, website, privacy policy URL |
| Contacts | Primary, technical, and support contacts (name, email, phone) |
Exit: member status is ACTIVE, and you have the Auth Portal's CamDX member code (EKYC_AUTH_PORTAL_MEMBER_CODE) and base URL.
Phase 2: Provision infrastructure
| Requirement | Specification |
|---|---|
| Runtime | Docker or Kubernetes running Node.js 24 container images built from the sidecar repository |
| Sidecar | Starting baseline: 1 vCPU and 1 GB RAM per instance (~50 req/s); stateless for horizontal scaling |
| Backoffice | 0.5 vCPU, 512 MB RAM |
| Database | PostgreSQL 15 or later on a dedicated database with encrypted storage and backups |
| Network: inbound | Only from your CamDX Security Server to /api/v1/provider/kyc/resolve/*, /api/v1/provider/kyc/ping, and (if enabled) /api/v1/provider/kyc/status; never expose the sidecar to the public internet |
| Network: internal | Core system → sidecar API; staff VPN → backoffice |
| Network: outbound | Sidecar → CamDX Security Server; DNS resolution; CamDL RPC (optional, for Providers publishing or Requesters checking CamDL) |
| CamDL | Optional (Providers declaring camdl): deploy an OpenAttestation Document Store on CamDL with your attestation wallet holding the revocation role; TSC keeps the wallet funded |
| CamDX | Security Server configured with your member code; Providers publish resolve/t{0-3}, ping, and optionally kyc-status-v1 |
| Secrets | Secret store for JWT_PRIVATE_KEY, PII_ENCRYPTION_KEY, ADMIN_JWT_SECRET, wallet file and password, and database credentials |
| Observability | Centralised log collection; optional Sentry error reporting (SENTRY_DSN) |
Phase 3: Keys and DNS
You need three secrets and two public DNS records.
1. Protocol signing key (ES512, curve P-521)
# From the sidecar repository root
node scripts/generate-test-resources.js
# Prints: ---PRIVATE-PEM--- (→ JWT_PRIVATE_KEY, keep secret)
# ---PUBLIC-PEM---
# ---DNS-RECORD--- ekyc_pub=<base64> (→ publish in DNS)
Or with OpenSSL:
openssl ecparam -name secp521r1 -genkey -noout -out ekyc-private.pem
openssl ec -in ekyc-private.pem -pubout -out ekyc-public.pem
# The TXT value is the base64-encoded compressed EC point; generate-test-resources.js computes it directly.
2. Attestation wallet (signs OpenAttestation documents)
Create an Ethereum-style encrypted JSON keystore, mount it at WALLET_FILE_PATH, and set its password in WALLET_PASS. The wallet address becomes your DID: did:ethr:<address>.
3. PII encryption key
# Exactly 32 UTF-8 bytes
openssl rand -base64 48 | tr -dc 'A-Za-z0-9' | head -c 32; echo
4. Publish DNS TXT records on your issuer domain
ekyc.yourorg.com.kh. 300 IN TXT "ekyc_pub=AgFx...base64..."
ekyc.yourorg.com.kh. 300 IN TXT "openatts a=dns-did; p=did:ethr:0xYourWalletAddress#controller"
Verify propagation with dig +short TXT ekyc.yourorg.com.kh.
Back up the wallet, JWT_PRIVATE_KEY, and PII_ENCRYPTION_KEY securely. Losing the wallet prevents signing new attestations under your DID; losing PII_ENCRYPTION_KEY makes cached KYC data unrecoverable. Establish a key-rotation procedure: publish the new ekyc_pub alongside the existing record, switch the sidecar key, and remove the old record after DNS TTL expiry.
Phase 4: Deploy the sidecar
Obtain container images
git clone <SIDECAR_REPOSITORY_URL> cross-provider-ekyc-sidecar # repository URL from the network operator
cd cross-provider-ekyc-sidecar
docker build -f docker/Dockerfile.server -t ekyc-sidecar:<version> .
docker build -f docker/Dockerfile.web -t ekyc-sidecar-web:<version> .
Pre-built images are also published to the CamDX registry (for example registry.camdx.gov.kh/cross-ekyc/sidecar:<version>).
Configure (complete list in Environment variables):
NODE_ENV=production
SERVER_URL=https://sidecar.internal.yourorg.com.kh
CORS_ORIGIN=https://ekyc-admin.internal.yourorg.com.kh
DATABASE_HOST=... DATABASE_USER=... DATABASE_PASSWORD=... DATABASE_NAME=ekyc_sidecar
ISSUER=ekyc.yourorg.com.kh # your issuer domain (DNS TXT records live here)
ISS_CODE=YOURORG # your partner code as registered by partners
CAMDX_MEMBER_CODE=CAMBODIA/COM/<id>/<subsystem>
CAMDX_SECURITY_SERVER=https://camdx-ss.internal.yourorg.com.kh/r1
EKYC_AUTH_PORTAL_MEMBER_CODE=<from Phase 1>
JWT_PRIVATE_KEY=<from secret store>
PII_ENCRYPTION_KEY=<from secret store, exactly 32 UTF-8 bytes>
WALLET_FILE_PATH=/run/secrets/wallet.json
WALLET_PASS=<from secret store>
ADMIN_JWT_SECRET=<at least 32 random bytes, required in production>
INITIAL_ADMIN_EMAIL=admin@yourorg.com.kh
INITIAL_ADMIN_PASSWORD=<strong initial password, required on first boot>
Run (Docker Compose example):
services:
sidecar:
image: ekyc-sidecar:<version>
env_file: sidecar.env
volumes: ["./secrets/wallet.json:/run/secrets/wallet.json:ro"]
ports: ["127.0.0.1:3000:3000"] # internal only
restart: unless-stopped
backoffice:
image: ekyc-sidecar-web:<version>
environment:
- NEXT_PUBLIC_SERVER_URL=https://sidecar.internal.yourorg.com.kh
ports: ["127.0.0.1:3001:3000"] # internal only
restart: unless-stopped
For Kubernetes, adapt the manifests in deployment/providers/sidecar and deployment/requester/sidecar (Deployment, Service, ConfigMap, Secret), moving all sensitive values from ConfigMaps into Secrets.
Database migrations. The server runs pending migrations automatically on startup, then creates the initial admin user if admins is empty. Provision an empty PostgreSQL database beforehand. During rolling updates that introduce migrations, start one replica before scaling out.
Verify:
-
GET /healthreturnsOK. -
GET /referenceserves the OpenAPI reference (restrict access in production). - You can sign in to the backoffice with the initial admin (
INITIAL_ADMIN_EMAILandINITIAL_ADMIN_PASSWORD) and change its password. - You can obtain an admin JWT and create a core-system API key via the Admin API (
POST /api/v1/admin/api-keys), storing the secret in your core system's secret store (shown once at creation).
Phase 5: Configure the partner allowlist
In the backoffice, open Partners → Add partner for each partner organisation:
| Field | Value |
|---|---|
| Code | Partner's ISS_CODE (matches iss_code / aud in JWTs) |
| Name (EN / KH) | Display names |
| CamDX member code | Partner's CamDX member code |
| CamDX eKYC path | Optional subsystem path prepended only to Ping requests; resolve calls address {CamDX member code}/resolve/t{tier} directly |
| Roles | isProvider if you fetch from them; isRequester if you serve data to them |
| Max tier | Highest tier permitted for this partner |
| Domains | Partner's issuer domain(s), matching iss in their JWTs and their DNS-DID record |
Enable the partner and run Ping to verify CamDX connectivity. Disabling a partner takes effect immediately and blocks new exchanges.
Phase 6: Integrate your core system
All calls from your core system to your sidecar authenticate with x-api-key and x-api-secret headers.
Step-by-step instructions with code samples, error handling, and checklists: Integrate as a Requester and Integrate as a Provider. Full endpoint contracts: Sidecar API reference.
As a Requester
Step 1: Request a login token
POST /api/v1/requester/token/request
x-api-key: <key id>
x-api-secret: <secret>
Content-Type: application/json
{ "tier": 1, "callback": "https://wallet.example.com.kh/ekyc/callback", "callback_type": "web" }
{ "token": "eyJhbGciOiJFUzUxMiIs..." }
callback_type is web or mobile. The token expires after 15 minutes by default.
Step 2: Redirect the customer to the Auth Portal at {AUTH_PORTAL_URL}/login?token={login token} (portal URL supplied at registration). The portal validates the token and renders the QR code.
Step 3: Receive the auth token at your callback URL in the q query parameter ({callback}?q={auth token}). The portal redirects only upon approval. Treat the auth token as a credential: never log it, and redeem it immediately before its 5-minute expiry.
Step 4: Fetch the verified data
POST /api/v1/requester/kyc/fetch
x-api-key: <key id>
x-api-secret: <secret>
Content-Type: application/json
{ "auth_token": "eyJhbGciOiJFUzUxMiIs...", "tier": 1 }
The response contains the signed attestation (data), plain attested fields (attested), and an ekyc_ref. Your sidecar validates Merkle integrity, issuer signature, DNS identity, and registered domain before encrypting and storing the attestation under ekyc_ref. Present the fields to the customer for confirmation, then persist them under your KYC policy alongside data as evidence and ekyc_ref for future status checks.
Step 5 (optional): Check held attestations. Poll GET /api/v1/requester/kyc/{ekyc_ref}/status according to your compliance schedule. It returns current, invalidated, unknown, or not_supported, without blocking onboarding if a check is unreachable. On invalidated, prompt the customer to re-verify. Use GET /kyc/{ekyc_ref} to read a stored attestation and DELETE /kyc/{ekyc_ref} to purge it under your retention policy. See Integrate as a Requester, step 5.
Requester checklist
- Sign-up UI offers "Verify with Cross-Provider eKYC".
- Callback endpoint handles approval, denial, and token expiry.
- Fetch errors map to clear user messages ("try again", "consent expired").
- Signed attestation retained as evidence; customer records governed by your retention policy.
-
ekyc_refstored with the customer record; compliance policy defined for periodic status checks andinvalidated,unknown, andnot_supportedoutcomes. - Auth tokens and API secrets are never logged.
As a Provider
Step 1: Scan and verify. Your mobile app scans the QR code (or opens via deep link), and your backend verifies the login token:
POST /api/v1/provider/token/verify
x-api-key: <key id>
x-api-secret: <secret>
Content-Type: application/json
{ "token": "eyJhbGciOiJFUzUxMiIs..." }
{ "valid": true, "payload": { "iss": "ekyc.wallet.example.com.kh", "iss_code": "EWALLET", "tier": 1, "ref_id": "…", "exp": 1790000000 } }
Step 2: Display the consent screen. The screen must show:
- the Requester's registered name, logo, and verified issuer domain (
iss), - the requested tier and exact fields to be shared in plain language,
- Allow and Deny actions, enforcing step-up authentication (PIN or biometrics) before Allow.
Step 3a: First share for this customer, kyc/submit
POST /api/v1/provider/kyc/submit
x-api-key: <key id>
x-api-secret: <secret>
Content-Type: application/json
{
"tier": 1,
"user_id": "CIF-000123",
"login_token": "eyJhbGciOiJFUzUxMiIs...",
"data": { "user_info": {
"phone_number": "+85512345678", "first_name": "Somnang", "last_name": "Chan",
"document_type": "NID", "document_id": "123456789",
"dob": "1990-01-01", "gender": "M", "nationality": "KHM",
"issue_date": "2020-01-01", "expiry_date": "2030-01-01",
"place_of_birth": "Phnom Penh",
"current_address": { "village": "…", "village_code": "…", "commune": "…", "commune_code": "…",
"district": "…", "district_code": "…", "province": "…", "province_code": "…",
"country": "Cambodia", "country_code": "KHM", "postal_code": "…" }
} }
}
Submit only verified KYC data from your core records. Include base64 media for T2 (face_image, face_image_integrity_hash) and T3 (document_image, document_image_back).
Step 3b: Returning customer with an active attestation, kyc/authorize
{ "user_id": "CIF-000123", "attestation_ref": "<saved from first submit>", "tier": 1, "login_token": "eyJ..." }
tier is required and cannot exceed the cached attestation's tier.
Both endpoints return user_id, status (submitted or authorized), attestation_ref, and a signed auth_payload. The sidecar delivers the auth token to the Auth Portal over CamDX automatically; your core system stores attestation_ref.
Step 4: Serve Requesters. No additional backend code is required. Requesters call /api/v1/provider/kyc/resolve/t{0-3} via CamDX, and your sidecar enforces all checks automatically. Ensure resolve/t{0-3} and ping (plus kyc-status-v1 if enabled) are published on your Security Server.
Step 5: Invalidate stale data. Whenever verified KYC information changes in your core system (re-KYC or profile modification), invalidate the active attestation immediately. No share or login_token is required (login_token is optional and ignored):
POST /api/v1/provider/kyc/invalidate
{ "user_id": "CIF-000123", "attestation_ref": "…", "reason": "profile_updated" }
Call kyc/submit with updated KYC data on the customer's next share. Invalidate before submitting a replacement, as kyc/submit returns 409 while an active attestation exists. Attestations do not expire and remain active until invalidated. See Integrate as a Provider, step 6.
Step 6 (optional): Offer status checks. Set ATTESTATION_STATUS_CHECKS (none, camdl, camdx, or camdl,camdx) to declare supported status checks on new attestations. camdl requires a Document Store on CamDL; camdx requires publishing kyc-status-v1 on your Security Server. See Integrate as a Provider, step 7.
Provider checklist
- QR scanner and deep-link handler implemented in mobile app.
- Consent screen displays verified Requester identity, requested fields, and step-up authentication.
-
attestation_refstored per customer;submitvsauthorizerouted accurately. - Verified-data updates call
kyc/invalidateimmediately, before any subsequentkyc/submit. - Only verified KYC records transmitted; images comply with size and format constraints.
-
/kyc/resolve/*and/kyc/ping(and/kyc/statusifcamdxchecks are enabled) published on CamDX; no other endpoints exposed externally.
Phase 7: Test and certify
Environments
| Stage | Setup |
|---|---|
| Local | Root docker-compose.yaml launches the local stack (auth service 4000, portal 4001, portal backoffice 4002, demo portals 4010 and 4011, sidecars 4020 and 4021, sidecar backoffices 4030 and 4031) with MockServer simulating CamDX. |
| Integration | Your sidecar connected to the network's UAT Auth Portal and a partner's UAT sidecar over CamDX test. |
| Pre-production | Production configuration with production keys and test customer records. |
Test checklist
| Area | Case | Expected |
|---|---|---|
| Happy path | T0, T1, T2, T3 end to end | Requester receives strictly the approved tier's fields |
| Consent | Customer taps Deny | No auth token issued; no data shared |
| Expiry | Scan login token after 15 minutes | Token rejected |
| Expiry | Redeem auth token after 5 minutes | Rejected |
| Replay | Redeem the same auth token twice | Second attempt rejected |
| Tier | Request a higher tier than approved | Rejected |
| Trust | Partner disabled in allowlist | Verify, fetch, and resolve rejected |
| Trust | Wrong or missing DNS key | Signature verification fails |
| Trust | Mismatched CamDX member code | Rejected |
| Privacy | Inspect Auth Portal DB/logs and CamDX logs | No personal data present |
| Privacy | Inspect kyc_cache and kyc_blobs | Ciphertext only |
| Privacy | Inspect sidecar logs | No tokens, secrets, or PII |
| Audit | Completed and failed exchanges | Matching transaction rows on both sides sharing ref_id |
| Resilience | CamDX or partner unreachable | Clear error returned; customer can retry |
| Invalidation | Invalidate, then submit replacement | Superseded attestation_ref rejected by authorize and resolve; replacement ref issued; submit before invalidate returns 409 |
| Status | Query ekyc_ref status before and after invalidation | current, then invalidated; attestations without status metadata return not_supported; unavailable CamDL or CamDX returns unknown without throwing |
Certification: submit test evidence to the network operator before production activation.
Phase 8: Go-live and operations
Production readiness checklist
- Production keys generated in a controlled environment; DNS TXT records published; DNSSEC enabled.
- All secrets stored in a secret manager (
JWT_PRIVATE_KEY,PII_ENCRYPTION_KEY, attestation wallet,ADMIN_JWT_SECRET, database password). -
NODE_ENV=productionandCAMDX_SECURITY_SERVERconfigured for the production Security Server. - Sidecar reachable only from your core system and your CamDX Security Server.
- Backoffice placed behind VPN or SSO; initial admin password rotated and unneeded accounts removed; RBAC roles assigned by least privilege.
- PostgreSQL backups encrypted and restore-tested; key backups stored separately.
- Monitoring and alerting configured for
/health, error rates by partner, latency, and CamDX failures. - Log and audit retention periods aligned with regulatory obligations.
- Operational runbooks documented for key rotation, partner suspension, incident response, and data-subject requests.
Operating targets (baseline)
| Metric | Target |
|---|---|
| Token verification | < 200 ms p95 (warm DNS cache) |
| KYC submit (without images) | < 1 s p95 |
| End-to-end fetch | < 3 s p95 (including one CamDX round trip) |
| Availability | Aligned with core system SLA; stateless sidecar with 2+ replicas |
Routine operations
| Task | Frequency | Where |
|---|---|---|
| Review failed sessions and error codes | Daily | Backoffice → Sessions |
| Reconcile transactions with partners and billing | Monthly | Backoffice → Analytics / Sessions |
| Review admin activity log | Monthly | Admin API (GET /api/v1/admin/activities) |
| Review partner allowlist and tiers | Quarterly | Backoffice → Partners |
| Rotate core-system API keys | Every 6–12 months | Admin API (/api/v1/admin/api-keys) |
| Rotate signing keys | Annually or on incident | DNS + secret store |
| Upgrade sidecar release | Each release | Deployment pipeline |
Responsibilities (RACI)
| Activity | Member org | Network operator | CamDX | Governance body |
|---|---|---|---|---|
| Member agreement and admission | R | C | – | A |
| Member registration in Auth Portal | R | A | – | C |
| CamDX membership and Security Server | R | – | A | – |
| Sidecar hosting, keys, database, backups | A/R | – | – | – |
| Partner allowlist in own sidecar | A/R | – | – | C |
| Consent UX (Providers) | A/R | C | – | C |
| Auth Portal operation | – | A/R | – | C |
| Member security incident | R | R | C | A |
| Sidecar software releases | C | A/R (maintainers) | – | – |
(R = responsible, A = accountable, C = consulted)
Part F: Reference
API summary
| Method and path | Caller | Auth | Purpose |
|---|---|---|---|
POST /api/v1/requester/token/request | Requester core | API key | Issue a login token |
POST /api/v1/requester/kyc/fetch | Requester core | API key | Redeem an auth token and return verified KYC data |
POST /api/v1/provider/token/verify | Provider core | API key | Verify a login token before displaying consent |
POST /api/v1/provider/kyc/submit | Provider core | API key | New customer: attest, encrypt, store, and issue auth token |
POST /api/v1/provider/kyc/authorize | Provider core | API key | Returning customer: issue auth token for cached attestation |
POST /api/v1/provider/kyc/invalidate | Provider core | API key | Invalidate cached attestation and clear encrypted payload (login_token optional and ignored) |
POST /api/v1/provider/kyc/status | Requester sidecar via CamDX | Request signature + CamDX | Status service kyc-status-v1: returns current, invalidated, or not_found |
GET /api/v1/requester/kyc/{ekyc_ref} | Requester core | API key | Retrieve a stored attestation |
GET /api/v1/requester/kyc/{ekyc_ref}/status | Requester core | API key | Check whether a stored attestation has been invalidated |
DELETE /api/v1/requester/kyc/{ekyc_ref} | Requester core | API key | Delete a stored attestation |
GET /api/v1/provider/kyc/ping | Partner sidecar via CamDX | CamDX | Connectivity test |
POST /api/v1/provider/kyc/resolve/t{0-3} | Requester sidecar via CamDX | Signature + CamDX | Deliver tier-scoped attestation (single use) |
/api/v1/admin/* | Backoffice / scripts | Admin JWT + role | Partners, users, API keys, sessions, attestations, stats, activity |
GET /health | Monitoring | None | Liveness probe |
GET /reference | Developers | None (restrict) | Interactive OpenAPI documentation |
Environment variables
| Variable | Required | Description |
|---|---|---|
NODE_ENV | Yes | Set to production in production |
NODE_PORT | No | Listen port (default 3000) |
SERVER_URL | Yes | Internal base URL of this sidecar (used in the OpenAPI document) |
CORS_ORIGIN | Yes | Allowed origin for the sidecar backoffice |
LOG_LEVEL, TZ | No | Defaults info, UTC |
DATABASE_HOST, _PORT, _USER, _PASSWORD, _NAME | Yes | PostgreSQL connection settings |
ISSUER | Yes | Issuer domain hosting DNS TXT records |
ISS_CODE | Yes | Partner code as registered by other members |
CAMDX_MEMBER_CODE | Yes | Organisation CamDX member code |
CAMDX_SECURITY_SERVER | Yes | Base URL of your CamDX Security Server |
EKYC_AUTH_PORTAL_MEMBER_CODE | Providers | Auth Portal's CamDX member code |
JWT_PRIVATE_KEY | Yes | EC P-521 private key in PEM format |
PII_ENCRYPTION_KEY | Yes | Exactly 32 UTF-8 bytes (AES-256-GCM key) |
WALLET_FILE_PATH, WALLET_PASS | Yes (production) | Encrypted attestation-signing keystore path and password |
ADMIN_JWT_SECRET | Yes (production) | Backoffice session signing secret (at least 32 bytes required in production) |
REQUEST_TOKEN_EXPIRY_MINUTES | No | Login token lifetime in minutes (default 15) |
ATTESTATION_STATUS_CHECKS | No | Provider: checks declared on new attestations (none default, camdl, camdx, or camdl,camdx) |
DOCUMENT_STORE_ADDRESS, RPC_URL, CAMDL_CHAIN_ID | With camdl | Provider: CamDL Document Store, RPC URL, and chain ID for revocation. Requester: RPC_URL and CAMDL_CHAIN_ID enable CamDL verification |
SENTRY_DSN (+ SENTRY_*) | No | Optional Sentry error reporting |
INITIAL_ADMIN_EMAIL, INITIAL_ADMIN_PASSWORD | First boot | Bootstrap super_admin credentials when admins is empty (INITIAL_ADMIN_PASSWORD required in all environments; INITIAL_ADMIN_EMAIL required in production) |
Additional status check variables (
CAMDL_CHAIN_NAME,CAMDX_STATUS_SERVICE_CODE,STATUS_CHECK_TIMEOUT_MS, andCAMDL_PUBLICATION_*) use sensible defaults. See Sidecar API reference, status check variables.
API_KEYandAPI_SECRET(optional) define a static core-system API key checked before database-backed keys; leave them unset in production.EXCHANGE_MODEandEKYC_PORTALare not read; all inter-member routing usesCAMDX_SECURITY_SERVER. Full table with defaults: Sidecar API reference, environment variables.
Frequently asked questions
Does the Auth Portal or the government see our customers' data? No. The Auth Portal handles tokens and session metadata only. CamDX carries encrypted, signed traffic and logs only member metadata. CamDL stores revocation hashes. See Who can see what.
Do we need to change our core KYC verification process? No. Providers share data they have already verified, and Requesters gain a supplementary onboarding channel alongside existing KYC flows.
Can we be both a Provider and a Requester? Yes, using a single sidecar instance with both roles enabled in your registration and partner allowlists.
What happens if CamDX is unavailable? The fetch fails with a clear error and the customer can retry within the active token lifetimes, without duplicating or losing data.
Who is liable if a Provider shares inaccurate data? The signed attestation cryptographically identifies the issuing Provider. Liability and dispute resolution are governed by the member agreement.
How do customers withdraw consent? Customers contact the Provider through the Provider's support channels according to its consent-withdrawal procedures.
Where are the source code and API reference?
Obtain the sidecar repository URL from the network operator, and access /reference on any running sidecar instance.
Related documents
- Integration Quick-start (condensed overview)
- Set up the sidecar, Integrate as a Requester, Integrate as a Provider (implementation guides)
- Sidecar API reference and Troubleshooting