UNPKG

@wristband/express-auth

Version:

SDK for integrating your ExpressJS application with Wristband. Handles user authentication and token management.

28 lines (27 loc) 1.76 kB
import { Request, Response } from 'express'; import { LoginState, LoginStateMapConfig } from '../types'; export declare function parseTenantSubdomain(req: Request, rootDomain: 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 resolveTenantDomainName(req: Request, useTenantSubdomains: boolean, rootDomain: 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; defaultTenantDomainName?: string; redirectUri: string; scopes: string[]; state: string; tenantCustomDomain?: string; tenantDomainName?: string; useCustomDomains?: boolean; wristbandApplicationDomain: string; }): string; export declare function isExpired(expiresAt: number): boolean;