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.
npm install @quantlayer-protocol/sdknpm install @aztec-foundation/bb.js@6.0.0 @noir-lang/noir_js@1.0.0Quickstart
Create a project and a scoped API key in the developer console, then issue and present a credential.
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: 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.
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.
Smart contracts
Addresses come only from deployment records and are checked against their bytecode fingerprint before the SDK calls them.
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.
| Network | Chain ID | Environment | Explorer | QuantLayer contracts |
|---|---|---|---|---|
| Arbitrum One | 42161 | Mainnet | arbiscan.io | Not deployed |
| Arbitrum Sepolia | 421614 | Testnet | sepolia.arbiscan.io | Deployed |
| Robinhood Chain | 4663 | Mainnet | robinhoodchain.blockscout.com | Not deployed |
| Robinhood Chain Testnet | 46630 | Testnet | explorer.testnet.chain.robinhood.com | Not deployed |
Error handling
Every error is a QuantLayerSdkError with a kind. Only requests that are safe to repeat are retried.
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);
}
}