cursor update to magic link v.3

This commit is contained in:
2026-01-16 06:32:39 +02:00
parent 7dbbb110a9
commit 6eab0bd877

View File

@@ -11,7 +11,7 @@ const MAGIC_LINK_EXPIRY = 7 * 24 * 60 * 60 * 1000; // 7 days
export interface MagicLinkToken {
guestId: string;
inviteCode: string;
destination: 'ticket' | 'dashboard';
destination: 'ticket' | 'dashboard' | 'rsvp';
timestamp: number;
expires: number;
nonce: string; // Cryptographic nonce for randomness
@@ -21,13 +21,13 @@ export interface MagicLinkToken {
* Generate a secure magic link token for email authentication
* @param guestId - Guest ID
* @param inviteCode - Guest invite code
* @param destination - Where to redirect after authentication ('ticket' or 'dashboard')
* @param destination - Where to redirect after authentication ('ticket', 'dashboard', or 'rsvp')
* @returns Base64 encoded signed token
*/
export async function generateMagicLinkToken(
guestId: string,
inviteCode: string,
destination: 'ticket' | 'dashboard'
destination: 'ticket' | 'dashboard' | 'rsvp'
): Promise<string> {
const timestamp = Date.now();
const randomBytesArray = randomBytes(MAGIC_LINK_TOKEN_LENGTH);