@eaccess/auth 0.1.14 → 0.1.16

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.
package/dist/index.d.cts CHANGED
@@ -39,6 +39,11 @@ interface AuthConfig {
39
39
  maxPasswordLength?: number;
40
40
  rememberDuration?: string;
41
41
  rememberCookieName?: string;
42
+ cookie?: {
43
+ domain?: string;
44
+ secure?: boolean;
45
+ sameSite?: "strict" | "lax" | "none";
46
+ };
42
47
  resyncInterval?: string;
43
48
  activityLog?: {
44
49
  enabled?: boolean;
@@ -275,6 +280,7 @@ interface AuthManager$1 {
275
280
  completeTwoFactorLogin(): Promise<void>;
276
281
  logout(): Promise<void>;
277
282
  register(email: string, password: string, userId?: string | number, callback?: TokenCallback): Promise<AuthAccount>;
283
+ resyncSession(force?: boolean): Promise<void>;
278
284
  getId(): number | null;
279
285
  getEmail(): string | null;
280
286
  getStatus(): number | null;
package/dist/index.d.ts CHANGED
@@ -39,6 +39,11 @@ interface AuthConfig {
39
39
  maxPasswordLength?: number;
40
40
  rememberDuration?: string;
41
41
  rememberCookieName?: string;
42
+ cookie?: {
43
+ domain?: string;
44
+ secure?: boolean;
45
+ sameSite?: "strict" | "lax" | "none";
46
+ };
42
47
  resyncInterval?: string;
43
48
  activityLog?: {
44
49
  enabled?: boolean;
@@ -275,6 +280,7 @@ interface AuthManager$1 {
275
280
  completeTwoFactorLogin(): Promise<void>;
276
281
  logout(): Promise<void>;
277
282
  register(email: string, password: string, userId?: string | number, callback?: TokenCallback): Promise<AuthAccount>;
283
+ resyncSession(force?: boolean): Promise<void>;
278
284
  getId(): number | null;
279
285
  getEmail(): string | null;
280
286
  getStatus(): number | null;
package/dist/index.js CHANGED
@@ -1678,13 +1678,20 @@ var AuthManager = class {
1678
1678
  }
1679
1679
  setRememberCookie(token, expires) {
1680
1680
  const cookieName = this.config.rememberCookieName || "remember_token";
1681
+ const cookieConfig = this.config.cookie || {};
1681
1682
  if (token === null) {
1682
- this.res.clearCookie(cookieName);
1683
+ this.res.clearCookie(cookieName, {
1684
+ domain: cookieConfig.domain,
1685
+ secure: cookieConfig.secure ?? this.req.secure,
1686
+ sameSite: cookieConfig.sameSite
1687
+ });
1683
1688
  } else {
1684
1689
  this.res.cookie(cookieName, token, {
1685
1690
  expires,
1686
1691
  httpOnly: true,
1687
- secure: this.req.secure
1692
+ secure: cookieConfig.secure ?? this.req.secure,
1693
+ domain: cookieConfig.domain,
1694
+ sameSite: cookieConfig.sameSite
1688
1695
  });
1689
1696
  }
1690
1697
  }