@wristband/express-auth
Version:
SDK for integrating your ExpressJS application with Wristband. Handles user authentication, session management, and token management.
29 lines (28 loc) • 1.82 kB
TypeScript
import { Request, Response } from 'express';
import { LoginState, LoginStateMapConfig } from '../types';
export declare function encodeBase64(input: string): string;
export declare function parseTenantSubdomain(req: Request, parseTenantFromRootDomain: string): string;
export declare function generateRandomString(length: number): string;
export declare function base64URLEncode(str: string): string;
export declare function encryptLoginState(loginState: LoginState, loginStateSecret: string): Promise<string>;
export declare function decryptLoginState(loginStateCookie: string, loginStateSecret: string): Promise<LoginState>;
export declare function getAndClearLoginStateCookie(req: Request, res: Response, dangerouslyDisableSecureCookies: boolean): string;
export declare function resolveTenantName(req: Request, parseTenantFromRootDomain: string): string;
export declare function resolveTenantCustomDomainParam(req: Request): string;
export declare function createLoginState(req: Request, redirectUri: string, config?: LoginStateMapConfig): LoginState;
export declare function clearOldestLoginStateCookie(req: Request, res: Response, dangerouslyDisableSecureCookies: boolean): void;
export declare function createLoginStateCookie(res: Response, state: string, encryptedLoginState: string, dangerouslyDisableSecureCookies: boolean): void;
export declare function getOAuthAuthorizeUrl(req: Request, config: {
clientId: string;
codeVerifier: string;
defaultTenantCustomDomain?: string;
defaultTenantName?: string;
redirectUri: string;
scopes: string[];
state: string;
tenantCustomDomain?: string;
tenantName?: string;
isApplicationCustomDomainActive?: boolean;
wristbandApplicationVanityDomain: string;
}): string;
export declare function isExpired(expiresAt: number): boolean;