UNPKG

@guardian/pan-domain-node

Version:

NodeJs implementation of Guardian pan-domain auth verification

20 lines (19 loc) 840 B
import { User } from './api'; export declare function decodeBase64(data: string): string; export type ParsedCookie = { data: string; signature: string; }; /** * Parse a pan-domain user cookie in to data and signature * Validates that the cookie is properly formatted (two base64 strings separated by '.') */ export declare function parseCookie(cookie: string): ParsedCookie | undefined; /** * Verify signed data using nodeJs crypto library */ export declare function verifySignature(message: string, signature: string, pandaPublicKey: string): boolean; export declare function sign(message: string, privateKey: string): string; export declare function base64ToPEM(key: string, headerFooter: string): string; export declare function httpGet(path: string): Promise<string>; export declare function parseUser(data: string): User;