IDv1 documentation
Any six-character code can be drawn as a strip of 16 × 4 cells, 64 bits: a format byte, the code in five bytes and a two-byte check. Any single damaged cell fails the check rather than reading wrong.
Drawing it
encodeScanCode turns a code into its 64 bits, and scanCodePath draws the strip as an SVG path:
import { encodeScanCode, scanCodePath } from '@0001-labs/idv1'
const bits = encodeScanCode('12ABCD') // 64 booleans, or null for no code
const path = scanCodePath(bits!, { cell: 10 }) // the dark cells, ten units each
Reading it
readRgbaScanFrame reads a strip from a camera frame’s pixels, locateRgbaScanFrame finds one anywhere in the frame, also when it is written on paper beside other marks, and StableScan answers only once three frames in a row have read the same code.
Scanning opens lists and accounts (isSupportedScanId). Items and events can be drawn as a strip, but scanning one opens nothing.
Report a vulnerability privately through the repository’s security advisories.