@logto/node 3.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,10 +10,10 @@ export type CookieConfig = {
10
10
  cookieKey?: string;
11
11
  /** Set to true in https */
12
12
  isSecure?: boolean;
13
- getCookie: (name: string) => string | undefined;
13
+ getCookie: (name: string) => Promise<string | undefined> | string | undefined;
14
14
  setCookie: (name: string, value: string, options: CookieSerializeOptions & {
15
15
  path: string;
16
- }) => void;
16
+ }) => Promise<void> | void;
17
17
  };
18
18
  /**
19
19
  * A storage that persists data in cookies with encryption.
@@ -30,7 +30,7 @@ class CookieStorage {
30
30
  }
31
31
  async init() {
32
32
  const { encryptionKey } = this.config;
33
- this.sessionData = await unwrapSession(this.config.getCookie(this.cookieKey) ?? '', encryptionKey);
33
+ this.sessionData = await unwrapSession((await this.config.getCookie(this.cookieKey)) ?? '', encryptionKey);
34
34
  }
35
35
  async getItem(key) {
36
36
  return this.sessionData[key] ?? null;
@@ -54,7 +54,7 @@ class CookieStorage {
54
54
  async write(data = this.sessionData) {
55
55
  const { encryptionKey } = this.config;
56
56
  const value = await wrapSession(data, encryptionKey);
57
- this.config.setCookie(this.cookieKey, value, this.cookieOptions);
57
+ await this.config.setCookie(this.cookieKey, value, this.cookieOptions);
58
58
  }
59
59
  }
60
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/node",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "module": "./lib/src/index.js",
6
6
  "types": "./lib/src/index.d.ts",