| 29 | * inside the JWT clock-skew tolerance every verifier accepts. |
| 30 | */ |
| 31 | export const buildJWTPayload = async ( |
| 32 | id: string, |
| 33 | email: string, |
| 34 | accountId: string |
| 35 | ): Promise<Record<string, string | number>> => { |
| 36 | const nowSeconds = Math.floor(nowMs() / 1000); |
| 37 | const cutoffSeconds = await jwtRevocationService.getUserRevokeCutoff(id); |
| 38 | const iat = Math.max(nowSeconds, cutoffSeconds); |
| 39 | |
| 40 | return { |
| 41 | id, |
| 42 | email, |
| 43 | aid: accountId, |
| 44 | jti: crypto.randomUUID(), |
| 45 | iat, |
| 46 | exp: iat + JWT_TTL_SECONDS, |
| 47 | }; |
| 48 | }; |