re-order alot, move to bun redis, generalized
All checks were successful
Code quality checks / biome (push) Successful in 8s

This commit is contained in:
creations 2025-05-18 09:53:23 -04:00
parent a646607597
commit 8a9499be85
Signed by: creations
GPG key ID: 8F553AA4320FC711
51 changed files with 559 additions and 916 deletions

27
config/jwt.ts Normal file
View file

@ -0,0 +1,27 @@
const allowedAlgorithms = [
"HS256",
"RS256",
"HS384",
"HS512",
"RS384",
"RS512",
] as const;
type AllowedAlgorithm = (typeof allowedAlgorithms)[number];
function getAlgorithm(envVar: string | undefined): AllowedAlgorithm {
if (allowedAlgorithms.includes(envVar as AllowedAlgorithm)) {
return envVar as AllowedAlgorithm;
}
return "HS256";
}
export const jwt: {
secret: string;
expiration: string;
algorithm: AllowedAlgorithm;
} = {
secret: process.env.JWT_SECRET || "",
expiration: process.env.JWT_EXPIRATION || "1h",
algorithm: getAlgorithm(process.env.JWT_ALGORITHM),
};