Skip to content

feat(#96): account/email/identity — suiNS fix + identity Move foundation (phased) - #99

Merged
dadadave80 merged 12 commits into
mainfrom
feat/96-account-identity
Jun 21, 2026
Merged

dadadave80 merged 12 commits into
mainfrom
feat/96-account-identity

Conversation

@dadadave80

Copy link
Copy Markdown
Member

Implements #96 (account / email / identity layer). Draft — landing in phases. Foundation + the standalone suiNS fix are done and green; the OTP backend + UI + the gated fresh publish follow.

Done in this PR so far

✅ suiNS display fix (standalone, mergeable now — commit 1)

Root cause confirmed: names were resolved on the app's testnet client, but .sui names live on mainnet → reverse always returned []. Fix: a dedicated read-only mainnet suiNS client (web/lib/suinsClient.ts), reverse + new forward resolution against it, network-scoped cache keys, useResolveSuiNSAddress for search, and no more silent error-swallowing. "No name" stays a normal null → callers fall back to identicon + hex. (This commit is independently shippable if you want to fast-track it.)

✅ Move identity foundation + Seal email policies (commit 2)

  • New hostit_ticket::identity: shared EmailRegistry (Table<HMAC, address> — one-account-one-email, register/unregister gated on ownership, idempotent same-owner) + attendee-minted shared EmailGrant (user bound to ctx.sender(), forward-only revoke).
  • access: EMAIL_NS_TAG (tag-first so the email namespace is disjoint from the bare-self KYC/drafts namespace), seal_approve_own_email (owner) + seal_approve_attendee_email (organizer + opt-in grant, confined to email).
  • Refines the issue's P0-B: with a tag-first namespace the owner needs a dedicated seal_approve_own_email (the issue's claim that seal_approve_self would still match was incorrect — the id no longer starts with the bare address). The KYC-isolation guarantee is now by construction (disjoint prefixes) and covered by a regression test.
  • 11 Move tests: uniqueness (E_EMAIL_TAKEN, free-on-unregister), grant/revoke ownership, and the policy passing for organizer+grant while aborting on the KYC/self namespace, wrong event, and wrong cap.

✅ Client-lib wiring

seal.ts (makeEmailSealId, approveOwnEmail, approveAttendeeEmail), lib/identity.ts (register/unregister/grant/revoke tx constructors), config.ts (EMAIL_REGISTRY_ID + 4 sponsored targets), moveErrors identity map, sponsor-targets test extended, roll-fresh-publish.mjs rolls the new EmailRegistry.

Gates: sui move test 144/144 (+11) · bunx tsc --noEmit clean · bun run lint 0 errors · bun run test 190/190.

Remaining (next pushes)

  1. Email-verification backend — app/api/email/{start,verify,bind-google} (Resend OTP + wallet-signature fusion; Google JWT re-verify) + shared server emailHash.ts (canonicalize + HMAC-pepper) + emailCanonical.ts. Needs ops secrets: RESEND_API_KEY, EMAIL_HASH_PEPPER, and a verified Resend sending domain (reuses TURNSTILE_SECRET_KEY + KV).
  2. Email-binding orchestration — useEnsureProfile() (Google auto-bind popup-free; wallet one-time EmailCaptureDialog), Seal-encrypt → Walrus → register_email.
  3. Profile/identity UI — <Avatar> + useDisplayName/useProfilePicture (suiNS name+avatar → uploaded → identicon), Settings (disconnect-for-wallet / locked-for-Google / "delete my email data" for all), buy-flow opt-in checkbox, organizer decrypt on the Redesign the per-event manage page as a lifecycle-driven command center #87 Attendees view.
  4. Gated fresh publish of the identity module + roll EMAIL_REGISTRY_ID (the identity fns/policies don't resolve on-chain until then) + P0-C empirical Seal dry-run check.

See #96 for the full design, the 5 open decisions, and v1/v2 scope (KYC is v2).

🤖 Generated with Claude Code

dadadave80 and others added 2 commits June 21, 2026 17:57
suiNS .sui names live on Sui mainnet, but reverse/forward resolution ran on the
app's active (testnet) client and always returned [] — so a connected wallet's
name never rendered. Add a dedicated read-only mainnet suiNS client
(lib/suinsClient.ts), resolve reverse + forward against it, network-scope the
query keys, add useResolveSuiNSAddress for search, and stop silently swallowing
RPC errors (so genuine failures retry/surface instead of caching null forever).
"No name" stays a normal null → callers fall back to identicon + hex.

Part of #96 (shipped first, standalone, decoupled).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The on-chain + client-lib foundation for the account/email layer (UI + OTP
backend follow). No plaintext PII on-chain — only an opaque email hash + grants.

Move:
- New `hostit_ticket::identity`: shared `EmailRegistry` (Table<HMAC, address> for
  one-account-one-email; register/unregister gated on ownership, idempotent for
  the same owner) + attendee-minted shared `EmailGrant` (grant/revoke, user bound
  to ctx.sender(), forward-only revoke) + EmailGrantCreated discovery event.
