UNPKG

@scaffoldly/serverless-util

Version:
28 lines 1.55 kB
import { BaseJwtPayload, HttpRequest } from './interfaces'; export declare const URN_PREFIX = "urn"; export declare const DEFAULT_PROVIDER = "auth"; export declare const AUTH_PREFIXES: string[]; export declare type AuthorizeTokenParams = { token: string; providers: string[]; domain?: string; method?: string; path?: string; }; export declare const cookieDomain: (httpRequest: HttpRequest) => string; export declare const cookiePrefix: (name: string) => string; export declare const cookieSecure: () => boolean; export declare const cookieSameSite: () => "lax" | "none"; export declare const generateSubject: (audience: string, userId: string) => string; export declare const generateAudience: (domain: string, provider: string) => string; export declare const extractUserId: (jwtPayload: BaseJwtPayload, defaultOnAbsent?: string | undefined) => string; export declare const parseUrn: (urn: string) => { prefix?: string | undefined; domain?: string | undefined; provider?: string | undefined; }; export declare const verifyAudience: (providers: string[], domain: string, aud: string) => boolean; export declare const verifyIssuer: (domain: string, iss: string) => boolean; export declare const authorizeToken: ({ providers, token, domain, method, path }: AuthorizeTokenParams) => Promise<BaseJwtPayload>; export declare function authorize(domain?: string, providers?: string[]): (request: HttpRequest, securityName: string, _scopes?: string[] | undefined) => Promise<BaseJwtPayload>; //# sourceMappingURL=auth.d.ts.map