@solidus-network/capture
v0.1.0
Published
Embeddable web ID-capture SDK: mountCapture() gives guided camera capture with real quality gating and on-device MRZ/barcode extraction (via @solidus-network/id-extract); createCapture({publishableKey}) adds tenant white-label + policy for Solidus Verify
Maintainers
Readme
@solidus-network/capture
Embeddable web ID-document capture: guided camera UI, honest quality gating, and on-device MRZ/barcode extraction. Framework-free — works in any web app; React/Next users mount it inside an effect.
Try it before installing: live demo at capture.solidus.network/demo — runs entirely in your browser, nothing is uploaded.
npm i @solidus-network/captureQuickstart (React / Next.js)
'use client'
import { useEffect, useRef } from 'react'
import { mountCapture, type CaptureWidgetResult } from '@solidus-network/capture'
export default function CaptureDemo() {
const mountRef = useRef<HTMLDivElement>(null)
useEffect(() => {
if (!mountRef.current) return
const widget = mountCapture(mountRef.current, {
docType: 'national-id', // ID-1 card; MRZ side (back) by default
onResult: (result: CaptureWidgetResult) => {
// Extracted ON-DEVICE — the image never left the browser.
console.log('autofill fields', result.autofill)
console.log('confidence', result.confidence, 'source', result.source)
},
})
return () => widget.unmount()
}, [])
return <div ref={mountRef} style={{ width: '100%', maxWidth: 480, margin: '0 auto' }} />
}Open the page over HTTPS (or localhost) — browsers only expose the
camera on secure origins.
Quickstart (vanilla)
<div id="capture" style="max-width: 480px"></div>
<script type="module">
import { mountCapture } from 'https://esm.sh/@solidus-network/capture'
mountCapture(document.getElementById('capture'), {
docType: 'national-id',
onResult: (result) => console.log(result.autofill),
})
</script>What you get
- Guided capture — rear-camera preview, document frame guide, live guidance driven by real signals (lighting, glare, a four-border rectangle check, an MRZ-band probe). The guide turns to the accent color and the copy says "Looks good — tap Capture" only when a document actually frames the guide in good light.
- Quality gating — captures are manual; the widget tells the user why conditions aren't good yet ("Find better light", "Reduce glare…") instead of pretending.
- On-device extraction — the captured frame goes to
@solidus-network/id-extractin the same browser tab: barcode first (PDF417 / QR / DataMatrix / Code128 viazxing-wasm), then MRZ OCR (tesseract.js, OCR-B whitelist) with checksum-validated reconstruction. - Typed autofill —
result.autofillcarries{ given_name, family_name, birth_date, nationality, document_number }ready for your form.result.document_expirywhen read. - A file-upload fallback — desktops without a camera (and users who decline it) can upload a photo through the same extraction path.
What it honestly does NOT do (v0.1)
Read this before integrating — these are real limits, not fine print:
- Passport (TD3) MRZ is not parsed on-device yet. Checksum-validated
reconstruction covers TD1 (ID-1 cards: national IDs, residence
permits, many driving licenses). For passports the widget still guides and
captures, but
autofillwill benullwithneeds_server_fallback: true— route the returnedfileto your own backend OCR if you need passports today. - Barcodes are decoded, not parsed. You get
{ format, text }per barcode; AAMVA (US/CA license) field parsing is not included. - No face match, no liveness, no document-authenticity scoring in this package. Those are server-side tooling in the Solidus Verify platform — this SDK is the capture + extraction layer.
- A checksum-valid read is not identity proofing. It proves the MRZ was read correctly, nothing more.
When on-device confidence is low the result says so
(confidence: 'low', needs_server_fallback: true) — nothing is silently
made up.
OCR engine loading
Extraction engines are lazy: nothing heavy loads at import. On the first
capture (or at mount, warmup: true by default) tesseract.js fetches its
WASM core and English traineddata using its package defaults (network
download, a few MB, cached by the browser). Fully self-hosted setups can
pass a custom extractor wired to @solidus-network/id-extract's
extractDocument(image, { ocr: { langPath, gzip } }).
Platform features (optional, keyed)
Everything above is keyless — no account, no network calls with document data. Separately, clients of the Solidus Verify Capture platform can resolve their tenant's white-label theme + verification policy:
import { createCapture } from '@solidus-network/capture'
const capture = createCapture({ publishableKey: 'vc_pk_…' })
const config = await capture.init() // white-label + policy + issuer standing
capture.applyTheme()Platform onboarding is not yet generally available — if you want to issue portable, verifiable credentials from your captures (W3C SD-JWT VC, selective disclosure), contact [email protected].
Status — read honestly
0.1.x— beta. API may change before 1.0.- Credential anchoring in the wider Solidus platform runs on testnet.
- Solidus holds no third-party certifications for this SDK today (no iBeta PAD, no SOC 2, no ISO 27001, no eIDAS QTSP status). Assurance levels offered by the platform cap at L2 (documented remote verification), not supervised/eIDAS-High.
- No accuracy/performance numbers are quoted anywhere in this README because we have not published measured ones.
Browser support
Evergreen Chrome / Edge / Firefox / Safari ≥ 16.4. Camera capture requires
getUserMedia (secure origin). Extraction requires WebAssembly. ESM only.
License
Apache-2.0
