Skip to content

Commit

Permalink
fix(secret): const env
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Dec 13, 2024
1 parent da6cfd3 commit 1c3ccf8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/server/secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ export async function validateSecret(secret: string): Promise<boolean> {
throw new Error('Invalid secret');
}

const secretEnv = env.SECRET;
// Assert that the secret env exists
if (env.SECRET === null || env.SECRET === undefined || env.SECRET === '') {
if (secretEnv === null || secretEnv === undefined || secretEnv === '') {
throw new Error('SECRET env is not defined or empty string');
}

const secretHash = await hashPassword(env.SECRET);
const secretHash = await hashPassword(secretEnv);
return await verifyPasswordHash(secretHash, secret);
}

0 comments on commit 1c3ccf8

Please sign in to comment.