@verifyx/kyc-sdk
v0.1.0
Published
VerifyX KYC SDK for browser (web) and Node.js clients.
Downloads
6
Maintainers
Readme
VerifyX KYC SDK (JS/TS)
Ready for publish to npm (scoped). Use in browsers (publishable key) and Node/Edge (secret key).
Install
npm install @verifyx/kyc-sdkQuick start
import kyc from '@verifyx/kyc-sdk';
kyc.init({
env: 'sandbox', // or pass baseUrl: 'https://api.yourdomain.com/api'
publishableKey: 'pk_test_123', // browser flows
secretKey: 'sk_test_123', // server flows
});
// Server-side start (secret key)
const session = await kyc.startSession({
docTypes: ['passport'],
requireSelfie: true,
secretKey: 'sk_test_123', // or rely on init()
});
// Browser upload (publishable key)
await kyc.uploadDocument({
sessionId: session.sessionId,
docType: 'passport',
side: 'front',
file: selectedFile,
publishableKey: 'pk_test_123', // or rely on init()
});
// Poll status
const status = await kyc.pollStatus(session.sessionId, { publishableKey: 'pk_test_123' });Webhook verification (Node-only)
import { verifyWebhookSignature } from '@verifyx/kyc-sdk';
const ok = verifyWebhookSignature({
timestamp: req.headers['x-timestamp'] as string,
signature: req.headers['x-signature'] as string,
rawBody: req.rawBody.toString('utf8'),
secret: process.env.WEBHOOK_SECRET!,
});
if (!ok) return res.status(401).send('invalid signature');Build (repo maintainers)
npm run build:sdk
# outputs to packages/sdk/dist, ready for npm publish