v3: added index default tab selection setting, fixed notification pages not loading, reduced invite token length, global player state survives page reloads, many visual fixes
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 44s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 44s
This commit is contained in:
@@ -3,9 +3,7 @@ import { jwtVerify, SignJWT } from "@panva/jose";
|
||||
|
||||
import {
|
||||
type AuthPayload,
|
||||
InvitePayload,
|
||||
isAuthPayload,
|
||||
isInvitePayload,
|
||||
isPasswordResetPayload,
|
||||
type PasswordResetPayload,
|
||||
} from "../model/interfaces.ts";
|
||||
@@ -18,28 +16,6 @@ if (!JWT_SECRET) {
|
||||
}
|
||||
const JWT_KEY = new TextEncoder().encode(JWT_SECRET);
|
||||
|
||||
// ── Invite tokens ─────────────────────────────────────────────────────────────
|
||||
|
||||
export async function createInviteToken(inviterId: string): Promise<string> {
|
||||
return await new SignJWT({ purpose: "invite", inviterId })
|
||||
.setProtectedHeader({ alg: "HS256" })
|
||||
.setJti(crypto.randomUUID())
|
||||
.setExpirationTime("7d")
|
||||
.sign(JWT_KEY);
|
||||
}
|
||||
|
||||
export async function verifyInviteToken(
|
||||
token: string,
|
||||
): Promise<InvitePayload | null> {
|
||||
try {
|
||||
const { payload } = await jwtVerify(token, JWT_KEY);
|
||||
if (!isInvitePayload(payload)) return null;
|
||||
return payload as InvitePayload;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Password reset tokens ─────────────────────────────────────────────────────
|
||||
|
||||
export async function createPasswordResetToken(
|
||||
|
||||
Reference in New Issue
Block a user