import { type CookieEnv, serializeCookie } from './util.js'; export { serializeCookie, CookieEnv }; /** * Name to be used for the session cookie if none provided. */ export declare const SESSION_COOKIE_NAME_DEFAULT = "session"; /** * Patch and return the given headers instance, removing the cookie. * * @param {Headers} headers The headers to patch * @param {string} [name] Optional name of the cookie. Default is `session`. * @returns {Headers} The patchec headers */ export declare function rmCookie(headers: Headers, name?: string): Headers; /** * Parse the given cookie string into an object of key - values. * * @param {string} cookie The cookie string * @param {(s:string)=>string} [_decode] Optional decode function * @returns {Record} */ export declare function parseCookie(cookie: string, _decode?: (s: string) => string): (Record & { session: string; }); /** * Patch or create a Headers object. */ export declare function setCookie(cookie: string, _headers?: Headers): Headers; /** * Create a cookie and return it as a string. * * @param sessionData Data to encode with the cookie * @param secretKey The secret key * @param name The name for the cookie; defaults to `session` * @returns {string} The cookie as string */ export declare function createCookie(sessionData: Record, secretKey: string, name?: string, env?: CookieEnv): Promise; /** * Create a new session token. * * @param newSessionData Any object of data to include in this session token. * @param {string} [secretKey] Optional secret key to use. Will get it from * environment variables if it is not passed in. * @returns {string} Signature + JSON session data encoded as base64 */ export declare function createSession(newSessionData: Record, secretKey: string): Promise; /** * Given an encoded signature + data string, return if the signature is * valid for the data. * @param {string} session The encoded session cookie * @returns {boolean} */ export declare function verifySessionString(session: string, key: string): Promise; /** * Sign the given data and return the signature as a string. * * @returns {string} */ export declare function sign(data: string | Uint8Array, key: string, opts?: Partial<{ algorithm: 'sha-256' | 'sha-512'; }>): Promise; /** * This depends on the signature being a specific length. * * The cookie is serialized like `signature + base64(JSON.stringify(data))` */ export declare function parseSession>(encodedSession: string): T | null; //# sourceMappingURL=index.d.ts.map