1 | import type { CookieInit, CookieList, CookieListItem, CookieStore, CookieStoreDeleteOptions, CookieStoreGetOptions } from 'cookie-store-interface';
|
2 | export * from 'cookie-store-interface';
|
3 | export interface SignedCookieStoreOptions {
|
4 | |
5 |
|
6 |
|
7 |
|
8 | keyring?: readonly CryptoKey[];
|
9 | }
|
10 | export interface DeriveOptions {
|
11 | secret: string | BufferSource | JsonWebKey;
|
12 | salt?: BufferSource;
|
13 | iterations?: number;
|
14 | format?: KeyFormat;
|
15 | hash?: HashAlgorithmIdentifier;
|
16 | hmacHash?: HashAlgorithmIdentifier;
|
17 | length?: number;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | export declare class SignedCookieStore implements CookieStore {
|
28 | #private;
|
29 | |
30 |
|
31 |
|
32 | static deriveCryptoKey(opts: DeriveOptions): Promise<CryptoKey>;
|
33 | constructor(store: CookieStore, key: CryptoKey, opts?: SignedCookieStoreOptions);
|
34 | /**
|
35 | * @throws if the signature doesn't match.
|
36 | * @returns null when the signature cookie is missing.
|
37 | */
|
38 | get(name?: string): Promise<CookieListItem | null>;
|
39 | get(options?: CookieStoreGetOptions): Promise<CookieListItem | null>;
|
40 | /**
|
41 | * @throws if any signature doesn't match.
|
42 | * @returns A list of cookies, exclusive of all cookies without signatures
|
43 | */
|
44 | getAll(name?: string): Promise<CookieList>;
|
45 | getAll(options?: CookieStoreGetOptions): Promise<CookieList>;
|
46 | set(name: string, value: string): Promise<void>;
|
47 | set(options: CookieInit): Promise<void>;
|
48 | delete(name: string): Promise<void>;
|
49 | delete(options: CookieStoreDeleteOptions): Promise<void>;
|
50 | addEventListener(...args: Parameters<CookieStore['addEventListener']>): void;
|
51 | dispatchEvent(event: Event): boolean;
|
52 | removeEventListener(...args: Parameters<CookieStore['removeEventListener']>): void;
|
53 | }
|