Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

kernel: the bento/id signed statements and conformance vectors (K2) (#764)

nyblnet1f4b566137be
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 52741622..e001af45 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -167,6 +167,13 @@ jobs:
# once found it cannot be swapped. Contract only: nothing calls it yet.
run: node scripts/test-identity.ts
+ - name: identity statements and conformance vectors
+ # bento/id: every signed statement (dev., bind., att., tomb., del.,
+ # cmp., cns.) and the address normal form. The reference must pass
+ # every row of kernel/fixtures/identity-v1.json, which is the contract
+ # each native host is held to, and must refuse every tampered statement.
+ run: node scripts/test-statements.ts
+
- name: Typecheck convert (standalone)
# convert/ is a library beside the apps (the CLI and bento.page/import
# use it; no shell does), so no app's tsc -b reaches it. Its own flags,
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index e689828c..1e5bab7d 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -10974,3 +10974,64 @@ Settled here, so other zones don't redefine them:
This change is contract only, with no callers. `scripts/test-identity.ts` pins
that no runtime module imports it yet.
+
+## 2026-10-18 — bento/id: the signed statements and their family rules (kernel/src/statements.ts)
+
+Every bento/id statement is defined once, in the kernel, with conformance
+vectors (`kernel/fixtures/identity-v1.json`) that every host must pass: the
+Swift, Kotlin and Rust agents, the extension and the directory. The rules are
+the shipped collab statements' rules, made strict:
+- **Exact bytes.** Dot-joined UTF-8 text, signed over its exact bytes and never
+ re-canonicalised. No JSON inside a statement.
+- **Every field is a closed, dot-free token or base64url free text.** Free
+ text means an email address or a display name, encoded as base64url without
+ padding. A raw email would break the split.
+- **Strict parse.** Split on `.`, keep empty fields, require the exact field
+ count, check each field's grammar, and accept printable ASCII only. An absent
+ value is an empty field.
+- **Units and versions.** Times are epoch ms. The version is in the prefix
+ (`bind2.`), never a field.
+- **Keys and signatures.** Keys are raw P-256 points. Signatures are raw r‖s,
+ low-S, base64url. DER and high-S signatures are refused.
+
+The statements:
+- `dev.`: the device cert. The account key signs both the device's routine key
+ and its hardware CONSENT key, so a consent signature can be tied to the person.
+ It's one cert, not two, because both keys share the device's lifetime and
+ revocation. The light tier has no hardware consent key, so its `consentPub` is
+ empty.
+- `bind.`: the person cert, holder-signed, with `seq` and a `prev` chain for
+ rotation.
+- `att.` and `tomb.`: signed by the directory's online key, with the binding
+ state inside the signature.
+- `del.` and `cmp.`: holder requests to the directory.
+- `cns.`: host-stamped consent (security §24). Its transcript binds the
+ audience, a single-use challenge and the exact authorised statement. The
+ verifier recomputes the transcript and never trusts one from the request.
+- `pk.` is reserved for the phase-2 passkey statement.
+
+Two placements are left open on purpose:
+- **kx** (identity-design §6b, a maintainer decision). Both `bind.` and `dev.`
+ carry a kx slot, and until the ruling BOTH must be empty, so nothing accepts a
+ placement nobody chose. Phase 1 shares nothing and needs no kx.
+- **Addresses are ASCII-only in phase 1** (a maintainer decision). Platforms
+ disagree on international domains, and an address two hosts read differently
+ is exactly what the shared normal form exists to prevent.
+
+**What phase 1 does NOT guarantee:** invite and revoke (`inv.`/`rev.`) are
+verified by the relay with the room OWNER key's signature, not with a
+consent-key `cns.`. In phase 1, documents don't convert to identity mode, so
+the owner key still lives in the document file. The kernel signs `inv.`/`rev.`
+with it exactly as today: no agent prompt, no user-verification gate, no consent
+key. The agent holds an owner key only after conversion (phase 2). Then
+`inv.`/`rev.` get a host-drawn prompt and a user-verified owner key, and phase
+2's room-audience `cns.` (a relay change, deployed first) adds the consent-key
+guarantee. No consent-key (AAL3) guarantee exists for `inv.`/`rev.` before then
+(security §24).
+
+**UI rule: a display name is self-asserted.** A `bind.` name or a `dev.` label
+is whatever its holder typed. The kernel refuses invisible and layout characters,
+requires NFC, and caps the length. No filter stops homoglyphs, though: "Аlice"
+with a Cyrillic А passes. So no surface ever shows a name WITHOUT the verified
+address beside it, and the ✓ always belongs to the address, never to the name.
+(security, #764)
diff --git a/kernel/fixtures/README.md b/kernel/fixtures/README.md
new file mode 100644
index 00000000..294bfa7e
--- /dev/null
+++ b/kernel/fixtures/README.md
@@ -0,0 +1,81 @@
+# bento/id conformance vectors
+
+`identity-v1.json` is the contract every host's statement code must pass:
+the iOS/macOS agent (Swift), the Android agent (Kotlin), the desktop agent
+(Rust), the extension (JS) and the directory. Each host must reach the stated
+verdict on every row. The `reason` field is informative: match it where you can,
+but the verdict is what counts.
+
+The reference implementation is `kernel/src/statements.ts` (statements) and
+`kernel/src/address.ts` (address normalisation). `scripts/test-statements.ts`
+proves the reference passes every row. `scripts/gen-identity-vectors.ts`
+regenerates the file. Regenerate only when the rules change: signatures are
+random, so a regeneration changes bytes but not verdicts.
+
+**The keys in this file are TEST KEYS ONLY.** Never use them for anything else.
+
+## What each section checks
+
+- `statements`: one row per case. `type` names the verifier. `text` and `sig`
+ are what arrives. The other fields are what the VERIFIER brings: its `now`,
+ `kxMode`, the `bindText` it holds, and for `cns` its own `rp`, `audience`,
+ `challenge`, `payloadText` and `docId`. `challengeSpent: true` means its
+ challenge book has already seen that challenge.
+- `transcripts`: the consent channel binding (security §24), including the
+ refusals (a dotted audience, a challenge under 16 bytes, a padded challenge).
+- `webauthn`: the light tier's `clientDataJSON.challenge` derivation (§27).
+- `lowS`: pairs of valid ECDSA signatures. Verifiers must refuse the high-S one,
+ and signers must emit only the low-S form.
+- `purposes`: which payload each routine `SignPurpose` may sign.
+- `addresses`: the one normal form for an email address.
+
+## Notes for native implementers
+
+- **Signatures are raw r‖s (64 bytes), low-S, base64url.** Android Keystore and
+ Apple's Security framework emit DER: convert, then fold s to the lower half,
+ before anything crosses the bridge. A DER or high-S signature is refused here,
+ so a forgotten conversion fails loudly rather than silently.
+- **Parse strictly.** Split on `.` and KEEP empty fields, then require the
+ exact field count. The traps, by language:
+ - Swift's `split(separator:)` DROPS empty fields by default
+ (`omittingEmptySubsequences: true`). Use `components(separatedBy: ".")`, or
+ pass `omittingEmptySubsequences: false`.
+ - Kotlin's plain `split(".")` keeps them, like JS. A `limit` argument or a
+ `.filter { it.isNotEmpty() }` loses them. (home-android, measured)
+ - Rust's `str::split('.')` keeps them; `split_terminator` and filters don't.
+
+ Base64url is canonical: no padding, and it must re-encode to the same string.
+- **Addresses: the vectors are the contract, not a regex.** The reference
+ avoids lookbehind, because Rust's `regex` crate has none. Implement the rules
+ however your language allows, but pass every row. Phase 1 is ASCII-only: any
+ character outside 0x21–0x7E is refused. A domain typed in its `xn--` form is
+ accepted as typed.
+- **Display names: embed the fixture's `displayForbidden` table.** Don't use
+ your platform's `\p{Cf}`-style categories. Those come from each platform's
+ Unicode tables, so a character newly assigned to a category would be refused
+ on one host and accepted on another, and a name would verify on one device
+ and not the next. The table is frozen at Unicode 17.0 as explicit ranges, and
+ changing it is a format decision. It includes every code point UNASSIGNED at
+ 17.0, the 66 noncharacters among them, because one assigned later could be
+ invisible. On top of the table: NFC is required, at most 64 code points, and
+ ZWNJ/ZWJ (U+200C/U+200D) are allowed only mid-text. (home-desktop found the
+ drift; security added the unassigned code points.)
+- **Compute NFC with Unicode 17.0 (or later) data.** Normalisation is stable
+ across versions only for assigned characters, and the table refuses
+ everything unassigned at 17.0. So any normaliser at 17.0 or later agrees on
+ every name the table lets through. A native port whose platform normaliser is
+ older than 17.0 must embed a 17.0 one.
+- **Spend the consent challenge FIRST.** A `cns.` attempt that gets past the
+ grammar check must consume its challenge even when it is refused (rp, docId,
+ transcript, expiry, signature). Otherwise a refused attempt's challenge stays
+ live to be retried. A verdict can't show the order, so every `cns` row carries
+ `spendCalled`: assert your spend callback was (or was not) invoked. A port
+ that spends late passes every verdict and fails these. (home-desktop found the
+ gap.)
+- **kx placement is unruled** (identity-design §6b). Both the `bind.` and the
+ `dev.` kx slots must be EMPTY in the default mode. Rows with `kxMode` A, B or C
+ show the format the ruling will select.
+- **The consent key is per use on Android** (measured by home-android on the
+ emulator): one BiometricPrompt authorises exactly one signature, and the
+ Keystore, not the UI, refuses a second. Residency in the TEE or StrongBox still
+ needs a real phone.
diff --git a/kernel/fixtures/identity-v1.json b/kernel/fixtures/identity-v1.json
new file mode 100644
index 00000000..b203cdd0
--- /dev/null
+++ b/kernel/fixtures/identity-v1.json
@@ -0,0 +1,4110 @@
+{
+ "version": 1,
+ "note": "bento/id conformance vectors. TEST KEYS ONLY — never use them for anything real. Every host must reach the stated verdict on every row; the reason is informative. Generated by scripts/gen-identity-vectors.ts, checked by scripts/test-statements.ts.",
+ "now": 1800000000000,
+ "kxModeDefault": "unruled",
+ "keys": {
+ "account": "BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI",
+ "device": "BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514",
+ "consent": "BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME",
+ "directory": "BLwJ4utvwaJpZHQ17QeRRGCfi64qIzA1fQrgy-aQ2SOHMLyJJ7hKF-F1OFEvn-eGyj9WdYP6qcySeH7kY5mbGK8",
+ "kx": "BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8",
+ "kx2": "BBOGnlvoDKEm9nVUEVFe11QFej6x9e6PSKbf2N642a3Pf96qGFvFj3vWONn_SHuRjo1v045hJqfW2dcu8_v5GCU"
+ },
+ "directoryKeys": {
+ "dir-2027a": "BLwJ4utvwaJpZHQ17QeRRGCfi64qIzA1fQrgy-aQ2SOHMLyJJ7hKF-F1OFEvn-eGyj9WdYP6qcySeH7kY5mbGK8"
+ },
+ "statements": [
+ {
+ "name": "dev: a native device (routine + consent key)",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "xRdyCa68JXPZsUuFLzYPGSSQhnwAA7eoNn6BXIBMYb9xXuNyIWfRaVt9dEYLyi49o0m9DZUsf-PuKYSgvyXPBA",
+ "expect": "accept"
+ },
+ {
+ "name": "dev: a light-tier device (no consent key)",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514..BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI...1799913600000.1825920000000",
+ "sig": "3qxr8bTKOUk4tskwvzTcnigkwTbrPq4RperY1DbXVqhv71YlTcQ4laa64ymu2CFII-Y9SHkTZ472miqdEsKQ9g",
+ "expect": "accept"
+ },
+ {
+ "name": "dev: kx filled while placement is unruled",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "T54XFHybBLwQ08kPhtYb9jAumK-rrIVPjcOoflJNjTIr22KwaWZ37ZHlPoAMe3J0P13Xm69k03l6Rbf2B5Oz8Q",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "dev: kx filled under mode B (per device)",
+ "type": "dev",
+ "kxMode": "B",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "T54XFHybBLwQ08kPhtYb9jAumK-rrIVPjcOoflJNjTIr22KwaWZ37ZHlPoAMe3J0P13Xm69k03l6Rbf2B5Oz8Q",
+ "expect": "accept"
+ },
+ {
+ "name": "dev: kx filled under mode A (it belongs in bind.)",
+ "type": "dev",
+ "kxMode": "A",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "T54XFHybBLwQ08kPhtYb9jAumK-rrIVPjcOoflJNjTIr22KwaWZ37ZHlPoAMe3J0P13Xm69k03l6Rbf2B5Oz8Q",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "dev: kx missing under mode C",
+ "type": "dev",
+ "kxMode": "C",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "xRdyCa68JXPZsUuFLzYPGSSQhnwAA7eoNn6BXIBMYb9xXuNyIWfRaVt9dEYLyi49o0m9DZUsf-PuKYSgvyXPBA",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "dev: kx equal to the device key",
+ "type": "dev",
+ "kxMode": "B",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "z1Loa-HTW6xcb4dC9ZKYce4fWCsEflNQ7Mvbv_e_MhNLoumCt3kBSpv3hR2rdNbwJW-EmEum6Jhutiy9M4N_jQ",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "dev: kx equal to the consent key",
+ "type": "dev",
+ "kxMode": "B",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "oZr1ttvmw3k4FQ4ygtgWCXqovWYg0eTJd1RX6ddTAoMErrdArst8KazhblJvEWNiDpxzXeG6mrpmSzmM8WXwBw",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "dev: consent key equal to the routine key",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "z6JlJPLNi4bsS5G5R-XX9USzGzzPu0WQTBQyDn7InZFpCqj6QnIVeTC8sL_5U19lpaTTebbOAgQmu5oNFQy-7A",
+ "expect": "reject",
+ "reason": "consent-key"
+ },
+ {
+ "name": "dev: expired",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1774080000000.1799913600000",
+ "sig": "cLc_DimqOgqq3mQW6TSZ5rM3HNKFpDMv-PXpIwjWFUNNNIuWSBKqQGJ8cCdh7p9KweYNv8FU7znymR995TaWRA",
+ "expect": "reject",
+ "reason": "expired"
+ },
+ {
+ "name": "dev: lifetime over 13 months + 1 day",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1836201600000",
+ "sig": "ujxICtCdRtOcKcROtUH_K5YW0n6u1sdeJaR4-QrknZhLQWR7d2EBlysD8YW6fkQdFZO_CIzFQ_BzKoY_yJAQQw",
+ "expect": "reject",
+ "reason": "lifetime"
+ },
+ {
+ "name": "dev: label with a bidi override",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..bGFwdG9w4oCuZ25wLmV4ZQ.1799913600000.1825920000000",
+ "sig": "wMTsvJIXC2NFj6ZNB4w7eMN3CPWHYtdYySnXe08EAW5LWXxVCxQdPcV9mWVBRxKYZd0BjxH-7zXpL_vWnH8XqA",
+ "expect": "reject",
+ "reason": "label"
+ },
+ {
+ "name": "dev: signed by the device key, not the account key",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "AMxLRYOTd6Y9abNrc9-skL-BmQ-S5Dj2sH27xqd5X6A5WDe5ihZPUrjT-6FHBqxCgFZQ-ba1iBy5yWmNcavIfg",
+ "expect": "reject",
+ "reason": "signature"
+ },
+ {
+ "name": "dev: high-S signature",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "xRdyCa68JXPZsUuFLzYPGSSQhnwAA7eoNn6BXIBMYb-OoRyM3pgul6SCi7n0NdHCGZ09oBHrHqEFkEYiPT1WTQ",
+ "expect": "reject",
+ "reason": "signature"
+ },
+ {
+ "name": "dev: DER signature (a host forgot to convert)",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "MEUCIQDFF3IJrrwlc9mxS4UvNg8ZJJCGfAADt6g2foFcgExhvwIgcV7jciFn0WlbfXRGC8ouPaNJvQ2VLH_j7imEoL8lzwQ",
+ "expect": "reject",
+ "reason": "signature"
+ },
+ {
+ "name": "dev: an extra field",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000.x",
+ "sig": "xRdyCa68JXPZsUuFLzYPGSSQhnwAA7eoNn6BXIBMYb9xXuNyIWfRaVt9dEYLyi49o0m9DZUsf-PuKYSgvyXPBA",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "dev: a field missing",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000",
+ "sig": "xRdyCa68JXPZsUuFLzYPGSSQhnwAA7eoNn6BXIBMYb9xXuNyIWfRaVt9dEYLyi49o0m9DZUsf-PuKYSgvyXPBA",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "dev: a padded base64url key",
+ "type": "dev",
+ "text": "dev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514=.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "TLQm4Npr_shaYlCYA-yG8ir8FheVI6AGP6AOtAgTpwwdHzjHS5hYe1pSI1ZQNJZNrUxZulOQo-IKpqMUQdTjrg",
+ "expect": "reject",
+ "reason": "key"
+ },
+ {
+ "name": "dev: a space in the text",
+ "type": "dev",
+ "text": "dev. BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.BJ3wd72f6iC6PLPJrOaj33UC30OnGOZRbqKRbu-8_NhkptHnZzcNWZxfGOGTN_VvAOTv0Wkj0FMQOCWu3KHmvME.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..Q2Fmw6kgbGFwdG9w.1799913600000.1825920000000",
+ "sig": "xRdyCa68JXPZsUuFLzYPGSSQhnwAA7eoNn6BXIBMYb9xXuNyIWfRaVt9dEYLyi49o0m9DZUsf-PuKYSgvyXPBA",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "bind: first binding (seq 1, no prev)",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "H396LcIoCsswc9fgEciUAcYgPRLuHG7pfTReH03-pREmKezF1WyAUnToNIupRLut3UGPemxXFQMFgGCu03th0A",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: a rotation (seq 2, prev = hash of seq 1)",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.2.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799913600000.1825920000000",
+ "sig": "BZNZ19wlWLsWEn3WD1Xoyxez-MYB4y_d2tyK42odTdRfZRCLF7ZLWbfkeU37lsotpK6RQcdetf40vI3EsmbJ4w",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: no display name (empty field)",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI...1..1799913600000.1825920000000",
+ "sig": "a9ZlIiSibxOTBBLKYktb5pulY6YQM0oaXa2rotzraxILReKp_rC5UuS4tfmFKfdY11Zd7UOZmurnD9GhnMbm0A",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: seq 1 with a prev",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799913600000.1825920000000",
+ "sig": "NuquaW1lRhSv3s-EbyEdS0j6zCL5CYill3wxK3EVW8F05cxJyx5q18y5uaYB692jz4ZptBcSOOIGm_UjIekLwA",
+ "expect": "reject",
+ "reason": "prev"
+ },
+ {
+ "name": "bind: seq 2 without a prev",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.2..1799913600000.1825920000000",
+ "sig": "9g-DlVElMQYLVAOAs5JmNTmj1knPBVanHt1V609VOtM5fdcyFnA-w8Hm1EbeZ4rz0eFEcC8d-RQnlPQgaUs2kg",
+ "expect": "reject",
+ "reason": "prev"
+ },
+ {
+ "name": "bind: an address not in normal form",
+ "type": "bind",
+ "text": "bind.QWxpY2VARXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "_v5ai69kgnO59C_LwC7vz7_WJodnw0O0YPpyMcxfOhNUAt7vzo-UX4UkaXgav-cvxOT4wtRSBYK-ZmR8pXKqow",
+ "expect": "reject",
+ "reason": "address"
+ },
+ {
+ "name": "bind: a raw (unencoded) email breaks the field count",
+ "type": "bind",
+ "text": "[email protected]_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "mnueBCOd-wMp4tdlBulL7MBUbSByIdp2irb2WoJ_M28J9XKwaKpWcCYGhX725qSWMHJtXeu4S8dCInxYd_QsWg",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "bind: a display name over 64 characters",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHg.1..1799913600000.1825920000000",
+ "sig": "Kkrzb4XiOGc8QIjJHEonJUIJ8UXv06UApJxwMjxTpcdk0bKM9wlIjrHgVKAcxeH4Rqxz9dgFpVwRntejCQWPVA",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing zero-width space is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzigItpY2U.1..1799913600000.1825920000000",
+ "sig": "MvWC3Tzywecl5q_v2KjD0vN7WyLCIuoYPHVT97OejnZJfZ2LIGX7arPoFZ3NA0JRGsrYhvfvnIw-Cjme8Lk75g",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing word joiner is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzigaBpY2U.1..1799913600000.1825920000000",
+ "sig": "OAMO9oyMlYlyIVD3UCQk3Qd2ISbAxJubz35oNSA_pgZghYk0qg99TGZ7KwlaZ9grVYdcuHU50rs5EFsOVZJoDg",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing byte-order mark is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzvu79pY2U.1..1799913600000.1825920000000",
+ "sig": "8ZQni3Kj9pOR0_k_87CWLZB5icbplHABW6wkLwejyrFMuWzkm38qhRoAllXaI7WQH6OYcGmY9V1NgAQI8ySmZg",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing Arabic letter mark (bidi) is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzYnGljZQ.1..1799913600000.1825920000000",
+ "sig": "sqVwzGFHFZ3aLdKKinitUXdeRFR_XO3Vb_GM5zi8Tz9fEd08UknKbLbQ1EermSXMsc0AhOUhoK6cue2aXerJXg",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing left-to-right mark is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzigI5pY2U.1..1799913600000.1825920000000",
+ "sig": "cAgtqD2fFa5s5CMsZmaz4Mv_3_YRJrBW8rFh99uyucA-G9njYbtF2Rz3He2RMJ0UHRIMM_DN_gNaoNvCl-UTdw",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing right-to-left override is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzigK5pY2U.1..1799913600000.1825920000000",
+ "sig": "r3-rjU0OhKwuR0oCxIi8K5JDL0EgmRb4VJpzslQoCZM0rhYtEYDUfTlyr8KCGJeaAR8T-hV-ure32fXVl6cZ5g",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing line separator is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzigKhpY2U.1..1799913600000.1825920000000",
+ "sig": "WRYVEMoVeH6Ov--GTgsZd6RFY6lWS8EIsIegb3M1Fd8Ar2w6Boy2UL_vy_a7M6AwkBnzjjCnWHtgmfhwEVzYPQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing paragraph separator is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzigKlpY2U.1..1799913600000.1825920000000",
+ "sig": "Ig1GXK6UtzMOhqO_MaAmBrM6WpwEegMO_UEMagy1LVYQKnqya0_ctquT62FLhss7qTIkzccgqOho3pLBXye4dA",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing Mongolian vowel separator is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzhoI5pY2U.1..1799913600000.1825920000000",
+ "sig": "eQZv3sjAZ1d0iMPLTXX1_2H4ZrbGmFVKW_9BFxpuZhRD6KSZt-cMlKzciv2h8vFTyo6AzID4QC1MuJkmJ3wtBw",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing soft hyphen is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzCrWljZQ.1..1799913600000.1825920000000",
+ "sig": "3patxyUfKyZhTU8SIeXkGxGekNylhPoh3ic43EROk4cdLVipHvFdJpIW5L8S5eh2T6wHXCEq4tm-dlGmF-iQJw",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing a control character is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWwHaWNl.1..1799913600000.1825920000000",
+ "sig": "ICYJ1kUAAbIpSVlPUPYDGDND28SNeQ5MT06xQKAGAPtW9cJxZvOpHootlFstous7QM74f73fcjKb-U1RVXRAfg",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing private use is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzugIBpY2U.1..1799913600000.1825920000000",
+ "sig": "-XCvW2-CfNfHqRTEhR-QTzOE2J2oQqtlBNYH_mhlKDEAu11ilWIhIKh6qF38A-EjDdMh0Yjbs-uioFyDcqo_JQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing Hangul filler (renders blank) is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzjhaRpY2U.1..1799913600000.1825920000000",
+ "sig": "IPxeqs65T0ydu6EB09KjGL5TeAD0r5ZeJDt8lAwYjc1fYTcQeCrQHaxdtSrwrhgSlB5cQUiOTJLSteMjZlNyEg",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing Hangul choseong filler is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzhhZ9pY2U.1..1799913600000.1825920000000",
+ "sig": "dnfCm9RLeRW8B0OY13OImny_mdWr32KtCngACAS-1aBEovzcqQ6ddBpQVErUFx0B8k58KqGgcNf1917kew7nuA",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing an unassigned code point is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzNuGljZQ.1..1799913600000.1825920000000",
+ "sig": "GRfSBMxFYnOWWmstlQVrdsRpVBtITmGVBZfUa1DXMgln_hXKVSM3J0W3mFHAwc0W5oGP9Xnt5E_w_ksRyHRE4Q",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing a noncharacter (U+FFFF) is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzvv79pY2U.1..1799913600000.1825920000000",
+ "sig": "6A1JoDxg3gutY5YMcNJpWsftYLurqvGOguTGnu5LNz5ypN3b9isR-w9sqPa3CCrm200HmNCVsNsKGQrbEhZQhQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing a noncharacter (U+FDD0) is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzvt5BpY2U.1..1799913600000.1825920000000",
+ "sig": "2JlLnAb4x391kXtQRZJQ3cVxJium2YMrDO3g6ULEa1BBGtel1EvoJPqeQFDHfH5tqbnB1c0M6VCm1YgQhHH-QQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name containing a noncharacter in plane 3 is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWzwv7-_aWNl.1..1799913600000.1825920000000",
+ "sig": "gLHFzHY13NWQ7_DCxaL-zfHo2Hpksrr6yjfniMaXddl2FZY8qEuJvwM4w6xlXjVB9TISYURg6xFFhabOB9advg",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name with ZWNJ at the start is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..4oCMQWxpY2U.1..1799913600000.1825920000000",
+ "sig": "AFz8fHiEnvch6pW2BeumTakoXYRy4B3yzgYWz4uGG2dmavSM6Kru1AnAsSMztV4BG1n5pRnw5819IqwOQUKCNQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name with ZWJ at the end is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2XigI0.1..1799913600000.1825920000000",
+ "sig": "8zxt45eB4mNDHbgeJpFEK4VlWZbkK2d5qyU2nJSUzNJZuLapmS1IW-JiC8rL-37lik0mPOghqFVBKypyFAzqQQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a name with not in NFC (a decomposed é) is refused",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QW1lzIFsaWU.1..1799913600000.1825920000000",
+ "sig": "PhXL1MHhwGt__PN89ucf28HU8Wacr2eNDSgizJNM2oIUlUuiFkvZn7pR35qGMYeXlurUO7RsCcm9NJ95hiI9wQ",
+ "expect": "reject",
+ "reason": "name"
+ },
+ {
+ "name": "bind: a Persian name with a mid-word ZWNJ is accepted",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..2YXbjOKAjNiu2YjYp9mH2YU.1..1799913600000.1825920000000",
+ "sig": "GqIEkiDAGYQc1O1cSANW5_FLE0ATCOt1vql-KiTVCoBUAIc_DniMplXyxuJr66tzndrNvJjp2oKfbnORHgBkhA",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: an emoji ZWJ sequence is accepted",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..8J-RqeKAjfCfkrsgRGV2.1..1799913600000.1825920000000",
+ "sig": "Z40K0iymxZT_T21tmijBnyrDUXi-WCkNDt7X-QC5y2h58DT5ZrdnykVqvMEhHrmMw_vDHW23PWkCfyUj4RWEsA",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: an NFC accented name is accepted",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QW3DqWxp.1..1799913600000.1825920000000",
+ "sig": "TDe6kebh3L_HWw5tAyy5t3gRbIc7sCCJwTLWO0rT7lJpuNenn9-QhUbMEZMsw9yOz5gK6lPqrX7GmLh9fT4Y_A",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: kx filled while placement is unruled",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "fLefsYqoHKffDWcnxVzRJ3I0Bu0qf8Vv2meKdKngMUIM0t4SvMI_PM4qfhtq9QoBKpuNirK_cloee-Sb1pghDQ",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "bind: kx filled under mode A (shared)",
+ "type": "bind",
+ "kxMode": "A",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "fLefsYqoHKffDWcnxVzRJ3I0Bu0qf8Vv2meKdKngMUIM0t4SvMI_PM4qfhtq9QoBKpuNirK_cloee-Sb1pghDQ",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: kx filled under mode C (recovery kx)",
+ "type": "bind",
+ "kxMode": "C",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "fLefsYqoHKffDWcnxVzRJ3I0Bu0qf8Vv2meKdKngMUIM0t4SvMI_PM4qfhtq9QoBKpuNirK_cloee-Sb1pghDQ",
+ "expect": "accept"
+ },
+ {
+ "name": "bind: kx filled under mode B (it belongs in dev.)",
+ "type": "bind",
+ "kxMode": "B",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BDpkPc7jczVdSHIraHaEYxKKuUOH_1WGYDpKBKc2x8A_7B2WSpfO7BMIejncvJ3mMy9wpDbQf0R4Ckg-kTTEMq8.QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "fLefsYqoHKffDWcnxVzRJ3I0Bu0qf8Vv2meKdKngMUIM0t4SvMI_PM4qfhtq9QoBKpuNirK_cloee-Sb1pghDQ",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "bind: kx equal to the account key",
+ "type": "bind",
+ "kxMode": "A",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "XTxbEyWOAteRbS2wQoLttH-BecHHmP7Z7DwUsb7dunFsDZnfiH7vkHllcWPaqdcQbcLU49uM4LI5wkeyAYGAxw",
+ "expect": "reject",
+ "reason": "kx"
+ },
+ {
+ "name": "bind: signed by a stranger",
+ "type": "bind",
+ "text": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "sig": "wbe5wBVEG_6hzAUYSk15qtiS5THzMjIJfIYB876-nEsu0deukoqcSAilHVvJpSO6QJGd9JDfPZQNl-lFGFNyUQ",
+ "expect": "reject",
+ "reason": "signature"
+ },
+ {
+ "name": "att: an active attestation",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.dir-2027a.active",
+ "sig": "E_C8NRzuv8Y1aALmxXzfUWZr1g0xD4GDu9oV_pQCA-pjQoXL_hCRduEQqGasszleQxvk-aTcFBZ-3ttOLLLFTQ",
+ "expect": "accept"
+ },
+ {
+ "name": "att: a frozen binding (state is signed)",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.dir-2027a.frozen",
+ "sig": "HG-SZkl-YYHwzDFIOiJVTkQR4oAwzYVrhnJFbQe64O4TGszeZtO1nuay_k3LzgUsrvNJLXIwyQF8hGLuJKZNNg",
+ "expect": "accept"
+ },
+ {
+ "name": "att: an answer too old to trust (replay)",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799996400000.dir-2027a.active",
+ "sig": "2_V2EbytAm8xHdUEklFbptV9auapEjEUWzGnDHvMRqId1em6lsSFH15DkW-oATAUsRhN_5PG1Sg0FvcWst_Sww",
+ "expect": "reject",
+ "reason": "stale"
+ },
+ {
+ "name": "att: for a different binding",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000x",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.dir-2027a.active",
+ "sig": "4Ne7U5bHj0LDdeSW5CyNIB9FSRLVnGKCnU075Uzuoc0MH6vNm_Koqn-oRFqBi6qUMU5lEC5lGrt9Fp91O2CDTw",
+ "expect": "reject",
+ "reason": "bind-mismatch"
+ },
+ {
+ "name": "att: an unknown key id",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.dir-unknown.active",
+ "sig": "IrqPUlPHMrZJVXTXWSTWIq9iXIvGtc1gng3ccQ13AoFEsOpwAYjQKQjK8UuzlNWmj8Y0JDZKlUuy-_vR5atNkw",
+ "expect": "reject",
+ "reason": "unknown-kid"
+ },
+ {
+ "name": "att: a prototype key as kid",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.__proto__.active",
+ "sig": "QwmvCy5VG-KOECAzoceDfmmlR7FIeSYv2ShKqh-KUT5nPKMZtpThMzdoUR3IkaN_zd4z7M4-Q54yljyoqt6XOA",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "att: a state outside the closed set",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.dir-2027a.revoked",
+ "sig": "kdqKgwJ-kKD1SdU8DDrkgn8fEo9HumvUooAjptIRcJVG8lxHAG9a27qr6Q05QLFHx12ioLrzp6YkYBGEgiAE9A",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "att: signed by the release key, not the directory key",
+ "type": "att",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "maxAgeMs": 600000,
+ "text": "att.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.1799996400000.1799999940000.dir-2027a.active",
+ "sig": "7mox1GUSvz2j-vYHHkOz9X3jdexe1iSPEPbz6FzmShZMAN7b9lGue0tjS9nI8Te5VMZ-duzDv4v01bXsdQeK8w",
+ "expect": "reject",
+ "reason": "signature"
+ },
+ {
+ "name": "tomb: a holder deletion",
+ "type": "tomb",
+ "text": "tomb.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.2.1799999999000.holder.dir-2027a",
+ "sig": "R4rHMtK2P76PlDQ-Ahx7q-f1-11o1ECm2-vmzHE28-E18xe_NXMzh1IJilxujyzEH6M797ZvHju-_AmqFhW1dA",
+ "expect": "accept"
+ },
+ {
+ "name": "tomb: no previous binding text (empty hash)",
+ "type": "tomb",
+ "text": "tomb..1.1799999999000.operator.dir-2027a",
+ "sig": "zHxazXEflyvMfC-hlq5BmPX7aZbY_xQgvqhCU-U_g4MMY7E2uW2jDyDcoBYZ9Fe6A1G54iCTa5Nx-E2YD960Lg",
+ "expect": "accept"
+ },
+ {
+ "name": "tomb: \"by\" outside the closed set",
+ "type": "tomb",
+ "text": "tomb.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.2.1799999999000.admin.dir-2027a",
+ "sig": "IDcirQSV9chwif1WrUfLaf19RCoc5_ZnZRebQGd9rlFFkgfubP9QeOgKuNMQA0JV8B4OgkgW1FU5ZTvIOf6fOQ",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "del: a delete request within ±5 min",
+ "type": "del",
+ "text": "del.YWxpY2VAZXhhbXBsZS5jb20.1799999940000",
+ "sig": "AJUZMy0VlU4VEzgQnH_bxQnhoIW-Y0Ib5Z6hsMyXS-wQ3UEeZhLhafZ9x31zHxqeqjUb3QY04loeL5VWRmMzHw",
+ "expect": "accept"
+ },
+ {
+ "name": "del: a delete request 6 min old",
+ "type": "del",
+ "text": "del.YWxpY2VAZXhhbXBsZS5jb20.1799999640000",
+ "sig": "A0HppToH5sr4Pzc1o_w2ZtKMtZmiUAr4XLgoQ9RjbcBXuQuwY0PgzUXxJMfzPHcGSkV8r50KLx88wcH9F2aXmg",
+ "expect": "reject",
+ "reason": "expired"
+ },
+ {
+ "name": "del: signed by a stranger",
+ "type": "del",
+ "text": "del.YWxpY2VAZXhhbXBsZS5jb20.1799999940000",
+ "sig": "Uu4tTNdUL6tW8VVTAyEch4_EGD-12We4oMZqilFUsKxMVQKCB-stfLy5c7GqtOlVDIEQQk-zrubDcWMAl13bUA",
+ "expect": "reject",
+ "reason": "signature"
+ },
+ {
+ "name": "cmp: completing this binding with the typed code",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ2P",
+ "sig": "2po85My8VrbFvtGW5tRUoqtkinCCTSpddJilAbfapN4ToFsqpjKbtRt7Vw9pJM_C2Hl4oVizIBnJrCMRgXbByQ",
+ "expect": "accept"
+ },
+ {
+ "name": "cmp: for a different binding",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000x",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ2P",
+ "sig": "bQBLxxawEolgummekphWTrXeOsKyKw35IQQ7b_HCKjtOU92s4PkeSdJG8Y6KAHBTkfvLs4Fii88L7YmgpaxMFA",
+ "expect": "reject",
+ "reason": "bind-mismatch"
+ },
+ {
+ "name": "cmp: a code refused — lowercase (the agent uppercases before signing)",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.k7q3mz2p",
+ "sig": "38U5lC15dGXw70zznrFHnOP7FFMndy3VwVbv24VFh2lEyb0wxiRRllC91bYScToZAymJMkzrQrU3uyXYpNTSAw",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cmp: a code refused — contains L",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ2L",
+ "sig": "f9x3nTBZPrSnJc5Ag9ifB4j-frSCNC0QZvBixXlcq517JD6-5PHZe0YVaShMM6G25Z3W5tvEtKCPOEmmW_6QLA",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cmp: a code refused — contains 0",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ20",
+ "sig": "Y6D9AJB1kybregOy-U-bsQMyOIbEWNfspBBT2O8O8BsHAagzQ6WmclzW03OZEHoGDqO05Hs2vpbtIIb9sGPN4Q",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cmp: a code refused — contains I",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ2I",
+ "sig": "KytJ8l8lbEjXsGV-U_X4qhuRexnD5O8HvNq9JmE5kZtxcFFuyNMgg-oVdfVntShYMAu4UAOfjZZFuOlr3-YUyQ",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cmp: a code refused — seven characters",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ2",
+ "sig": "kjBROiJdqoH6ERye_P-DWAFPvs6nsf3prCUvJsEY5xMMc07mvsD5VpFggzo31Cvw5mD_KX4TQdPhyKZ15uu7PA",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cmp: a code refused — nine characters",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3MZ2PP",
+ "sig": "qsWrpxasM55zaGWFLWWeo2752uV-sLn-fqeR69DLjwNGU2JAL_4TpVx_B9fmTzrUv7KnV9X964qiPS0lRSHXbw",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cmp: a code refused — a space",
+ "type": "cmp",
+ "bindText": "bind.YWxpY2VAZXhhbXBsZS5jb20.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..QWxpY2U.1..1799913600000.1825920000000",
+ "text": "cmp.qS1ldSnoR_CKxQnN42rVQgI-5DaOGbUcU4IRBcAeU-o.K7Q3 Z2P",
+ "sig": "vs5uXI_tyqJZNmU-hcZBDQHpT-FGogr0yLrkg_9k5K4ykSjCtS2b8lSnSXefuWHU5Koul5IK38j14mt_jJzyVw",
+ "expect": "reject",
+ "reason": "grammar"
+ },
+ {
+ "name": "cns: link a device (account-scoped, audience dir)",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "oVvtoRlAZgnuIXShWGgGq71RLNCp-wkXT6uNcLG_0lIKuAWh77JZNhlAAIbhoZkOyOt1Wt6xjylNr4Y7BBSaVw",
+ "expect": "accept",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: REPLAY — the challenge was already spent",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "challengeSpent": true,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "oVvtoRlAZgnuIXShWGgGq71RLNCp-wkXT6uNcLG_0lIKuAWh77JZNhlAAIbhoZkOyOt1Wt6xjylNr4Y7BBSaVw",
+ "expect": "reject",
+ "reason": "replay",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: RELAY — presented to a different audience",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "room:wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "oVvtoRlAZgnuIXShWGgGq71RLNCp-wkXT6uNcLG_0lIKuAWh77JZNhlAAIbhoZkOyOt1Wt6xjylNr4Y7BBSaVw",
+ "expect": "reject",
+ "reason": "transcript",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: PAYLOAD SWAP — authorising a different statement",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..VGFibGV0.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "oVvtoRlAZgnuIXShWGgGq71RLNCp-wkXT6uNcLG_0lIKuAWh77JZNhlAAIbhoZkOyOt1Wt6xjylNr4Y7BBSaVw",
+ "expect": "reject",
+ "reason": "transcript",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: EXPIRED",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "now": 1800000120000,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "oVvtoRlAZgnuIXShWGgGq71RLNCp-wkXT6uNcLG_0lIKuAWh77JZNhlAAIbhoZkOyOt1Wt6xjylNr4Y7BBSaVw",
+ "expect": "reject",
+ "reason": "expired",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: valid for longer than 5 minutes",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000360000",
+ "sig": "WCMwZL_iGFWnCXdpbtPJ6nhZIlwKgOd7PnEkWg1X2OIfBU9PNecGv-A2e9XGwz14SrraBqx2p7fzWm0ahcvITg",
+ "expect": "reject",
+ "reason": "lifetime",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: signed by the routine device key, not the consent key",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "iynKuxmto5Uzg10SIUQk1lqXKUZvbrr7anA97qFnosIc4nKlMTQiVV_A0P00OQ3pGpG7EFMmtAakpVK54F8SyA",
+ "expect": "reject",
+ "reason": "signature",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: for another relying party",
+ "type": "cns",
+ "rp": "vault-acme",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "oVvtoRlAZgnuIXShWGgGq71RLNCp-wkXT6uNcLG_0lIKuAWh77JZNhlAAIbhoZkOyOt1Wt6xjylNr4Y7BBSaVw",
+ "expect": "reject",
+ "reason": "rp",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: purpose \"link\" over an inv. payload",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "inv.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI.writer.0",
+ "docId": null,
+ "text": "cns.bento.link..vP_Do7TnX33aDyt_JmbWK95FtVKrFk8_30UyKQLBIUI.1800000060000",
+ "sig": "7IruYMXde3gzncXPoQdTKyI6Kvqy4RyzHpgXRsMfprcvdjI2QWggxUsIgfZaI9pijU9zUC9bU4wZZIU8qOSpNQ",
+ "expect": "reject",
+ "reason": "payload-family",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: an account-scoped purpose carrying a docId",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.link.doc-1.JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "LcGIpNNNGr12O_G1UDxn-_HcPhiwerRD0GKUwf-HnQsUbVm0vMVDSMjxIH4qpAcf6Cayi6_8t31oVhmboIavaw",
+ "expect": "reject",
+ "reason": "docid",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: a reserved purpose (grant, phase 2)",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.grant..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "ec9eSTWl8HjJs1YazJllHF5MCjCDY0eyRwb65lVFQB12y5w7oXUfV_daVNL9BR7HLvyfQ0dEI4IzqhXDJQ9HiA",
+ "expect": "reject",
+ "reason": "reserved-purpose",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: a dotted rp (\"bento.page\") breaks the field count",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "dev.BM0XKkWH26V11oalK_Hcx1gL6I-2Y37P90yCh7mfAVJHcEtzvclLLElTsgPO-K_vuoQewgHV66qIrY5WsjSUOtg.BKAx1sDl8PsTOnoLFVV6iZIViEpZ96ZqXBvErTQn95d95Tq4nG4A7xhV4v1YlIeWcYX-xLYM4teBhra8GHE1rbQ.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI..UGhvbmU.1799913600000.1825920000000",
+ "docId": null,
+ "text": "cns.bento.page.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "sig": "L2c4tPxxn43zxxgNbSwmmfk1LWSURevHy7_dEDhkaHwnJUYz4atxICAuvwohHcTlVR07gm0F1QDoRbyIDzDJlg",
+ "expect": "reject",
+ "reason": "grammar",
+ "spendCalled": false
+ },
+ {
+ "name": "cns: invite (document-scoped, audience room)",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "room:wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "inv.BNMDTJQFyuyCzTEOM8hbtOdzu8R1LjiYZaTOxCHW-s-pWTzQHx9liQ6fLwXS6cDdXcwGAWuyXEEbEdPUeh-_-No.writer.0",
+ "docId": "doc-abc_123",
+ "text": "cns.bento.invite.doc-abc_123.tBGdcGG4s5Dv5X481E49zCyvRLy5Chu4pZC2c23pBYg.1800000060000",
+ "sig": "4nx7JdUfwazBdaqKgNr5DLU9WpjyFrKa5tG3MpT4B2lUw6IUIaaP4bh_aMhTjkhLYdeS0dZ_uPIcvG8w5rXYEw",
+ "expect": "accept",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: DOCID SWAP — applied to another document",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "room:wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "inv.BNMDTJQFyuyCzTEOM8hbtOdzu8R1LjiYZaTOxCHW-s-pWTzQHx9liQ6fLwXS6cDdXcwGAWuyXEEbEdPUeh-_-No.writer.0",
+ "docId": "doc-other",
+ "text": "cns.bento.invite.doc-abc_123.tBGdcGG4s5Dv5X481E49zCyvRLy5Chu4pZC2c23pBYg.1800000060000",
+ "sig": "4nx7JdUfwazBdaqKgNr5DLU9WpjyFrKa5tG3MpT4B2lUw6IUIaaP4bh_aMhTjkhLYdeS0dZ_uPIcvG8w5rXYEw",
+ "expect": "reject",
+ "reason": "docid",
+ "spendCalled": true
+ },
+ {
+ "name": "cns: a document-scoped purpose with no docId",
+ "type": "cns",
+ "rp": "bento",
+ "audience": "room:wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payloadText": "inv.BNMDTJQFyuyCzTEOM8hbtOdzu8R1LjiYZaTOxCHW-s-pWTzQHx9liQ6fLwXS6cDdXcwGAWuyXEEbEdPUeh-_-No.writer.0",
+ "docId": "doc-abc_123",
+ "text": "cns.bento.invite..tBGdcGG4s5Dv5X481E49zCyvRLy5Chu4pZC2c23pBYg.1800000060000",
+ "sig": "1HqboH8kEGpU98yKOdiPH2bdygRgt9qiywBABIhZS69kC2bY_FSLMhYvhj3DWwSOp09YOlud1yneGwoSY19ZHw",
+ "expect": "reject",
+ "reason": "docid",
+ "spendCalled": true
+ }
+ ],
+ "transcripts": [
+ {
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payload": "dev.example",
+ "transcript": "IiTxWi7-f39uS4afGpRRo8p9LUhnfP19Y0Hb0xtvFKo"
+ },
+ {
+ "audience": "room:wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payload": "inv.example",
+ "transcript": "0kRuKb11LKj-BGyukPKfVGENHZeG1xgQid3eTovzty0"
+ },
+ {
+ "audience": "id.bento.page",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA",
+ "payload": "x",
+ "transcript": null,
+ "note": "a dotted audience is refused"
+ },
+ {
+ "audience": "dir",
+ "challenge": "AAAAAAAAAAA",
+ "payload": "x",
+ "transcript": null,
+ "note": "a challenge under 16 bytes is refused"
+ },
+ {
+ "audience": "dir",
+ "challenge": "Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA=",
+ "payload": "x",
+ "transcript": null,
+ "note": "a padded challenge is refused"
+ }
+ ],
+ "webauthn": [
+ {
+ "cns": "cns.bento.link..JzXlQBx3iExDjZ5oaRqJl5BNqEzTZ6UP9cs6sM8-9kw.1800000060000",
+ "challenge": "qI_6pnPGWSCuUlbbWPWOYLl33rcaxhrFy4eHiBFXVXo"
+ }
+ ],
+ "lowS": [
+ {
+ "high": "O_i9o7kVaNfQ9TIi0JxY7k08V2MQeP-JZI6uAbEbFNDl6IqEa_XumNVPL1U-QLzc9L6di43-f6cbBqu94x6EBQ",
+ "low": "O_i9o7kVaNfQ9TIi0JxY7k08V2MQeP-JZI6uAbEbFNAaF3V6lAoRaCqw0KrBv0MiyChdIhkZHt3Ysx8FGUShTA"
+ },
+ {
+ "high": "xy7AkWQccPUb3Wkwm7GWKJKv3pkJawcudCKwWAfNqp_cytIXbGlrvuXG_HC3hCqnh_Tm1-KBScL_pzQZ9mhjpA",
+ "low": "xy7AkWQccPUb3Wkwm7GWKJKv3pkJawcudCKwWAfNqp8jNS3nk5aUQho5A49Ie9VYNPIT1cSWVMH0EpapBfrBrQ"
+ },
+ {
+ "high": "7w7BruyFj1JWERIr2LHOGlC3_9o_fqpedDnom3n2I7qW9rV44Ti8VCjn3i5ipvHvY49oDlkGLDU-LVCfClxzVg",
+ "low": "7w7BruyFj1JWERIr2LHOGlC3_9o_fqpedDnom3n2I7ppCUqGHsdDrNcYIdGdWQ4QWVeSn04Rck-1jHoj8gax-w"
+ }
+ ],
+ "purposes": [
+ {
+ "purpose": "frame",
+ "payload": "AQEBAQEBAQEBAQEB.AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg",
+ "match": true
+ },
+ {
+ "purpose": "frame",
+ "payload": "AQEBAQEBAQEBAQEB.AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg.x",
+ "match": false
+ },
+ {
+ "purpose": "frame",
+ "payload": "rev.BHfxypmo3b-JT1aropKgAN_9FrkpSfP_jkuasqfjg7vqsLf5gWRim6U7qQJjKx-EGhYtrbHhAzvnv3CxibKb4JI",
+ "match": false
+ },
+ {
+ "purpose": "prove",
+ "payload": "prove.Aw4ZJC86RVBbZnF8h5KdqLO-ydTf6vUA.wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "match": true
+ },
+ {
+ "purpose": "prove",
+ "payload": "prove.short.wBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
+ "match": false
+ },
+ {
+ "purpose": "delegate",
+ "payload": "dlg.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514",
+ "match": true
+ },
+ {
+ "purpose": "show",
+ "payload": "live",
+ "match": true
+ },
+ {
+ "purpose": "show",
+ "payload": "end",
+ "match": true
+ },
+ {
+ "purpose": "show",
+ "payload": "nav.aud.AQEBAQEBAQEBAQEB.AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg",
+ "match": true
+ },
+ {
+ "purpose": "show",
+ "payload": "laser.aud.AQEBAQEBAQEBAQEB.AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg",
+ "match": false
+ },
+ {
+ "purpose": "invite",
+ "payload": "inv.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.writer.0",
+ "match": true
+ },
+ {
+ "purpose": "invite",
+ "payload": "inv.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.owner.0",
+ "match": false
+ },
+ {
+ "purpose": "revoke",
+ "payload": "rev.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514",
+ "match": true
+ },
+ {
+ "purpose": "revoke",
+ "payload": "inv.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.writer.0",
+ "match": false,
+ "note": "a revoke prompt can never sign an invite"
+ },
+ {
+ "purpose": "frame",
+ "payload": "inv.BPNyms33ggb5b4Dgb5iMEF_7ZvtZ8qzi1aFfZe8jNz9swQ2HkTE2y1OtyYMdcJMQa4uu_HIH9LnKQvnxCMR7514.writer.0",
+ "match": false,
+ "note": "a routine frame can never sign an invite"
+ }
+ ],
+ "addresses": [
+ {
+ "input": "[email protected]",
+ "address": "[email protected]"
+ },
+ {
+ "input": "[email protected]",
+ "address": "[email protected]",
+ "note": "no provider folding"
+ },
+ {
+ "input": "[email protected]",
+ "address": "[email protected]",
+ "note": "an ASCII xn-- domain, as typed"
+ },
+ {
+ "input": " [email protected] ",
+ "address": "[email protected]",
+ "note": "surrounding space is trimmed"
+ },
+ {
+ "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com",
+ "address": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com"
+ },
+ {
+ "input": "ü@x.de",
+ "reason": "not-ascii"
+ },
+ {
+ "input": "a@bü.de",
+ "reason": "not-ascii"
+ },
+ {
+ "input": "\"q\"@x.com",
+ "reason": "local-part",
+ "note": "a quoted local part (the quote is printable ASCII, so it fails dot-atom)"
+ },
+ {
+ "input": "a(c)@x.com",
+ "reason": "local-part"
+ },
+ {
+ "input": "a@[1.2.3.4]",
+ "reason": "domain"
+ },
+ {
+ "input": "[email protected]",
+ "reason": "numeric-tld"
+ },
+ {
+ "input": "[email protected]",
+ "reason": "local-part"
+ },
+ {
+ "input": "[email protected]",
+ "reason": "local-part"
+ },
+ {
+ "input": "[email protected]",
+ "reason": "local-part"
+ },
+ {
+ "input": "a@x",
+ "reason": "domain",
+ "note": "a single label"
+ },
+ {
+ "input": "[email protected]",
+ "reason": "domain"
+ },
+ {
+ "input": "[email protected]",
+ "reason": "domain"
+ },
+ {
+ "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com",
+ "reason": "too-long"
+ },
+ {
+ "input": "a@bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
+ "reason": "too-long",
+ "note": "255 characters"
+ },
+ {
+ "input": "a [email protected]",
+ "reason": "not-ascii",
+ "note": "an inner space"
+ },
+ {
+ "input": "a@[email protected]",
+ "reason": "at-sign"
+ },
+ {
+ "input": "@x.com",
+ "reason": "at-sign"
+ },
+ {
+ "input": "a@",
+ "reason": "at-sign"
+ }
+ ],
+ "displayForbidden": {
+ "unicode": "17.0",
+ "ranges": [
+ [
+ 0,
+ 31
+ ],
+ [
+ 127,
+ 159
+ ],
+ [
+ 173,
+ 173
+ ],
+ [
+ 888,
+ 889
+ ],
+ [
+ 896,
+ 899
+ ],
+ [
+ 907,
+ 907
+ ],
+ [
+ 909,
+ 909
+ ],
+ [
+ 930,
+ 930
+ ],
+ [
+ 1328,
+ 1328
+ ],
+ [
+ 1367,
+ 1368
+ ],
+ [
+ 1419,
+ 1420
+ ],
+ [
+ 1424,
+ 1424
+ ],
+ [
+ 1480,
+ 1487
+ ],
+ [
+ 1515,
+ 1518
+ ],
+ [
+ 1525,
+ 1541
+ ],
+ [
+ 1564,
+ 1564
+ ],
+ [
+ 1757,
+ 1757
+ ],
+ [
+ 1806,
+ 1807
+ ],
+ [
+ 1867,
+ 1868
+ ],
+ [
+ 1970,
+ 1983
+ ],
+ [
+ 2043,
+ 2044
+ ],
+ [
+ 2094,
+ 2095
+ ],
+ [
+ 2111,
+ 2111
+ ],
+ [
+ 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 [
+ 9258,
+ 9279
+ ],
+ [
+ 9291,
+ 9311
+ ],
+ [
+ 11124,
+ 11125
+ ],
+ [
+ 11508,
+ 11512
+ ],
+ [
+ 11558,
+ 11558
+ ],
+ [
+ 11560,
+ 11564
+ ],
+ [
+ 11566,
+ 11567
+ ],
+ [
+ 11624,
+ 11630
+ ],
+ [
+ 11633,
+ 11646
+ ],
+ [
+ 11671,
+ 11679
+ ],
+ [
+ 11687,
+ 11687
+ ],
+ [
+ 11695,
+ 11695
+ ],
+ [
+ 11703,
+ 11703
+ ],
+ [
+ 11711,
+ 11711
+ ],
+ [
+ 11719,
+ 11719
+ ],
+ [
+ 11727,
+ 11727
+ ],
+ [
+ 11735,
+ 11735
+ ],
+ [
+ 11743,
+ 11743
+ ],
+ [
+ 11870,
+ 11903
+ ],
+ [
+ 11930,
+ 11930
+ ],
+ [
+ 12020,
+ 12031
+ ],
+ [
+ 12246,
+ 12271
+ ],
+ [
+ 12352,
+ 12352
+ ],
+ [
+ 12439,
+ 12440
+ ],
+ [
+ 12544,
+ 12548
+ ],
+ [
+ 12592,
+ 12592
+ ],
+ [
+ 12644,
+ 12644
+ ],
+ [
+ 12687,
+ 12687
+ ],
+ [
+ 12774,
+ 12782
+ ],
+ [
+ 12831,
+ 12831
+ ],
+ [
+ 42125,
+ 42127
+ ],
+ [
+ 42183,
+ 42191
+ ],
+ [
+ 42540,
+ 42559
+ ],
+ [
+ 42744,
+ 42751
+ ],
+ [
+ 42973,
+ 42992
+ ],
+ [
+ 43053,
+ 43055
+ ],
+ [
+ 43066,
+ 43071
+ ],
+ [
+ 43128,
+ 43135
+ ],
+ [
+ 43206,
+ 43213
+ ],
+ [
+ 43226,
+ 43231
+ ],
+ [
+ 43348,
+ 43358
+ ],
+ [
+ 43389,
+ 43391
+ ],
+ [
+ 43470,
+ 43470
+ ],
+ [
+ 43482,
+ 43485
+ ],
+ [
+ 43519,
+ 43519
+ ],
+ [
+ 43575,
+ 43583
+ ],
+ [
+ 43598,
+ 43599
+ ],
+ [
+ 43610,
+ 43611
+ ],
+ [
+ 43715,
+ 43738
+ ],
+ [
+ 43767,
+ 43776
+ ],
+ [
+ 43783,
+ 43784
+ ],
+ [
+ 43791,
+ 43792
+ ],
+ [
+ 43799,
+ 43807
+ ],
+ [
+ 43815,
+ 43815
+ ],
+ [
+ 43823,
+ 43823
+ ],
+ [
+ 43884,
+ 43887
+ ],
+ [
+ 44014,
+ 44015
+ ],
+ [
+ 44026,
+ 44031
+ ],
+ [
+ 55204,
+ 55215
+ ],
+ [
+ 55239,
+ 55242
+ ],
+ [
+ 55292,
+ 55295
+ ],
+ [
+ 57344,
+ 63743
+ ],
+ [
+ 64110,
+ 64111
+ ],
+ [
+ 64218,
+ 64255
+ ],
+ [
+ 64263,
+ 64274
+ ],
+ [
+ 64280,
+ 64284
+ ],
+ [
+ 64311,
+ 64311
+ ],
+ [
+ 64317,
+ 64317
+ ],
+ [
+ 64319,
+ 64319
+ ],
+ [
+ 64322,
+ 64322
+ ],
+ [
+ 64325,
+ 64325
+ ],
+ [
+ 64976,
+ 65007
+ ],
+ [
+ 65050,
+ 65055
+ ],
+ [
+ 65107,
+ 65107
+ ],
+ [
+ 65127,
+ 65127
+ ],
+ [
+ 65132,
+ 65135
+ ],
+ [
+ 65141,
+ 65141
+ ],
+ [
+ 65277,
+ 65280
+ ],
+ [
+ 65440,
+ 65440
+ ],
+ [
+ 65471,
+ 65473
+ ],
+ [
+ 65480,
+ 65481
+ ],
+ [
+ 65488,
+ 65489
+ ],
+ [
+ 65496,
+ 65497
+ ],
+ [
+ 65501,
+ 65503
+ ],
+ [
+ 65511,
+ 65511
+ ],
+ [
+ 65519,
+ 65531
+ ],
+ [
+ 65534,
+ 65535
+ ],
+ [
+ 65548,
+ 65548
+ ],
+ [
+ 65575,
+ 65575
+ ],
+ [
+ 65595,
+ 65595
+ ],
+ [
+ 65598,
+ 65598
+ ],
+ [
+ 65614,
+ 65615
+ ],
+ [
+ 65630,
+ 65663
+ ],
+ [
+ 65787,
+ 65791
+ ],
+ [
+ 65795,
+ 65798
+ ],
+ [
+ 65844,
+ 65846
+ ],
+ [
+ 65935,
+ 65935
+ ],
+ [
+ 65949,
+ 65951
+ ],
+ [
+ 65953,
+ 65999
+ ],
+ [
+ 66046,
+ 66175
+ ],
+ [
+ 66205,
+ 66207
+ ],
+ [
+ 66257,
+ 66271
+ ],
+ [
+ 66300,
+ 66303
+ ],
+ [
+ 66340,
+ 66348
+ ],
+ [
+ 66379,
+ 66383
+ ],
+ [
+ 66427,
+ 66431
+ ],
+ [
+ 66462,
+ 66462
+ ],
+ [
+ 66500,
+ 66503
+ ],
+ [
+ 66518,
+ 66559
+ ],
+ [
+ 66718,
+ 66719
+ ],
+ [
+ 66730,
+ 66735
+ ],
+ [
+ 66772,
+ 66775
+ ],
+ [
+ 66812,
+ 66815
+ ],
+ [
+ 66856,
+ 66863
+ ],
+ [
+ 66916,
+ 66926
+ ],
+ [
+ 66939,
+ 66939
+ ],
+ [
+ 66955,
+ 66955
+ ],
+ [
+ 66963,
+ 66963
+ ],
+ [
+ 66966,
+ 66966
+ ],
+ [
+ 66978,
+ 66978
+ ],
+ [
+ 66994,
+ 66994
+ ],
+ [
+ 67002,
+ 67002
+ ],
+ [
+ 67005,
+ 67007
+ ],
+ [
+ 67060,
+ 67071
+ ],
+ [
+ 67383,
+ 67391
+ ],
+ [
+ 67414,
+ 67423
+ ],
+ [
+ 67432,
+ 67455
+ ],
+ [
+ 67462,
+ 67462
+ ],
+ [
+ 67505,
+ 67505
+ ],
+ [
+ 67515,
+ 67583
+ ],
+ [
+ 67590,
+ 67591
+ ],
+ [
+ 67593,
+ 67593
+ ],
+ [
+ 67638,
+ 67638
+ ],
+ [
+ 67641,
+ 67643
+ ],
+ [
+ 67645,
+ 67646
+ ],
+ [
+ 67670,
+ 67670
+ ],
+ [
+ 67743,
+ 67750
+ ],
+ [
+ 67760,
+ 67807
+ ],
+ [
+ 67827,
+ 67827
+ ],
+ [
+ 67830,
+ 67834
+ ],
+ [
+ 67868,
+ 67870
+ ],
+ [
+ 67898,
+ 67902
+ ],
+ [
+ 67930,
+ 67967
+ ],
+ [
+ 68024,
+ 68027
+ ],
+ [
+ 68048,
+ 68049
+ ],
+ [
+ 68100,
+ 68100
+ ],
+ [
+ 68103,
+ 68107
+ ],
+ [
+ 68116,
+ 68116
+ ],
+ [
+ 68120,
+ 68120
+ ],
+ [
+ 68150,
+ 68151
+ ],
+ [
+ 68155,
+ 68158
+ ],
+ [
+ 68169,
+ 68175
+ ],
+ [
+ 68185,
+ 68191
+ ],
+ [
+ 68256,
+ 68287
+ ],
+ [
+ 68327,
+ 68330
+ ],
+ [
+ 68343,
+ 68351
+ ],
+ [
+ 68406,
+ 68408
+ ],
+ [
+ 68438,
+ 68439
+ ],
+ [
+ 68467,
+ 68471
+ ],
+ [
+ 68498,
+ 68504
+ ],
+ [
+ 68509,
+ 68520
+ ],
+ [
+ 68528,
+ 68607
+ ],
+ [
+ 68681,
+ 68735
+ ],
+ [
+ 68787,
+ 68799
+ ],
+ [
+ 68851,
+ 68857
+ ],
+ [
+ 68904,
+ 68911
+ ],
+ [
+ 68922,
+ 68927
+ ],
+ [
+ 68966,
+ 68968
+ ],
+ [
+ 68998,
+ 69005
+ ],
+ [
+ 69008,
+ 69215
+ ],
+ [
+ 69247,
+ 69247
+ ],
+ [
+ 69290,
+ 69290
+ ],
+ [
+ 69294,
+ 69295
+ ],
+ [
+ 69298,
+ 69313
+ ],
+ [
+ 69320,
+ 69327
+ ],
+ [
+ 69337,
+ 69369
+ ],
+ [
+ 69416,
+ 69423
+ ],
+ [
+ 69466,
+ 69487
+ ],
+ [
+ 69514,
+ 69551
+ ],
+ [
+ 69580,
+ 69599
+ ],
+ [
+ 69623,
+ 69631
+ ],
+ [
+ 69710,
+ 69713
+ ],
+ [
+ 69750,
+ 69758
+ ],
+ [
+ 69821,
+ 69821
+ ],
+ [
+ 69827,
+ 69839
+ ],
+ [
+ 69865,
+ 69871
+ ],
+ [
+ 69882,
+ 69887
+ ],
+ [
+ 69941,
+ 69941
+ ],
+ [
+ 69960,
+ 69967
+ ],
+ [
+ 70007,
+ 70015
+ ],
+ [
+ 70112,
+ 70112
+ ],
+ [
+ 70133,
+ 70143
+ ],
+ [
+ 70162,
+ 70162
+ ],
+ [
+ 70210,
+ 70271
+ ],
+ [
+ 70279,
+ 70279
+ ],
+ [
+ 70281,
+ 70281
+ ],
+ [
+ 70286,
+ 70286
+ ],
+ [
+ 70302,
+ 70302
+ ],
+ [
+ 70314,
+ 70319
+ ],
+ [
+ 70379,
+ 70383
+ ],
+ [
+ 70394,
+ 70399
+ ],
+ [
+ 70404,
+ 70404
+ ],
+ [
+ 70413,
+ 70414
+ ],
+ [
+ 70417,
+ 70418
+ ],
+ [
+ 70441,
+ 70441
+ ],
+ [
+ 70449,
+ 70449
+ ],
+ [
+ 70452,
+ 70452
+ ],
+ [
+ 70458,
+ 70458
+ ],
+ [
+ 70469,
+ 70470
+ ],
+ [
+ 70473,
+ 70474
+ ],
+ [
+ 70478,
+ 70479
+ ],
+ [
+ 70481,
+ 70486
+ ],
+ [
+ 70488,
+ 70492
+ ],
+ [
+ 70500,
+ 70501
+ ],
+ [
+ 70509,
+ 70511
+ ],
+ [
+ 70517,
+ 70527
+ ],
+ [
+ 70538,
+ 70538
+ ],
+ [
+ 70540,
+ 70541
+ ],
+ [
+ 70543,
+ 70543
+ ],
+ [
+ 70582,
+ 70582
+ ],
+ [
+ 70593,
+ 70593
+ ],
+ [
+ 70595,
+ 70596
+ ],
+ [
+ 70598,
+ 70598
+ ],
+ [
+ 70603,
+ 70603
+ ],
+ [
+ 70614,
+ 70614
+ ],
+ [
+ 70617,
+ 70624
+ ],
+ [
+ 70627,
+ 70655
+ ],
+ [
+ 70748,
+ 70748
+ ],
+ [
+ 70754,
+ 70783
+ ],
+ [
+ 70856,
+ 70863
+ ],
+ [
+ 70874,
+ 71039
+ ],
+ [
+ 71094,
+ 71095
+ ],
+ [
+ 71134,
+ 71167
+ ],
+ [
+ 71237,
+ 71247
+ ],
+ [
+ 71258,
+ 71263
+ ],
+ [
+ 71277,
+ 71295
+ ],
+ [
+ 71354,
+ 71359
+ ],
+ [
+ 71370,
+ 71375
+ ],
+ [
+ 71396,
+ 71423
+ ],
+ [
+ 71451,
+ 71452
+ ],
+ [
+ 71468,
+ 71471
+ ],
+ [
+ 71495,
+ 71679
+ ],
+ [
+ 71740,
+ 71839
+ ],
+ [
+ 71923,
+ 71934
+ ],
+ [
+ 71943,
+ 71944
+ ],
+ [
+ 71946,
+ 71947
+ ],
+ [
+ 71956,
+ 71956
+ ],
+ [
+ 71959,
+ 71959
+ ],
+ [
+ 71990,
+ 71990
+ ],
+ [
+ 71993,
+ 71994
+ ],
+ [
+ 72007,
+ 72015
+ ],
+ [
+ 72026,
+ 72095
+ ],
+ [
+ 72104,
+ 72105
+ ],
+ [
+ 72152,
+ 72153
+ ],
+ [
+ 72165,
+ 72191
+ ],
+ [
+ 72264,
+ 72271
+ ],
+ [
+ 72355,
+ 72367
+ ],
+ [
+ 72441,
+ 72447
+ ],
+ [
+ 72458,
+ 72543
+ ],
+ [
+ 72552,
+ 72639
+ ],
+ [
+ 72674,
+ 72687
+ ],
+ [
+ 72698,
+ 72703
+ ],
+ [
+ 72713,
+ 72713
+ ],
+ [
+ 72759,
+ 72759
+ ],
+ [
+ 72774,
+ 72783
+ ],
+ [
+ 72813,
+ 72815
+ ],
+ [
+ 72848,
+ 72849
+ ],
+ [
+ 72872,
+ 72872
+ ],
+ [
+ 72887,
+ 72959
+ ],
+ [
+ 72967,
+ 72967
+ ],
+ [
+ 72970,
+ 72970
+ ],
+ [
+ 73015,
+ 73017
+ ],
+ [
+ 73019,
+ 73019
+ ],
+ [
+ 73022,
+ 73022
+ ],
+ [
+ 73032,
+ 73039
+ ],
+ [
+ 73050,
+ 73055
+ ],
+ [
+ 73062,
+ 73062
+ ],
+ [
+ 73065,
+ 73065
+ ],
+ [
+ 73103,
+ 73103
+ ],
+ [
+ 73106,
+ 73106
+ ],
+ [
+ 73113,
+ 73119
+ ],
+ [
+ 73130,
+ 73135
+ ],
+ [
+ 73180,
+ 73183
+ ],
+ [
+ 73194,
+ 73439
+ ],
+ [
+ 73465,
+ 73471
+ ],
+ [
+ 73489,
+ 73489
+ ],
+ [
+ 73531,
+ 73533
+ ],
+ [
+ 73563,
+ 73647
+ ],
+ [
+ 73649,
+ 73663
+ ],
+ [
+ 73714,
+ 73726
+ ],
+ [
+ 74650,
+ 74751
+ ],
+ [
+ 74863,
+ 74863
+ ],
+ [
+ 74869,
+ 74879
+ ],
+ [
+ 75076,
+ 77711
+ ],
+ [
+ 77811,
+ 77823
+ ],
+ [
+ 78896,
+ 78911
+ ],
+ [
+ 78934,
+ 78943
+ ],
+ [
+ 82939,
+ 82943
+ ],
+ [
+ 83527,
+ 90367
+ ],
+ [
+ 90426,
+ 92159
+ ],
+ [
+ 92729,
+ 92735
+ ],
+ [
+ 92767,
+ 92767
+ ],
+ [
+ 92778,
+ 92781
+ ],
+ [
+ 92863,
+ 92863
+ ],
+ [
+ 92874,
+ 92879
+ ],
+ [
+ 92910,
+ 92911
+ ],
+ [
+ 92918,
+ 92927
+ ],
+ [
+ 92998,
+ 93007
+ ],
+ [
+ 93018,
+ 93018
+ ],
+ [
+ 93026,
+ 93026
+ ],
+ [
+ 93048,
+ 93052
+ ],
+ [
+ 93072,
+ 93503
+ ],
+ [
+ 93562,
+ 93759
+ ],
+ [
+ 93851,
+ 93855
+ ],
+ [
+ 93881,
+ 93882
+ ],
+ [
+ 93908,
+ 93951
+ ],
+ [
+ 94027,
+ 94030
+ ],
+ [
+ 94088,
+ 94094
+ ],
+ [
+ 94112,
+ 94175
+ ],
+ [
+ 94181,
+ 94191
+ ],
+ [
+ 94199,
+ 94207
+ ],
+ [
+ 101590,
+ 101630
+ ],
+ [
+ 101663,
+ 101759
+ ],
+ [
+ 101875,
+ 110575
+ ],
+ [
+ 110580,
+ 110580
+ ],
+ [
+ 110588,
+ 110588
+ ],
+ [
+ 110591,
+ 110591
+ ],
+ [
+ 110883,
+ 110897
+ ],
+ [
+ 110899,
+ 110927
+ ],
+ [
+ 110931,
+ 110932
+ ],
+ [
+ 110934,
+ 110947
+ ],
+ [
+ 110952,
+ 110959
+ ],
+ [
+ 111356,
+ 113663
+ ],
+ [
+ 113771,
+ 113775
+ ],
+ [
+ 113789,
+ 113791
+ ],
+ [
+ 113801,
+ 113807
+ ],
+ [
+ 113818,
+ 113819
+ ],
+ [
+ 113824,
+ 117759
+ ],
+ [
+ 118013,
+ 118015
+ ],
+ [
+ 118452,
+ 118457
+ ],
+ [
+ 118481,
+ 118495
+ ],
+ [
+ 118513,
+ 118527
+ ],
+ [
+ 118574,
+ 118575
+ ],
+ [
+ 118599,
+ 118607
+ ],
+ [
+ 118724,
+ 118783
+ ],
+ [
+ 119030,
+ 119039
+ ],
+ [
+ 119079,
+ 119080
+ ],
+ [
+ 119155,
+ 119162
+ ],
+ [
+ 119275,
+ 119295
+ ],
+ [
+ 119366,
+ 119487
+ ],
+ [
+ 119508,
+ 119519
+ ],
+ [
+ 119540,
+ 119551
+ ],
+ [
+ 119639,
+ 119647
+ ],
+ [
+ 119673,
+ 119807
+ ],
+ [
+ 119893,
+ 119893
+ ],
+ [
+ 119965,
+ 119965
+ ],
+ [
+ 119968,
+ 119969
+ ],
+ [
+ 119971,
+ 119972
+ ],
+ [
+ 119975,
+ 119976
+ ],
+ [
+ 119981,
+ 119981
+ ],
+ [
+ 119994,
+ 119994
+ ],
+ [
+ 119996,
+ 119996
+ ],
+ [
+ 120004,
+ 120004
+ ],
+ [
+ 120070,
+ 120070
+ ],
+ [
+ 120075,
+ 120076
+ ],
+ [
+ 120085,
+ 120085
+ ],
+ [
+ 120093,
+ 120093
+ ],
+ [
+ 120122,
+ 120122
+ ],
+ [
+ 120127,
+ 120127
+ ],
+ [
+ 120133,
+ 120133
+ ],
+ [
+ 120135,
+ 120137
+ ],
+ [
+ 120145,
+ 120145
+ ],
+ [
+ 120486,
+ 120487
+ ],
+ [
+ 120780,
+ 120781
+ ],
+ [
+ 121484,
+ 121498
+ ],
+ [
+ 121504,
+ 121504
+ ],
+ [
+ 121520,
+ 122623
+ ],
+ [
+ 122655,
+ 122660
+ ],
+ [
+ 122667,
+ 122879
+ ],
+ [
+ 122887,
+ 122887
+ ],
+ [
+ 122905,
+ 122906
+ ],
+ [
+ 122914,
+ 122914
+ ],
+ [
+ 122917,
+ 122917
+ ],
+ [
+ 122923,
+ 122927
+ ],
+ [
+ 122990,
+ 123022
+ ],
+ [
+ 123024,
+ 123135
+ ],
+ [
+ 123181,
+ 123183
+ ],
+ [
+ 123198,
+ 123199
+ ],
+ [
+ 123210,
+ 123213
+ ],
+ [
+ 123216,
+ 123535
+ ],
+ [
+ 123567,
+ 123583
+ ],
+ [
+ 123642,
+ 123646
+ ],
+ [
+ 123648,
+ 124111
+ ],
+ [
+ 124154,
+ 124367
+ ],
+ [
+ 124411,
+ 124414
+ ],
+ [
+ 124416,
+ 124607
+ ],
+ [
+ 124639,
+ 124639
+ ],
+ [
+ 124662,
+ 124669
+ ],
+ [
+ 124672,
+ 124895
+ ],
+ [
+ 124903,
+ 124903
+ ],
+ [
+ 124908,
+ 124908
+ ],
+ [
+ 124911,
+ 124911
+ ],
+ [
+ 124927,
+ 124927
+ ],
+ [
+ 125125,
+ 125126
+ ],
+ [
+ 125143,
+ 125183
+ ],
+ [
+ 125260,
+ 125263
+ ],
+ [
+ 125274,
+ 125277
+ ],
+ [
+ 125280,
+ 126064
+ ],
+ [
+ 126133,
+ 126208
+ ],
+ [
+ 126270,
+ 126463
+ ],
+ [
+ 126468,
+ 126468
+ ],
+ [
+ 126496,
+ 126496
+ ],
+ [
+ 126499,
+ 126499
+ ],
+ [
+ 126501,
+ 126502
+ ],
+ [
+ 126504,
+ 126504
+ ],
+ [
+ 126515,
+ 126515
+ ],
+ [
+ 126520,
+ 126520
+ ],
+ [
+ 126522,
+ 126522
+ ],
+ [
+ 126524,
+ 126529
+ ],
+ [
+ 126531,
+ 126534
+ ],
+ [
+ 126536,
+ 126536
+ ],
+ [
+ 126538,
+ 126538
+ ],
+ [
+ 126540,
+ 126540
+ ],
+ [
+ 126544,
+ 126544
+ ],
+ [
+ 126547,
+ 126547
+ ],
+ [
+ 126549,
+ 126550
+ ],
+ [
+ 126552,
+ 126552
+ ],
+ [
+ 126554,
+ 126554
+ ],
+ [
+ 126556,
+ 126556
+ ],
+ [
+ 126558,
+ 126558
+ ],
+ [
+ 126560,
+ 126560
+ ],
+ [
+ 126563,
+ 126563
+ ],
+ [
+ 126565,
+ 126566
+ ],
+ [
+ 126571,
+ 126571
+ ],
+ [
+ 126579,
+ 126579
+ ],
+ [
+ 126584,
+ 126584
+ ],
+ [
+ 126589,
+ 126589
+ ],
+ [
+ 126591,
+ 126591
+ ],
+ [
+ 126602,
+ 126602
+ ],
+ [
+ 126620,
+ 126624
+ ],
+ [
+ 126628,
+ 126628
+ ],
+ [
+ 126634,
+ 126634
+ ],
+ [
+ 126652,
+ 126703
+ ],
+ [
+ 126706,
+ 126975
+ ],
+ [
+ 127020,
+ 127023
+ ],
+ [
+ 127124,
+ 127135
+ ],
+ [
+ 127151,
+ 127152
+ ],
+ [
+ 127168,
+ 127168
+ ],
+ [
+ 127184,
+ 127184
+ ],
+ [
+ 127222,
+ 127231
+ ],
+ [
+ 127406,
+ 127461
+ ],
+ [
+ 127491,
+ 127503
+ ],
+ [
+ 127548,
+ 127551
+ ],
+ [
+ 127561,
+ 127567
+ ],
+ [
+ 127570,
+ 127583
+ ],
+ [
+ 127590,
+ 127743
+ ],
+ [
+ 128729,
+ 128731
+ ],
+ [
+ 128749,
+ 128751
+ ],
+ [
+ 128765,
+ 128767
+ ],
+ [
+ 128986,
+ 128991
+ ],
+ [
+ 129004,
+ 129007
+ ],
+ [
+ 129009,
+ 129023
+ ],
+ [
+ 129036,
+ 129039
+ ],
+ [
+ 129096,
+ 129103
+ ],
+ [
+ 129114,
+ 129119
+ ],
+ [
+ 129160,
+ 129167
+ ],
+ [
+ 129198,
+ 129199
+ ],
+ [
+ 129212,
+ 129215
+ ],
+ [
+ 129218,
+ 129231
+ ],
+ [
+ 129241,
+ 129279
+ ],
+ [
+ 129624,
+ 129631
+ ],
+ [
+ 129646,
+ 129647
+ ],
+ [
+ 129661,
+ 129663
+ ],
+ [
+ 129675,
+ 129677
+ ],
+ [
+ 129735,
+ 129735
+ ],
+ [
+ 129737,
+ 129740
+ ],
+ [
+ 129757,
+ 129758
+ ],
+ [
+ 129771,
+ 129774
+ ],
+ [
+ 129785,
+ 129791
+ ],
+ [
+ 129939,
+ 129939
+ ],
+ [
+ 130043,
+ 131071
+ ],
+ [
+ 173792,
+ 173823
+ ],
+ [
+ 178206,
+ 178207
+ ],
+ [
+ 183982,
+ 183983
+ ],
+ [
+ 191457,
+ 191471
+ ],
+ [
+ 192094,
+ 194559
+ ],
+ [
+ 195102,
+ 196607
+ ],
+ [
+ 201547,
+ 201551
+ ],
+ [
+ 210042,
+ 917759
+ ],
+ [
+ 918000,
+ 1114111
+ ]
+ ]
+ }
+}
diff --git a/kernel/src/address.ts b/kernel/src/address.ts
new file mode 100644
index 00000000..ed7ce7c0
--- /dev/null
+++ b/kernel/src/address.ts
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// bento/id — the ONE definition of "which mailbox is this address".
+//
+// The directory binds an address to a key, and an agent looks an address up. If
+// the two normalise differently, a lookup and a binding can disagree about which
+// mailbox they mean, and someone else's key could answer for yours. So both use
+// this rule: the directory imports this module, and the native agents (Swift,
+// Kotlin, Rust, which cannot import it) must pass every row of the vector fixture
+// (kernel/fixtures/identity-v1.json). The VECTORS are the contract for them; this
+// file is the reference.
+//
+// Phase 1 accepts ASCII addresses only (a maintainer decision). International
+// domain handling diverges between platforms (WHATWG URL uses UTS #46
+// non-transitional processing; java.net.IDN is IDNA2003, so "ß" becomes a
+// different domain), and an address two hosts read differently is exactly the
+// bug this module exists to prevent. A domain typed in its ASCII `xn--` form is
+// accepted as typed. The limit lifts once vectors prove every host agrees.
+//
+// No provider folding of any kind: Gmail's dots and +tags are part of the
+// address. Folding is a guess about one provider's policy, and a wrong guess
+// merges two people's mailboxes.
+
+export type AddressResult =
+ | { ok: true; address: string }
+ | { ok: false; reason: AddressRefusal }
+
+export type AddressRefusal =
+ | 'too-long' // over 254 characters, or a local part over 64
+ | 'not-ascii' // a character outside 0x21–0x7E (spaces, non-ASCII, controls)
+ | 'at-sign' // not exactly one '@', or '@' first or last
+ | 'local-part' // not a dot-atom: quoted, comments, leading/trailing/double dots
+ | 'domain' // fewer than two labels, or a malformed label, or an IP literal
+ | 'numeric-tld' // the last label is all digits (an IPv4 address)
+
+const MAX_ADDRESS = 254
+const MAX_LOCAL = 64
+const MAX_LABEL = 63
+
+/** RFC 5322 atext, lower-cased (the input is lower-cased before this runs). */
+const ATEXT = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+$/
+
+/** Normalise an address typed by a person, or say why it is refused. */
+export function normalizeAddress(input: string): AddressResult {
+ const s = input.trim()
+ if (s.length > MAX_ADDRESS) return { ok: false, reason: 'too-long' }
+ for (let i = 0; i < s.length; i++) {
+ const c = s.charCodeAt(i)
+ if (c < 0x21 || c > 0x7e) return { ok: false, reason: 'not-ascii' }
+ }
+ const at = s.indexOf('@')
+ if (at <= 0 || at !== s.lastIndexOf('@') || at === s.length - 1) return { ok: false, reason: 'at-sign' }
+ const local = s.slice(0, at).toLowerCase()
+ const domain = s.slice(at + 1).toLowerCase()
+
+ if (local.length > MAX_LOCAL) return { ok: false, reason: 'too-long' }
+ // dot-atom: atext runs separated by single dots, none leading or trailing
+ for (const atom of local.split('.')) if (!ATEXT.test(atom)) return { ok: false, reason: 'local-part' }
+
+ const labels = domain.split('.')
+ if (labels.length < 2) return { ok: false, reason: 'domain' }
+ for (const label of labels) {
+ if (label.length < 1 || label.length > MAX_LABEL) return { ok: false, reason: 'domain' }
+ if (!/^[a-z0-9-]+$/.test(label)) return { ok: false, reason: 'domain' } // also refuses '[' IP literals
+ if (label.startsWith('-') || label.endsWith('-')) return { ok: false, reason: 'domain' }
+ }
+ if (/^[0-9]+$/.test(labels[labels.length - 1])) return { ok: false, reason: 'numeric-tld' }
+
+ return { ok: true, address: `${local}@${domain}` }
+}
+
+/** True when `s` is already in normal form (what a signed statement must carry). */
+export function isNormalAddress(s: string): boolean {
+ const r = normalizeAddress(s)
+ return r.ok && r.address === s
+}
diff --git a/kernel/src/display-table.ts b/kernel/src/display-table.ts
new file mode 100644
index 00000000..226a5152
--- /dev/null
+++ b/kernel/src/display-table.ts
@@ -0,0 +1,762 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// GENERATED by scripts/gen-display-table.ts — do not edit by hand.
+//
+// The code points a bento/id display name may not contain, frozen at Unicode
+// 17.0: controls, private use, unassigned (with the noncharacters), line and
+// paragraph separators, format characters except ZWNJ/ZWJ, and the Hangul fill
+// letters. 746 inclusive ranges, sorted and disjoint, as a flat list of
+// [first, last] pairs. kernel/fixtures/identity-v1.json carries the same table
+// for the native hosts, which embed it rather than reading their own platform's
+// (drifting) Unicode tables.
+
+export const DISPLAY_FORBIDDEN_UNICODE = '17.0'
+
+export const DISPLAY_FORBIDDEN_FLAT: readonly number[] = Object.freeze([
+ 0x0,0x1f,
+ 0x7f,0x9f,
+ 0xad,0xad,
+ 0x378,0x379,
+ 0x380,0x383,
+ 0x38b,0x38b,
+ 0x38d,0x38d,
+ 0x3a2,0x3a2,
+ 0x530,0x530,
+ 0x557,0x558,
+ 0x58b,0x58c,
+ 0x590,0x590,
+ 0x5c8,0x5cf,
+ 0x5eb,0x5ee,
+ 0x5f5,0x605,
+ 0x61c,0x61c,
+ 0x6dd,0x6dd,
+ 0x70e,0x70f,
+ 0x74b,0x74c,
+ 0x7b2,0x7bf,
+ 0x7fb,0x7fc,
+ 0x82e,0x82f,
+ 0x83f,0x83f,
+ 0x85c,0x85d,
+ 0x85f,0x85f,
+ 0x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0x1029f,
+ 0x102d1,0x102df,
+ 0x102fc,0x102ff,
+ 0x10324,0x1032c,
+ 0x1034b,0x1034f,
+ 0x1037b,0x1037f,
+ 0x1039e,0x1039e,
+ 0x103c4,0x103c7,
+ 0x103d6,0x103ff,
+ 0x1049e,0x1049f,
+ 0x104aa,0x104af,
+ 0x104d4,0x104d7,
+ 0x104fc,0x104ff,
+ 0x10528,0x1052f,
+ 0x10564,0x1056e,
+ 0x1057b,0x1057b,
+ 0x1058b,0x1058b,
+ 0x10593,0x10593,
+ 0x10596,0x10596,
+ 0x105a2,0x105a2,
+ 0x105b2,0x105b2,
+ 0x105ba,0x105ba,
+ 0x105bd,0x105bf,
+ 0x105f4,0x105ff,
+ 0x10737,0x1073f,
+ 0x10756,0x1075f,
+ 0x10768,0x1077f,
+ 0x10786,0x10786,
+ 0x107b1,0x107b1,
+ 0x107bb,0x107ff,
+ 0x10806,0x10807,
+ 0x10809,0x10809,
+ 0x10836,0x10836,
+ 0x10839,0x1083b,
+ 0x1083d,0x1083e,
+ 0x10856,0x10856,
+ 0x1089f,0x108a6,
+ 0x108b0,0x108df,
+ 0x108f3,0x108f3,
+ 0x108f6,0x108fa,
+ 0x1091c,0x1091e,
+ 0x1093a,0x1093e,
+ 0x1095a,0x1097f,
+ 0x109b8,0x109bb,
+ 0x109d0,0x109d1,
+ 0x10a04,0x10a04,
+ 0x10a07,0x10a0b,
+ 0x10a14,0x10a14,
+ 0x10a18,0x10a18,
+ 0x10a36,0x10a37,
+ 0x10a3b,0x10a3e,
+ 0x10a49,0x10a4f,
+ 0x10a59,0x10a5f,
+ 0x10aa0,0x10abf,
+ 0x10ae7,0x10aea,
+ 0x10af7,0x10aff,
+ 0x10b36,0x10b38,
+ 0x10b56,0x10b57,
+ 0x10b73,0x10b77,
+ 0x10b92,0x10b98,
+ 0x10b9d,0x10ba8,
+ 0x10bb0,0x10bff,
+ 0x10c49,0x10c7f,
+ 0x10cb3,0x10cbf,
+ 0x10cf3,0x10cf9,
+ 0x10d28,0x10d2f,
+ 0x10d3a,0x10d3f,
+ 0x10d66,0x10d68,
+ 0x10d86,0x10d8d,
+ 0x10d90,0x10e5f,
+ 0x10e7f,0x10e7f,
+ 0x10eaa,0x10eaa,
+ 0x10eae,0x10eaf,
+ 0x10eb2,0x10ec1,
+ 0x10ec8,0x10ecf,
+ 0x10ed9,0x10ef9,
+ 0x10f28,0x10f2f,
+ 0x10f5a,0x10f6f,
+ 0x10f8a,0x10faf,
+ 0x10fcc,0x10fdf,
+ 0x10ff7,0x10fff,
+ 0x1104e,0x11051,
+ 0x11076,0x1107e,
+ 0x110bd,0x110bd,
+ 0x110c3,0x110cf,
+ 0x110e9,0x110ef,
+ 0x110fa,0x110ff,
+ 0x11135,0x11135,
+ 0x11148,0x1114f,
+ 0x11177,0x1117f,
+ 0x111e0,0x111e0,
+ 0x111f5,0x111ff,
+ 0x11212,0x11212,
+ 0x11242,0x1127f,
+ 0x11287,0x11287,
+ 0x11289,0x11289,
+ 0x1128e,0x1128e,
+ 0x1129e,0x1129e,
+ 0x112aa,0x112af,
+ 0x112eb,0x112ef,
+ 0x112fa,0x112ff,
+ 0x11304,0x11304,
+ 0x1130d,0x1130e,
+ 0x11311,0x11312,
+ 0x11329,0x11329,
+ 0x11331,0x11331,
+ 0x11334,0x11334,
+ 0x1133a,0x1133a,
+ 0x11345,0x11346,
+ 0x11349,0x1134a,
+ 0x1134e,0x1134f,
+ 0x11351,0x11356,
+ 0x11358,0x1135c,
+ 0x11364,0x11365,
+ 0x1136d,0x1136f,
+ 0x11375,0x1137f,
+ 0x1138a,0x1138a,
+ 0x1138c,0x1138d,
+ 0x1138f,0x1138f,
+ 0x113b6,0x113b6,
+ 0x113c1,0x113c1,
+ 0x113c3,0x113c4,
+ 0x113c6,0x113c6,
+ 0x113cb,0x113cb,
+ 0x113d6,0x113d6,
+ 0x113d9,0x113e0,
+ 0x113e3,0x113ff,
+ 0x1145c,0x1145c,
+ 0x11462,0x1147f,
+ 0x114c8,0x114cf,
+ 0x114da,0x1157f,
+ 0x115b6,0x115b7,
+ 0x115de,0x115ff,
+ 0x11645,0x1164f,
+ 0x1165a,0x1165f,
+ 0x1166d,0x1167f,
+ 0x116ba,0x116bf,
+ 0x116ca,0x116cf,
+ 0x116e4,0x116ff,
+ 0x1171b,0x1171c,
+ 0x1172c,0x1172f,
+ 0x11747,0x117ff,
+ 0x1183c,0x1189f,
+ 0x118f3,0x118fe,
+ 0x11907,0x11908,
+ 0x1190a,0x1190b,
+ 0x11914,0x11914,
+ 0x11917,0x11917,
+ 0x11936,0x11936,
+ 0x11939,0x1193a,
+ 0x11947,0x1194f,
+ 0x1195a,0x1199f,
+ 0x119a8,0x119a9,
+ 0x119d8,0x119d9,
+ 0x119e5,0x119ff,
+ 0x11a48,0x11a4f,
+ 0x11aa3,0x11aaf,
+ 0x11af9,0x11aff,
+ 0x11b0a,0x11b5f,
+ 0x11b68,0x11bbf,
+ 0x11be2,0x11bef,
+ 0x11bfa,0x11bff,
+ 0x11c09,0x11c09,
+ 0x11c37,0x11c37,
+ 0x11c46,0x11c4f,
+ 0x11c6d,0x11c6f,
+ 0x11c90,0x11c91,
+ 0x11ca8,0x11ca8,
+ 0x11cb7,0x11cff,
+ 0x11d07,0x11d07,
+ 0x11d0a,0x11d0a,
+ 0x11d37,0x11d39,
+ 0x11d3b,0x11d3b,
+ 0x11d3e,0x11d3e,
+ 0x11d48,0x11d4f,
+ 0x11d5a,0x11d5f,
+ 0x11d66,0x11d66,
+ 0x11d69,0x11d69,
+ 0x11d8f,0x11d8f,
+ 0x11d92,0x11d92,
+ 0x11d99,0x11d9f,
+ 0x11daa,0x11daf,
+ 0x11ddc,0x11ddf,
+ 0x11dea,0x11edf,
+ 0x11ef9,0x11eff,
+ 0x11f11,0x11f11,
+ 0x11f3b,0x11f3d,
+ 0x11f5b,0x11faf,
+ 0x11fb1,0x11fbf,
+ 0x11ff2,0x11ffe,
+ 0x1239a,0x123ff,
+ 0x1246f,0x1246f,
+ 0x12475,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 0x1f80c,0x1f80f,
+ 0x1f848,0x1f84f,
+ 0x1f85a,0x1f85f,
+ 0x1f888,0x1f88f,
+ 0x1f8ae,0x1f8af,
+ 0x1f8bc,0x1f8bf,
+ 0x1f8c2,0x1f8cf,
+ 0x1f8d9,0x1f8ff,
+ 0x1fa58,0x1fa5f,
+ 0x1fa6e,0x1fa6f,
+ 0x1fa7d,0x1fa7f,
+ 0x1fa8b,0x1fa8d,
+ 0x1fac7,0x1fac7,
+ 0x1fac9,0x1facc,
+ 0x1fadd,0x1fade,
+ 0x1faeb,0x1faee,
+ 0x1faf9,0x1faff,
+ 0x1fb93,0x1fb93,
+ 0x1fbfb,0x1ffff,
+ 0x2a6e0,0x2a6ff,
+ 0x2b81e,0x2b81f,
+ 0x2ceae,0x2ceaf,
+ 0x2ebe1,0x2ebef,
+ 0x2ee5e,0x2f7ff,
+ 0x2fa1e,0x2ffff,
+ 0x3134b,0x3134f,
+ 0x3347a,0xe00ff,
+ 0xe01f0,0x10ffff,
+])
diff --git a/kernel/src/identity.ts b/kernel/src/identity.ts
index 54ecca34..e1a75d85 100644
--- a/kernel/src/identity.ts
+++ b/kernel/src/identity.ts
@@ -56,9 +56,16 @@ export interface PublicIdentity {
* show — `live`/`end` and `${kind}.aud.${i}`, presenting controls (routine)
* invite — `inv.${pub}.${role}.${exp}`, an owner granting a role (high authority)
* revoke — `rev.${pub}`, an owner removing a key (high authority)
- * High-authority purposes get the host's own consent prompt and the consent
- * key every time; routine ones ride the session (security §2e). The shared
- * payload matcher and its test vectors land with the statement formats (K2).
+ * Routine purposes are signed with the DEVICE key and ride the session (§2e).
+ * The high-authority ones are signed with the room's OWNER key, which the relay
+ * verifies. In phase 1 that key still lives in the document file and the kernel
+ * signs with it directly, exactly as today: no agent holds an owner key, so a
+ * phase-1 agent refuses `invite`/`revoke` ('unavailable'). The agent holds an
+ * owner key only once a document converts to identity mode (phase 2). Then it
+ * signs `inv.`/`rev.` after its own consent prompt, and the CONSENT key signs a
+ * separate `cns.` (statements.ts) that travels beside it. A cns. needs the
+ * verifier's audience and challenge, so phase 2 adds a call that carries them;
+ * this contract version has none. The shared payload matcher is statements.ts.
*/
export type SignPurpose = 'frame' | 'prove' | 'delegate' | 'show' | 'invite' | 'revoke'
@@ -104,7 +111,11 @@ export interface IdentityAgent {
/** The person using this document, or null when no identity is set up or
* they declined to use it here (consent is per document). */
whoami(): Promise<PublicIdentity | null>
- /** Sign `payload` (the exact UTF-8 text) for `purpose` with this device's key. */
+ /** Sign `payload` (the exact UTF-8 text) for `purpose` with this device's key.
+ * A host method that throws reaches the caller as a REJECTED promise: callers
+ * treat a rejection exactly like `{ ok: false, reason: 'unavailable' }` and
+ * never let it escape. Check the payload first with statements.ts
+ * payloadMatchesPurpose; the host refuses a mismatch either way. */
sign(purpose: SignPurpose, payload: string): Promise<SignResult>
/** Who a key in the room (or, phase 2, an address) belongs to; null if unknown.
* A lookup by `{email}` is consent-gated and rate-limited by the HOST, so a
diff --git a/kernel/src/statements.ts b/kernel/src/statements.ts
new file mode 100644
index 00000000..9073e76a
--- /dev/null
+++ b/kernel/src/statements.ts
@@ -0,0 +1,656 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// bento/id — the signed statements: one definition of every byte, for every host.
+//
+// Identity is keys, and everything anyone trusts is a SIGNED STATEMENT: "this
+// device is mine" (dev.), "this key is [email protected]" (bind.), "the directory
+// checked that binding" (att.), "this person consented to exactly this action"
+// (cns.), and the directory's deletion record, delete request and email-code
+// completion (tomb., del., cmp.). The agents (Swift, Kotlin, Rust, and the
+// extension's JS) build and check them, and so do the directory and the
+// document. If two of them read the same bytes differently, a signature means
+// different things to different verifiers. So this module is the reference,
+// and kernel/fixtures/identity-v1.json is the conformance contract every host
+// must pass.
+//
+// THE FAMILY RULES — the same as the shipped collab statements (inv./dlg./rev.):
+// - A statement is dot-joined UTF-8 text, signed over its EXACT bytes. Nobody
+// re-serialises or canonicalises; the text is stored and hashed verbatim.
+// No JSON ever sits inside a signed statement.
+// - Every field is either a token from a CLOSED, dot-free grammar (a purpose
+// word, a kid, an integer) or FREE TEXT encoded as base64url without padding
+// (an email address, a display name). A raw email would break the split: it
+// has dots.
+// - Parsing is strict: split on '.', keep empty fields, require the EXACT field
+// count, check every field against its grammar. A stray field is a rejection,
+// never a re-join. The whole text must be printable ASCII.
+// - An ABSENT value is an EMPTY field, and only where its grammar allows one.
+// - Times are epoch MILLISECONDS, everywhere.
+// - The VERSION is the prefix: `bind.` is version 1; a breaking change is `bind2.`.
+// - Keys are raw uncompressed P-256 points (65 bytes), base64url. Signatures are
+// raw r‖s (64 bytes), base64url, LOW-S — never DER. A host whose platform
+// emits DER converts before anything crosses the bridge; a high-S or DER
+// signature here is a rejection, so a forgotten conversion fails loudly.
+
+import { isNormalAddress } from './address.ts'
+import { DISPLAY_FORBIDDEN_FLAT, DISPLAY_FORBIDDEN_UNICODE } from './display-table.ts'
+import type { SignPurpose } from './identity.ts'
+
+// --- strict base64url --------------------------------------------------------
+
+const B64U_RE = /^[A-Za-z0-9_-]*$/
+
+export function b64uEnc(bytes: Uint8Array): string {
+ let s = ''
+ for (const b of bytes) s += String.fromCharCode(b)
+ return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
+}
+
+/** Canonical base64url only: the alphabet, no padding, and it must re-encode to
+ * exactly the same string (so trailing bits are zero). Null otherwise. */
+export function b64uDec(s: string): Uint8Array | null {
+ if (typeof s !== 'string' || !B64U_RE.test(s) || s.length % 4 === 1) return null
+ let bin: string
+ try { bin = atob(s.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((s.length + 3) % 4)) } catch { return null }
+ const out = new Uint8Array(bin.length)
+ for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i)
+ return b64uEnc(out) === s ? out : null
+}
+
+const te = new TextEncoder()
+const utf8 = (s: string) => te.encode(s)
+const strictUtf8 = new TextDecoder('utf-8', { fatal: true })
+
+/** base64url-of-UTF-8 → text, canonical both ways; null if not. */
+function freeText(f: string): string | null {
+ const b = b64uDec(f)
+ if (!b) return null
+ let t: string
+ try { t = strictUtf8.decode(b) } catch { return null }
+ return b64uEnc(utf8(t)) === f ? t : null
+}
+
+/**
+ * Display text a person sees (a name, a device label): bounded, in NFC, and free
+ * of anything invisible or layout-changing that could make "alice ✓" read as
+ * something else on screen. Refused:
+ * - controls (Cc), private use (Co), line and paragraph separators (Zl, Zp);
+ * - UNASSIGNED code points (Cn), the 66 noncharacters among them: one assigned
+ * later could be an invisible format character, and NFC is stable across
+ * Unicode versions only for assigned characters (security, #764);
+ * - every format character (Cf): bidi overrides and marks (including U+061C),
+ * zero-width space, word joiner, BOM, soft hyphen, the Mongolian vowel
+ * separator — EXCEPT ZWNJ/ZWJ (U+200C/U+200D), which Persian, Indic scripts
+ * and emoji sequences need, and which are refused only at either end;
+ * - the Hangul fill letters U+115F, U+1160, U+3164, U+FFA0, which render blank.
+ * No filter stops homoglyphs, so a name is SELF-ASSERTED and must never be shown
+ * without the verified address beside it (docs/DECISIONS.md).
+ *
+ * The set is FROZEN as explicit code-point ranges, not resolved through `\p{…}`.
+ * General categories come from each platform's Unicode tables, so a character
+ * newly assigned to Cf would be refused by one host and accepted by another until
+ * both updated, and a name would verify on one device and not the next. These
+ * ranges are the categories above as of Unicode 17.0, generated into
+ * kernel/src/display-table.ts by scripts/gen-display-table.ts (which refuses to
+ * run on any other Unicode version); the fixture carries the same table for the
+ * native hosts, and the rig recomputes it. Changing it is a deliberate format
+ * decision, never a side effect of a platform update.
+ */
+const MAX_DISPLAY = 64
+export { DISPLAY_FORBIDDEN_UNICODE }
+/** The frozen table as [first, last] pairs (kernel/src/display-table.ts, generated). */
+export const DISPLAY_FORBIDDEN_RANGES: ReadonlyArray<readonly [number, number]> = Object.freeze(
+ Array.from({ length: DISPLAY_FORBIDDEN_FLAT.length / 2 },
+ (_, i) => Object.freeze([DISPLAY_FORBIDDEN_FLAT[2 * i], DISPLAY_FORBIDDEN_FLAT[2 * i + 1]]) as readonly [number, number])
+)
+/** Is this code point refused in display text? A binary search over the frozen ranges. */
+export function displayForbidden(cp: number): boolean {
+ let lo = 0, hi = DISPLAY_FORBIDDEN_RANGES.length - 1
+ while (lo <= hi) {
+ const mid = (lo + hi) >> 1
+ const [a, b] = DISPLAY_FORBIDDEN_RANGES[mid]
+ if (cp < a) hi = mid - 1
+ else if (cp > b) lo = mid + 1
+ else return true
+ }
+ return false
+}
+const ZWNJ = 0x200c, ZWJ = 0x200d
+function displayText(f: string): string | null {
+ const t = freeText(f)
+ if (t === null || t.length === 0) return null
+ const cps = [...t].map((c) => c.codePointAt(0)!)
+ if (cps.length > MAX_DISPLAY) return null
+ if (t.normalize('NFC') !== t) return null
+ if (cps.some(displayForbidden)) return null
+ const ends = [cps[0], cps[cps.length - 1]]
+ if (ends.some((c) => c === ZWNJ || c === ZWJ)) return null
+ return t
+}
+
+export async function sha256b64u(text: string): Promise<string> {
+ return b64uEnc(new Uint8Array(await crypto.subtle.digest('SHA-256', utf8(text) as BufferSource)))
+}
+
+// --- keys and signatures -----------------------------------------------------
+
+const EC_SIGN = { name: 'ECDSA', namedCurve: 'P-256' } as const
+const EC_KX = { name: 'ECDH', namedCurve: 'P-256' } as const
+const SIGN_ALG = { name: 'ECDSA', hash: 'SHA-256' } as const
+/** the P-256 group order */
+const N = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n
+const HALF_N = N >> 1n
+
+const toBig = (b: Uint8Array) => b.reduce((x, v) => (x << 8n) | BigInt(v), 0n)
+function to32(x: bigint): Uint8Array {
+ const out = new Uint8Array(32)
+ for (let i = 31; i >= 0; i--) { out[i] = Number(x & 0xffn); x >>= 8n }
+ return out
+}
+
+/** A raw r‖s signature in range with s in the lower half. */
+function sigInRange(sig: Uint8Array): boolean {
+ if (sig.length !== 64) return false
+ const r = toBig(sig.subarray(0, 32)), s = toBig(sig.subarray(32))
+ return r > 0n && r < N && s > 0n && s <= HALF_N
+}
+
+/** The low-S form of a raw r‖s signature (what every signer must emit). */
+export function lowS(sig: Uint8Array): Uint8Array {
+ const s = toBig(sig.subarray(32))
+ if (s <= HALF_N) return sig
+ const out = new Uint8Array(64)
+ out.set(sig.subarray(0, 32))
+ out.set(to32(N - s), 32)
+ return out
+}
+
+/** A raw uncompressed P-256 point that the platform accepts for `alg`. */
+async function point(b64: string, alg: typeof EC_SIGN | typeof EC_KX): Promise<CryptoKey | null> {
+ const raw = b64uDec(b64)
+ if (!raw || raw.length !== 65 || raw[0] !== 0x04) return null
+ try {
+ return await crypto.subtle.importKey('raw', raw as BufferSource, alg, false,
+ alg.name === 'ECDSA' ? ['verify'] : [])
+ } catch { return null }
+}
+export const isSigningKey = async (b64: string) => (await point(b64, EC_SIGN)) !== null
+export const isKxKey = async (b64: string) => (await point(b64, EC_KX)) !== null
+
+/** Verify `sigB64` (raw r‖s, low-S) by `pubB64` over the exact UTF-8 of `text`. */
+export async function verifyStatementSig(pubB64: string, sigB64: string, text: string): Promise<boolean> {
+ const sig = b64uDec(sigB64)
+ if (!sig || !sigInRange(sig)) return false
+ const key = await point(pubB64, EC_SIGN)
+ if (!key) return false
+ try { return await crypto.subtle.verify(SIGN_ALG, key, sig as BufferSource, utf8(text) as BufferSource) } catch { return false }
+}
+
+/** Sign `text` with `key`, emitting the low-S raw form. For JS agents and the
+ * vector generator; native agents produce the same bytes from their key stores. */
+export async function signStatement(key: CryptoKey, text: string): Promise<string> {
+ const sig = new Uint8Array(await crypto.subtle.sign(SIGN_ALG, key, utf8(text) as BufferSource))
+ return b64uEnc(lowS(sig))
+}
+
+// --- strict parsing ------------------------------------------------------------
+
+export type Verdict<T> = { ok: true; value: T } | { ok: false; reason: string }
+const no = (reason: string): { ok: false; reason: string } => ({ ok: false, reason })
+
+const MAX_STATEMENT = 4096
+
+/** Split a statement: printable ASCII only, exact prefix and field count, empty
+ * fields kept. `count` includes the prefix. */
+function fields(text: unknown, prefix: string, count: number): string[] | null {
+ if (typeof text !== 'string' || text.length === 0 || text.length > MAX_STATEMENT) return null
+ for (let i = 0; i < text.length; i++) {
+ const c = text.charCodeAt(i)
+ if (c < 0x21 || c > 0x7e) return null
+ }
+ const parts = text.split('.')
+ return parts.length === count && parts[0] === prefix ? parts : null
+}
+
+const INT_RE = /^(0|[1-9][0-9]{0,15})$/
+function int(f: string): number | null {
+ if (!INT_RE.test(f)) return null
+ const n = Number(f)
+ return Number.isSafeInteger(n) ? n : null
+}
+const ms = (f: string) => { const n = int(f); return n !== null && n > 0 ? n : null }
+/** a SHA-256 digest, base64url (32 bytes, 43 characters) */
+const isHash = (f: string) => b64uDec(f)?.length === 32
+
+const KID_RE = /^[a-z0-9][a-z0-9-]{0,62}$/
+const RP_RE = /^(bento|vault-[a-z0-9][a-z0-9-]{0,62})$/
+const DOCID_RE = /^[A-Za-z0-9_-]{1,128}$/ // security §19i
+const ROOM_RE = /^w[A-Za-z0-9_-]{43}$/ // 'w' + b64u(sha256(owner pub))
+/** The email code: exactly 8 characters from a 31-character alphabet with no
+ * 0/O or 1/I/L, always UPPERCASE (agents uppercase what was typed before
+ * signing). About 39.6 bits, behind 5 attempts and a 20-minute TTL. */
+const CODE_RE = /^[23456789ABCDEFGHJKMNPQRSTUVWXYZ]{8}$/
+
+/** Clock skew tolerated for "issued in the future". */
+export const SKEW_MS = 5 * 60_000
+const DAY = 86_400_000
+/** A certificate lives at most 13 months, plus a day of slack: 13 × 30.5 days + 1. */
+export const CERT_MAX_MS = (13 * 30.5 + 1) * DAY
+
+function lifetime(created: number, expires: number, now: number): string | null {
+ if (expires <= created) return 'lifetime'
+ if (expires - created > CERT_MAX_MS) return 'lifetime'
+ if (created > now + SKEW_MS) return 'not-yet-valid'
+ if (now >= expires) return 'expired'
+ return null
+}
+
+// --- kx placement (pending the maintainer, identity-design §6b) ----------------
+
+/**
+ * Where the key-agreement key lives is a maintainer decision (§6b): A shared kx
+ * in bind.; B per-device kx in dev.; C per-device kx in dev. AND a recovery kx in
+ * bind. Both certificates carry a kx SLOT now, so the ruling changes which slot
+ * is required, never the format. Until it is ruled, the strictest reading holds:
+ * BOTH slots must be empty, so nothing accepts a placement nobody chose. Phase 1
+ * shares nothing, so it needs no kx.
+ */
+export type KxMode = 'unruled' | 'A' | 'B' | 'C'
+export const KX_MODE: KxMode = 'unruled'
+const KX_SLOT: Record<KxMode, { bind: 'empty' | 'required'; dev: 'empty' | 'required' }> = {
+ unruled: { bind: 'empty', dev: 'empty' },
+ A: { bind: 'required', dev: 'empty' },
+ B: { bind: 'empty', dev: 'required' },
+ C: { bind: 'required', dev: 'required' },
+}
+
+/** Check a kx slot: present only when the mode requires it, a valid ECDH point,
+ * and never equal to any signing key in the same certificate. */
+async function kxSlot(f: string, rule: 'empty' | 'required', others: string[]): Promise<string | null | false> {
+ if (rule === 'empty') return f === '' ? null : false
+ if (f === '' || !(await isKxKey(f)) || others.includes(f)) return false
+ return f
+}
+
+// --- dev. — the device certificate (signed by the account key) ---------------
+
+/**
+ * `dev.<devicePub>.<consentPub|empty>.<accountPub>.<kx|empty>.<b64u(label)|empty>.<created>.<expires>`
+ *
+ * Binds this device's ROUTINE key and its hardware CONSENT key to the account.
+ * The consent key is a separate, non-exportable key (Secure Enclave
+ * `.userPresence`, a BiometricPrompt-bound Keystore key, Windows Hello); a
+ * consent statement (cns.) is accepted only from a key certified here. The light
+ * tier has no hardware consent key, so consentPub is empty there, and that
+ * device can never produce an accepted cns.
+ */
+export interface DeviceCert {
+ devicePub: string
+ consentPub: string | null
+ accountPub: string
+ kx: string | null
+ label: string | null
+ created: number
+ expires: number
+}
+
+export function buildDev(c: DeviceCert): string {
+ return ['dev', c.devicePub, c.consentPub ?? '', c.accountPub, c.kx ?? '',
+ c.label ? b64uEnc(utf8(c.label)) : '', c.created, c.expires].join('.')
+}
+
+export async function verifyDev(text: string, sig: string, opts: { now: number; kxMode?: KxMode }):
+ Promise<Verdict<DeviceCert>> {
+ const p = fields(text, 'dev', 8)
+ if (!p) return no('grammar')
+ const [, devicePub, consentF, accountPub, kxF, labelF, createdF, expiresF] = p
+ if (!(await isSigningKey(devicePub)) || !(await isSigningKey(accountPub))) return no('key')
+ if (devicePub === accountPub) return no('key')
+ let consentPub: string | null = null
+ if (consentF !== '') {
+ if (!(await isSigningKey(consentF)) || consentF === devicePub || consentF === accountPub) return no('consent-key')
+ consentPub = consentF
+ }
+ const kx = await kxSlot(kxF, KX_SLOT[opts.kxMode ?? KX_MODE].dev, [devicePub, accountPub, consentF])
+ if (kx === false) return no('kx')
+ let label: string | null = null
+ if (labelF !== '') { label = displayText(labelF); if (label === null) return no('label') }
+ const created = ms(createdF), expires = ms(expiresF)
+ if (created === null || expires === null) return no('grammar')
+ const life = lifetime(created, expires, opts.now)
+ if (life) return no(life)
+ if (!(await verifyStatementSig(accountPub, sig, text))) return no('signature')
+ return { ok: true, value: { devicePub, consentPub, accountPub, kx, label, created, expires } }
+}
+
+// --- bind. — the person certificate (signed by the account key) --------------
+
+/**
+ * `bind.<b64u(address)>.<accountPub>.<kx|empty>.<b64u(name)|empty>.<seq>.<prev|empty>.<created>.<expires>`
+ *
+ * "This account key is this address", signed by the holder; the directory then
+ * attests it (att.). `address` must already be in normal form (address.ts).
+ * `seq` starts at 1; `prev` is the hash of the previous bind. text for this
+ * address, empty exactly when seq is 1, so a rotation chain cannot be forked
+ * silently.
+ */
+export interface BindCert {
+ address: string
+ accountPub: string
+ kx: string | null
+ name: string | null
+ seq: number
+ prev: string | null
+ created: number
+ expires: number
+}
+
+export function buildBind(c: BindCert): string {
+ return ['bind', b64uEnc(utf8(c.address)), c.accountPub, c.kx ?? '',
+ c.name ? b64uEnc(utf8(c.name)) : '', c.seq, c.prev ?? '', c.created, c.expires].join('.')
+}
+
+export async function verifyBind(text: string, sig: string, opts: { now: number; kxMode?: KxMode }):
+ Promise<Verdict<BindCert>> {
+ const p = fields(text, 'bind', 9)
+ if (!p) return no('grammar')
+ const [, addressF, accountPub, kxF, nameF, seqF, prevF, createdF, expiresF] = p
+ const address = freeText(addressF)
+ if (address === null || !isNormalAddress(address)) return no('address')
+ if (!(await isSigningKey(accountPub))) return no('key')
+ const kx = await kxSlot(kxF, KX_SLOT[opts.kxMode ?? KX_MODE].bind, [accountPub])
+ if (kx === false) return no('kx')
+ let name: string | null = null
+ if (nameF !== '') { name = displayText(nameF); if (name === null) return no('name') }
+ const seq = int(seqF)
+ if (seq === null || seq < 1) return no('seq')
+ if ((seq === 1) !== (prevF === '')) return no('prev')
+ if (prevF !== '' && !isHash(prevF)) return no('prev')
+ const created = ms(createdF), expires = ms(expiresF)
+ if (created === null || expires === null) return no('grammar')
+ const life = lifetime(created, expires, opts.now)
+ if (life) return no(life)
+ if (!(await verifyStatementSig(accountPub, sig, text))) return no('signature')
+ return { ok: true, value: { address, accountPub, kx, name, seq, prev: prevF || null, created, expires } }
+}
+
+// --- att. — the directory's attestation (signed by a directory key) ----------
+
+export type AttState = 'active' | 'pending' | 'frozen'
+
+/**
+ * `att.<sha256(bind text)>.<verifiedAt>.<issuedAt>.<kid>.<active|pending|frozen>`
+ *
+ * The directory's signed answer to a lookup. `issuedAt` is fresh on every
+ * answer, so a client can refuse a replayed one; `state` is inside the
+ * signature, so a directory answer cannot be replayed as "active" during a
+ * rotation freeze (security §25). Signed by the directory's ONLINE key named by
+ * `kid` — never the release key.
+ */
+export interface Attestation {
+ bindHash: string
+ verifiedAt: number
+ issuedAt: number
+ kid: string
+ state: AttState
+}
+
+export function buildAtt(a: Attestation): string {
+ return ['att', a.bindHash, a.verifiedAt, a.issuedAt, a.kid, a.state].join('.')
+}
+
+export async function verifyAtt(text: string, sig: string, opts: {
+ directoryKeys: Readonly<Record<string, string>>
+ bindText: string
+ now: number
+ maxAgeMs: number
+}): Promise<Verdict<Attestation>> {
+ const p = fields(text, 'att', 6)
+ if (!p) return no('grammar')
+ const [, bindHash, verifiedF, issuedF, kid, state] = p
+ if (!isHash(bindHash) || !KID_RE.test(kid)) return no('grammar')
+ if (state !== 'active' && state !== 'pending' && state !== 'frozen') return no('grammar')
+ const verifiedAt = ms(verifiedF), issuedAt = ms(issuedF)
+ if (verifiedAt === null || issuedAt === null || verifiedAt > issuedAt) return no('grammar')
+ if (issuedAt > opts.now + SKEW_MS) return no('not-yet-valid')
+ if (opts.now - issuedAt > opts.maxAgeMs) return no('stale')
+ if (bindHash !== (await sha256b64u(opts.bindText))) return no('bind-mismatch')
+ if (!Object.hasOwn(opts.directoryKeys, kid)) return no('unknown-kid')
+ if (!(await verifyStatementSig(opts.directoryKeys[kid], sig, text))) return no('signature')
+ return { ok: true, value: { bindHash, verifiedAt, issuedAt, kid, state: state as AttState } }
+}
+
+// --- tomb. — the directory's deletion record ---------------------------------
+
+export type TombBy = 'holder' | 'mailbox' | 'operator'
+
+/**
+ * `tomb.<sha256(last bind text)|empty>.<seq>.<deletedAt>.<holder|mailbox|operator>.<kid>`
+ *
+ * Lets a client tell "deleted" from "never bound". The hash is empty when the
+ * directory holds no previous binding text for the address.
+ */
+export interface Tombstone {
+ lastBindHash: string | null
+ seq: number
+ deletedAt: number
+ by: TombBy
+ kid: string
+}
+
+export function buildTomb(t: Tombstone): string {
+ return ['tomb', t.lastBindHash ?? '', t.seq, t.deletedAt, t.by, t.kid].join('.')
+}
+
+export async function verifyTomb(text: string, sig: string, opts: {
+ directoryKeys: Readonly<Record<string, string>>
+ now: number
+}): Promise<Verdict<Tombstone>> {
+ const p = fields(text, 'tomb', 6)
+ if (!p) return no('grammar')
+ const [, hashF, seqF, deletedF, by, kid] = p
+ if (hashF !== '' && !isHash(hashF)) return no('grammar')
+ const seq = int(seqF), deletedAt = ms(deletedF)
+ if (seq === null || seq < 1 || deletedAt === null) return no('grammar')
+ if (by !== 'holder' && by !== 'mailbox' && by !== 'operator') return no('grammar')
+ if (!KID_RE.test(kid)) return no('grammar')
+ if (deletedAt > opts.now + SKEW_MS) return no('not-yet-valid')
+ if (!Object.hasOwn(opts.directoryKeys, kid)) return no('unknown-kid')
+ if (!(await verifyStatementSig(opts.directoryKeys[kid], sig, text))) return no('signature')
+ return { ok: true, value: { lastBindHash: hashF || null, seq, deletedAt, by: by as TombBy, kid } }
+}
+
+// --- del. — a holder's delete request (signed by the account key) ------------
+
+/** `del.<b64u(address)>.<ts>`, valid within ±5 minutes of `ts`. */
+export const DELETE_WINDOW_MS = 5 * 60_000
+
+export function buildDel(address: string, ts: number): string {
+ return ['del', b64uEnc(utf8(address)), ts].join('.')
+}
+
+export async function verifyDel(text: string, sig: string, opts: { accountPub: string; now: number }):
+ Promise<Verdict<{ address: string; ts: number }>> {
+ const p = fields(text, 'del', 3)
+ if (!p) return no('grammar')
+ const address = freeText(p[1])
+ if (address === null || !isNormalAddress(address)) return no('address')
+ const ts = ms(p[2])
+ if (ts === null) return no('grammar')
+ if (Math.abs(opts.now - ts) > DELETE_WINDOW_MS) return no('expired')
+ if (!(await verifyStatementSig(opts.accountPub, sig, text))) return no('signature')
+ return { ok: true, value: { address, ts } }
+}
+
+// --- cmp. — the email-code completion (signed by the binding's account key) --
+
+/** `cmp.<sha256(bind text)>.<code>`: the person typed `code` into their agent,
+ * and the agent signs that it completes THIS binding. */
+export function buildCmp(bindHash: string, code: string): string {
+ return ['cmp', bindHash, code].join('.')
+}
+
+export async function verifyCmp(text: string, sig: string, opts: { accountPub: string; bindText: string }):
+ Promise<Verdict<{ bindHash: string; code: string }>> {
+ const p = fields(text, 'cmp', 3)
+ if (!p) return no('grammar')
+ const [, bindHash, code] = p
+ if (!isHash(bindHash) || !CODE_RE.test(code)) return no('grammar')
+ if (bindHash !== (await sha256b64u(opts.bindText))) return no('bind-mismatch')
+ if (!(await verifyStatementSig(opts.accountPub, sig, text))) return no('signature')
+ return { ok: true, value: { bindHash, code } }
+}
+
+// --- cns. — host-stamped consent (signed by a certified consent key) ---------
+
+/**
+ * The consent purposes a cns. may carry, a CLOSED set, and the statement family
+ * each one authorises. `grant` and `role` are reserved for phase 2 and refused
+ * until defined. (Distinct from identity.ts SignPurpose, which is about routine
+ * signing with the device key.)
+ */
+export type ConsentPurpose = 'invite' | 'revoke' | 'link' | 'rotate' | 'unbind'
+const CONSENT_FAMILY: Record<ConsentPurpose, string> = {
+ invite: 'inv.', revoke: 'rev.', link: 'dev.', rotate: 'bind.', unbind: 'del.',
+}
+const RESERVED_PURPOSES = new Set(['grant', 'role'])
+/** Purposes about one document carry its docId; account-scoped ones carry none. */
+const DOC_SCOPED = new Set<ConsentPurpose>(['invite', 'revoke'])
+
+/** A consent signature is good for at most this long after it is made. */
+export const CONSENT_MAX_TTL_MS = 5 * 60_000
+
+const AUDIENCE_RE = new RegExp(`^(dir|room:${ROOM_RE.source.slice(1, -1)})$`)
+
+/**
+ * The channel binding (security §24): it ties the consent to WHO verifies it
+ * (the audience: `dir`, or `room:<roomName>`), to the single-use CHALLENGE that
+ * verifier issued, and to the EXACT statement being authorised. A relayed
+ * signature fails the audience, a replayed one the spent challenge, and a swapped
+ * payload the hash. Null if a part breaks its grammar.
+ *
+ * transcript = b64u( SHA-256( UTF-8( "cnst.v1." ‖ audience ‖ "." ‖ challenge ‖ "." ‖ b64u(SHA-256(payload)) ) ) )
+ */
+export async function consentTranscript(audience: string, challenge: string, payloadText: string): Promise<string | null> {
+ if (!AUDIENCE_RE.test(audience)) return null
+ const c = b64uDec(challenge)
+ if (!c || c.length < 16 || c.length > 64) return null
+ return sha256b64u(`cnst.v1.${audience}.${challenge}.${await sha256b64u(payloadText)}`)
+}
+
+export interface Consent {
+ rp: string
+ purpose: ConsentPurpose
+ docId: string | null
+ transcript: string
+ exp: number
+}
+
+/** `cns.<rp>.<purpose>.<docId|empty>.<transcript>.<exp>`, every field host-stamped. */
+export function buildConsent(c: Consent): string {
+ return ['cns', c.rp, c.purpose, c.docId ?? '', c.transcript, c.exp].join('.')
+}
+
+/**
+ * Verify a consent signature. The verifier RECOMPUTES the transcript from its
+ * OWN audience, the challenge it issued and the payload it is about to apply —
+ * it never trusts a transcript from the request. `spend(challenge)` must mark
+ * the challenge used and return false if it was already spent or has expired;
+ * it is called first, so any attempt consumes the challenge. That is the right
+ * default for races (no second try against one challenge), and it relies on
+ * challenges being SESSION-BOUND: one issued to one session, so a stranger who
+ * spends it can only fail that session's attempt, never take it over.
+ *
+ * `consentPub` must come from a verified dev. certificate's consentPub field;
+ * that is what makes it a consent key and not merely a key.
+ */
+export async function verifyConsent(text: string, sig: string, opts: {
+ consentPub: string
+ rp: string
+ audience: string
+ challenge: string
+ payloadText: string
+ docId: string | null
+ now: number
+ spend: (challenge: string) => boolean
+}): Promise<Verdict<Consent>> {
+ const p = fields(text, 'cns', 6)
+ if (!p) return no('grammar')
+ if (!opts.spend(opts.challenge)) return no('replay')
+ const [, rp, purposeF, docIdF, transcript, expF] = p
+ if (!RP_RE.test(rp) || !isHash(transcript)) return no('grammar')
+ if (RESERVED_PURPOSES.has(purposeF)) return no('reserved-purpose')
+ if (!Object.hasOwn(CONSENT_FAMILY, purposeF)) return no('grammar')
+ const purpose = purposeF as ConsentPurpose
+ const exp = ms(expF)
+ if (exp === null) return no('grammar')
+ if (rp !== opts.rp) return no('rp')
+ // the payload must be of the family this purpose authorises
+ if (!opts.payloadText.startsWith(CONSENT_FAMILY[purpose])) return no('payload-family')
+ // document-scoped purposes name the document; account-scoped ones name none
+ if (DOC_SCOPED.has(purpose)) {
+ if (!DOCID_RE.test(docIdF) || docIdF !== opts.docId) return no('docid')
+ } else if (docIdF !== '' || opts.docId !== null) return no('docid')
+ const expected = await consentTranscript(opts.audience, opts.challenge, opts.payloadText)
+ if (expected === null || transcript !== expected) return no('transcript')
+ if (opts.now >= exp) return no('expired')
+ if (exp - opts.now > CONSENT_MAX_TTL_MS) return no('lifetime')
+ if (!(await verifyStatementSig(opts.consentPub, sig, text))) return no('signature')
+ return { ok: true, value: { rp, purpose, docId: docIdF || null, transcript, exp } }
+}
+
+/**
+ * The light tier has no hardware consent key (its dev. consentPub is empty). In
+ * phase 1 its consent is a WebAuthn assertion verified only by the directory
+ * (every phase-1 cns. has audience `dir`), and the assertion carries the
+ * statement as `clientDataJSON.challenge` = this value: base64url of SHA-256 over
+ * the EXACT cns. bytes (security §27).
+ */
+export const webauthnChallengeFor = (cnsText: string): Promise<string> => sha256b64u(cnsText)
+
+/**
+ * Prefixes reserved for statements not defined yet, so nothing else takes them:
+ * pk. — an account-signed passkey statement (phase 2), for room-audience
+ * verifiers of light-tier consent. Never the dev. consentPub slot.
+ * drev. — an account-signed device revocation. Not needed in phase 1: a device
+ * retired without rotating the account key is one whose hardware-wrapped
+ * keys were destroyed by a confirmed wipe, so its dev. cert names a key
+ * nobody holds. It arrives with per-device kx, when senders wrap to
+ * device keys (security §25b).
+ */
+export const RESERVED_PREFIXES: readonly string[] = Object.freeze(['pk', 'drev'])
+
+// --- routine signing: what payload each SignPurpose (identity.ts) may sign ----
+
+/** A canonical base64url field decoding to at least `min` (exactly `exact`) bytes. */
+const b64Len = (f: string, min: number, exact?: number) => {
+ const b = b64uDec(f)
+ return !!b && (exact === undefined ? b.length >= min : b.length === exact)
+}
+const isPubField = (f: string) => { const b = b64uDec(f); return !!b && b.length === 65 && b[0] === 0x04 }
+const IV = (f: string) => b64Len(f, 0, 12) // AES-GCM iv
+const CT = (f: string) => b64Len(f, 16) // ciphertext with its 16-byte tag
+
+/**
+ * Does `payload` have the exact shape of the statement `purpose` names? The
+ * agent signs only a matching payload, so a prompt shown for one kind of action
+ * can never yield a signature on another. Shapes are the shipped collab
+ * statements (kernel/src/sync/online.ts, verified by the relay).
+ */
+export function payloadMatchesPurpose(purpose: SignPurpose, payload: string): boolean {
+ if (typeof payload !== 'string' || payload.length > MAX_STATEMENT) return false
+ const p = payload.split('.')
+ switch (purpose) {
+ case 'frame': return p.length === 2 && IV(p[0]) && CT(p[1]) // `${i}.${d}`
+ case 'prove': return p.length === 3 && p[0] === 'prove' && b64Len(p[1], 16) && /^[rw][A-Za-z0-9_-]{1,64}$/.test(p[2])
+ case 'delegate': return p.length === 2 && p[0] === 'dlg' && isPubField(p[1])
+ case 'show':
+ return (p.length === 1 && (p[0] === 'live' || p[0] === 'end')) ||
+ (p.length === 4 && (p[0] === 'nav' || p[0] === 'black') && p[1] === 'aud' && IV(p[2]) && CT(p[3]))
+ case 'invite': return p.length === 4 && p[0] === 'inv' && isPubField(p[1]) &&
+ (p[2] === 'writer' || p[2] === 'commenter' || p[2] === 'audience') && INT_RE.test(p[3])
+ case 'revoke': return p.length === 2 && p[0] === 'rev' && isPubField(p[1])
+ default: return false
+ }
+}
diff --git a/scripts/gen-display-table.ts b/scripts/gen-display-table.ts
new file mode 100644
index 00000000..5d43dbbd
--- /dev/null
+++ b/scripts/gen-display-table.ts
@@ -0,0 +1,66 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// Generates kernel/src/display-table.ts — the frozen set of code points a bento/id
+// display name (bind. name, dev. label) may not contain.
+//
+// node scripts/gen-display-table.ts
+//
+// It REFUSES to run unless the runtime's Unicode tables are exactly the frozen
+// version, so regenerating on a newer Node can never silently change the table.
+// Changing the version is a deliberate format decision: bump UNICODE, run on a
+// matching runtime, regenerate identity-v1.json, and record it in DECISIONS.
+
+import { writeFileSync } from 'node:fs'
+import { join, dirname } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const UNICODE = '17.0'
+if (process.versions.unicode !== UNICODE) {
+ console.error(`refusing: this runtime has Unicode ${process.versions.unicode}; the table is frozen at ${UNICODE}`)
+ process.exit(1)
+}
+
+// Refused: controls, private use, UNASSIGNED (including the 66 noncharacters),
+// line and paragraph separators, every format character except ZWNJ/ZWJ, and the
+// Hangul fill letters. Unassigned code points are refused because one assigned
+// LATER could be an invisible format character, and NFC is stable across Unicode
+// versions only for assigned characters (security, #764).
+const RE = /[\p{Cc}\p{Co}\p{Cn}\p{Zl}\p{Zp}ᅟᅠㅤᅠ]|(?![‌‍])\p{Cf}/u
+
+const ranges: [number, number][] = []
+let start = -1
+for (let c = 0; c <= 0x10ffff; c++) {
+ if (c >= 0xd800 && c <= 0xdfff) { // surrogates never survive strict UTF-8 decoding
+ if (start >= 0) { ranges.push([start, c - 1]); start = -1 }
+ continue
+ }
+ const hit = RE.test(String.fromCodePoint(c))
+ if (hit && start < 0) start = c
+ if (!hit && start >= 0) { ranges.push([start, c - 1]); start = -1 }
+}
+if (start >= 0) ranges.push([start, 0x10ffff])
+
+const hex = (n: number) => '0x' + n.toString(16)
+const body = ranges.map(([a, b]) => `${hex(a)},${hex(b)}`).join(',\n ')
+const out = `// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// GENERATED by scripts/gen-display-table.ts — do not edit by hand.
+//
+// The code points a bento/id display name may not contain, frozen at Unicode
+// ${UNICODE}: controls, private use, unassigned (with the noncharacters), line and
+// paragraph separators, format characters except ZWNJ/ZWJ, and the Hangul fill
+// letters. ${ranges.length} inclusive ranges, sorted and disjoint, as a flat list of
+// [first, last] pairs. kernel/fixtures/identity-v1.json carries the same table
+// for the native hosts, which embed it rather than reading their own platform's
+// (drifting) Unicode tables.
+
+export const DISPLAY_FORBIDDEN_UNICODE = '${UNICODE}'
+
+export const DISPLAY_FORBIDDEN_FLAT: readonly number[] = Object.freeze([
+ ${body},
+])
+`
+const file = join(dirname(fileURLToPath(import.meta.url)), '..', 'kernel/src/display-table.ts')
+writeFileSync(file, out)
+console.log(`wrote ${file}: ${ranges.length} ranges at Unicode ${UNICODE}`)
diff --git a/scripts/gen-identity-vectors.ts b/scripts/gen-identity-vectors.ts
new file mode 100644
index 00000000..72c96b17
--- /dev/null
+++ b/scripts/gen-identity-vectors.ts
@@ -0,0 +1,351 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// Generates kernel/fixtures/identity-v1.json — the bento/id conformance vectors.
+//
+// node scripts/gen-identity-vectors.ts
+//
+// Every host's statement code (Swift, Kotlin, Rust, the extension's JS and the
+// directory) must reach the same verdict as the kernel reference on every row.
+// The keys are minted fresh for each run and are TEST KEYS ONLY. Signatures are
+// random (ECDSA), so regenerating changes the file; that is fine — the rig checks
+// verdicts, not bytes. Regenerate only when the rules change, and commit the result.
+
+import { writeFileSync, mkdirSync } from 'node:fs'
+import { join, dirname } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import {
+ b64uEnc, signStatement, sha256b64u, buildDev, buildBind, buildAtt, buildTomb, buildDel, buildCmp,
+ buildConsent, consentTranscript, webauthnChallengeFor, lowS, CONSENT_MAX_TTL_MS,
+ DISPLAY_FORBIDDEN_RANGES, DISPLAY_FORBIDDEN_UNICODE,
+} from '../kernel/src/statements.ts'
+
+const root = join(dirname(fileURLToPath(import.meta.url)), '..')
+const OUT = join(root, 'kernel/fixtures/identity-v1.json')
+
+const NOW = 1_800_000_000_000 // 2027-01-15, fixed so the rows are stable in time
+const DAY = 86_400_000
+const created = NOW - DAY
+const expires = NOW + 300 * DAY
+
+type KP = { pub: string; key: CryptoKey }
+async function signer(): Promise<KP> {
+ const kp = (await crypto.subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign', 'verify'])) as CryptoKeyPair
+ return { pub: b64uEnc(new Uint8Array(await crypto.subtle.exportKey('raw', kp.publicKey))), key: kp.privateKey }
+}
+async function kxKey(): Promise<string> {
+ const kp = (await crypto.subtle.generateKey({ name: 'ECDH', namedCurve: 'P-256' }, true, ['deriveBits'])) as CryptoKeyPair
+ return b64uEnc(new Uint8Array(await crypto.subtle.exportKey('raw', kp.publicKey)))
+}
+
+const account = await signer(), device = await signer(), consent = await signer()
+const directory = await signer(), stranger = await signer()
+const kx = await kxKey(), kx2 = await kxKey()
+const KID = 'dir-2027a'
+const directoryKeys = { [KID]: directory.pub }
+const ROOM = 'w' + b64uEnc(new Uint8Array(32).fill(7)) // a room NAME, 43 chars after 'w'
+const CHALLENGE = b64uEnc(new Uint8Array(24).map((_, i) => i * 11 + 3))
+const enc = (s: string) => b64uEnc(new TextEncoder().encode(s))
+
+/** A signature in high-S form (valid ECDSA, refused here) and a DER encoding. */
+const N = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n
+const dec = (s: string) => Uint8Array.from(atob(s.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((s.length + 3) % 4)), (c) => c.charCodeAt(0))
+const big = (b: Uint8Array) => b.reduce((x, v) => (x << 8n) | BigInt(v), 0n)
+function highS(sig: string): string {
+ const b = dec(sig), s = big(b.subarray(32)), hs = N - s
+ const out = new Uint8Array(64); out.set(b.subarray(0, 32))
+ for (let i = 63, x = hs; i >= 32; i--) { out[i] = Number(x & 0xffn); x >>= 8n }
+ return b64uEnc(out)
+}
+function der(sig: string): string {
+ const b = dec(sig)
+ const int = (x: Uint8Array) => { let i = 0; while (i < x.length - 1 && x[i] === 0) i++; let v = x.subarray(i); if (v[0] & 0x80) v = Uint8Array.of(0, ...v); return Uint8Array.of(0x02, v.length, ...v) }
+ const r = int(b.subarray(0, 32)), s = int(b.subarray(32))
+ return b64uEnc(Uint8Array.of(0x30, r.length + s.length, ...r, ...s))
+}
+
+const rows: Record<string, unknown>[] = []
+const row = (r: Record<string, unknown>) => rows.push(r)
+const sign = (k: KP, t: string) => signStatement(k.key, t)
+
+// --- dev. -----------------------------------------------------------------------
+{
+ const base = { devicePub: device.pub, consentPub: consent.pub, accountPub: account.pub, kx: null, label: 'Café laptop', created, expires }
+ const t = buildDev(base)
+ const s = await sign(account, t)
+ row({ name: 'dev: a native device (routine + consent key)', type: 'dev', text: t, sig: s, expect: 'accept' })
+ const light = buildDev({ ...base, consentPub: null, label: null })
+ row({ name: 'dev: a light-tier device (no consent key)', type: 'dev', text: light, sig: await sign(account, light), expect: 'accept' })
+ const withKx = buildDev({ ...base, kx })
+ const sKx = await sign(account, withKx)
+ row({ name: 'dev: kx filled while placement is unruled', type: 'dev', text: withKx, sig: sKx, expect: 'reject', reason: 'kx' })
+ row({ name: 'dev: kx filled under mode B (per device)', type: 'dev', kxMode: 'B', text: withKx, sig: sKx, expect: 'accept' })
+ row({ name: 'dev: kx filled under mode A (it belongs in bind.)', type: 'dev', kxMode: 'A', text: withKx, sig: sKx, expect: 'reject', reason: 'kx' })
+ row({ name: 'dev: kx missing under mode C', type: 'dev', kxMode: 'C', text: t, sig: s, expect: 'reject', reason: 'kx' })
+ const kxIsDevice = buildDev({ ...base, kx: device.pub })
+ row({ name: 'dev: kx equal to the device key', type: 'dev', kxMode: 'B', text: kxIsDevice, sig: await sign(account, kxIsDevice), expect: 'reject', reason: 'kx' })
+ const kxIsConsent = buildDev({ ...base, kx: consent.pub })
+ row({ name: 'dev: kx equal to the consent key', type: 'dev', kxMode: 'B', text: kxIsConsent, sig: await sign(account, kxIsConsent), expect: 'reject', reason: 'kx' })
+ const sameKeys = buildDev({ ...base, consentPub: device.pub })
+ row({ name: 'dev: consent key equal to the routine key', type: 'dev', text: sameKeys, sig: await sign(account, sameKeys), expect: 'reject', reason: 'consent-key' })
+ const old = buildDev({ ...base, created: NOW - 300 * DAY, expires: NOW - DAY })
+ row({ name: 'dev: expired', type: 'dev', text: old, sig: await sign(account, old), expect: 'reject', reason: 'expired' })
+ const long = buildDev({ ...base, expires: created + 420 * DAY })
+ row({ name: 'dev: lifetime over 13 months + 1 day', type: 'dev', text: long, sig: await sign(account, long), expect: 'reject', reason: 'lifetime' })
+ const bidi = buildDev({ ...base, label: 'laptop‮gnp.exe' })
+ row({ name: 'dev: label with a bidi override', type: 'dev', text: bidi, sig: await sign(account, bidi), expect: 'reject', reason: 'label' })
+ row({ name: 'dev: signed by the device key, not the account key', type: 'dev', text: t, sig: await sign(device, t), expect: 'reject', reason: 'signature' })
+ row({ name: 'dev: high-S signature', type: 'dev', text: t, sig: highS(s), expect: 'reject', reason: 'signature' })
+ row({ name: 'dev: DER signature (a host forgot to convert)', type: 'dev', text: t, sig: der(s), expect: 'reject', reason: 'signature' })
+ row({ name: 'dev: an extra field', type: 'dev', text: t + '.x', sig: s, expect: 'reject', reason: 'grammar' })
+ row({ name: 'dev: a field missing', type: 'dev', text: t.slice(0, t.lastIndexOf('.')), sig: s, expect: 'reject', reason: 'grammar' })
+ const padded = t.replace(device.pub, device.pub + '=')
+ row({ name: 'dev: a padded base64url key', type: 'dev', text: padded, sig: await sign(account, padded), expect: 'reject', reason: 'key' })
+ row({ name: 'dev: a space in the text', type: 'dev', text: t.replace('dev.', 'dev. '), sig: s, expect: 'reject', reason: 'grammar' })
+}
+
+// --- bind. ----------------------------------------------------------------------
+let bind1 = ''
+{
+ const base = { address: '[email protected]', accountPub: account.pub, kx: null, name: 'Alice', seq: 1, prev: null, created, expires }
+ bind1 = buildBind(base)
+ row({ name: 'bind: first binding (seq 1, no prev)', type: 'bind', text: bind1, sig: await sign(account, bind1), expect: 'accept' })
+ const b2 = buildBind({ ...base, seq: 2, prev: await sha256b64u(bind1) })
+ row({ name: 'bind: a rotation (seq 2, prev = hash of seq 1)', type: 'bind', text: b2, sig: await sign(account, b2), expect: 'accept' })
+ const noName = buildBind({ ...base, name: null })
+ row({ name: 'bind: no display name (empty field)', type: 'bind', text: noName, sig: await sign(account, noName), expect: 'accept' })
+ const seq1Prev = buildBind({ ...base, prev: await sha256b64u(bind1) })
+ row({ name: 'bind: seq 1 with a prev', type: 'bind', text: seq1Prev, sig: await sign(account, seq1Prev), expect: 'reject', reason: 'prev' })
+ const seq2NoPrev = buildBind({ ...base, seq: 2 })
+ row({ name: 'bind: seq 2 without a prev', type: 'bind', text: seq2NoPrev, sig: await sign(account, seq2NoPrev), expect: 'reject', reason: 'prev' })
+ const upper = buildBind({ ...base, address: '[email protected]' })
+ row({ name: 'bind: an address not in normal form', type: 'bind', text: upper, sig: await sign(account, upper), expect: 'reject', reason: 'address' })
+ const raw = ['bind', '[email protected]', account.pub, '', enc('Alice'), 1, '', created, expires].join('.')
+ row({ name: 'bind: a raw (unencoded) email breaks the field count', type: 'bind', text: raw, sig: await sign(account, raw), expect: 'reject', reason: 'grammar' })
+ const longName = buildBind({ ...base, name: 'x'.repeat(65) })
+ row({ name: 'bind: a display name over 64 characters', type: 'bind', text: longName, sig: await sign(account, longName), expect: 'reject', reason: 'name' })
+ // display names: invisible and layout characters refused (security, #764)
+ for (const [c, what] of [
+ ['\u200B', 'zero-width space'], ['\u2060', 'word joiner'], ['\uFEFF', 'byte-order mark'],
+ ['\u061C', 'Arabic letter mark (bidi)'], ['\u200E', 'left-to-right mark'], ['\u202E', 'right-to-left override'],
+ ['\u2028', 'line separator'], ['\u2029', 'paragraph separator'], ['\u180E', 'Mongolian vowel separator'],
+ ['\u00AD', 'soft hyphen'], ['\u0007', 'a control character'], ['\uE000', 'private use'],
+ ['\u3164', 'Hangul filler (renders blank)'], ['\u115F', 'Hangul choseong filler'],
+ ['\u0378', 'an unassigned code point'], ['\uFFFF', 'a noncharacter (U+FFFF)'], ['\uFDD0', 'a noncharacter (U+FDD0)'],
+ ['\u{3FFFF}', 'a noncharacter in plane 3'],
+ ] as const) {
+ const t = buildBind({ ...base, name: `Al${c}ice` })
+ row({ name: `bind: a name containing ${what} is refused`, type: 'bind', text: t, sig: await sign(account, t), expect: 'reject', reason: 'name' })
+ }
+ for (const [n, what] of [
+ ['\u200CAlice', 'ZWNJ at the start'], ['Alice\u200D', 'ZWJ at the end'], ['Ame\u0301lie', 'not in NFC (a decomposed é)'],
+ ] as const) {
+ const t = buildBind({ ...base, name: n })
+ row({ name: `bind: a name with ${what} is refused`, type: 'bind', text: t, sig: await sign(account, t), expect: 'reject', reason: 'name' })
+ }
+ for (const [n, what] of [
+ ['\u0645\u06CC\u200C\u062E\u0648\u0627\u0647\u0645', 'a Persian name with a mid-word ZWNJ'],
+ ['\u{1F469}\u200D\u{1F4BB} Dev', 'an emoji ZWJ sequence'], ['Améli', 'an NFC accented name'],
+ ] as const) {
+ const t = buildBind({ ...base, name: n })
+ row({ name: `bind: ${what} is accepted`, type: 'bind', text: t, sig: await sign(account, t), expect: 'accept' })
+ }
+ const withKx = buildBind({ ...base, kx })
+ const sKx = await sign(account, withKx)
+ row({ name: 'bind: kx filled while placement is unruled', type: 'bind', text: withKx, sig: sKx, expect: 'reject', reason: 'kx' })
+ row({ name: 'bind: kx filled under mode A (shared)', type: 'bind', kxMode: 'A', text: withKx, sig: sKx, expect: 'accept' })
+ row({ name: 'bind: kx filled under mode C (recovery kx)', type: 'bind', kxMode: 'C', text: withKx, sig: sKx, expect: 'accept' })
+ row({ name: 'bind: kx filled under mode B (it belongs in dev.)', type: 'bind', kxMode: 'B', text: withKx, sig: sKx, expect: 'reject', reason: 'kx' })
+ const kxIsKey = buildBind({ ...base, kx: account.pub })
+ row({ name: 'bind: kx equal to the account key', type: 'bind', kxMode: 'A', text: kxIsKey, sig: await sign(account, kxIsKey), expect: 'reject', reason: 'kx' })
+ row({ name: 'bind: signed by a stranger', type: 'bind', text: bind1, sig: await sign(stranger, bind1), expect: 'reject', reason: 'signature' })
+}
+
+// --- att. -----------------------------------------------------------------------
+{
+ const h = await sha256b64u(bind1)
+ const base = { bindHash: h, verifiedAt: NOW - 3600_000, issuedAt: NOW - 60_000, kid: KID, state: 'active' as const }
+ const t = buildAtt(base)
+ const ctx = { bindText: bind1, maxAgeMs: 10 * 60_000 }
+ row({ name: 'att: an active attestation', type: 'att', ...ctx, text: t, sig: await sign(directory, t), expect: 'accept' })
+ const frozen = buildAtt({ ...base, state: 'frozen' })
+ row({ name: 'att: a frozen binding (state is signed)', type: 'att', ...ctx, text: frozen, sig: await sign(directory, frozen), expect: 'accept' })
+ const stale = buildAtt({ ...base, issuedAt: NOW - 3600_000 })
+ row({ name: 'att: an answer too old to trust (replay)', type: 'att', ...ctx, text: stale, sig: await sign(directory, stale), expect: 'reject', reason: 'stale' })
+ row({ name: 'att: for a different binding', type: 'att', ...ctx, bindText: bind1 + 'x', text: t, sig: await sign(directory, t), expect: 'reject', reason: 'bind-mismatch' })
+ const otherKid = buildAtt({ ...base, kid: 'dir-unknown' })
+ row({ name: 'att: an unknown key id', type: 'att', ...ctx, text: otherKid, sig: await sign(directory, otherKid), expect: 'reject', reason: 'unknown-kid' })
+ const protoKid = t.replace(KID, '__proto__')
+ row({ name: 'att: a prototype key as kid', type: 'att', ...ctx, text: protoKid, sig: await sign(directory, protoKid), expect: 'reject', reason: 'grammar' })
+ const badState = t.replace('.active', '.revoked')
+ row({ name: 'att: a state outside the closed set', type: 'att', ...ctx, text: badState, sig: await sign(directory, badState), expect: 'reject', reason: 'grammar' })
+ row({ name: 'att: signed by the release key, not the directory key', type: 'att', ...ctx, text: t, sig: await sign(stranger, t), expect: 'reject', reason: 'signature' })
+}
+
+// --- tomb. / del. / cmp. -----------------------------------------------------------
+{
+ const t = buildTomb({ lastBindHash: await sha256b64u(bind1), seq: 2, deletedAt: NOW - 1000, by: 'holder', kid: KID })
+ row({ name: 'tomb: a holder deletion', type: 'tomb', text: t, sig: await sign(directory, t), expect: 'accept' })
+ const none = buildTomb({ lastBindHash: null, seq: 1, deletedAt: NOW - 1000, by: 'operator', kid: KID })
+ row({ name: 'tomb: no previous binding text (empty hash)', type: 'tomb', text: none, sig: await sign(directory, none), expect: 'accept' })
+ const by = t.replace('.holder.', '.admin.')
+ row({ name: 'tomb: "by" outside the closed set', type: 'tomb', text: by, sig: await sign(directory, by), expect: 'reject', reason: 'grammar' })
+
+ const d = buildDel('[email protected]', NOW - 60_000)
+ row({ name: 'del: a delete request within ±5 min', type: 'del', text: d, sig: await sign(account, d), expect: 'accept' })
+ const late = buildDel('[email protected]', NOW - 6 * 60_000)
+ row({ name: 'del: a delete request 6 min old', type: 'del', text: late, sig: await sign(account, late), expect: 'reject', reason: 'expired' })
+ row({ name: 'del: signed by a stranger', type: 'del', text: d, sig: await sign(stranger, d), expect: 'reject', reason: 'signature' })
+
+ const c = buildCmp(await sha256b64u(bind1), 'K7Q3MZ2P')
+ row({ name: 'cmp: completing this binding with the typed code', type: 'cmp', bindText: bind1, text: c, sig: await sign(account, c), expect: 'accept' })
+ row({ name: 'cmp: for a different binding', type: 'cmp', bindText: bind1 + 'x', text: c, sig: await sign(account, c), expect: 'reject', reason: 'bind-mismatch' })
+ for (const [code, why] of [
+ ['k7q3mz2p', 'lowercase (the agent uppercases before signing)'],
+ ['K7Q3MZ2L', 'contains L'], ['K7Q3MZ20', 'contains 0'], ['K7Q3MZ2I', 'contains I'],
+ ['K7Q3MZ2', 'seven characters'], ['K7Q3MZ2PP', 'nine characters'], ['K7Q3 Z2P', 'a space'],
+ ] as const) {
+ const bad = buildCmp(await sha256b64u(bind1), code)
+ row({ name: `cmp: a code refused — ${why}`, type: 'cmp', bindText: bind1, text: bad, sig: await sign(account, bad), expect: 'reject', reason: 'grammar' })
+ }
+}
+
+// --- cns. — security §24's five attacks, and the grammar ---------------------------
+{
+ const phone = { devicePub: (await signer()).pub, consentPub: (await signer()).pub, accountPub: account.pub, kx: null, label: 'Phone', created, expires }
+ const linkPayload = buildDev(phone)
+ const otherPayload = buildDev({ ...phone, label: 'Tablet' }) // a different statement, same keys
+ const tLink = await consentTranscript('dir', CHALLENGE, linkPayload)
+ const link = buildConsent({ rp: 'bento', purpose: 'link', docId: null, transcript: tLink!, exp: NOW + 60_000 })
+ const ctx = { rp: 'bento', audience: 'dir', challenge: CHALLENGE, payloadText: linkPayload, docId: null }
+ const sLink = await sign(consent, link)
+ row({ name: 'cns: link a device (account-scoped, audience dir)', type: 'cns', ...ctx, text: link, sig: sLink, expect: 'accept' })
+ row({ name: 'cns: REPLAY — the challenge was already spent', type: 'cns', ...ctx, challengeSpent: true, text: link, sig: sLink, expect: 'reject', reason: 'replay' })
+ row({ name: 'cns: RELAY — presented to a different audience', type: 'cns', ...ctx, audience: `room:${ROOM}`, text: link, sig: sLink, expect: 'reject', reason: 'transcript' })
+ row({ name: 'cns: PAYLOAD SWAP — authorising a different statement', type: 'cns', ...ctx, payloadText: otherPayload, text: link, sig: sLink, expect: 'reject', reason: 'transcript' })
+ row({ name: 'cns: EXPIRED', type: 'cns', ...ctx, now: NOW + 120_000, text: link, sig: sLink, expect: 'reject', reason: 'expired' })
+ const longTtl = buildConsent({ rp: 'bento', purpose: 'link', docId: null, transcript: tLink!, exp: NOW + CONSENT_MAX_TTL_MS + 60_000 })
+ row({ name: 'cns: valid for longer than 5 minutes', type: 'cns', ...ctx, text: longTtl, sig: await sign(consent, longTtl), expect: 'reject', reason: 'lifetime' })
+ row({ name: 'cns: signed by the routine device key, not the consent key', type: 'cns', ...ctx, text: link, sig: await sign(device, link), expect: 'reject', reason: 'signature' })
+ row({ name: 'cns: for another relying party', type: 'cns', ...ctx, rp: 'vault-acme', text: link, sig: sLink, expect: 'reject', reason: 'rp' })
+ // the transcript genuinely covers this inv. payload, so ONLY the family rule can refuse it
+ const invForLink = 'inv.' + account.pub + '.writer.0'
+ const tMismatch = await consentTranscript('dir', CHALLENGE, invForLink)
+ const linkOverInv = buildConsent({ rp: 'bento', purpose: 'link', docId: null, transcript: tMismatch!, exp: NOW + 60_000 })
+ row({ name: 'cns: purpose "link" over an inv. payload', type: 'cns', ...ctx, payloadText: invForLink, text: linkOverInv, sig: await sign(consent, linkOverInv), expect: 'reject', reason: 'payload-family' })
+ const withDoc = buildConsent({ rp: 'bento', purpose: 'link', docId: 'doc-1', transcript: tLink!, exp: NOW + 60_000 })
+ row({ name: 'cns: an account-scoped purpose carrying a docId', type: 'cns', ...ctx, text: withDoc, sig: await sign(consent, withDoc), expect: 'reject', reason: 'docid' })
+ const grant = link.replace('.link.', '.grant.')
+ row({ name: 'cns: a reserved purpose (grant, phase 2)', type: 'cns', ...ctx, text: grant, sig: await sign(consent, grant), expect: 'reject', reason: 'reserved-purpose' })
+ const dotted = link.replace('cns.bento.', 'cns.bento.page.')
+ row({ name: 'cns: a dotted rp ("bento.page") breaks the field count', type: 'cns', ...ctx, text: dotted, sig: await sign(consent, dotted), expect: 'reject', reason: 'grammar' })
+
+ // a document-scoped consent, audience = the room
+ const invPayload = `inv.${(await signer()).pub}.writer.0`
+ const tInv = await consentTranscript(`room:${ROOM}`, CHALLENGE, invPayload)
+ const inv = buildConsent({ rp: 'bento', purpose: 'invite', docId: 'doc-abc_123', transcript: tInv!, exp: NOW + 60_000 })
+ const ictx = { rp: 'bento', audience: `room:${ROOM}`, challenge: CHALLENGE, payloadText: invPayload, docId: 'doc-abc_123' }
+ const sInv = await sign(consent, inv)
+ row({ name: 'cns: invite (document-scoped, audience room)', type: 'cns', ...ictx, text: inv, sig: sInv, expect: 'accept' })
+ row({ name: 'cns: DOCID SWAP — applied to another document', type: 'cns', ...ictx, docId: 'doc-other', text: inv, sig: sInv, expect: 'reject', reason: 'docid' })
+ const noDoc = buildConsent({ rp: 'bento', purpose: 'invite', docId: null, transcript: tInv!, exp: NOW + 60_000 })
+ row({ name: 'cns: a document-scoped purpose with no docId', type: 'cns', ...ictx, text: noDoc, sig: await sign(consent, noDoc), expect: 'reject', reason: 'docid' })
+}
+
+// --- derivations ------------------------------------------------------------------
+const transcripts = []
+for (const [audience, payload] of [['dir', 'dev.example'], [`room:${ROOM}`, 'inv.example']] as const) {
+ transcripts.push({ audience, challenge: CHALLENGE, payload, transcript: await consentTranscript(audience, CHALLENGE, payload) })
+}
+transcripts.push({ audience: 'id.bento.page', challenge: CHALLENGE, payload: 'x', transcript: null, note: 'a dotted audience is refused' })
+transcripts.push({ audience: 'dir', challenge: b64uEnc(new Uint8Array(8)), payload: 'x', transcript: null, note: 'a challenge under 16 bytes is refused' })
+transcripts.push({ audience: 'dir', challenge: CHALLENGE + '=', payload: 'x', transcript: null, note: 'a padded challenge is refused' })
+
+const sampleCns = rows.find((r) => r.type === 'cns' && r.expect === 'accept')!.text as string
+const webauthn = [{ cns: sampleCns, challenge: await webauthnChallengeFor(sampleCns) }]
+
+const lowSPairs = []
+for (let i = 0; i < 3; i++) {
+ const t = `dev.lows.${i}`
+ const s = await sign(account, t)
+ lowSPairs.push({ high: highS(s), low: s })
+}
+// lowS() must be the identity on a low-S input and must fold a high-S one
+for (const p of lowSPairs) if (b64uEnc(lowS(dec(p.high))) !== p.low) throw new Error('lowS fold mismatch')
+
+// --- routine sign purposes (identity.ts SignPurpose) --------------------------------
+const iv = b64uEnc(new Uint8Array(12).fill(1)), ct = b64uEnc(new Uint8Array(40).fill(2))
+const purposes = [
+ { purpose: 'frame', payload: `${iv}.${ct}`, match: true },
+ { purpose: 'frame', payload: `${iv}.${ct}.x`, match: false },
+ { purpose: 'frame', payload: `rev.${account.pub}`, match: false },
+ { purpose: 'prove', payload: `prove.${CHALLENGE}.${ROOM}`, match: true },
+ { purpose: 'prove', payload: `prove.short.${ROOM}`, match: false },
+ { purpose: 'delegate', payload: `dlg.${device.pub}`, match: true },
+ { purpose: 'show', payload: 'live', match: true },
+ { purpose: 'show', payload: 'end', match: true },
+ { purpose: 'show', payload: `nav.aud.${iv}.${ct}`, match: true },
+ { purpose: 'show', payload: `laser.aud.${iv}.${ct}`, match: false },
+ { purpose: 'invite', payload: `inv.${device.pub}.writer.0`, match: true },
+ { purpose: 'invite', payload: `inv.${device.pub}.owner.0`, match: false },
+ { purpose: 'revoke', payload: `rev.${device.pub}`, match: true },
+ { purpose: 'revoke', payload: `inv.${device.pub}.writer.0`, match: false, note: 'a revoke prompt can never sign an invite' },
+ { purpose: 'frame', payload: `inv.${device.pub}.writer.0`, match: false, note: 'a routine frame can never sign an invite' },
+]
+
+// --- addresses (share's rows; ASCII-only phase 1) -------------------------------------
+const L64 = 'a'.repeat(64), L65 = 'a'.repeat(65)
+const addresses = [
+ { input: '[email protected]', address: '[email protected]' },
+ { input: '[email protected]', address: '[email protected]', note: 'no provider folding' },
+ { input: '[email protected]', address: '[email protected]', note: 'an ASCII xn-- domain, as typed' },
+ { input: ' [email protected] ', address: '[email protected]', note: 'surrounding space is trimmed' },
+ { input: `${L64}@example.com`, address: `${L64}@example.com` },
+ { input: 'ü@x.de', reason: 'not-ascii' },
+ { input: 'a@bü.de', reason: 'not-ascii' },
+ { input: '"q"@x.com', reason: 'local-part', note: 'a quoted local part (the quote is printable ASCII, so it fails dot-atom)' },
+ { input: 'a(c)@x.com', reason: 'local-part' },
+ { input: 'a@[1.2.3.4]', reason: 'domain' },
+ { input: '[email protected]', reason: 'numeric-tld' },
+ { input: '[email protected]', reason: 'local-part' },
+ { input: '[email protected]', reason: 'local-part' },
+ { input: '[email protected]', reason: 'local-part' },
+ { input: 'a@x', reason: 'domain', note: 'a single label' },
+ { input: '[email protected]', reason: 'domain' },
+ { input: '[email protected]', reason: 'domain' },
+ { input: `${L65}@example.com`, reason: 'too-long' },
+ { input: `a@${'b'.repeat(63)}.${'c'.repeat(63)}.${'d'.repeat(63)}.${'e'.repeat(61)}`, reason: 'too-long', note: '255 characters' },
+ { input: 'a [email protected]', reason: 'not-ascii', note: 'an inner space' },
+ { input: 'a@[email protected]', reason: 'at-sign' },
+ { input: '@x.com', reason: 'at-sign' },
+ { input: 'a@', reason: 'at-sign' },
+]
+
+// Every cns. attempt that gets past the grammar check must CONSUME its challenge,
+// including one refused for rp, docId, transcript, expiry or signature — otherwise
+// a refused attempt's challenge stays live to be retried. A verdict alone cannot
+// show the order, so each row states whether the verifier must have called spend().
+// (home-desktop found the gap: a late spend passed every row.)
+for (const r of rows) if (r.type === 'cns') r.spendCalled = !(r.expect === 'reject' && r.reason === 'grammar')
+
+const fixture = {
+ version: 1,
+ note: 'bento/id conformance vectors. TEST KEYS ONLY — never use them for anything real. ' +
+ 'Every host must reach the stated verdict on every row; the reason is informative. ' +
+ 'Generated by scripts/gen-identity-vectors.ts, checked by scripts/test-statements.ts.',
+ now: NOW,
+ kxModeDefault: 'unruled',
+ keys: { account: account.pub, device: device.pub, consent: consent.pub, directory: directory.pub, kx, kx2 },
+ directoryKeys,
+ statements: rows,
+ transcripts,
+ webauthn,
+ lowS: lowSPairs,
+ purposes,
+ addresses,
+ // the frozen display-text refusal table: embed THIS, not your platform's \p{} tables
+ displayForbidden: { unicode: DISPLAY_FORBIDDEN_UNICODE, ranges: DISPLAY_FORBIDDEN_RANGES.map(([a, b]) => [a, b]) },
+}
+mkdirSync(dirname(OUT), { recursive: true })
+writeFileSync(OUT, JSON.stringify(fixture, null, 2) + '\n')
+console.log(`wrote ${OUT}: ${rows.length} statement rows, ${addresses.length} address rows, ${purposes.length} purpose rows`)
diff --git a/scripts/test-identity.ts b/scripts/test-identity.ts
index 779ac420..78510ce8 100644
--- a/scripts/test-identity.ts
+++ b/scripts/test-identity.ts
@@ -167,8 +167,10 @@ console.log('\nonce found, the agent cannot be reassigned')
ok(threw && a.sign === orig, 'a write to the captured agent throws (strict mode) and changes nothing')
}
-// K1 is contract only. Pin that no runtime file imports it yet, so this PR is
-// provably free of behaviour change; the bridge (B1) and the apps add callers.
+// Pin that nothing CALLS the agent yet, so the contract is provably free of
+// behaviour change until the bridge (B1) and the apps add callers. A type-only
+// import (`import type`) brings no code, so it does not count: statements.ts
+// uses the SignPurpose type to check payloads.
console.log('\ncontract only: nothing calls it yet')
{
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
@@ -179,11 +181,11 @@ console.log('\ncontract only: nothing calls it yet')
const p = join(dir, f)
if (statSync(p).isDirectory()) walk(p)
else if (/\.(ts|tsx|js|mjs)$/.test(f) && p !== join(root, 'kernel/src/identity.ts') &&
- /from ['"][^'"]*\/identity(\.ts)?['"]/.test(readFileSync(p, 'utf8'))) hits.push(p.slice(root.length + 1))
+ /^import(?!\s+type\b)[^\n]*from ['"][^'"]*\/identity(\.ts)?['"]/m.test(readFileSync(p, 'utf8'))) hits.push(p.slice(root.length + 1))
}
}
for (const d of ['kernel/src', 'slides/src', 'spaces/src', 'type/src', 'dash/src']) walk(join(root, d))
- ok(hits.length === 0, `no runtime module imports kernel/src/identity.ts (${hits.join(', ') || 'none'})`)
+ ok(hits.length === 0, `no runtime module imports kernel/src/identity.ts for its code (${hits.join(', ') || 'none'})`)
}
// The real path, last: identityAgent() over globalThis, with its capture-once
diff --git a/scripts/test-statements.ts b/scripts/test-statements.ts
new file mode 100644
index 00000000..d8659501
--- /dev/null
+++ b/scripts/test-statements.ts
@@ -0,0 +1,187 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// bento/id statements rig: kernel/src/statements.ts + kernel/src/address.ts
+// against the conformance vectors in kernel/fixtures/identity-v1.json.
+//
+// node scripts/test-statements.ts
+//
+// WHAT THIS PROVES. Every host (Swift, Kotlin, Rust, the extension and the
+// directory) is told to pass the fixture. That instruction is only worth
+// something if the REFERENCE passes it too, row by row, for the stated reason.
+// Beyond the rows, every accepted statement is tampered with three ways
+// (signature, an extra field, one byte of text) and must then be refused, and
+// every builder must reproduce the exact text it was parsed from.
+// It also pins that the attack rows security's §22/§24 check runs (replay,
+// relay, payload swap, docId swap, expiry) and the grammar refusals exist, so
+// deleting a row cannot quietly shrink the contract.
+
+import { readFileSync } from 'node:fs'
+import { join, dirname } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import {
+ verifyDev, verifyBind, verifyAtt, verifyTomb, verifyDel, verifyCmp, verifyConsent,
+ buildDev, buildBind, buildAtt, buildTomb, buildDel, buildCmp, buildConsent,
+ consentTranscript, webauthnChallengeFor, lowS, verifyStatementSig, payloadMatchesPurpose,
+ b64uDec, b64uEnc, KX_MODE, RESERVED_PREFIXES, DISPLAY_FORBIDDEN_RANGES, DISPLAY_FORBIDDEN_UNICODE,
+ displayForbidden, type Verdict, type KxMode,
+} from '../kernel/src/statements.ts'
+import { normalizeAddress } from '../kernel/src/address.ts'
+import type { SignPurpose } from '../kernel/src/identity.ts'
+
+let failures = 0
+let checks = 0
+function ok(cond: boolean, msg: string) {
+ checks++
+ if (!cond) { failures++; console.log(` FAIL ${msg}`) }
+ else console.log(` ok ${msg}`)
+}
+
+const root = join(dirname(fileURLToPath(import.meta.url)), '..')
+const F = JSON.parse(readFileSync(join(root, 'kernel/fixtures/identity-v1.json'), 'utf8'))
+type Row = Record<string, unknown> & { name: string; type: string; text: string; sig: string; expect: 'accept' | 'reject'; reason?: string; spendCalled?: boolean }
+
+let spendCalls = 0
+async function check(r: Row, text = r.text, sig = r.sig): Promise<Verdict<unknown>> {
+ const now = (r.now as number) ?? F.now
+ const kxMode = (r.kxMode as KxMode) ?? F.kxModeDefault
+ switch (r.type) {
+ case 'dev': return verifyDev(text, sig, { now, kxMode })
+ case 'bind': return verifyBind(text, sig, { now, kxMode })
+ case 'att': return verifyAtt(text, sig, { directoryKeys: F.directoryKeys, bindText: r.bindText as string, now, maxAgeMs: r.maxAgeMs as number })
+ case 'tomb': return verifyTomb(text, sig, { directoryKeys: F.directoryKeys, now })
+ case 'del': return verifyDel(text, sig, { accountPub: F.keys.account, now })
+ case 'cmp': return verifyCmp(text, sig, { accountPub: F.keys.account, bindText: r.bindText as string })
+ case 'cns': return verifyConsent(text, sig, {
+ consentPub: F.keys.consent, rp: r.rp as string, audience: r.audience as string, challenge: r.challenge as string,
+ payloadText: r.payloadText as string, docId: (r.docId as string | null) ?? null, now,
+ spend: () => { spendCalls++; return !r.challengeSpent },
+ })
+ default: throw new Error(`unknown row type ${r.type}`)
+ }
+}
+
+function rebuild(type: string, v: unknown): string | null {
+ const x = v as never
+ switch (type) {
+ case 'dev': return buildDev(x)
+ case 'bind': return buildBind(x)
+ case 'att': return buildAtt(x)
+ case 'tomb': return buildTomb(x)
+ case 'del': { const d = v as { address: string; ts: number }; return buildDel(d.address, d.ts) }
+ case 'cmp': { const c = v as { bindHash: string; code: string }; return buildCmp(c.bindHash, c.code) }
+ case 'cns': return buildConsent(x)
+ default: return null
+ }
+}
+
+console.log(`\nthe reference passes every statement row (${F.statements.length})`)
+for (const r of F.statements as Row[]) {
+ spendCalls = 0
+ const v = await check(r)
+ const got = v.ok ? 'accept' : `reject:${v.reason}`
+ const want = r.expect === 'accept' ? 'accept' : `reject:${r.reason}`
+ ok(got === want, `${r.name} → ${want}${got === want ? '' : ` (got ${got})`}`)
+ if (r.type === 'cns') {
+ ok((spendCalls > 0) === r.spendCalled,
+ `${r.name}: the challenge was ${r.spendCalled ? '' : 'NOT '}consumed (spend called ${spendCalls}×)`)
+ }
+}
+
+console.log('\nevery accepted statement round-trips, and refuses tampering')
+for (const r of (F.statements as Row[]).filter((r) => r.expect === 'accept')) {
+ const v = await check(r)
+ if (!v.ok) continue
+ ok(rebuild(r.type, v.value) === r.text, `${r.type}: the builder reproduces the exact text (${r.name})`)
+ const sig = b64uDec(r.sig)!
+ sig[10] ^= 0x01
+ ok(!(await check(r, r.text, b64uEnc(sig))).ok, `${r.type}: a flipped signature bit is refused`)
+ ok(!(await check(r, r.text + '.x', r.sig)).ok, `${r.type}: an extra field is refused`)
+ const i = r.text.length - 2
+ const flipped = r.text.slice(0, i) + (r.text[i] === '1' ? '2' : '1') + r.text.slice(i + 1)
+ ok(!(await check(r, flipped, r.sig)).ok, `${r.type}: one changed byte of text is refused`)
+}
+
+console.log('\nthe contract cannot quietly shrink: required rows are present')
+{
+ const names = (F.statements as Row[]).map((r) => r.name)
+ const has = (needle: string) => names.some((n) => n.includes(needle))
+ for (const attack of ['REPLAY', 'RELAY', 'PAYLOAD SWAP', 'DOCID SWAP', 'EXPIRED']) ok(has(attack), `cns attack row present: ${attack}`)
+ for (const g of ['high-S', 'DER', 'an extra field', 'a field missing', 'raw (unencoded) email', 'dotted rp', 'padded base64url'])
+ ok(has(g), `grammar/signature row present: ${g}`)
+ for (const t of ['dev', 'bind', 'att', 'tomb', 'del', 'cmp', 'cns'])
+ ok((F.statements as Row[]).some((r) => r.type === t && r.expect === 'accept') &&
+ (F.statements as Row[]).some((r) => r.type === t && r.expect === 'reject'), `${t}: at least one accept and one reject row`)
+ ok(F.kxModeDefault === 'unruled' && KX_MODE === 'unruled', 'kx placement is unruled: both slots must be empty until §6b is decided')
+}
+
+console.log('\nderivations: the consent transcript and the WebAuthn challenge')
+for (const t of F.transcripts) {
+ const got = await consentTranscript(t.audience, t.challenge, t.payload)
+ ok(got === t.transcript, `transcript(${t.audience}) ${t.transcript === null ? `→ refused (${t.note})` : '→ the fixture value'}`)
+}
+for (const w of F.webauthn) ok((await webauthnChallengeFor(w.cns)) === w.challenge, 'clientDataJSON.challenge = b64u(SHA-256(exact cns. bytes))')
+
+console.log('\nlow-S: verifiers refuse high-S, signers fold it')
+for (const [i, p] of (F.lowS as { high: string; low: string }[]).entries()) {
+ const text = `dev.lows.${i}`
+ ok(await verifyStatementSig(F.keys.account, p.low, text), `pair ${i}: the low-S signature verifies`)
+ ok(!(await verifyStatementSig(F.keys.account, p.high, text)), `pair ${i}: its high-S twin (equally valid ECDSA) is refused`)
+ ok(b64uEnc(lowS(b64uDec(p.high)!)) === p.low && b64uEnc(lowS(b64uDec(p.low)!)) === p.low, `pair ${i}: lowS folds high to low and leaves low alone`)
+}
+
+console.log('\nroutine signing: each SignPurpose signs only its own statement shape')
+for (const p of F.purposes as { purpose: SignPurpose; payload: string; match: boolean; note?: string }[]) {
+ ok(payloadMatchesPurpose(p.purpose, p.payload) === p.match,
+ `${p.purpose} ${p.match ? 'accepts' : 'refuses'} ${p.payload.slice(0, 24)}${p.payload.length > 24 ? '…' : ''}${p.note ? ` (${p.note})` : ''}`)
+}
+
+console.log('\naddresses: one normal form for every host (ASCII-only, phase 1)')
+for (const a of F.addresses as { input: string; address?: string; reason?: string; note?: string }[]) {
+ const r = normalizeAddress(a.input)
+ const want = a.address !== undefined ? `ok:${a.address}` : `refused:${a.reason}`
+ const got = r.ok ? `ok:${r.address}` : `refused:${r.reason}`
+ ok(got === want, `${JSON.stringify(a.input).slice(0, 40)} → ${want}${got === want ? '' : ` (got ${got})`}`)
+}
+
+console.log('\nstrict base64url')
+{
+ ok(b64uDec('QQ') !== null && b64uDec('QQ==') === null, 'padding is refused')
+ ok(b64uDec('QR') === null, 'non-zero trailing bits (a non-canonical spelling of "A") are refused')
+ ok(b64uDec('Q') === null, 'an impossible length is refused')
+ ok(b64uDec('Q+8') === null && b64uDec('Q/8') === null, 'the standard alphabet (+ /) is refused')
+ ok(b64uDec('') !== null && b64uDec('')!.length === 0, 'the empty string is zero bytes')
+}
+
+console.log('\nreserved prefixes')
+ok(RESERVED_PREFIXES.includes('pk'), 'pk. is reserved for the phase-2 passkey statement')
+ok(RESERVED_PREFIXES.includes('drev'), 'drev. is reserved for device revocation (arrives with per-device kx)')
+
+console.log('\nthe display refusal set is FROZEN, not read from the platform\'s Unicode tables')
+{
+ ok(JSON.stringify(F.displayForbidden.ranges) === JSON.stringify(DISPLAY_FORBIDDEN_RANGES) &&
+ F.displayForbidden.unicode === DISPLAY_FORBIDDEN_UNICODE, `the fixture carries the same table (Unicode ${DISPLAY_FORBIDDEN_UNICODE})`)
+ const ascending = DISPLAY_FORBIDDEN_RANGES.every(([a, b], i, r) => a <= b && (i === 0 || a > r[i - 1][1] + 1))
+ ok(ascending, 'ranges are sorted, disjoint and non-adjacent (one canonical table)')
+ // The categories it was frozen from. Compared only on a runtime whose tables ARE
+ // that version; on another Node the categories may differ, which is the point.
+ const re = /[\p{Cc}\p{Co}\p{Cn}\p{Zl}\p{Zp}\u115F\u1160\u3164\uFFA0]|(?![\u200C\u200D])\p{Cf}/u
+ if (process.versions.unicode === DISPLAY_FORBIDDEN_UNICODE) {
+ let same = true
+ for (let c = 0; c <= 0x10ffff; c++) {
+ if (c >= 0xd800 && c <= 0xdfff) continue
+ if (re.test(String.fromCodePoint(c)) !== displayForbidden(c)) { same = false; break }
+ }
+ ok(same, `on Unicode ${process.versions.unicode} the frozen table equals the categories it was built from`)
+ } else {
+ console.log(` note runtime is Unicode ${process.versions.unicode}; the frozen table (${DISPLAY_FORBIDDEN_UNICODE}) is authoritative, category check skipped`)
+ }
+ ok(!displayForbidden(0x200c) && !displayForbidden(0x200d), 'ZWNJ and ZWJ are not in the table (refused only at either end)')
+ const nonchars = [...Array.from({ length: 32 }, (_, i) => 0xfdd0 + i), ...Array.from({ length: 17 }, (_, p) => [p * 0x10000 + 0xfffe, p * 0x10000 + 0xffff]).flat()]
+ ok(nonchars.length === 66 && nonchars.every(displayForbidden), 'all 66 noncharacters are refused')
+ ok(displayForbidden(0x0378) && displayForbidden(0x3ffff), 'unassigned code points (U+0378, U+3FFFF) are refused')
+ ok(!displayForbidden(0x1f469) && !displayForbidden(0x06cc) && !displayForbidden(0x0041), 'assigned letters and emoji are not')
+}
+
+console.log(`\n${checks - failures}/${checks} checks passed`)
+process.exit(failures ? 1 : 0)