MCPcopy Create free account
hub / github.com/dailydotdev/apps / hashEmailForMeta

Function hashEmailForMeta

packages/webapp/components/Pixels.tsx:40–57  ·  view source on GitHub ↗
(
  email?: string,
)

Source from the content-addressed store, hash-verified

38// here keeps a value set after init (a signup in this session) from going out
39// in plain text.
40export const hashEmailForMeta = async (
41 email?: string,
42): Promise<string | undefined> => {
43 const normalized = email?.trim().toLowerCase();
44
45 if (!normalized || !globalThis.crypto?.subtle) {
46 return undefined;
47 }
48
49 const digest = await globalThis.crypto.subtle.digest(
50 'SHA-256',
51 new TextEncoder().encode(normalized),
52 );
53
54 return Array.from(new Uint8Array(digest))
55 .map((byte) => byte.toString(16).padStart(2, '0'))
56 .join('');
57};
58
59const FbTracking = ({ userId, consent, email }: PixelProps): ReactElement => {
60 useEffect(() => {

Callers 2

trackSignupFunction · 0.90
FbTrackingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected