Powered by Nimbus-Key API Docs
Development

API Documentation Portal

Central hub where teams browse OpenAPI contracts, explore endpoints, and access integration and testing guides.

docs-api-dev.nimbus-id.com
CONTRACTS
YAML specs
β†’
DOCS
This portal
β†’
QA
Validation

API Gateway v2

Handshake, encrypted proxy, and route allowlist.

Dynamic Key v2

Key Management v2

QR generation, reverse QR state, PIN consume, and login resolution.

QR API

Web SDK

TypeScript client for Dynamic Key V2 handshake and encrypted proxy.

v0.1.3

Authentication

Login, users, roles, and session management.

Coming soon

QR Flows

End-to-end QR login and device linking workflows.

Coming soon
β„Ή
Centralized documentation portal β€” OpenAPI contracts in contracts/ are served independently from application runtimes. Use the API selector above to switch between specifications.

Dynamic Key V2

End-to-end encryption protocol that replaces the shared-secret handshake (v1). Uses ECDH P-256, HKDF-SHA256, and AES-256-GCM.

⚠
Dynamic Key v1 remains active on POST /api/info. Requests without X-Dynamic-Key-Version: 2 do not enter the v2 flow.

Integration flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” POST /api/info/v2 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Client β”‚ ─────────────────────────► β”‚ Gateway β”‚ β”‚ (Web/Mobile)β”‚ ◄───────────────────────── β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ serverPublicKey, token β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ Derive sessionKey (ECDH + HKDF) β”‚ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” POST /api/request/v2 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Encrypt β”‚ ─────────────────────────► β”‚ Decrypt β”‚ β”‚ {nonce,data}β”‚ ◄───────────────────────── β”‚ β†’ upstream β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ encrypted response β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Required headers

HeaderHandshakeEncrypted request
X-Dynamic-Key-Version: 2βœ“βœ“
X-Session-Idβ€”βœ“
Authorization: Bearerβ€”βœ“
Content-Type: application/jsonβœ“βœ“

Handshake β€” POST /api/info/v2

{
  "clientPublicKey": "BASE64_SPKI_EPHEMERAL_KEY",
  "device": {
    "id": "browser-uuid-v4",
    "platform": "browser"
  },
  "client": {
    "type": "internal",
    "clientId": "internal-web-client"
  }
}

Response

{
  "serverPublicKey": "...",
  "sessionId": "opaque-session-id",
  "token": "jwt",
  "expireToken": 0,
  "expiresAt": "2026-06-04T00:00:00.000Z"
}

Encrypted request β€” POST /api/request/v2

Internal plaintext describes the upstream route:

{
  "method": "GET",
  "path": "/countries/get",
  "headers": {},
  "query": {},
  "body": null
}

Sent encrypted as an envelope:

{
  "nonce": "base64-12-unique-bytes",
  "data": "base64(ciphertext || authTag)"
}

Route allowlist

Only routes explicitly allowed in the gateway can be proxied via v2:

  • POST /users/login
  • GET /users/getbyid/:id
  • GET /qr/get/reverse/:BFP
  • GET /companies/getbyid/:idCompany
  • GET /countries/get, /lang/get, etc.
πŸ“„
Full spec: contracts/api-gateway-v2.yaml β€” QA: qa/dynamic-key-v2.md β€” Web SDK: @nimbus/sdk-web

Web SDK β€” @nimbus/sdk-web

TypeScript reference client for Dynamic Key V2 in browsers. Handles handshake, session derivation, encryption, and protected requests against API Gateway v2.

v0.1.3 β€” published to AWS CodeArtifact as @nimbus/sdk-web

β„Ή
Package path: sdk/nimbus-sdk-web-v2. Remains independent from application UI β€” consume via a thin adapter behind VITE_API_SECURITY_MODE=v2.

Responsibilities

  • Dynamic Key V2 handshake (POST /api/info/v2)
  • ECDH P-256 + HKDF-SHA256 session key derivation
  • AES-256-GCM encrypt/decrypt for proxy envelopes
  • Protected request client (POST /api/request/v2)
  • Optional session storage adapter (NIM-944)

Install from CodeArtifact

aws codeartifact login \
  --tool npm \
  --repository nimbus-sdk-web-v2 \
  --domain nimbus \
  --domain-owner $AWS_ACCOUNT_ID

npm install @nimbus/sdk-web

Install from monorepo

cd sdk/nimbus-sdk-web-v2
npm install
npm run build

Configuration

FieldDescription
gatewayBaseUrlGateway origin for the selected environment
client.typeinternal or external
client.clientIdAllowlisted client ID on the gateway
device.idBrowser or device instance ID
device.platforme.g. browser
fetcherOptional custom fetch for tests or Node scripts
sessionStorageOptional DynamicKeySessionStorage adapter

Trailing slashes on gatewayBaseUrl are stripped automatically.