- `access`: `EMAIL_NS_TAG = b"hostit-email:"` (tag-FIRST so the email namespace is
  disjoint from the bare-self KYC/drafts namespace), `seal_approve_own_email`
  (owner) + `seal_approve_attendee_email` (organizer + opt-in grant, confined to
  the email namespace). Refines the issue's P0-B: with a tag-first namespace the
  owner needs a dedicated own-email policy (seal_approve_self can't match it).
- tests/identity_tests.move (11 tests): uniqueness incl. E_EMAIL_TAKEN + free-on-
  unregister; grant/revoke ownership; the policy passes for organizer+grant and
  aborts on the KYC/self namespace (P0-B regression), wrong event, and wrong cap.

Client-lib:
- web/lib/seal.ts: EMAIL_NS_TAG, makeEmailSealId, approveOwnEmail, approveAttendeeEmail.
- web/lib/identity.ts: register/unregister/grant/revoke tx constructors + EV.
- config.ts: EMAIL_REGISTRY_ID + 4 identity SPONSORED_TARGETS; moveErrors identity
  map; sponsoredTargets test extended; roll-fresh-publish.mjs rolls EmailRegistry.

Gates: sui move test 144/144 (+11) · web tsc clean · lint 0 errors · vitest 190/190.
Part of #96. Needs a fresh publish + config roll before the identity fns resolve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hostit-sui Ready Ready Preview, Comment Jun 21, 2026 7:29pm

dadadave80 and others added 2 commits June 21, 2026 18:31
Server-side email layer (ships safely disabled until ops sets the secrets):
- lib/emailCanonical.ts (+6 tests) — shared client/server canonicalization
  (case, +tag, gmail dot/googlemail folding); the single source of truth for
  uniqueness. lib/accountMessages.ts — the wallet personal-message formats.
- lib/emailHash.ts (server-only) — HMAC-SHA256(EMAIL_HASH_PEPPER, canonical)
  → opaque registry key, versioned for rotation.
- app/api/email/start — wallet-sig-verified OTP request (Resend), KV one-time
  code; /verify — code check → returns the opaque hash for register_email;
  /bind-google — verifies the Google id_token (JWKS) → hash (no OTP, provider-
  verified). All clone the sponsor defense stack (force-dynamic, body cap,
  per-address+IP rate limit, Turnstile) and 503 when unconfigured.
- app/api/identity/profile-pointer — open GET, signed PUT (zkLogin-capable via
  a passed SuiClient) for the non-sensitive profile:<addr>→blobId KV pointer.
- config: EMAIL_ENABLED public flag (server secrets stay out of config).

Needs ops secrets to go live: RESEND_API_KEY, EMAIL_HASH_PEPPER, a verified
Resend domain (EMAIL_FROM); reuses TURNSTILE_SECRET_KEY + the KV creds.

Gates: tsc clean · lint 0 errors · vitest 196/196. Part of #96.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No-secrets identity display layer (works now on the fixed suiNS):
- lib/profile.ts — ProfileEnvelope + useProfile (KV pointer → Walrus, cached,
  degrades to null), useDisplayName (provided username → suiNS → hex; isSuiNS
  flag so only verified suiNS gets the ✓), useProfilePicture (uploaded avatar
  → seeded fallback).
- components/UserAvatar.tsx — never-blank avatar (Walrus blob → address-seeded
  swatch via lib/data hashHue).
- AddressDisplay now routes through useDisplayName: shows a provided username
  (no badge) or a suiNS name (verified badge) or truncated hex.

Gates: tsc clean · lint 0 errors · vitest 196/196. Part of #96.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fresh publish adding the identity module + email Seal policies. Rolls config.ts +
Move.toml + Published.toml to the new ids (incl. EMAIL_REGISTRY_ID). Smoke-verified
on-chain: identity register/unregister/grant/revoke + EmailRegistry/EmailGrant +
access seal_approve_own_email/seal_approve_attendee_email all live.

- package 0xa32a5fa219199d01c34f9f4dfa98d429b9f8fb20eebd0528fc99904994912d74
- Hub 0x97a47754… · TransferPolicy 0x954db2d6… · governance 0xfd72543e…
- EmailRegistry 0x279607e4… · UpgradeCap 0xa8807e83… · deployer 0xc8567c14…

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dadadave80 and others added 3 commits June 21, 2026 18:57
scripts/seal-email-smoke.ts drives the deployer (as organizer + attendee)
through the real package + committee key server:
- owner decrypts own email via seal_approve_own_email ✅
- organizer + EmailGrant decrypts the attendee email via
  seal_approve_attendee_email ✅  (P0-C: the key server resolves the owned
  OrganizerCap + shared Event/EmailGrant dry-run)
- organizer + grant is DENIED the bare-self (KYC/drafts) namespace ✅  (P0-B)

De-risks the whole opt-in-disclosure design before building the UI on top.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The user-facing binding integration on the live registry:
- lib/emailBinding.ts — orchestration: useSignPersonalMessage (wallet/zkLogin),
  encryptEmailEnvelope (Seal under EMAIL_NS_TAG → {id,ct} on Walrus),
  decryptOwnEmail / decryptAttendeeEmail, bindGoogleEmail (popup-free),
  startWalletEmail/verifyWalletEmail (OTP), eraseEmail, writeProfilePointer.
- components/EmailCaptureDialog.tsx — ProfileGate island (opens once per address
  when EMAIL_ENABLED + connected + unbound; dismissible) + the dialog: Google
  auto-binds the verified JWT email; wallet does email → 6-digit code → verify.
  Mounted in app/(app)/layout.tsx.

Each bind: Seal-encrypt the email for the owner, register the opaque hash on
chain (sponsored), write the profile pointer (signed). No-ops until EMAIL_ENABLED.

Gates: tsc clean · lint 0 errors · vitest 196/196. Part of #96.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
In BuyTicketDialog's review step, when the buyer has a bound email + EMAIL_ENABLED,
an unchecked "share my email with this event's organizer" checkbox. On a
successful mint it fires grant_email_access(event) (sponsored, best-effort —
never fails the purchase), creating the EmailGrant the organizer's
seal_approve_attendee_email reads. Also stores the opaque email hash in the
profile envelope so erase/disconnect can unregister without re-deriving it.

Gates: tsc clean · lint 0 errors · vitest 196. Part of #96.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Completes the account/identity UI:
- SettingsScreen: "Email" tab — reveal (decrypt own email via seal_approve_own_email),
  Disconnect (wallet) / locked-for-Google with "Delete my email data" for all
  (unregister + clear profile + Google suppress-rebind tombstone). "Public profile"
  editor — provided username + avatar upload → Walrus profile envelope (signed
  pointer), surfaced by useDisplayName/UserAvatar.
- EventManageScreen: AttendeeEmailsCard — lists attendees who opted in
  (EmailGrantCreated), one SessionKey, decrypts each via seal_approve_attendee_email
  (the organizer payoff; P0-C-verified). Degrades to "(revoked/unavailable)" per row.

#96 now code-complete across all v1 requirements (KYC deferred to v2).
Gates: tsc clean · lint 0 errors · vitest 196/196.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- AttendeeEmailsCard: "Export CSV" of the decrypted opted-in {address,email}
  (client-side download; only successfully-decrypted rows).
- CreateEventScreen: publishing now requires a bound email (app-layer only —
  on-chain create_event stays permissionless). Resolves the issue's open
  decision #1 toward "required for organizers at create": the Publish button
  becomes "Add email to publish" (opens the bind dialog) until an email is set.

Gates: tsc clean · lint 0 errors · vitest 196/196. Part of #96.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- app/api/identity/lookup-email — HMACs the email + devInspects identity::owner_of
  → the registered wallet (rate-limited + Turnstile; null when unregistered).
- DoorScreen AdmitPanel: "Will-call — find by email" → resolves the wallet →
  getOwnedObjects for a ticket on THIS event → fills the ticket id + reports
  status. The holder still submits the check-in with their own wallet (the ticket
  is owned), so this is verification + auto-fill, not a staff override.

Gates: tsc clean · lint 0 errors · vitest 196/196. Part of #96.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dadadave80
dadadave80 marked this pull request as ready for review June 21, 2026 19:02
…ation

True staff-side will-call check-in, the design from the deep-dive:
- event: `allow_organizer_checkin` flag (opt-in, default off) + setter/reader;
  `record_checkin` now owns the distinct-ticket count via a `checked_in_tickets`
  set, so voucher / self / organizer check-ins all count consistently
  (checkin.move drops its ticket-status-based counter).
- checkin::organizer_check_in(cap, event, ticket_id, attendee, clock) — cap-gated,
  window-checked, records Event-side attendance + CheckedIn WITHOUT the attendee's
  owned ticket (so it's one-sided → gated on the opt-in). Doesn't flip ticket status.
- poap::claim_poap reconciled: accepts ticket status OR Event-side attendance, so
  organizer-checked-in holders can still claim a POAP.
- +4 Move tests (marks attendance + count, disabled abort, wrong-cap abort,
  POAP-claim-after-organizer-checkin). 148/148.

Frontend: organizerCheckInTx + setAllowOrganizerCheckinTx; SPONSORED_TARGETS +
moveErrors(checkin 9); manage DoorPrep "Organizer email check-in" toggle + a
"Check in by email" card (email → lookup → ticket → organizer_check_in) shown in
the Doors-Open deck when enabled.

Needs a fresh publish before it's live (new Event field + fns); batches into the
next deploy. tsc clean · lint 0 errors · vitest 196/196.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dadadave80
dadadave80 merged commit 377c884 into main Jun 21, 2026
8 checks passed
dadadave80 added a commit that referenced this pull request Jun 21, 2026
chore(deploy): roll prod to fresh publish #99 (organizer check-in)
@dadadave80
dadadave80 deleted the feat/96-account-identity branch June 21, 2026 20:43

This branch was successfully deployed

1 active deployment
Preview — 834bec45 Deployed Jun 21, 2026 by vercel[bot]
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