Initial import of zappier-identity from zapier monorepo

This commit is contained in:
George Lambert 2026-09-11 18:38:50 -04:00
commit 3f136070b6
8 changed files with 204 additions and 0 deletions

15
src/ids.js Normal file
View file

@ -0,0 +1,15 @@
import { createHash } from 'node:crypto';
export function stableVeraeUserId(username) {
const n = String(username || '')
.trim()
.toLowerCase();
return `vu_${createHash('sha256').update(n).digest('hex').slice(0, 16)}`;
}
export function bindEmail(email) {
const veraeUsername = String(email || '')
.trim()
.toLowerCase();
return { veraeUserId: stableVeraeUserId(veraeUsername), veraeUsername, bound: true };
}