MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / verifyCSRFToken

Function verifyCSRFToken

packages/auth-server/src/server/csrf.ts:29–36  ·  view source on GitHub ↗
(token: string)

Source from the content-addressed store, hash-verified

27}
28
29export function verifyCSRFToken(token: string) {
30 const [csrfToken, csrfTokenHash] = token.split('|');
31 const expectedCsrfTokenHash = createHash('sha256')
32 .update(`${csrfToken}${process.env.NEXTAUTH_SECRET}`)
33 .digest('hex');
34
35 return csrfTokenHash === expectedCsrfTokenHash;
36}

Callers 1

csrfMiddlewareFunction · 0.90

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected