(user: {
banned?: boolean | null;
banExpires?: Date | string | null;
banReason?: string | null;
})
| 188 | } |
| 189 | |
| 190 | export function assertNotBanned(user: { |
| 191 | banned?: boolean | null; |
| 192 | banExpires?: Date | string | null; |
| 193 | banReason?: string | null; |
| 194 | }): void { |
| 195 | if (user.banned !== true) return; |
| 196 | if (user.banExpires && new Date(user.banExpires) <= new Date()) return; |
| 197 | throw new BannedAccountError( |
| 198 | user.banReason ? `Account banned: ${user.banReason}` : "Account banned", |
| 199 | ); |
| 200 | } |
| 201 | |
| 202 | export async function authenticateApiKeyRequest(opts: { |
| 203 | request: Request; |
no outgoing calls
no test coverage detected