(origin: string, allowed: ReadonlySet<string>)
| 51 | * from handing an authenticated cross-origin channel to any web page. |
| 52 | */ |
| 53 | export const isAllowedOrigin = (origin: string, allowed: ReadonlySet<string>): boolean => { |
| 54 | const hostname = hostnameFromOrigin(origin); |
| 55 | if (hostname === null) return false; |
| 56 | return allowed.has(hostname) || allowed.has(`[${hostname}]`); |
| 57 | }; |
| 58 | |
| 59 | export const hasBearerToken = (request: Request, token: string): boolean => { |
| 60 | const authorization = request.headers.get("authorization"); |
no test coverage detected