Session lifecycle

  1. Reuse in-memory session when not expired.
  2. Try sessionStorage.load() when an adapter is configured.
  3. Perform a fresh handshake via POST /api/info/v2.
  4. Persist session through sessionStorage.save() after handshake (when adapter supports it).

Basic usage

import { SecureApiClient } from '@nimbus/sdk-web';

const client = new SecureApiClient({
  gatewayBaseUrl: 'https://apiauthdev.nimbus-id.com',
  client: { type: 'internal', clientId: 'internal-web-client' },
  device: { id: 'browser-or-device-id', platform: 'browser' },
});

await client.ensureSession();

const data = await client.protectedRequest({
  request: {
    method: 'GET',
    path: '/qr/get/reverse/example-bfp',
    query: {},
    body: {},
    headers: {},
  },
});

Public API

  • SecureApiClient β€” recommended entry point
  • DynamicKeyClient β€” handshake only
  • encryptJson / decryptJson β€” low-level crypto
  • NimbusSdkError + SDK_ERROR β€” typed errors
  • EncryptedSessionStorage β€” storage scaffold (NIM-944, persistence pending)
  • createDynamicKeyV2Aad β€” AAD helper for v2:{sessionId}
⚠
EncryptedSessionStorage load()/save() throw NIMBUS_SDK_STORAGE_UNAVAILABLE until NSSS root-key encryption ships. The SDK re-handshakes when restore is unavailable.

Compatible frontend stacks

The SDK is framework-agnostic. It only requires a browser runtime with Web Crypto API and fetch.

StackIntegration pattern
AngularInjectable service wrapping SecureApiClient
IonicSame Angular service pattern (Capacitor / Cordova WebView)
React / Next.jsSingleton client + custom hook or context provider
Vue / NuxtComposable (useSecureApiClient) or plugin
Svelte / SvelteKitModule store or onMount session bootstrap
Vanilla TS / JSDirect SecureApiClient usage in app bootstrap

Not supported: server-side rendering without a browser crypto.subtle context. Run the SDK in the client bundle only.

Frontend integration

  1. Install @nimbus/sdk-web from CodeArtifact or build from the monorepo.
  2. Wrap SecureApiClient in a framework-specific adapter (service, hook, composable).
  3. Gate legacy V1 vs V2 with an environment flag (e.g. VITE_API_SECURITY_MODE).
  4. Call ensureSession() on app start or before protected calls.
  5. Route business API calls through protectedRequest() β€” never call microservice URLs directly.

Examples

Angular service

import { SecureApiClient } from '@nimbus/sdk-web';

@Injectable({ providedIn: 'root' })
export class ApiClientV2Service {
  private client = new SecureApiClient({
    gatewayBaseUrl: environment.gatewayUrl,
    client: { type: 'internal', clientId: environment.clientId },
    device: { id: this.deviceId, platform: 'browser' },
  });

  async getQrReverse(bfp: string) {
    await this.client.ensureSession();
    return this.client.protectedRequest({
      request: {
        method: 'GET',
        path: `/qr/get/reverse/${bfp}`,
        query: {},
        body: {},
        headers: {},
      },
    });
  }
}

React hook

import { useCallback, useMemo } from 'react';
import { SecureApiClient } from '@nimbus/sdk-web';

function createClient() {
  return new SecureApiClient({
    gatewayBaseUrl: import.meta.env.VITE_GATEWAY_URL,
    client: { type: 'internal', clientId: import.meta.env.VITE_CLIENT_ID },
    device: { id: getDeviceId(), platform: 'browser' },
  });
}

export function useSecureApi() {
  const client = useMemo(() => createClient(), []);

  const getQrReverse = useCallback(async (bfp: string) => {
    await client.ensureSession();
    return client.protectedRequest({
      request: {
        method: 'GET',
        path: `/qr/get/reverse/${bfp}`,
        query: {},
        body: {},
        headers: {},
      },
    });
  }, [client]);

  return { getQrReverse };
}

Security considerations

  • Do not persist ephemeral ECDH private keys across page reloads.
  • Rotate the session on logout or when expiresAt is reached.
  • Use a unique nonce per request β€” the SDK handles this per call.
  • Do not log tokens, session keys, or envelopes in production.

Local smoke test

Start API Gateway V2 locally, then run:

cd sdk/nimbus-sdk-web-v2
GATEWAY_URL=https://localhost:3072 npm run smoke:local

Related documentation

  • qa/sdk-web-v2.md β€” integration reference
  • qa/dynamic-key-v2.md β€” protocol QA cases
  • contracts/api-gateway-v2.yaml β€” wire contract

Mobile Guide (iOS / Android)

Native app flow with QR, device binding, and Dynamic Key v2.

Device identification

{
  "device": {
    "id": "installation-uuid",
    "platform": "ios" | "android"
  }
}

