IDv1 documentation
The four shapes hold about 2.5 billion codes. That is enough for every person, list and item, but not for every event an app records or every visit to it. The expanded version gives those their own codes, still six characters of the same 62 letters and digits.
What an event’s code is
An event’s code is any six letters or digits that make none of the four shapes: k3Rw9Q, 7xP2mB, Q8z1aT. Since no account, product, list or item can be one, it is still told apart on sight.
| Version | Kinds | Codes |
|---|---|---|
| Standard | account, product, list, item | 2,501,740,800, the four shapes as read (a list’s small letters included) |
| Advanced | event | 54,298,494,784, every code the four shapes leave |
| Both | every kind | 56,800,235,584, all of 62⁶ |
There are 54 times as many events as items, so an app can draw one for each event for a long time before codes grow scarce.
Using it
The expanded version is its own entry, so the standard one stays as it is:
import { ADVANCED_SPACE, advancedCodeKind, eventCodeCandidate, isEventCode } from '@0001-labs/idv1/advanced'
eventCodeCandidate() // k3Rw9Q
isEventCode('k3Rw9Q') // true
advancedCodeKind('k3Rw9Q') // 'event'
advancedCodeKind('Ab12Cd') // 'item'
ADVANCED_SPACE.events // 54_298_494_784
eventCodeCandidatedraws all six characters uniformly from the platform’s cryptographic random numbers (secureRandom), and draws again while they make one of the four shapes or spell a blocked word.advancedCodeKindreads all five kinds. The standardcodeKindis unchanged and reads an event’s code as no code at all.isAdvancedCodeOf(kind, code)checks a code against the kind an app expects, events included.
Keep it free
As with every kind, a candidate is only a code to try. With 54 billion to draw from, two events rarely meet, but an app that looks events up by code checks that nothing holds it before keeping it. An app that only shows the code, never looks it up, may keep it as drawn.
Scanning
The scannable code can carry an event’s code like any other six characters, but scanning one opens nothing: isSupportedScanId accepts lists and accounts only.