From an API key to a verified presentation.

The SDK signs, derives and proves locally with the same code the API verifies. Configure the API for platform calls, a network for on-chain calls, and the Node entry for in-process post-quantum keys.

Installation

Node.js 20.19 or later, or any modern browser. The proof engine's two libraries are optional peers.
shell
npm install @quantlayer-protocol/sdk
shell, local proving only
npm install @aztec-foundation/bb.js@6.0.0 @noir-lang/noir_js@1.0.0

Quickstart

Create a project and a scoped API key in the developer console, then issue and present a credential.
issuer.ts
const issuer = await quantlayer.credentials.registerIssuer({
  algorithm: 'ML-DSA-65',
  credentialTypes: ['quantlayer:KycVerification'],
});

const { holderCredential } = await quantlayer.credentials.issue(issuer.id, {
  type: 'quantlayer:KycVerification',
  typeVersion: 1,
  subject: holderDid,
  claims: { level: 'enhanced', country: 'DE' },
  disclosurePolicy: { required: ['level'], optional: ['country'] },
  evidence: { source: 'source:kyc-provider', reference: 'case-123' },
  expiresAt: new Date(Date.now() + 30 * 86_400_000),
});
holder-and-verifier.ts
// Holder: verify the issuer's ML-DSA signature locally, then reveal one optional claim.
const held = await quantlayer.credentials.accept(holderCredential, holderDid);
const presentation = await quantlayer.credentials.present({
  credential: held,
  holder: holderDid,
  signer,
  reveal: ['country'],
  audience: 'shop.example.com',
  nonce,
});

// Verifier
const result = await quantlayer.credentials.verifyPresentation({
  presentation,
  audience: 'shop.example.com',
  nonce,
});

TypeScript SDK

One client, ten modules, three entry points.
@quantlayer-protocol/sdk
Client, all modules, protocol building blocks, Ed25519 signers. ESM and CommonJS, browser-safe.
@quantlayer-protocol/sdk/zk
The Noir and Barretenberg (UltraHonk) engine, native or WASM.
@quantlayer-protocol/sdk/node
Native post-quantum keys and verification, and the shipped circuit artifacts.
SDK reference

API overview

Authentication
Project API keys (quantlayer_sk_…) with scopes for protocol routes; wallet sessions for projects and keys.
Format
JSON over HTTPS, base64url for bytes, ISO 8601 for times, structured errors with a request id.
Specification
OpenAPI 3.1, served at /openapi.json.
API reference

Smart contracts

Addresses come only from deployment records and are checked against their bytecode fingerprint before the SDK calls them.
contracts.ts
const status = await quantlayer.contracts.read(
  'QuantLayerCredentialRegistry',
  'credentialStatus',
  [issuerId, credentialIdHash],
);

Network integration

Pass your own RPC provider; the client refuses an endpoint that serves another chain.
NetworkChain IDEnvironmentExplorerQuantLayer contracts
Arbitrum OnePrimary network42161Mainnetarbiscan.ioNot deployed
Arbitrum SepoliaPrimary network421614Testnetsepolia.arbiscan.ioDeployed
Robinhood ChainSecondary network4663Mainnetrobinhoodchain.blockscout.comNot deployed
Robinhood Chain TestnetSecondary network46630Testnetexplorer.testnet.chain.robinhood.comNot deployed

Error handling

Every error is a QuantLayerSdkError with a kind. Only requests that are safe to repeat are retried.
errors.ts
import { isQuantLayerSdkError } from '@quantlayer-protocol/sdk';

try {
  await quantlayer.identity.resolve(did);
} catch (error) {
  if (isQuantLayerSdkError(error)) {
    // kind: validation | api | transport | compatibility | configuration | protocol
    console.error(error.kind, error.status, error.reason, error.requestId);
  }
}