Post-join sign-in actually works: live position lookup for a cold index, ordered calls, redirect no longer races the signature
#787 registered at 18:35 CT, 22 minutes after the first join-flow fix, and still had no profile. Two causes, both fixed: 1. messages.verifyChallenge resolved the wallet through chain.memberIdByAccount, which reads the CACHED index. Seconds after a registration that wallet is not in it, so the signature was rejected with "No RM Circle position is registered to this wallet". It now accepts an idHint (the position id from the member's own registration receipt) and, on a cache miss, reads that id live from the contract via chain.verifyMember, minting only when the contract says this exact wallet owns it. That is a stronger proof than the cache, not a weaker one. Now async; the single call site awaits. 2. join-now.js fired the sign-in and a 4.5s redirect in parallel, so the page could navigate away while the wallet was still showing the signature prompt, and it did not wait for submit-id (which runs the live verifyMember server-side that seeds the index). It now awaits the report, passes the receipt id, and redirects only once the signature settles, with a 120s bailout. qa/signin-fallback.mjs (7 assertions) proves the cold-index path with real secp256k1 signatures and covers the abuse cases: a hint for a position the wallet does not own is refused, and a signature from another wallet is refused. Existing suites still pass: profiles-unit 28, gate-e2e 47. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -775,7 +775,7 @@ async function handleApi(req,res,pathname){
|
||||
if(req.method==='POST'&&pathname==='/api/public/msg-verify'){
|
||||
const b=await bodyJson(req);
|
||||
if(!b||typeof b.address!=='string'||!messages.ADDR_RE.test(b.address)||typeof b.signature!=='string')return json(res,400,{error:'Invalid request.'});
|
||||
const r=messages.verifyChallenge(b.address,b.signature);
|
||||
const r=await messages.verifyChallenge(b.address,b.signature,b.id);
|
||||
if(r.error)return json(res,401,{error:r.error});
|
||||
return json(res,200,{ok:true,id:r.id},{'Set-Cookie':messages.sessionCookie(r.token)});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user