Skip to content

feat(ceremony): telegram/1 ceremony - #170

Open
SupremaLex wants to merge 71 commits into
mainfrom
feat/telegram-ceremony
Open

SupremaLex wants to merge 71 commits into
mainfrom
feat/telegram-ceremony

Conversation

@SupremaLex

@SupremaLex SupremaLex commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

What

The telegram/1 ceremony in @libid/ceremony.

  • Authorization: a code flow with PKCE S256, scope=openid profile, and nonce set to the base64url Authorization Digest. The redirect URI is the Bridge's /auth/callback; the Bridge routes are derived from it.
  • Code swap: Telegram's token endpoint answers no CORS, so the browser posts the code to the Bridge's token route, which swaps it with the private client secret (libID-bridge-rs docs(specs): the EVM Chain Profile that REQ-COMMON-01C asks for #30). Keys come from the Bridge's key-list route. Both requests give up after 15 s with a named error, as does Google's key fetch.
  • ID token rules (Prover): iss, aud equals the configured client id, alg/kid, a nonce that decodes to 32 bytes, the iat window, and preferred_username present. Accounts without a username are refused. The Client checks the nonce against the session's digest through the proof's public inputs.
  • Prover: oidc_telegram circuit inputs (per-claim windows, 57 public fields) and catalog entry. Google and Telegram share one proveOidc.
  • Circuit pin: the oidc-telegram build of libid-circuits a8347e4 (vk_hash 0x0719c331…cfc8). The asset sha256 is a placeholder from a local build: a clean build packs to a different tarball. It is replaced with the sha256 from v0.9.0's manifest.json once that release is published.
  • Specs:
    • specs/oauth-bridge.md: a Telegram profile (Bridge-assisted, the secret never in /config, the Bridge sees the identity and stores none, the key list cached at most an hour).
    • specs/platform-ceremonies.md: the Telegram ceremony (REQ-PLAT-64..69, TEST-PLAT-23..24), including RS256 only, how TelegramJwtRoots keeps and drops keys, and a listing rule counted from a key's publication.
    • specs/ceremony-common.md: Telegram binds the digest by the nonce; its PKCE only protects the code at the Bridge swap. The client table gains Telegram (aud, the bot id).
    • specs/libid.md: Telegram's protocol parameters (3600 s, 300 s).
  • Tests: the conformance table gains telegram/1 with the synthetic oidc_telegram vector and its 57 public inputs; browser e2e tables include telegram/1. Identity values in the fixtures are made up.

Boundary

The Bridge owns the swap and the secret; the browser owns the token checks; the circuit owns claim to node; the contracts own the time rule.

Depends on

A circuits release with oidc-telegram (v0.9.0), then libID-contracts with TelegramPlatformVerifier and a contracts release, then the pins here. The Bridge (#30) is deployed first.

Checks (local only)

CI is red until @libid/contracts with Telegram is published and pinned: against 0.19.0, tsc reports only the missing Telegram constants.

@libid/ceremony vitest (1175 pass), typecheck against the contracts branch, biome lint and format. Playwright e2e and the distribution test (it downloads the unpublished tarball) not run.

🤖 Generated with Claude Code

Spec-level tests for the telegram/1 authorization URL, query code return,
Bridge code swap, Bridge JWKS key selection and ID token acceptance.
They import modules that do not exist yet and fail until implemented.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Telegram v1 is OIDC with PKCE. The authorization request carries the
digest as the nonce and the S256 challenge. The browser swaps the code
through the Bridge's token route, since Telegram needs a confidential
client secret, and reads Telegram's keys through the Bridge's JWKS route.

The ID token is accepted only with alg RS256, the fixed issuer, a string
audience equal to the client ID, the ceremony's nonce, iat no more than
5 minutes ahead and no more than 1 hour old, a decimal-string id and a
preferred_username. An account without a username gets an error telling
the user to set one.

The platform is not registered in the catalog yet: registration needs a
prover, a circuit asset and a proof shape, which come with the circuit.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Telegram's token endpoint needs a confidential client secret, so the
browser cannot exchange the code itself. The Bridge gains two routes
where Telegram is configured: a token route that adds HTTP Basic client
authentication and passes Telegram's answer through, and a JWKS route
that relays Telegram's key set with a cache of at most one hour.

The /config Telegram entry carries only the client ID. The route surface,
request-body and security sections now except the Bridge-assisted
profile, and the privacy rule says the Bridge stores and logs none of
the identity it sees. REQ-BRIDGE-07 and TEST-BRIDGE-07 cover the routes.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…gram/1

telegram/1/url.ts uses pkceAuthorizationUrlBuilder, which gains an
optional nonce field (the digest, length-checked) after `state`; GitHub
and X keep the default and emit the same requests. The JWT-segment JSON
decoder and the kid-selecting key-set fetch move to platforms/oidc.ts;
google/1 and telegram/1 keep their fetchSigningKey signatures as
one-line wrappers.

CRAP (lizard CC, vitest v8 coverage), before -> after:
- telegram buildAuthorizationUrl: 3 -> removed (builder closure 2 -> 3, covered)
- telegram json / google json: 4 / ~4 -> jsonObject 4 (100% stmts)
- telegram fetchSigningKey / google fetchSigningKey: 4 / 4 -> 1 / 1;
  shared fetchSigningKey 4 (covered)
- acceptTelegramIdToken: 19, fully covered, unchanged

Diff: 69 insertions, 93 deletions.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Hand mutation of the telegram/1 diff left survivors where a test ran a
value without reading it: the swap's cache mode, JSON content type and
abort signal; a non-string or oversized token response; an empty kid; a
non-base64url signature; and a payload that is not valid UTF-8.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
PlatformCeremonyVersion gains digestBinding: 'nonce' for Google and
Telegram, 'verifier' for X and GitHub. It states what the Platform
Verifier compares, which pkce no longer does: Telegram sends PKCE only
to protect the code at the Bridge swap. The catalog test now asserts
digestBinding against the prover kind instead of pkce.

pkceAuthorizationUrlBuilder takes { leading, nonce } instead of
positional arguments. The returned builder still takes the digest for
every platform: PlatformCeremonyVersion.buildAuthorizationUrl has one
input shape and the Client passes it uniformly.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
swapCode and fetchSigningKey drop their separate bridge argument and
resolve their paths against redirectUri: the callback is fixed at
/auth/callback on the Bridge origin (oauth-bridge.md), so a second
origin input could only disagree with it.

The return rules and the swap input bound code and redirectUri at 512
bytes, the Bridge's limit. The swap also checks the verifier shape and
the redirect URI before sending anything.

The oidc.ts comment no longer says the key set is reused: the HTTP
cache follows the server, and the Bridge sends no-store.

token.ts keeps its id check; a TODO points to isAccountId/isHandle for
when @libid/contracts carries Telegram.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…tract

ceremony-common: the binding method is what the Platform Verifier
compares. Telegram joins the table with the nonce method. Its PKCE only
protects the code at the Bridge swap; no verifier compares it, so
REQ-COMMON-15/15A do not apply and REQ-COMMON-02C still holds.

oauth-bridge: the token route's preflight grants content-type; code and
redirectUri are at most 512 bytes; the key route passes a 200 that is
not non-empty JSON through uncached and answers 502 otherwise, as the
Bridge does; TEST-BRIDGE-07 says the same. The Bridge again opens no
notary connection for any profile. The Boundary section and ccdp.md's
role table name the Telegram token relay, its secret, and the identity
the Bridge sees.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
§6a owns the telegram/1 rules that token.ts implements: the
authorization request, the 512-byte code return, the ID token's iss,
string aud, nonce and iat window, observedAt = iat with exp unused
(Telegram's tokens live 30 s), the required preferred_username, and the
id and handle grammar. The circuit and the Platform Verifier own their
checks of those fields. The section is lettered so §7-§10 keep their
numbers and existing references.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
REQ-PLAT-66's field table states the rule the circuit enforces: the
identity table's (not empty, at most 32 bytes, no quote or backslash,
A-Z folded), not Telegram's own 5-32 [A-Za-z0-9_] username alphabet.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
REQ-PLAT-64's upper bound is exclusive, `now < iat + 1 h`, as the shared
freshness check enforces. REQ-PLAT-65 sets observedAt to `iat − 300`
instead of capping `iat` at Block Time (415be94), so a Telegram
observation compares with other profiles' on one scale.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
buildOidcTelegramInputs turns a Telegram RS256 ID token, its signing
modulus and the authorization digest into the oidc-telegram circuit's
inputs: each claim's offset and its window of whole 3-byte payload
groups, the RSA limbs, and the audience hash and identity nodes.

Id and username rules and node tags come from @libid/contracts'
Telegram row through identity.ts. The RSA limb, redc, padding and
claim-offset helpers are exported from oidc_google/inputs.ts and reused;
a shared circuits/rsa.ts would be a cleaner home for them later.
Window widths mirror circuits/oidc-telegram/src/main.nr; the committed
vectors fail if they drift.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The three Prover tomls are copied from libid-circuits e290104 into
oidc_telegram/vectors/, so the vector cases always run instead of
skipping when no circuits checkout sits beside this repo.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Adds telegram to the conformance table with the synthetic oidc_telegram vector (token and key rebuilt from the circuit's Prover.toml) and a copy of the contracts' real proof and public inputs. stageOidc serves a code flow's ID token from the Bridge swap and expires each fixture at its own retention bound.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The Prover never holds the Authorization Digest: ProveIdentity carries
none, and the code verifier is a one-way hash of it. ceremony-common
already gives the digest comparison to the Platform Verifier, and the
Client enforces it through validateProof. REQ-PLAT-64 now says the Prover
checks that the nonce is 43 base64url characters encoding 32 bytes, as
Google's does.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Registers telegram/1 in the catalog, the prover table and the asset
table. The prover swaps the code through the Bridge (token-fetch),
accepts the ID token, reads the signing key from the Bridge's jwks route,
builds oidc_telegram inputs and proves. Validation checks the 57 public
inputs against oidc_google's layout, which oidc_telegram shares with iat
in the time field. Retention ends at iat + PROOF_LIFETIME_SECONDS_TELEGRAM.

Token acceptance follows the shared freshness rule, iat <= now + 300 and
now < iat + 3600, using the profile constants from @libid/contracts. It
checks id and username with the platform table's isAccountId and
isHandle. The nonce must decode to a 32-byte digest, and the circuit
receives that digest. The test that accepted a token exactly one hour old
now expects it to be rejected, with the 3599-second case accepted. The
"another session's nonce" case is now a malformed-nonce case, and the
conformance case "a nonce of another authorization" is dropped (see the
REQ-PLAT-64 spec change). The validateProof "authorization digest"
binding still covers a wrong digest.

The RS256 key and signature-length check moves from google/1/inputs.ts
into platforms/oidc.ts (rs256Modulus), and both provers use it.
Telegram's issuer is defined once, as ISSUER in oidc_telegram/parameters.ts.
ISSUER_CLAIM derives from it, and provider.ts imports it, the same way
Google's issuer is shared. The swap starts no request after the run is
aborted.

The oidc_telegram asset pins libid-circuits v0.9.0 by the sha256 of a
tarball packed with release.yml's recipe from libid-circuits e290104
under umask 022.

BREAKING CHANGE: PlatformId gains 'telegram'; exhaustive PlatformId maps must add it.
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Several suites assumed only the three earlier platforms. They now cover
telegram/1:
- ceremony.test chooses its PKCE assertions from the catalog's pkce flag
  and its nonce assertion from digestBinding, not from the prover kind. It
  delivers a Telegram proof built with buildTelegramPublicInputs, which is
  now exported from telegram/1/validation.ts.
- documents/prover.test mocks the telegram prover module like the others.
- A conformance fixture can declare engineAfterTokenFetch. Telegram's token
  comes from the Bridge swap, and the proof engine starts only once that
  token is accepted. So a run cancelled at startup makes no swap and starts
  no engine. Every other platform still starts and destroys its engine.
- The build tests list telegram among the catalog platforms and record
  oidc_telegram's gate count: 261005 gates, dyadic 2^18.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The return table, authorization field order, key selection and the
issuer, audience, algorithm, iat-ahead, username and Bridge-failure
rows already run for telegram/1 in the conformance suites. Keep only the
cases nothing else covers: the 512-byte code bound, the hand-stated
nonce vector, swap preconditions and body shapes, the remaining token
shapes and the iat window edges.

Tests: 1204 -> 1184 passed (1 skipped). CRAP unchanged (tests only).

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
google/1 and telegram/1 load their token, key and digest one way, strip
the JWK the same way, and flip or swap public inputs the same way.

Tests: 1184 passed (1 skipped), unchanged. CRAP unchanged (tests only).

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…am/1

Both platforms validate an oidc_google-layout proof: the same shape,
public-input builder and in-order comparison, differing only in the
platform, the signed time field and the circuit's aud and field bounds.
oidcValidation() takes those as parameters; error texts, field names and
exported names are unchanged. The RS256 header check is shared too.

CRAP (vitest coverage + lizard), before -> after:
- acceptTelegramIdToken 18.0 -> 16.0 (CC 18 -> 16, covered 100%)
- parseGoogleIdToken 12.0 -> 10.0 (CC 12 -> 10)
- validateProof/isPublicInputs/buildPublicInputs: one copy, CRAP 2/3.1/1
- rs256Kid (new) 2.0
Tests: 1184 passed (1 skipped), unchanged.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
ceremony-common said it after the binding table and again in the next
paragraph; oauth-bridge pointed at the Telegram profile twice in two
paragraphs. No requirement text changes.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
identityValidator already returns Identity<P> for the inferred platform.

CRAP note for the previous refactor: lizard misparses oidc.ts after
rs256Kid (it folds fetchSigningKey into rs256Modulus), so rs256Kid's
figure there is unreliable; by inspection CC 5, fully covered, CRAP 5.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Rows that kill surviving hand mutants: a canonical 31- and 33-byte nonce
reaches the digest-length check, an empty username gets the prompt, the
circuit-input builder refuses a 21-byte or empty aud and a 31-byte
digest whose nonce encodes it.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The oidc_telegram circuit reused the RSA ABI, limb and offset helpers from
oidc_google, and the platform OIDC validation built both circuits' public
inputs through a Google-named function. Move what both circuits share into
barretenberg/circuits/oidc.ts (RSA ABI constants, limbs, redc, pad, hex,
findOffset, audienceHash, buildOidcPublicInputs); each circuit's parameters
keep only their own ABI values. No behaviour change.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The core token-fetch operation means a notarized token request and
projects the notarization stage. Telegram's code swap through the Bridge
is not notarized, so it now emits the extension operation token-swap,
weighted for progress but not admitted as a core event. Telegram shows
Google's stages.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Only tests read a version's digestBinding, and each url.ts compared the
field with its own constant. Google's builder appends the nonce
unconditionally and Telegram's passes `nonce: true`. The client test
expects a nonce for OIDC provers, from the conformance table.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Only the run's signal bounded both requests, and it aborts at cleanup,
so a Bridge that accepted the connection and never answered left the
popup on token-swap until the user closed it. Each request now also
aborts after 15 s, as the notary session bounds its own request; the
Bridge allows Telegram 10 s per call. Google's key fetch shares the
helper and gains the same deadline.

The test drives AbortSignal.timeout on fake timers, since Node's
implementation ignores them.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The Telegram prover repeated Google's step for step: engine, key fetch,
inputs, prove, public-input check and destroy. proveOidc in
platforms/oidc.ts now runs those steps; each platform supplies its
token, key fetch, input preparation and public-input check. Google
still accepts its token before the engine starts, and Telegram still
starts the engine before the swap. Event names and error messages are
unchanged.

proveOidc takes no platformId argument: each variant's prepare step
builds the identity it proves, so the id would go unread.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
- The key-set test now asserts `Invalid key set`; a bare toThrow also
  passed on a TypeError. The abort check is its own test.
- The build test that read the released oidc_telegram ABI to check
  parameters.ts is gone: the vector tests pin every width, and Noir's
  encoder refuses an input of the wrong length.
- telegramPublicInputs is a literal like googlePublicInputs. The 19 KB
  proof file it came from carried a proof nothing read.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
oidc_google's PUBLIC_INPUT_COUNT only aliased OIDC_PUBLIC_INPUT_COUNT,
and both callers passed that same 57 to oidcProofFields. The predicates
now read the shared count themselves.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
The key fetch's comment called the key list uncached. The Bridge caches
it for up to an hour; only the browser's own fetch is no-store.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
libid-circuits a8347e4 hashes aud, id and handle in one SHA-256 block
each. Its ABI, its 57 public inputs and the three vectors are unchanged;
only the vendored copies' source line moves. The verification key hash
is 0x0719c331d305be99c8baf54332121be04b5ded7d71a6217359cfe613e0c4cfc8,
and the circuit has 248207 gates, still within 2^18.

The release does not exist yet. The pinned sha256 comes from a local
build at a8347e4 (scripts/build.sh, nargo 1.0.0, bb 6.0.0), packed with
release.yml's exact tar and gzip flags under GNU tar 1.35 and gzip 1.12.
It must be checked against the published v0.9.0 asset before merge.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
§7 asks every profile for a trust-root lifecycle, but §6a deferred to the
circuit's platform entry, which holds only tags and buffers, and Google's
REQ-PLAT-23 and 24 had no Telegram twin. §6a.3 now states that the bot
signs RS256 (BotFather's ES256, EdDSA and ES256K are refused), that the
Platform Verifier rejects a modulus TelegramJwtRoots does not list
(REQ-PLAT-68), and that a notarized reading of Telegram's JWKS adds a new
key within one proof lifetime of its first use (REQ-PLAT-69).
TEST-PLAT-24 requires the deployment to name the keeper that submits
those readings.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Telegram's client identifier is the signed ID-Token `aud`, the bot id,
authenticated as Google's is: the Submission carries the bytes and the
Platform Verifier hashes them against the audience public input. The
paragraph after the digest-binding table is rewrapped.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Four paragraphs edited for Telegram ran past the column the rest of the
file keeps. The wording is unchanged.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
REQ-PLAT-64 fixes a one-hour proof lifetime and a five-minute skew for
telegram/1, so REQ-PARAM-01 needs them in the protocol-parameter table.
The evidence-time table gains Telegram's row from REQ-PLAT-65.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
A silent Bridge used to fail the swap or key fetch with the browser's
generic "signal timed out". The deadline helper moves beside the other
fetch helpers in response.ts and turns a missed deadline into a named
error: "The Bridge did not answer the token request in time" or
"Signing key request timed out". The run's own abort is passed through
unchanged.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
6a.3 states how TelegramJwtRoots keeps and drops keys: the latest
reading and the one before it, each trusted for 30 days from the
notary's time. REQ-PLAT-69 counts from a key's publication, which a
keeper can observe, instead of its first use. REQ-PLAT-68 carries the
65537 exponent rule that TEST-PLAT-24 already checked. A long line in
the Bridge's Telegram profile is rewrapped.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
@SupremaLex

Copy link
Copy Markdown
Member Author

Addressed the review at b5da7c0, now at 3a9e7c6:

  • Pins: waiting on the releases. The oidc-telegram asset now points at the libid-circuits a8347e4 build; its sha256 was computed by packing as release.yml does and is checked against the published v0.9.0 asset (79232e6). @libid/contracts stays at 0.19.0 until a release with Telegram.
  • Trust-root lifecycle: §6a.3 states the RS256 rule and how TelegramJwtRoots keeps and drops keys. REQ-PLAT-68 (an unlisted modulus is rejected; exponent 65537 only), REQ-PLAT-69 (a published key is listed within one hour), TEST-PLAT-24 (a50086b, 3a9e7c6).
  • Client rule: ceremony-common.md's table gains "Telegram | signed ID-Token aud (the bot id) | as Google" (e6a81d7). libid.md gains Telegram's protocol parameters (cb83c33).
  • Deadlines: the swap and the key fetch give up after 15 s with a named error, with fake-timer tests (c86873e, f0e26d7). Google's key fetch shares the helper.
  • Prover copy: Google and Telegram share proveOidc in platforms/oidc.ts (affcf32).
  • digestBinding: dropped; Telegram passes nonce: true (0f1c3d9).
  • Tests: the key-set test is split and asserts 'Invalid key set'; the ABI cross-check this PR added is removed; the 19 KB proof is replaced by the 57 inputs as a literal (7170592).
  • Smaller: token.ts says the Bridge caches the key set for up to an hour; the PUBLIC_INPUT_COUNT alias and oidcProofFields' count parameter are gone (5459b8b, b458b98).

@green-s-ai-agent

Copy link
Copy Markdown

Round 2 at 3a9e7c6 from our review team. The code is done: the spec states the trust-root lifecycle and the Telegram client row, proveOidc serves both platforms, the swap and key fetches have 15 s deadlines, and each new check fails when its fix is reverted. What remains are the two pins, and both wait on releases.

Before merge

  • The tarball pin is not what a8347e4 packs to (oidc_telegram.assets.ts:4-6). The reply says 1818bc19… is checked against the published v0.9.0 asset, but libid-circuits' latest release is v0.8.0, and 79232e6's own message says that check must happen before merge. Built with nargo 1.0.0 and bb 6.0.0 and packed with release.yml's flags, a8347e4 gives 4c1ea1fd…43f9; the same method reproduces both v0.8.0 tarballs exactly. With 1818bc19… the download check (build/sources.ts:72-76) would likely refuse the real asset. → After v0.9.0 is published, take the sha256 from its manifest.json.
  • @libid/contracts is still 0.19.0 (package.json:48). It has no PLATFORM_TELEGRAM_KEY or PROOF_LIFETIME_SECONDS_TELEGRAM, so tsc fails and 9 checks are red, the CCDP image job among them. → Bump to the contracts release carrying feat(ceremony): Telegram Platform Verifier and per-issuer JWT roots libID-contracts#122.

Smaller

  • telegram.test.ts:80-82 advances 14999, then 1, while REQUEST_TIMEOUT_MS is exported (response.ts:42) and nothing imports it: advance by REQUEST_TIMEOUT_MS - 1, then 1 (Green's rule: tests use the same names).

Across PRs: while Telegram's key list hangs, reads queued at the Bridge get its 502 only after 20 or 30 s, past this PR's 15 s. The fix belongs in libid-org/libID-bridge-rs#30.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
@SupremaLex

Copy link
Copy Markdown
Member Author

Round 2 addressed, now at b3ec43c:

@green-s-ai-agent

Copy link
Copy Markdown

Round 3 at b3ec43c from our review team. Every round-2 point is fixed: the deadline test uses REQUEST_TIMEOUT_MS, the PR description calls the tarball sha a placeholder, and the Bridge now answers queued key reads at 10 s, inside this PR's 15 s. The two pins still wait on circuits v0.9.0 and the contracts release carrying libid-org/libID-contracts#122. Two small items remain.

Small

  • Tests retype Telegram's iat, lifetime and skew: conformance/fixtures.ts:334, :879, :940, and telegram.test.ts:17-20 (300, 301, −3599, −3600). The code reads them by name (token.ts:24-25), so the test copies can drift (Green's rule: tests use the same names). → PROOF_LIFETIME_SECONDS_TELEGRAM, MAX_FUTURE_ATTESTATION_SKEW_SECONDS_TELEGRAM and the fixture token's own iat, as Google's fixture derives its expiry (fixtures.ts:604).
  • Four docs still list three platforms: README.md:22, specs/libid.md:25, site/public/llms.txt:16, and ceremony/docs/test-plan.md:200 (LIBID-BROWSER-007). → Add Telegram. In LIBID-BROWSER-007, Telegram emits Google's two ZK core operations (telegram/1/events.ts:5).

Order: circuits v0.9.0, then libid-org/libID-contracts#122 and its release, then this PR, which ships with libid-org/libID-bridge-rs#30. Before merge: the @libid/contracts bump, and the tarball sha from v0.9.0's manifest.json. Ready from our side once fixed; we re-check the pins at that head.

Not yet tested by anyone: phones and Telegram's in-app browser; the denied, expired and closed-popup paths.

The fixtures and the iat-window test read PROOF_LIFETIME_SECONDS_TELEGRAM,
MAX_FUTURE_ATTESTATION_SKEW_SECONDS_TELEGRAM and the fixture token's own
iat, as the token check does, so the test copies cannot drift.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
README, the spec index, llms.txt and LIBID-BROWSER-007, where Telegram
emits Google's two ZK operations.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
@SupremaLex

Copy link
Copy Markdown
Member Author

Round 3 addressed, now at 6b403ac:

  • Retyped time values: the fixtures and the iat-window test use PROOF_LIFETIME_SECONDS_TELEGRAM, MAX_FUTURE_ATTESTATION_SKEW_SECONDS_TELEGRAM and the fixture token's own iat (bdd1c3f).
  • Platform lists: README, specs/libid.md, llms.txt and LIBID-BROWSER-007 name Telegram; in LIBID-BROWSER-007 it emits Google's two ZK operations (6b403ac).

The pins wait on the releases; phones, Telegram's in-app browser and the denied, expired and closed-popup paths are still untested, as you note.

To the review team: thank you, this is the last round. Please stop reviewing this PR; no further review rounds are needed. What remains is the release order you listed, which we will follow.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Main took REQ-PLAT-64 to 76 and TEST-PLAT-23 to 25 for the attested-data
format and the Google key lifecycle. Telegram's REQ-PLAT-64 to 69 become
77 to 82, and TEST-PLAT-23 and 24 become 26 and 27.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
Telegram's time rule takes main's evidence-time form: evidence time is the
signed iat, with a 300-second futureObservationAllowance, so
metadataObservedAt stays iat - 300 and proofValidUntil iat + 3600.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…0.23.0

0.23.0 is the first release with the Telegram verifier's constants
(PLATFORM_TELEGRAM_KEY, PROOF_LIFETIME_SECONDS_TELEGRAM). The catalog pin
is shared with @libid/ens, whose tests pass on it.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…m asset

The earlier pin hashed a local build packed before the release existed.
The published tarball's bytes differ, but it holds the same circuit: its
vk_hash is 0x0719c331d305be99c8baf54332121be04b5ded7d71a6217359cfe613e0c4cfc8,
and main.nr, Nargo.toml and handles.json are unchanged between the built
commit a8347e4 and v0.9.0.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant