carlos / platform Public

demo-claim-code

Problem. POST /api/demo/apps returned claimToken (the update bearer) and a claimUrl whose fragment was that same token, so an agent handing the person their claim link had to read the update secret into its transcript.

Change. Create mints a second secret, the claim code, and stores only its SHA-256 (demo_apps.claim_code_hash, claim_code_minted).

  • claimUrl is now <console>/demo/claim#<claim code>. claimToken is unchanged: the update bearer.
  • Claim start (POST /api/demo/claims) takes the claim code as claimCode, or under the old field name claimToken (exactly one). Browser claim (/demo/claim/intent) takes it from the fragment as before.
  • The update endpoint refuses the claim code; both claim entry points refuse the update bearer.
  • Back-compat: a demo created before this release has claim_code_minted=0; only such a row accepts its bearer at the claim doors, until it expires (24 h).
  • The code is spent with the bearer at claim commit, expiry and takedown, and a code is only accepted while its bearer is live. demo_spent_tokens.kind (token/update/code) keeps each door's refusal reasons to its own credential.
  • Migration adds three columns and one partial unique index; nothing dropped or rewritten.

Tests. demo_claim_code_test.go (doors both ways, legacy links, minted-flag gate, code dies with bearer, migration, nothing logged); demo_spent_token_test.go covers spent reasons for both credentials and cross-door refusals after spending.

Not in this branch. Release/roll (Paul's GO). Website contract repin after release.

Human

Demo claim links carry their own one-time claim code; the update bearer never has to be shown.

Commits 4
Discussions 1 1 open
Tasks 7/7 done

Activity