master-zapier-plan-draft/packages/verae-zapier-middleware/src/lib/identity.js
George Lambert 345aeeead9
Some checks are pending
offline / test (push) Waiting to run
Bind each customer to a Verae userId for hop tracing
Signup registers/binds a Verae central user and stores veraeUserId. Public access stays the zappier API key. Chain JWTs stay server-side behind tokenRef. Authz, billing, and jobs.watch carry veraeUserId.
2026-09-11 16:18:06 -04:00

16 lines
468 B
JavaScript

/**
* Stable Verae user id derived from username/email.
* Live /auth/login.user.id wins when present; this is the mock/offline id.
*/
import { createHash } from 'node:crypto';
export function normalizeVeraeUsername(username) {
return String(username || '')
.trim()
.toLowerCase();
}
export function stableVeraeUserId(username) {
const n = normalizeVeraeUsername(username);
return `vu_${createHash('sha256').update(n).digest('hex').slice(0, 16)}`;
}