0
2
The next grain.social and the apps take HUD 0.31.0, their tokens bound to a key
Merged Approved
This moves next/, the iOS app and the Android app to HUD 0.31.0. It also changes the two sign-in call sites so each account's key is kept with its tokens. I found nothing that must change.
- Version bump: it is consistent across
package.jsonand its lock,Package.swift,Package.resolved,libs.versions.toml, the app file'shudand the$schemaof the app file, views and parts. I read only the first diff lines of the views; the rest of that diff is the same one-line$schemachange in each file. - iOS:
requestis theSignInRequestalready in scope insignIn, and the same value is passed toexchange(... for: request).AccountSession.start(request, tokens:handle:ended:)fits that. - Android:
storeis theKeystoreSessionStorethatAccountSession.restoreuses, soauth.exchange(code, request, store.keys)makes the key in the store the account later restores from. I could not check the call against hudkit's signatures from here. I am relying on your note that you read them at the 0.31.0 release. - Checks:
checkpassed.next,next-image,androidandtestwere still running or queued when I looked, so I can't say they pass. Nothing changed thate2eorlexiconscover, and both were skipped.
Before this ships, deploy hud-grain 0.31.0 first, since the app file now needs >=0.31.0. Also try the key paths on a real device, as the body already says.
All checks have passed
6 passed, 2 skipped
Merged as 5618047
What changes
The next grain.social and the iOS and Android apps take HUD 0.31.0 (
just hud-version 0.31.0):next/package.jsonand its lock,ios/HUD/Package.swiftandios/Package.resolved,android/gradle/libs.versions.toml, the app file's"hud": ">=0.31.0"and the$schemaof the app file, the views and the parts.The apps' sign-ins are bound to a key on the device. 0.31.0's HUDKit and hudkit make a P-256 key per account (the Secure Enclave, the Android Keystore) and send a DPoP proof with every request carrying HUD's tokens, so the session's refresh token is no longer rotated. Grain's two calls change with the kits' API: iOS passes its
SignInRequesttoAccountSession.start(request, tokens:handle:ended:)(ios/Grain/Shell.swift), so the key made with the request stays with the account; Android passes its store's keys toauth.exchange(code, request, store.keys)(android/.../Shell.kt). An account signed in before this gets its key at its next renewal, without signing in again.The web's sessions are bound too.
@hud/shell'sSessionsderives one key fromSESSION_SECRETand thegrain-nextsalt, so every server of the app holds it and nothing new is configured;next/src/lib/server/hud.tsis unchanged.An account is let go only when HUD says its grant is no good (
invalid_grant,invalid_client,unauthorized_client), on the web and in both apps: HUD unreached, restarting, a proxy's refusal or a proof refused fails that renewal and keeps the session.Why
The iOS app (Grain/101) signed its user out on 2026-11-30 at 03:07 UTC: a refresh hud-grain answered at 02:31 never reached the app (suspended with it in flight), and the next refresh, with the token the app kept, was taken by HUD as a replayed one and ended the session. The web lost both of a browser's accounts the same way on 2026-12-01 at 01:32 UTC, a page that refreshed them abandoned before its cookie arrived. HUD 0.31.0 answers a lost rotation's token again for bearer clients (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n3itkfwwqzbb) and binds its own clients' tokens to a key (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n3ivjsetb6du), so their refresh tokens are not rotated at all: RFC 9700 §4.14.2's sender-constrained tokens in place of rotation.
How it was checked
Release 0.31.0(8bcb4947): Grain calls no other API that changed (AccountSession.restore,kept,KeystoreSessionStore,HUDClient(base:session:)andSessionsas before).ssr.mjswith a fake HUD checking every proof), the server's under its coverage gate, and both e2e suites.next,next-imageandandroidare left to the checks. The iOS app builds only on a Mac: not built yet.Shortcomings
>=0.31.0, which an older HUD refuses. Move it (hetzner-infra,services/hud) first.Review
The two call sites in
ios/Grain/Shell.swiftandandroid/app/src/main/java/social/grain/Shell.kt; the rest is the version bump.