Network hub hook (Marty 2026-11-16): sign out everywhere, hub blocks and erases end sessions here; "Sign out everywhere" button

hubevents.js (new, byte-identical in VBB, DLB, ViralAdBlitz, DownlineHydra, 5xYourTeam): POST /api/hub/events, signed by the hub
with HUB_SECRET (same hook InstantAdPay and LinkSpin take). member.signedout and member.blocked: the person is looked up by hub id
(/v1/resolve, signed as fivex) and their sessions here end (by the main wallet or any contract wallet). member.erased: matched by the wallet SHA-256s
(and email SHA-256) the hub now sends with the event. Only sessions made before the event end (a replay never signs anyone out
twice); a failed hub lookup answers 503 so the hub resends. Off with HUB_HOOK=0. Admin status: hubEvents (counts only).
/team: "Sign out everywhere" next to Sign out (POST /api/auth/logout-everywhere -> networksso.signOutEverywhere, then every
session of this member here ends).
Smoke: section 14b (same cases as the other wallet sites): 172 pass, 2 fail with UI; the same 2 (pool size, this week's pot: test-clock dated) fail on a clean HEAD. team.js?v=4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-16 05:05:38 -06:00
parent 3cbe33db77
commit b2d5eb4625
6 changed files with 188 additions and 4 deletions
+3 -1
View File
@@ -81,6 +81,8 @@ const SESSION_TTL = 7 * 24 * 3600000;
function mintSession(address) { const token = crypto.randomBytes(32).toString('hex'); S.sessions[token] = { address: address.toLowerCase(), expires: Date.now() + SESSION_TTL }; save(); return token; }
function session(token) { const s = token && S.sessions[token]; return s && s.expires > Date.now() ? Object.assign({ token }, s) : null; }
function dropSession(token) { delete S.sessions[token]; save(); }
// network hub events (hubevents.js, 2026-11-16): end every session `match` names that was made before `before` -> how many
function endSessions(match, before) { let n = 0; for (const [k, x] of Object.entries(S.sessions)) if (x.expires - SESSION_TTL <= before && match(x)) { delete S.sessions[k]; n++; } if (n) save(); return n; }
// ---- positions (from the chain) ----
const purchases = () => Object.entries(S.purchases || {}).map(([key, x]) => Object.assign({ key }, x));
@@ -118,5 +120,5 @@ const draft = week => S.drafts[week] || null;
function putDraft(d) { S.drafts[d.week] = d; save(); return d; }
module.exports = { SPLITS, load, flush, save, state, ctDay, ctWeek, ctToMs, addDays, bump, today, member, upsertMember, memberByName, memberByHub, members,
mintSession, session, dropSession, SESSION_TTL, purchases, positionsOf, firstPositionAt, coaches, credits, addCredits,
mintSession, session, dropSession, endSessions, SESSION_TTL, purchases, positionsOf, firstPositionAt, coaches, credits, addCredits,
picks, pick, addPick, savePick, picksOf, picksOfPerson, addMsg, msgsOfPick, saveMsg, setRefid, refidOf, draft, putDraft };