Layer 1 of bento/id. It answers one question: does this key belong to this mailbox? Under option G an address's account is a roster of passkeys (see "The passkey roster" below).
The first design is retired. It bound one account key to an address with
a typed code mailed to the address and entered, signed, in bento/home
(bind.), served the binding at /v1/lookup, and removed it with a
holder-signed del. or another typed code. Under option G every mailed
confirmation is a link that completes only on the sign-in host (G13), so a
typed code on this host contradicts it, and with no way to make a binding the
lookup and deletions had nothing to serve. Every one of those routes answers
410, and the object that held bindings is gone. The directory was never
deployed, so nothing was migrated. Account deletion returns as a mailed link
to the sign-in host or a member's assertion.
No private key, no document, no access list, no share, no "who looked up whom". Storage is one Durable Object per address, named by a hash of the address, and nothing lists or iterates them. Per-IP limits key on a daily-salted HMAC, so no raw IP is stored and one day's hashes can't be linked to the next.
What it keeps only for a while (the privacy notice states each; the rigs pin the code to it). Each is deleted by the object's own alarm, so an address nobody asks about again still ends up holding none of it:
- a setup link's send time: 31 days, the budget's window (
setupTimesKeepMs), whether or not an account was then set up; - an unused setup or reset link's hash: until the link expires;
- an ended void link's hash (to answer "too late" or "already used"): 31 days
after it ended (
endedKeepMs); past that the link answers like one never known; - a spent challenge: 10 minutes;
- the per-IP ledger's day salt and counters: until a minute after that day ends (UTC). Minting a new day's salt never pushes the pending purge later.
Every write of one of these brings the alarm forward to its time
(schedule), never later.
| route | answer |
|---|---|
/v1/bind/start, /v1/bind/complete, /v1/lookup, /v1/delete, /v1/delete/start, /v1/delete/complete |
retired: 410 {error: "gone"} for any method (a preflight included) and body; nothing is read, mailed or stored |
GET /v1/keys |
the directory's public keys, for diagnosis (clients trust the list in the signed release) |
The roster's routes and the sign-in host's are below.
Every answer, an unexpected failure included, is JSON with the full header
set: an exception is caught at the top and answered as a 500
{error: "internal"} that names nothing inside.
The ros. roster format and the address normal form are the KERNEL's
(kernel/src/roster.ts, kernel/src/address.ts), so the directory and every
agent verify with one implementation. src/address.js only adds the storage
name. The rig runs kernel's address vectors
(kernel/fixtures/identity-v1.json) through the directory's normal form.
Phase 1 accepts ASCII addresses only (recommended, pending the maintainer's decision on international addresses): the platforms disagree on internationalised domains, so one address could otherwise mean one mailbox on one host and another elsewhere.
Not here yet:
- the route that serves a roster chain to peers (every link is countersigned and stored; nothing serves the chain yet)
- the passkey key-blob store and the access-ledger blob
- the SES mailer
It needs the id.bento.page DNS, an Amazon SES account in an EU region, and
SPF/DKIM/DMARC on a dedicated sending subdomain, all first. Then:
cd server/directory
npx wrangler secret put CHALLENGE_KEY # 32+ random characters: seals the single-use challenges
npx wrangler secret put DIR_KEY_JWK # the directory's ONLINE P-256 signing key (private JWK): the countersign; DIR_KID names it
npx wrangler deployWithout DIR_KEY_JWK nothing can be set up or take effect: every link is
countersigned before it is stored, so a missing key stores nothing.
node scripts/test-directory.ts # the retired routes, the address normal form, limits
node scripts/test-directory-roster.ts # the passkey roster, setup links, the void, the reset, mail, headers
node scripts/test-directory-browsers.ts # browser certificates: challenges, enrolment, renewal, the 7-day cap, revocation
node scripts/test-directory-mutants.ts # each rule loosened in turn must turn a rig red
node scripts/test-directory-void-page.mjs [--chrome] # the void page in a real browser (Playwright; PLAYWRIGHT_MODULE)Both rigs drive the real worker and Durable Object classes against an in-memory namespace and a hand-moved clock.
This directory is licensed under the GNU Affero General Public License,
version 3 only (AGPL-3.0-only, full text in LICENSE); the rest of
the repository is MIT. It runs as a network service, so anyone who offers a
modified copy to users over a network must offer those users its source.
Contributions to it need the contributor licence agreement in
CLA.md; see CONTRIBUTING.md.
Under option G a bento/id account is a roster of passkeys (the kernel's
ros. chain, kernel/src/roster.ts); no account private key exists anywhere.
src/roster.js keeps each address's roster in its own Durable Object
(Roster, named by the same address hash) and enforces the directory's half:
- One constant (
src/passkey.jsPASSKEY): rpid.bento.page, and the only accepted origin is the sign-in hosthttps://signin.id.bento.page. Nothttps://id.bento.page,https://home.bento.pageorhttps://bento.page. Native origins join as each is measured; none is listed yet. - Registration is checked here (strict client data, exact challenge and origin, never cross-origin, exact rp hash, UP+UV, ES256 P-256 only; the directory relies on no attestation). Assertions go through the kernel verifier with the credential's stored signature counter.
- A change is asked for by an unquarantined passkey member over the exact
new
ros.text, which names a single-use directory challenge. One member added or removed; an added passkey brings its registration over the same challenge. It waits 72 hours on the directory's clock; one change at a time. A member removing itself is immediate only while another unquarantined passkey stays. - Setup needs a 256-bit single-use setup token, with no attempt counter.
The token arrives in a mailed link (
src/links.js, below) that opens on the sign-in host; it completes only there, in the browser that opens it, when that browser makes a passkey. - The setup budget (one link a minute, 3 a day, 10 in 31 days per
address) can be filled by anyone, so it may hold a link back only while a
link it already mailed is still live. With the budget full and no live
link, one link goes anyway, and that link lives 24 hours (a link inside
the budget lives 20 minutes). Its life is what limits mail beyond the
budget: a stranger asking as often as they like costs the address at most
the day's 3 plus one, about 4 setup mails a day, and the address always has
a live link. A link whose mail is still going out (younger than the
mailer's 30-second timeout plus 5 seconds) holds the next back as a mailed
one would, so a burst of starts during a slow send mails one link, not one
each. A link the mailer refused is withdrawn and holds nothing back.
Per IP: 10 setup starts an hour.
setup/startanswers the same bytes (202 {"ok":true}) whatever happened. - No other mail ever reads a stranger-fillable budget.
src/mail.jsMAIL_KINDSclasses every kind of mail: setup links alone may be budgeted; roster, reset, void and freeze mail never are. Sending an undeclared kind throws, and the rig checks that the budget is read in one function per object, called from one place. - Log: every enrolment and change, with the FULL public key it is about
(and the full key that asked), the request
Origin, the ceremony origin, the opener the sign-in host reports, and the time. The incident lever acts on the exact key, so the log never stands in a fingerprint for it. - Mail: every roster mail names the change in words, to the second, with the host class, and lists the whole roster. No budget a stranger can fill holds one back.
- The waiting notice gates the wait. That mail is how the person stops a
change, so a change waits to take effect only once the mailer has accepted
its notice. With the mailer down the request fails (503
{error: "mail"}) and nothing is queued. A change whose object stopped between holding the slot and hearing from the mailer never takes effect, and frees the slot after 10 minutes. A send counts as failed after 30 seconds, and what follows it (marking the change sent, or clearing it after a failure) touches the stored change only if it is still that request's: a change that was dropped or replaced meanwhile is never brought back (409{error: "superseded"}). - Spent challenges are one storage key each (
spent:<issued>:<nonce>), kept 10 minutes and swept a few at a time by later spends, and by the object's alarm once nobody spends. Anyone can spend a challenge without an account, so one growing value would let a stranger fill it to the storage limit and break every request on the address.
| route | proof | answer |
|---|---|---|
POST /v1/roster/setup/start {email} |
none | always 202; mails a setup link if the address has no roster and the setup budget allows (see above) |
POST /v1/roster/challenge {email} |
none | a sealed single-use challenge for that address (5 minutes) |
GET /v1/roster?e= |
none | the head ros. text and any waiting change, or 404 |
POST /v1/roster/setup {email, token, dirNonce, reg} |
the setup token + a registration over dirNonce |
200 with ros.0 |
POST /v1/roster/request {email, ros, credId, assertion, reg?, rq?} |
a member's assertion over ros (+ the new passkey's registration for an add) |
202 queued, or 200 for an immediate self-removal; 403 cooldown for 72 h after its last change was cancelled |
GET /void, /void.js, /void.css |
none | the void page (below): fixed bytes, nothing read or changed |
POST /v1/void {email, token, choice} (60 an hour per IP) |
the void token | choice cancel, remove or undo, as the token allows: 200 {done}; 409 late {at, by?} (what it was for took effect; by: 'reset' when a reset did), 409 used {at}, 409 preempted {at} (a reset cancelled the change), 409 busy (another press or a reset holds the roster: try again), 400 invalid (a token the directory does not know), 400 choice (not offered; the token is kept), 503 mail (Remove whose notice the mailer refused: nothing changed), 503 mail-timeout (the mailer did not answer in 30 s: nothing changed, but the notice may still arrive, so the page says it may and that the page is right) |
POST /v1/roster/reset/start {email} (10 an hour per IP) |
none | always 202; mails a reset link if the address has a roster, no reset waits, and no reset link is live |
POST /v1/roster/reset {email, token, dirNonce, reg} |
the reset token + a registration over dirNonce |
202: the reset waits 72 h, preempting any waiting change |
POST /v1/roster/reset/void {email, credId, assertion, dirNonce} |
a member's passkey | 409 no-reset, 403 new-account (first 14 days), 400 signer, 403 quarantined; otherwise 501 until the kernel defines what the passkey signs |
The countersign. Every link is countersigned (rip., the kernel's
format) with the online key when it takes effect, never at request: the
setup head at once, a member's change at 72 hours, under the authority word
for the act (m member change and setup, q suspension on a void, x the
suspended passkey's removal, u its undo, r a reset).
The void (G3, G4). Every waiting notice carries a void link to the void page, a 256-bit single-use token in the fragment with no count of wrong guesses. For a member's change the page offers Cancel this change (the change is dropped; the passkey that asked cannot ask again for 72 hours) and, while another live member would remain, Cancel, and remove the passkey that asked for it (that passkey is suspended at once and its removal waits 72 hours; the removal's own notice carries a link that puts it back). A reset offers Cancel only. A cancel never waits on the mailer; a Remove waits for its notice, since that carries the undo.
The hold. A Remove and a reset send their mail BEFORE they act, so first
they hold the roster, for the mailer's timeout and a margin: while the hold
is on, the waiting change cannot take effect, and another press, a reset or a
member's request is refused (busy, or pending) before any mail of its own
goes. So every mail states an act that then happens. A mailer refusal takes
the hold off. A send that outlives its hold (the object stopped) acts only if
nothing changed meanwhile and no one else holds the roster.
Ended links. The directory remembers the last 16 void links whose life
ended, by their token's hash, and says how: late (with the time it took
effect), used, or preempted. The page never says "Nothing changed" when it
cannot know.
The reset (G5). For someone who has lost every passkey: a mailed link
(no budget holds it back; a live one holds the next back, and it lives a
day) completes on the sign-in host with a new passkey, then waits 72 hours
and preempts whatever change waits. A waiting member change is cancelled for
good; a waiting removal of a suspended passkey is only set aside: its undo
link keeps working (the reset then starts its 72 hours again, since the chain
takes no link asked for before the one before it took effect), and if the
reset is stopped the removal waits again at its own time. It can be stopped from its own notice's
link; by a member's passkey only once the account is 14 days old (from its
setup; not built past the age rule yet). When it takes effect the roster is
that one passkey. GET /v1/roster reports createdAt and newAccount.
Not built yet: the passkey signature that stops a reset, the chain route, consent-key and recovery-key members, account deletion, and the incident lever across addresses.
src/links.js is the only place a link is built, and the sign-in host
(server/signin/) must read exactly this format:
<SIGNIN_ORIGIN>/setup#v=1&e=<address, percent-encoded>&t=<token>
<SIGNIN_ORIGIN>/reset#v=1&e=<address, percent-encoded>&t=<token>
(and the void link, https://id.bento.page/void#v=1&e=…&t=…&k=c|o|r|u, the
one link that opens on the directory itself: the void page runs no ceremony.
k picks the buttons it shows; the directory decides what the token may do.)
SIGNIN_ORIGINis the sign-in host (src/passkey.js). Neverid.bento.page, which serves no page that reads a link.- Everything is in the fragment, which no browser sends to a server: a mail scanner that fetches the link gets the bare page, cannot make a passkey, and never sees the token. No route anywhere completes on a GET.
vis1;eis the normalised address;tis 32 bytes, base64url without padding (43 characters). Any other key, a missing or repeated one, a query string or another path: refuse (parseSetupLinkis the reference).- The page clears the fragment from the address bar first, then, once the
person makes a passkey over a fresh
POST /v1/roster/challengefore, sendsPOST /v1/roster/setup {email: e, token: t, dirNonce, reg}.
A browser's device key is certified by a roster passkey on the sign-in host
(the kernel's wdev., kernel/src/devices.ts) and kept in force by the
directory's countersign (watt.): 24 hours at most, never past 7 days after
the ceremony. The /v1/web/* routes answer CORS to the sign-in host only and
the /v1/home/* routes to bento/home only (never *, with Vary: Origin);
each requires that Origin and refuses any other, or none, with 403 origin.
Bodies are JSON, sent as text/plain.
| route | answer |
|---|---|
POST /v1/web/challenge {address} |
200 {nonce, at, rosHash}: a challenge for an enrolment, the directory's time for it (the ceremony time), and the hash of the latest ripened roster head; 404 for an address with no account |
POST /v1/web/enrol {text, rq, assertion} (60 an hour per IP) |
200 {ok, wdev, watt}; 400 text, rq, assertion, nonce, ceremony, head; 403 signer, assertion; 409 device-known |
POST /v1/home/challenge {address} |
200 {nonce}: a challenge for a renewal; 404 for an address with no account |
POST /v1/home/checkin {wren, sig, pin?} (120 an hour per IP per address, once the signature verifies and the challenge is the directory's) |
200 {watt, wattSig, signer, assertion, roster, incidents} (the roster as kernel RosterLink objects from the pinned head, or from setup); 403 {error: unknown | revoked | cap, incidents}; 400 wren, nonce |
POST /v1/web/signin/challenge {} (120 an hour per IP) |
200 {nonce}: a sign-in challenge, 5 minutes |
POST /v1/web/signin {nonce, assertion} (60 an hour per IP) |
200 {address}: the account a discoverable passkey belongs to, named by the first 32 bytes of its 48-byte user handle; 400 nonce, assertion, assertion-<reason>; 403 not-member, quarantined. Nothing is logged or mailed; the passkey's counter is stored |
POST /v1/web/signout/challenge {address} |
404 for an address with no account (a per-IP lookup); otherwise 501 until the kernel defines the statement, so the sign-in host never asks for a passkey for nothing. Then 200 {nonce, at} |
POST /v1/web/signout {text, assertion} (60 an hour per IP) |
text is wout.<b64u(address)>.<at>.<nonce> (the sign-in host's provisional layout). 400 text, nonce (spent first; at must be the challenge's), assertion, assertion-<reason>; 403 not-member, quarantined; then 501 until the kernel defines the statement; then 200 {ok, at, signedAt} |
GET /v1/device/status?e=<address>&c=<sha256 of the certificate> (CORS *) |
200 {state: ok | revoked | cap | unknown, incidents} |
- A browser challenge is sealed for its audience (enrolment or renewal) and its address and lives 60 seconds. The address's object spends it before any other check, so reuse, a failed assertion and a challenge used at the other route each use it up. Nothing is stored when one is issued.
- Asking for one costs a per-IP lookup (the budget
GET /v1/rosteruses; both answer 404 for an address with no account) and one of 20 an hour from that IP for that address, enrolments and renewals counted apart. No count is shared by every caller. - A check-in is counted (120 an hour per IP per address) only once its
signature verifies and it carries a challenge the directory issued for that
address. A
wren.verifies under the key it names, so anyone can make one: a check-in without such a challenge, from the owner's network, never uses up the owner's renewals and writes no count. - An unreadable
INCIDENTSlist answers 500 at enrolment and check-in alike, before the challenge is opened: nothing is countersigned and the challenge is left. - An enrolment must name the challenge's own time, the latest ripened head, bento/home as the page that asked, an unquarantined passkey member, an assertion from the sign-in host with a forward-moving counter, and a device key never enrolled before.
- A renewal's
wren.signature is checked before its challenge is spent (only the browser that asked knows it). It is refused for an unknown key, a revoked one (signed out everywhere, or its passkey removed, suspended or added again since the ceremony), and from 7 days after the ceremony. obis 1 when bento/home asked (therqthe sign-in host reports), in the countersign and on every event-log entry; nothing decides on it.mbin the countersign is the account's mailbox state: 0 while the address is confirmed, which is every account today (the address is proved at setup, and nothing yet asks for it again), else the time it went unconfirmed.incidentscomes from theINCIDENTSvariable,[{id, from, to}]; a list that does not read answers 500 and countersigns nothing.- Signing out everywhere is a time, the moment the sign-out is accepted (not
the time in the signed text; both are logged): every browser certificate
made by then is refused (403
revoked, and the status route saysrevokedat once), and a ceremony whose challenge was issued by then cannot finish. A countersign already issued stays valid at peers that do not check the status route, for up to 24 hours. It is logged (signout-all) and mailed to the address (roster mail, never held back). The route runs every check and then answers 501 until the kernel defines what the passkey signs. - A sign-in challenge is spent in the object of the account the passkey's user handle names (once per account); a handle naming no account is refused before anything is written. A passkey's signature counter is stored only over the value its assertion was checked against.
- Not here yet: the sign-out statement itself (a kernel layout), a
dev2.made by a passkey alone, retiring the old key at a new ceremony, and mail for a new browser.
A path that is no route answers 404 with no CORS at all.
What id.bento.page answers: JSON with nosniff, a Permissions-Policy that
turns off WebAuthn create and get, a CSP with default-src 'none' and
frame-ancestors 'none', and X-Frame-Options: DENY, on every response. It
serves no /.well-known/webauthn. The Permissions-Policy does not cover the
WebAuthn Signal API, so no page here may run script, except the void page
(src/voidpage.js), under its own headers: script, style and fetch from its
own origin only, nothing inline, frame-ancestors 'none' and DENY, no
referrer, no caching, the same Permissions-Policy, and Trusted Types with no
policy. It is fixed text, sends nothing until a button is pressed, takes the
token out of the address bar first, and calls no WebAuthn or Signal API.
Rigs: see Testing above.