IDv1 documentation

Install the package, then draw codes where the app creates accounts, lists or items.

vp add @0001-labs/idv1
import { accountCodeCandidate, codeKind, nameLetters } from '@0001-labs/idv1'

codeKind('Ab12Cd') // 'item'
const code = accountCodeCandidate(nameLetters('Leo Andersen')) // Le0125, say

Keep the database side in the app

A candidate is only a code to try. Keep it when nothing in your database holds it yet, and draw again when something does. Store the code on the row beside the database’s own id, with an index on it, and look rows up by it.

ID_SPACE and idUsage say how many codes of each kind there can be and how many are used.

The scannable code

encodeScanCode turns a code into its 64 bits and scanCodePath draws the strip as SVG. readRgbaScanFrame, locateRgbaScanFrame and StableScan read it back from camera pixels.

Report a vulnerability privately through the repository’s security advisories.