Code & Text Diff Checker
Deterministic 2D Longest Common Subsequence (LCS) matrix diff with synchronized side-by-side and unified views.
+10 Added-5 Removed14 Unchanged
Original Text (Before)19 lines
Modified Text (After)24 lines
Synchronized Split Diff29 computed rows
| Old # | Original | New # | Modified |
|---|---|---|---|
| 1 | export interface UserSession { | 1 | export interface UserSession { |
| 2 | id: string; | 2 | id: string; |
| 3 | username: string; | 3 | username: string; |
| 4 | role: 'admin' | 'user'; | 4 | email: string; |
| 5 | role: 'admin' | 'user' | 'superadmin'; | ||
| 5 | createdAt: number; | 6 | createdAt: number; |
| 7 | expiresAt: number; | ||
| 6 | } | 8 | } |
| 7 | 9 | ||
| 8 | export function validateSession(session: UserSession): boolean { | 10 | export function validateSession(session: UserSession): boolean { |
| 9 | if (!session.id) { | 11 | if (!session.id || !session.email) { |
| 10 | return false; | 12 | return false; |
| 11 | } | 13 | } |
| 12 | const now = Math.floor(Date.now() / 1000); | 14 | const now = Math.floor(Date.now() / 1000); |
| 13 | return now - session.createdAt < 3600; | 15 | return now < session.expiresAt; |
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | export async function authenticate(token: string) { | 18 | export async function authenticate(token: string) { |
| 17 | console.log("Authenticating token:", token); | 19 | // Production zero-telemetry authentication |
| 18 | return { status: 200, success: true }; | 20 | if (!token.startsWith("Bearer ")) { |
| 21 | throw new Error("Invalid token prefix format"); | ||
| 22 | } | ||
| 23 | return { status: 200, success: true, verified: true }; | ||
| 19 | } | 24 | } |