Forum reward lookup (Marty 2026-11-10: 1 POL for an introduction, ongoing, linked wallet + payouts on): GET /api/forum/member?email= signed with the forum secret (HMAC of email.ts, 5-minute window) returns found/username/activated (member id > 0)/address/suspended for the earnerscorner.com reward service. qa/forumsso 17/17.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -41,4 +41,14 @@ function redirectFor(v, acct, site) {
|
||||
return v.returnUrl + (v.returnUrl.includes('?') ? '&' : '?') + 'sso=' + encodeURIComponent(out) + '&sig=' + sign(out);
|
||||
}
|
||||
|
||||
module.exports = { verify, redirectFor, sign, SECRET, FORUM_URL };
|
||||
// server-to-server: the forum's reward service asks "is this email an activated member, and where are payouts sent?" The request is
|
||||
// signed with the same shared secret: header x-forum-sig = hex HMAC-SHA256 of "<email>.<unix seconds>", x-forum-ts = those seconds,
|
||||
// valid for 5 minutes.
|
||||
function verifyServer(email, ts, sig) {
|
||||
if (SECRET().length < 32) return false;
|
||||
const t = Number(ts); if (!(t > 0) || Math.abs(Date.now() / 1000 - t) > 300) return false;
|
||||
const want = Buffer.from(sign(String(email || '').toLowerCase() + '.' + t), 'hex'), got = Buffer.from(String(sig || ''), 'hex');
|
||||
return want.length === got.length && crypto.timingSafeEqual(want, got);
|
||||
}
|
||||
|
||||
module.exports = { verify, verifyServer, redirectFor, sign, SECRET, FORUM_URL };
|
||||
|
||||
Reference in New Issue
Block a user