(token: string = DEFAULT_TOKEN)
| 41 | * subprotocol helpers) stay consistent; `isValid` accepts only that token. |
| 42 | */ |
| 43 | export function fixedTokenAuth(token: string = DEFAULT_TOKEN): ServiceOverride { |
| 44 | const impl: IAuthTokenServiceType = { |
| 45 | _serviceBrand: undefined, |
| 46 | getToken: () => token, |
| 47 | isValid: async (candidate) => candidate === token, |
| 48 | }; |
| 49 | return [IAuthTokenService, impl]; |
| 50 | } |
| 51 | |
| 52 | /** An `Authorization: Bearer <token>` header bag, for spreading into `headers`. */ |
| 53 | export function authHeaders(token: string = DEFAULT_TOKEN): { Authorization: string } { |
no outgoing calls