Typical flow

  1. v2 handshake when the app opens (or when refreshing the token).
  2. Login via encrypted /users/login on the allowlist.
  3. QR: GET /qr/get/reverse/:BFP to link the device.
  4. Include the device header on legacy routes that require it.

Suggested libraries

  • iOS: CryptoKit (P-256), Security framework.
  • Android: KeyPairGenerator EC + Cipher AES-GCM.

Offline / reconnection

If expiresAt has expired, repeat the handshake before any encrypted request. Do not cache encrypted responses without validating integrity (GCM auth tag).

Backend Guide

Server-to-server integration and external SDK for partners.

External client (SDK)

{
  "client": {
    "type": "external",
    "clientId": "partner-acme-corp"
  },
  "device": {
    "id": "server-instance-id",
    "platform": "server"
  }
}

Allowlist and restrictions

external clients only access explicitly enabled routes. Any other route returns DYNAMIC_KEY_V2_ROUTE_NOT_ALLOWED.

Downstream microservices

The gateway decrypts, validates the allowlist, and forwards to internal services (Auth, QR, etc.). Microservices do not implement Dynamic Key β€” they receive normal HTTP requests from the gateway.

Required configuration

  • JWT_SECRET from Store Keys (/getKeys).
  • Service URL variables (AUTH_SERVICES_URL, etc.).
  • Logs with safeErrorLog β€” do not expose secrets.

QA Guide

Practical layer to validate that OpenAPI contracts work at runtime. Full reference in qa/.

What to test on /api/info/v2

CaseExpected
Valid handshake with correct SPKI200 + sessionId + token
Missing X-Dynamic-Key-Version header400 DYNAMIC_KEY_V2_MISSING_VERSION
Invalid clientPublicKey400 DYNAMIC_KEY_V2_INVALID_PUBLIC_KEY

What to test on /api/request/v2

CaseExpected
Encrypted GET /countries/get200 + encrypted envelope
Encrypted POST /users/login200 or 401 depending on credentials
Route outside allowlist404 DYNAMIC_KEY_V2_ROUTE_NOT_ALLOWED
Repeated nonce400 encryption error
Invalid / expired token401 or 400
Invalid session400

Release checklist

  • ☐ Spec published and versioned in contracts/
  • ☐ Smoke test per category (Auth, QR, Companies, Catalogs)
  • ☐ Negative cases: nonce, token, route, session
  • ☐ Sanitized examples (no real passwords)
  • ☐ Portal points to the correct environment

Reference files

  • qa/dynamic-key-v2.md β€” handshake and proxy
  • qa/sdk-web-v2.md β€” Web SDK integration
  • qa/critical-routes.md β€” P0/P1 routes
  • qa/error-cases.md β€” error catalog

Authentication

Documentation for login, user management, roles, and session APIs will be published here as microservice contracts are onboarded to the portal.

β„Ή
Authentication endpoints are currently proxied through API Gateway v2 allowlisted routes. Use the API Gateway spec and Dynamic Key V2 guide until the dedicated Authentication section is available.

Key Management

Extended guides for key lifecycle, secrets store integration, and cryptographic key operations will be added here.

β„Ή
The Key Management v2 OpenAPI spec (QR endpoints) is already available in the API selector. This section will expand with operational guides and non-QR key management topics.

QR Flows

End-to-end QR login, reverse QR, device linking, and mobile-to-web handoff workflows will be documented here with sequence diagrams and integration checklists.

β„Ή
QR endpoint contracts are available under Key Management v2 in the API selector. Explore the QR flow steps in each endpoint's detail view.

DOCS / CONTRACTS / QA Architecture

How the three Nimbus documentation layers relate.

CONTRACTS β€” OpenAPI Specs

YAML files that define the real technical contract. Swagger reads them to render endpoints, schemas, and examples.

contracts/
β”œβ”€β”€ api-gateway-v2.yaml      ← microservice-apigateway-v2
β”œβ”€β”€ key-management-v2.yaml   ← microservice-key-management-v2
└── upcoming/                ← future service specs

sdk/nimbus-sdk-web-v2        ← @nimbus/sdk-web (client library)

DOCS β€” Developer Portal

This centralized portal. API spec selector, environment selector, Swagger UI, guides, and Dynamic Key v2 documentation β€” decoupled from application runtimes.

docs-api-dev.nimbus-id.com   β†’ development
docs-api-stg.nimbus-id.com   β†’ staging
docs-api.nimbus-id.com       β†’ production

QA β€” QA Reference

Practical guides: critical routes, headers, positive/negative cases, checklists.

Linked from specs via x-qa-ref.

DevSecOps pipeline (target)

Developer ──► contracts/*.yaml ──► CI (spectral lint) β”‚ β–Ό Portal (S3/CF) ◄── auto-publish β”‚ β–Ό QA runs checklist ──► release

Summary

  • DOCS = where you view it
  • CONTRACTS = what defines the API
  • QA = how you test it