UNPKG

@guardian/pan-domain-node

Version:

NodeJs implementation of Guardian pan-domain auth verification

20 lines (19 loc) 900 B
/// <reference types="node" /> import { User, AuthenticationResult, ValidateUserFn } from './api'; import { PublicKeyHolder } from './fetch-public-key'; export declare function createCookie(user: User, privateKey: string): string; export declare function verifyUser(pandaCookie: string | undefined, publicKey: string, currentTime: Date, validateUser: ValidateUserFn): AuthenticationResult; export declare class PanDomainAuthentication { cookieName: string; region: string; bucket: string; keyFile: string; validateUser: ValidateUserFn; publicKey: Promise<PublicKeyHolder>; keyCacheTime: number; keyUpdateTimer?: NodeJS.Timeout; constructor(cookieName: string, region: string, bucket: string, keyFile: string, validateUser: ValidateUserFn); stop(): void; getPublicKey(): Promise<string>; verify(requestCookies: string): Promise<AuthenticationResult>; }