(redirectUri: string, allowedHosts: string[])
| 26 | } |
| 27 | |
| 28 | function redirectHostAllowed(redirectUri: string, allowedHosts: string[]): boolean { |
| 29 | let parsed: URL; |
| 30 | try { |
| 31 | parsed = new URL(redirectUri); |
| 32 | } catch { |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | if (["localhost", "127.0.0.1", "[::1]"].includes(parsed.hostname)) return true; |
| 37 | return allowedHosts.includes(parsed.hostname); |
| 38 | } |
| 39 | |
| 40 | export class SqliteOAuthStore { |
| 41 | private readonly database: DatabaseHandle; |