zoivera-sdk
v1.0.1
Published
ZoiVera Age Verification SDK - On-device age verification with API key validation
Maintainers
Readme
zoivera-sdk
ZoiVera Age Verification SDK - on-device age verification with API key validation and continuous age confidence updates.
Installation
npm install zoivera-sdkCore SDK Usage
import { ZoiVeraSDK } from 'zoivera-sdk';
const sdk = new ZoiVeraSDK({ apiKey: process.env.ZOIVERA_API_KEY! });
await sdk.initialize();
const result = await sdk.verifyDOB('1990-01-01');
console.log(result.isOver18);Continuous Age Confidence
Continuous Age Confidence is a developer API feature that lets you maintain a rolling confidence score (0 to 1) for each user. The client aggregates local verifier outcomes and sends only a signed, minimal payload.
Privacy guarantees
- No raw biometric frames are transmitted.
- No raw behavioral timing arrays are transmitted.
- Only aggregated score data, nonce, timestamp, signature, and opaque user/device identifiers are sent.
Score ranges (0–1)
- 0.00–0.40: likely minor
- 0.40–0.70: uncertain/unknown
- 0.70–1.00: likely adult
Configure credentials
const apiKey = process.env.ZOIVERA_API_KEY!;
const apiSecret = process.env.ZOIVERA_API_SECRET!; // HMAC secret
const endpoint = `${process.env.SUPABASE_URL}/functions/v1/age-confidence-update`;Send confidence updates after verification
import {
aggregateConfidence,
buildSignedUpdate,
postContinuousConfidence,
type ConfidenceSignal,
} from 'zoivera-sdk';
const signals: ConfidenceSignal[] = [
{ source: 'facial_age', confidence: 84, isOver13: true, isOver18: true, isOver21: false },
{ source: 'behavioral_biometrics', confidence: 73, isOver13: true, isOver18: true },
];
const score = aggregateConfidence(signals);
const payload = await buildSignedUpdate({
apiSecret,
user_id: 'user_123',
confidence_score: score,
device_id: 'browser_a1',
});
const update = await postContinuousConfidence({ endpoint, apiKey, payload });
if (!update.ok) throw new Error(update.error || 'Update failed');Check confidence on the server
// Example edge middleware pseudocode
if (update.age_confidence?.score && update.age_confidence.score >= 0.7) {
// adult features enabled
}Feature gating example
function canAccessRestrictedFeature(score: number): boolean {
return score >= 0.7;
}Error handling example
try {
const resp = await postContinuousConfidence({ endpoint, apiKey, payload });
if (!resp.ok) {
console.error('Continuous confidence rejected:', resp.error);
}
} catch (err) {
console.error('Network/signing error:', err);
}Terms of Service
This software is licensed for use with a valid ZoiVera API key only.
