@thunderid/node 0.4.0 → 0.6.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.
package/dist/cjs/index.cjs
CHANGED
|
@@ -239,9 +239,35 @@ var ThunderIDNodeClient_default = ThunderIDNodeClient;
|
|
|
239
239
|
|
|
240
240
|
//#endregion
|
|
241
241
|
//#region src/constants/CookieConfig.ts
|
|
242
|
-
var CookieConfig = class {
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
var CookieConfig = class CookieConfig {
|
|
243
|
+
/**
|
|
244
|
+
* Builds the session cookie name for a given vendor namespace.
|
|
245
|
+
* @param vendor - Vendor/brand namespace. Defaults to `VendorConstants.VENDOR_PREFIX` ('thunderid').
|
|
246
|
+
*/
|
|
247
|
+
static getSessionCookieName(vendor) {
|
|
248
|
+
return `__${(0, __thunderid_javascript.getVendorPrefix)(vendor)}__session`;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Builds the temporary session cookie name for a given vendor namespace.
|
|
252
|
+
* @param vendor - Vendor/brand namespace. Defaults to `VendorConstants.VENDOR_PREFIX` ('thunderid').
|
|
253
|
+
*/
|
|
254
|
+
static getTempSessionCookieName(vendor) {
|
|
255
|
+
return `__${(0, __thunderid_javascript.getVendorPrefix)(vendor)}__temp.session`;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Resolves the session cookie name, honoring an explicit `sessionCookie.name`
|
|
259
|
+
* override before falling back to the vendor-derived default.
|
|
260
|
+
*/
|
|
261
|
+
static resolveSessionCookieName(vendor, overrideName) {
|
|
262
|
+
return overrideName ?? CookieConfig.getSessionCookieName(vendor);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Resolves the temporary session cookie name, honoring an explicit
|
|
266
|
+
* `sessionCookie.name`-derived override before falling back to the vendor-derived default.
|
|
267
|
+
*/
|
|
268
|
+
static resolveTempSessionCookieName(vendor, overrideName) {
|
|
269
|
+
return overrideName ?? CookieConfig.getTempSessionCookieName(vendor);
|
|
270
|
+
}
|
|
245
271
|
static DEFAULT_MAX_AGE = 3600;
|
|
246
272
|
static DEFAULT_HTTP_ONLY = true;
|
|
247
273
|
static DEFAULT_SAME_SITE = "lax";
|
|
@@ -16,8 +16,26 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
declare class CookieConfig {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Builds the session cookie name for a given vendor namespace.
|
|
21
|
+
* @param vendor - Vendor/brand namespace. Defaults to `VendorConstants.VENDOR_PREFIX` ('thunderid').
|
|
22
|
+
*/
|
|
23
|
+
static getSessionCookieName(vendor?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the temporary session cookie name for a given vendor namespace.
|
|
26
|
+
* @param vendor - Vendor/brand namespace. Defaults to `VendorConstants.VENDOR_PREFIX` ('thunderid').
|
|
27
|
+
*/
|
|
28
|
+
static getTempSessionCookieName(vendor?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the session cookie name, honoring an explicit `sessionCookie.name`
|
|
31
|
+
* override before falling back to the vendor-derived default.
|
|
32
|
+
*/
|
|
33
|
+
static resolveSessionCookieName(vendor?: string, overrideName?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the temporary session cookie name, honoring an explicit
|
|
36
|
+
* `sessionCookie.name`-derived override before falling back to the vendor-derived default.
|
|
37
|
+
*/
|
|
38
|
+
static resolveTempSessionCookieName(vendor?: string, overrideName?: string): string;
|
|
21
39
|
static readonly DEFAULT_MAX_AGE: number;
|
|
22
40
|
static readonly DEFAULT_HTTP_ONLY: boolean;
|
|
23
41
|
static readonly DEFAULT_SAME_SITE: 'lax' | 'strict' | 'none';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieConfig.d.ts","sourceRoot":"","sources":["../../src/constants/CookieConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,cAAM,YAAY;IAChB,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"CookieConfig.d.ts","sourceRoot":"","sources":["../../src/constants/CookieConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,cAAM,YAAY;IAChB;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAIpD;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAIxD;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;IAI/E;;;OAGG;IACH,MAAM,CAAC,4BAA4B,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;IAInF,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAQ;IAE/C,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAQ;IAElD,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAS;IAErE,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAQ;IAG/C,OAAO;CACR;AAED,eAAe,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fetch, { Headers, Request, Response } from "cross-fetch";
|
|
2
|
-
import { ThunderIDAuthException, ThunderIDJavaScriptClient,
|
|
2
|
+
import { ThunderIDAuthException, ThunderIDJavaScriptClient, getVendorPrefix } from "@thunderid/javascript";
|
|
3
3
|
import cache from "memory-cache";
|
|
4
4
|
import base64url from "base64url";
|
|
5
5
|
import sha256 from "fast-sha256";
|
|
@@ -210,9 +210,35 @@ var ThunderIDNodeClient_default = ThunderIDNodeClient;
|
|
|
210
210
|
|
|
211
211
|
//#endregion
|
|
212
212
|
//#region src/constants/CookieConfig.ts
|
|
213
|
-
var CookieConfig = class {
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
var CookieConfig = class CookieConfig {
|
|
214
|
+
/**
|
|
215
|
+
* Builds the session cookie name for a given vendor namespace.
|
|
216
|
+
* @param vendor - Vendor/brand namespace. Defaults to `VendorConstants.VENDOR_PREFIX` ('thunderid').
|
|
217
|
+
*/
|
|
218
|
+
static getSessionCookieName(vendor) {
|
|
219
|
+
return `__${getVendorPrefix(vendor)}__session`;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Builds the temporary session cookie name for a given vendor namespace.
|
|
223
|
+
* @param vendor - Vendor/brand namespace. Defaults to `VendorConstants.VENDOR_PREFIX` ('thunderid').
|
|
224
|
+
*/
|
|
225
|
+
static getTempSessionCookieName(vendor) {
|
|
226
|
+
return `__${getVendorPrefix(vendor)}__temp.session`;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Resolves the session cookie name, honoring an explicit `sessionCookie.name`
|
|
230
|
+
* override before falling back to the vendor-derived default.
|
|
231
|
+
*/
|
|
232
|
+
static resolveSessionCookieName(vendor, overrideName) {
|
|
233
|
+
return overrideName ?? CookieConfig.getSessionCookieName(vendor);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Resolves the temporary session cookie name, honoring an explicit
|
|
237
|
+
* `sessionCookie.name`-derived override before falling back to the vendor-derived default.
|
|
238
|
+
*/
|
|
239
|
+
static resolveTempSessionCookieName(vendor, overrideName) {
|
|
240
|
+
return overrideName ?? CookieConfig.getTempSessionCookieName(vendor);
|
|
241
|
+
}
|
|
216
242
|
static DEFAULT_MAX_AGE = 3600;
|
|
217
243
|
static DEFAULT_HTTP_ONLY = true;
|
|
218
244
|
static DEFAULT_SAME_SITE = "lax";
|
package/dist/models/config.d.ts
CHANGED
|
@@ -43,6 +43,14 @@ export interface SessionCookieConfig {
|
|
|
43
43
|
sameSite?: 'lax' | 'strict' | 'none';
|
|
44
44
|
/** Whether the cookie requires HTTPS. Default: `false` (dev-friendly). */
|
|
45
45
|
secure?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Full override of the cookie name. If not set, derived from `vendor`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Use a fully custom cookie name regardless of `vendor`.
|
|
51
|
+
* { sessionCookie: { name: 'my_app_session' } }
|
|
52
|
+
*/
|
|
53
|
+
name?: string;
|
|
46
54
|
}
|
|
47
55
|
/**
|
|
48
56
|
* Configuration type for the ThunderID Node.js SDK.
|
|
@@ -54,5 +62,11 @@ export type ThunderIDNodeConfig = Config & {
|
|
|
54
62
|
* so that any server SDK (Node, Express, Next.js, …) inherits the same shape.
|
|
55
63
|
*/
|
|
56
64
|
sessionCookie?: SessionCookieConfig;
|
|
65
|
+
/**
|
|
66
|
+
* Vendor/brand namespace used to prefix cookie names and other server-side identifiers.
|
|
67
|
+
* Override this when white-labeling the SDK under a different brand.
|
|
68
|
+
* @default 'thunderid'
|
|
69
|
+
*/
|
|
70
|
+
vendor?: string;
|
|
57
71
|
};
|
|
58
72
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/models/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/models/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG;IACzC;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Node.js runtime SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"secure-random-bytes": "5.0.1",
|
|
53
53
|
"tslib": "2.8.1",
|
|
54
54
|
"uuid": "11.1.1",
|
|
55
|
-
"@thunderid/javascript": "^0.
|
|
55
|
+
"@thunderid/javascript": "^0.6.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|