Initial import of zappier-identity from zapier monorepo
This commit is contained in:
commit
3f136070b6
8 changed files with 204 additions and 0 deletions
15
src/ids.js
Normal file
15
src/ids.js
Normal 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 };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue