ageproof-sdk
v0.1.0
Published
Dependency-free client for AgeProof — provable, tamper-evident age-gating compliance for app developers (App Store Accountability Act: TX SB 2420, AL, UT, LA). Apply per-state rules and record audit evidence without storing age data.
Maintainers
Readme
ageproof-sdk
Dependency-free client for AgeProof — provable, tamper-evident age-gating compliance for app developers subject to US App Store Accountability Act laws (Texas SB 2420, Alabama, Utah, Louisiana).
Apple and Google hand your app an age-range signal. AgeProof applies the right per-state rule, returns a gate decision (allow / block / require parental consent), and records hash-chained audit evidence — storing zero age data and zero personal identifiers.
- Works anywhere
fetchexists: browsers, Node 18+, React Native / Expo - Zero runtime dependencies · dual ESM + CJS · full TypeScript types
testkeys write a sandbox chain;livekeys write the regulator-facing record
Install
npm install ageproof-sdkQuickstart
import { ComplianceClient } from "ageproof-sdk";
const compliance = new ComplianceClient({
baseUrl: "https://age-gate-compliance.fly.dev",
apiKey: process.env.AGEPROOF_API_KEY!, // ak_test_… while developing, ak_live_… in prod
});
// One call: decide the gate AND record the tamper-evident evidence.
const { decision } = await compliance.gate({
platform: "ios",
state: "TX",
action: "in_app_purchase",
ageBracket: "age_16_17", // from the Apple/Google signal — never a raw age
subjectRef: "opaque-session-ref", // pseudonymous; never a real id, email, or DOB
});
if (decision.outcome === "blocked") {
// stop the action
} else if (decision.outcome === "parental_consent_required") {
// route to your parental-consent flow
}Get an API key by signing up at https://age-gate-compliance.fly.dev/signup — you receive a sandbox test key instantly (no credit card).
API
new ComplianceClient(options)
| option | type | notes |
| --- | --- | --- |
| baseUrl | string | Your AgeProof deployment URL |
| apiKey | string | Per-app key (ak_test_… / ak_live_…) |
| fetchImpl | typeof fetch | Optional — inject a polyfill or a mock |
gate(input): Promise<GateResult>
Decide and log a gated action. input: { platform, state, action, ageBracket, subjectRef, clientTs? }.
Returns { decision, mode?, event }.
recordEvent(input): Promise<EventResult>
Record a non-gate event such as a parental-consent check or withdrawal.
input: { platform, eventType, ageBracket, subjectRef, gateOutcome, stateRuleId, clientTs? }.
Errors
Any non-2xx response throws ComplianceError with .status and the parsed .body
(e.g. code: "pii_rejected" if you accidentally send a forbidden field).
Exported constants & types
PLATFORMS, AGE_BRACKETS, EVENT_TYPES, GATE_OUTCOMES, STATE_CODES, ACTIONS (const
arrays), plus the matching TypeScript unions and the GateDecision interface.
Not legal advice
AgeProof produces technical compliance evidence; per-state rule interpretations are DRAFT pending review by licensed counsel. It does not verify identity and is not a guarantee against fines. See the Trust page.
MIT © AgeProof
