@a-type/auth
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -21,2 +21,3 @@ import cookie from 'cookie'; | ||
secure: true, | ||
partitioned: sameSite === 'none', | ||
})); | ||
@@ -44,2 +45,3 @@ } | ||
secure: true, | ||
partitioned: sameSite === 'none', | ||
})); | ||
@@ -46,0 +48,0 @@ } |
@@ -124,2 +124,3 @@ import { parse, serialize } from 'cookie'; | ||
expires: this.getRefreshTokenExpirationTime(), | ||
partitioned: this.partitioned, | ||
}); | ||
@@ -147,2 +148,3 @@ headers.append('Set-Cookie', refreshCookie); | ||
expires: new Date(0), | ||
partitioned: this.partitioned, | ||
}); | ||
@@ -211,6 +213,10 @@ headers.append('Set-Cookie', refreshCookie); | ||
get sameSite() { | ||
var _a; | ||
return (_a = this.options.sameSite) !== null && _a !== void 0 ? _a : 'lax'; | ||
var _a, _b; | ||
return (_b = (_a = this.options.cookieOptions) === null || _a === void 0 ? void 0 : _a.sameSite) !== null && _b !== void 0 ? _b : 'lax'; | ||
} | ||
get partitioned() { | ||
var _a, _b; | ||
return (_b = (_a = this.options.cookieOptions) === null || _a === void 0 ? void 0 : _a.partitioned) !== null && _b !== void 0 ? _b : this.sameSite === 'none'; | ||
} | ||
} | ||
//# sourceMappingURL=session.js.map |
@@ -34,5 +34,9 @@ export interface Session { | ||
clientDomain?: string; | ||
sameSite?: 'strict' | 'lax' | 'none'; | ||
cookieOptions?: { | ||
partitioned?: boolean; | ||
sameSite?: 'strict' | 'lax' | 'none'; | ||
}; | ||
}); | ||
get sameSite(): "strict" | "lax" | "none"; | ||
get partitioned(): boolean; | ||
createSession: (userId: string) => Promise<Session>; | ||
@@ -39,0 +43,0 @@ getAccessToken: (req: { |
{ | ||
"name": "@a-type/auth", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "My personal auth request handlers", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
@@ -29,2 +29,3 @@ import cookie from 'cookie'; | ||
secure: true, | ||
partitioned: sameSite === 'none', | ||
}), | ||
@@ -61,2 +62,3 @@ ); | ||
secure: true, | ||
partitioned: sameSite === 'none', | ||
}), | ||
@@ -63,0 +65,0 @@ ); |
@@ -50,3 +50,6 @@ import { parse, serialize } from 'cookie'; | ||
clientDomain?: string; | ||
sameSite?: 'strict' | 'lax' | 'none'; | ||
cookieOptions?: { | ||
partitioned?: boolean; | ||
sameSite?: 'strict' | 'lax' | 'none'; | ||
}; | ||
}, | ||
@@ -66,4 +69,7 @@ ) { | ||
public get sameSite() { | ||
return this.options.sameSite ?? 'lax'; | ||
return this.options.cookieOptions?.sameSite ?? 'lax'; | ||
} | ||
get partitioned() { | ||
return this.options.cookieOptions?.partitioned ?? this.sameSite === 'none'; | ||
} | ||
@@ -198,2 +204,3 @@ createSession = async (userId: string): Promise<Session> => { | ||
expires: this.getRefreshTokenExpirationTime(), | ||
partitioned: this.partitioned, | ||
}, | ||
@@ -224,2 +231,3 @@ ); | ||
expires: new Date(0), | ||
partitioned: this.partitioned, | ||
}); | ||
@@ -226,0 +234,0 @@ headers.append('Set-Cookie', refreshCookie); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
127609
2553