UNPKG

@azure/static-web-apps-cli

Version:
52 lines 1.95 kB
import cookie from "cookie"; /** * Serialize a cookie name-value pair into a string that can be used in Set-Cookie header. * @param cookieName The name for the cookie. * @param cookieValue The value to set the cookie to. * @param options An object containing serialization options * @throws {TypeError} when maxAge options is invalid. * @returns The serialized value. */ export declare function serializeCookie(cookieName: string, cookieValue: string, options: any): string; /** * Check if the StaticWebAppsAuthCookie is available. * @param cookieValue The cookie value. * @returns True if StaticWebAppsAuthCookie is found. False otherwise. */ export declare function validateCookie(cookieValue: string | number | string[]): boolean; /** * * @param cookieValue * @returns A ClientPrincipal object. */ export declare function decodeCookie(cookieValue: string): ClientPrincipal | null; /** * Check if the StaticWebAppsAuthContextCookie is available. * @param cookieValue The cookie value. * @returns True if StaticWebAppsAuthContextCookie is found. False otherwise. */ export declare function validateAuthContextCookie(cookieValue: string | number | string[]): boolean; /** * * @param cookieValue * @returns StaticWebAppsAuthContextCookie string. */ export declare function decodeAuthContextCookie(cookieValue: string): AuthContext | null; export interface CookieOptions extends Omit<cookie.CookieSerializeOptions, "expires"> { name: string; value: string; expires?: string; } export declare class CookiesManager { private readonly _chunkSize; private readonly _existingCookies; private _cookiesToSet; private _cookiesToDelete; constructor(requestCookie?: string); private _generateDeleteChunks; private _generateChunks; addCookieToSet(options: CookieOptions): void; addCookieToDelete(name: string): void; getCookies(): CookieOptions[]; } //# sourceMappingURL=cookie.d.ts.map