OverviewFilesCommitsIssuesDocsReleasesPeers

ap-bridge commits / 486f5cf

admission takes the claim bytes from the shared package
One definition, next to the verifier that consumes it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
486f5cf1085e03bec80f93dbfd78696fdf983a94
by plankatron <fleeky@gmail.com> · 2026-09-11T16:19:58.000Z

Changed files (1) +7 -13

lib/admission.js +7 -13
……@@ -27,18 +27,16 @@
2727import crypto from 'bare-crypto'
2828import b4a from 'b4a'
2929import { readAttested } from 'favela-identity/lib/attestation.js'
30// ⛔ THE BYTES COME FROM THE SHARED PACKAGE, not from here. The claimant builds them too, and a
31// disagreement of one byte surfaces as "proof does not attest that identity" — indistinguishable
32// from a forged proof. One definition, next to the verifier that consumes it.
33import { claimBytes, releaseBytes } from 'favela-identity/lib/bridge-claim.js'
3034
3135const HEX64 = /^[0-9a-f]{64}$/i
3236// Deliberately the same shape registrations.js enforces, so bytes signed here can never describe a
3337// name the registry would reject.
3438const NAME = /^[a-z0-9][a-z0-9_-]{0,31}$/
3539
36// ⚠ VERSIONED AND PREFIXED. The prefix keeps a claim proof from ever verifying as a release proof;
37// the version means a future change to what is bound can be introduced without silently accepting
38// both shapes. Colons are safe separators: a username cannot contain one (NAME), and the nonce and
39// feed key are hex.
40const CLAIM = 'favela-bridge:v1:claim'
41const RELEASE = 'favela-bridge:v1:release'
4240
4341const DEFAULT_TTL = 120_000 // two minutes — a round trip, not a session
4442
……@@ -65,14 +63,10 @@ export class Admission {
6563 }
6664
6765 /** The exact bytes a claimant must sign. Public, because the caller has to produce them too. */
68 claimBytes ({ nonce, username, feedKey }) {
69 return b4a.from([CLAIM, nonce, username, feedKey || ''].join(':'), 'utf8')
70 }
66 claimBytes (params) { return claimBytes(params) }
7167
72 /** The exact bytes a releaser must sign. No feed: releasing says nothing about where a feed is. */
73 releaseBytes ({ nonce, username }) {
74 return b4a.from([RELEASE, nonce, username].join(':'), 'utf8')
75 }
68 /** The exact bytes a releaser must sign. */
69 releaseBytes (params) { return releaseBytes(params) }
7670
7771 verifyClaim ({ nonce, username, feedKey, root, proof } = {}) {
7872 if (badName(username)) return fail('bad username')