( encoded: string )
| 18 | } |
| 19 | |
| 20 | export function decodeCursor( |
| 21 | encoded: string |
| 22 | ): { createdAt: string; id: string } | null { |
| 23 | try { |
| 24 | const json = Buffer.from(encoded, 'base64url').toString('utf8'); |
| 25 | const obj = JSON.parse(json); |
| 26 | if (typeof obj.createdAt === 'string' && typeof obj.id === 'string') { |
| 27 | return obj; |
| 28 | } |
| 29 | return null; |
| 30 | } catch { |
| 31 | return null; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export const sessionRouter = createTRPCRouter({ |
| 36 | list: protectedProcedure |