2022-10-29 22:21:24 +02:00
|
|
|
import { createHash } from 'node:crypto'
|
|
|
|
import dotenv from 'dotenv'
|
|
|
|
dotenv.config()
|
|
|
|
|
|
|
|
// Cleans an email for hashing
|
2022-10-30 19:16:19 +01:00
|
|
|
export const clean = (string) => string.toLowerCase().trim()
|
2022-10-29 22:21:24 +02:00
|
|
|
|
2022-10-30 19:16:19 +01:00
|
|
|
// Hashes a (cleaned) string
|
|
|
|
export const hash = (string) => createHash('sha256').update(clean(string)).digest('hex')
|
2022-10-29 22:21:24 +02:00
|
|
|
|