@cubis/verifyme
The official JavaScript / TypeScript SDK — server, browser, React and Vue.
npm i @cubis/verifymeZero runtime dependencies (fetch + Web Crypto). Node 20+, Bun, Deno,
Cloudflare Workers and browsers; ESM and CommonJS, fully typed.
| Import | Where | API key |
|---|---|---|
@cubis/verifyme | server | yes |
@cubis/verifyme/browser | any web page | no |
@cubis/verifyme/react | React 18+ | no |
@cubis/verifyme/vue | Vue 3.3+ / Nuxt | no |
Client
import { Verifyme } from "@cubis/verifyme"
const verifyme = new Verifyme({
apiKey: process.env.VERIFYME_API_KEY!,
baseUrl: "https://verifyme.cubis.tech", // or your instance
timeout: 15_000, // ms per request
})
// or Verifyme.fromEnv() — reads VERIFYME_API_KEY and VERIFYME_URLCreate one client and reuse it.
| Method | Does |
|---|---|
send(input) | Send a code → { token, exp, trace_id } |
check({ token, code }) | → { success } |
status(token) | → { status, target, created_at } |
widget.createSession(input) | → { session_id, widget_token, expires_at } |
widget.redeem(proof) | → { verified, session_id, target, client_reference, … } |
otp.generate(input) / otp.verify(input) | TOTP (authenticator apps) |
Every method takes { signal } as a last argument for cancellation.
Errors
import { VerifymeError } from "@cubis/verifyme"
try {
await verifyme.send({ target })
} catch (e) {
if (e instanceof VerifymeError) {
e.status // 400, 401, 403, 429, 5xx, or 0 for a network failure
e.message // the API's `detail`
e.retryAfter // seconds, on 429
e.traceId // paste into the console to find the request
e.retryable // 429, 5xx or transport
}
}Browser and frameworks
import { openWidget, loadWidgetScript, mountWidget } from "@cubis/verifyme/browser"
import { VerifyWidget, useVerifyWidget } from "@cubis/verifyme/react"
import { VerifyWidget, useVerifyWidget } from "@cubis/verifyme/vue"See Widget → Frameworks. mountWidget returns a
handle synchronously — the building block for your own framework binding.
Webhooks
parseWebhook({ payload, signature, secret }) returns the typed event or
throws; verifyWebhook(...) returns a boolean. See Webhooks.