@zitadel/sdk-core 0.1.0-alpha.8 → 0.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.
- package/README.md +106 -1
- package/dist/index.d.mts +23 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +40 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{jwt.d.ts → jwt.d.mts} +115 -83
- package/dist/jwt.d.mts.map +1 -0
- package/dist/jwt.mjs +465 -0
- package/dist/jwt.mjs.map +1 -0
- package/dist/middleware.d.mts +556 -0
- package/dist/middleware.d.mts.map +1 -0
- package/dist/middleware.mjs +764 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/types.d.mts +310 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +78 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +29 -12
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -51
- package/dist/jwt.d.ts.map +0 -1
- package/dist/jwt.js +0 -383
- package/dist/middleware.d.ts +0 -39
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -76
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -206
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -8
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"fileNames":["../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/types.ts","../src/middleware.ts","../src/jwt.ts","../src/index.ts"],"fileIdsList":[[60,61,62]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"67c8d6b4a00fdd968ab54288e7dbefe088f8466c71609afc9e5bf5c58baad943","signature":"cb2a014455a28c33ff7121c94aa835563226796204466fcd6371c783851ef0f5","impliedFormat":99},{"version":"d8f9a793ef8eebd91cfaa19d8a62e6bd05314563d725799e08c4ddc2c8837dc5","signature":"808f2f3727dd8d4d91a46ea45b4457764da16fd9a0e1d8e523b293f0e4ab6704","impliedFormat":99},{"version":"55c476210b58acc4bb22045d8e82fdc91d6d103b3124269a9beb924b7dca82ad","signature":"720645b75e737dd913a52f88be1d511b7b1588d7682ec238653aa94342face28","impliedFormat":99},{"version":"279186bfad2e46f4ac5cc6d81f02daf74fb46eede846423c1ab773409eac3094","signature":"4b977c6a69b68df4547497acf80e8262506e27195166f6e179e4f02bf5deca1f","impliedFormat":99}],"root":[[60,63]],"options":{"composite":true,"declarationMap":true,"emitDeclarationOnly":false,"importHelpers":true,"module":199,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":9,"tsBuildInfoFile":"./tsconfig.lib.tsbuildinfo"},"referencedMap":[[63,1]],"latestChangedDtsFile":"./index.d.ts","version":"6.0.3"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types for the Nextgen SDK middleware layer.
|
|
3
|
-
*
|
|
4
|
-
* These types are consumed by both `sdk-next` and `sdk-nuxt`. Each SDK
|
|
5
|
-
* re-exports them from its own public surface so consumers don't need
|
|
6
|
-
* to add a direct `sdk-core` dependency.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* The authenticated session for a signed-in user.
|
|
10
|
-
*/
|
|
11
|
-
export type NextgenSession = {
|
|
12
|
-
/** The user's unique identifier (`sub` claim). */
|
|
13
|
-
userId: string;
|
|
14
|
-
/** The user's email address, or `null` if not present in the token. */
|
|
15
|
-
email: string | null;
|
|
16
|
-
/** The user's display name, or `null` if not present in the token. */
|
|
17
|
-
name: string | null;
|
|
18
|
-
/** The raw verified JWT. */
|
|
19
|
-
token: string;
|
|
20
|
-
};
|
|
21
|
-
/** Auth state when the user is signed in. */
|
|
22
|
-
export type AuthState = {
|
|
23
|
-
isAuthenticated: true;
|
|
24
|
-
session: NextgenSession;
|
|
25
|
-
};
|
|
26
|
-
/** Auth state when the user is not signed in. */
|
|
27
|
-
export type UnauthState = {
|
|
28
|
-
isAuthenticated: false;
|
|
29
|
-
session: null;
|
|
30
|
-
};
|
|
31
|
-
/** Union of all possible auth states. */
|
|
32
|
-
export type AuthResult = AuthState | UnauthState;
|
|
33
|
-
/**
|
|
34
|
-
* Options passed to the SDK middleware factory (`nextgenMiddleware` in
|
|
35
|
-
* sdk-next, `createNextgenMiddleware` in sdk-nuxt).
|
|
36
|
-
*/
|
|
37
|
-
export type NextgenMiddlewareOptions = {
|
|
38
|
-
/**
|
|
39
|
-
* Full URL of the Zitadel auth backend.
|
|
40
|
-
* @default process.env.ZITADEL_URL ?? "http://localhost:8080"
|
|
41
|
-
*/
|
|
42
|
-
url?: string;
|
|
43
|
-
/**
|
|
44
|
-
* URL path prefix that is reverse-proxied to the auth backend.
|
|
45
|
-
* @default "/__nextgen"
|
|
46
|
-
*/
|
|
47
|
-
proxyPath?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Pathnames that require a valid session. Requests to these routes without
|
|
50
|
-
* a valid token are redirected to {@link loginPath}.
|
|
51
|
-
* Entries ending with `*` match any sub-path (e.g. `"/admin*"`).
|
|
52
|
-
* @default []
|
|
53
|
-
*/
|
|
54
|
-
protectedRoutes?: string[];
|
|
55
|
-
/**
|
|
56
|
-
* Pathnames that are completely skipped by the middleware — no JWT
|
|
57
|
-
* verification, no protection check, no header tunnelling.
|
|
58
|
-
* Useful for webhooks, health-check endpoints, or any route where
|
|
59
|
-
* running auth logic is undesirable.
|
|
60
|
-
* Entries ending with `*` match any sub-path (e.g. `"/public*"`).
|
|
61
|
-
* @default []
|
|
62
|
-
*/
|
|
63
|
-
ignoredRoutes?: string[];
|
|
64
|
-
/**
|
|
65
|
-
* Pathname to redirect unauthenticated users to.
|
|
66
|
-
* A `next` query parameter is appended with the originally requested path.
|
|
67
|
-
* @default "/login"
|
|
68
|
-
*/
|
|
69
|
-
loginPath?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Reserved for future use. Local PEM public key for offline JWT verification.
|
|
72
|
-
*/
|
|
73
|
-
jwtKey?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Restrict accepted JWT `alg` header values. Tokens whose algorithm is not
|
|
76
|
-
* in this list are rejected before JWKS is fetched.
|
|
77
|
-
* @default ["RS256", "ES256"]
|
|
78
|
-
*/
|
|
79
|
-
allowedAlgorithms?: string[];
|
|
80
|
-
/**
|
|
81
|
-
* Clock skew tolerance in milliseconds applied to `exp`, `nbf`, and `iat`
|
|
82
|
-
* claim validation.
|
|
83
|
-
* @default 5000
|
|
84
|
-
*/
|
|
85
|
-
clockSkewMs?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Expected value(s) of the `aud` claim. When omitted, audience is not
|
|
88
|
-
* validated. Pass a single string or an array when a token may carry
|
|
89
|
-
* multiple audiences.
|
|
90
|
-
*/
|
|
91
|
-
audience?: string | string[];
|
|
92
|
-
/**
|
|
93
|
-
* Accepted values for the JWT header `typ` claim (case-insensitive).
|
|
94
|
-
* Tokens whose `typ` is not in this list are rejected.
|
|
95
|
-
* Set to `[]` to disable token-type checking entirely.
|
|
96
|
-
* @default ["JWT", "at+JWT"]
|
|
97
|
-
*/
|
|
98
|
-
allowedTokenTypes?: string[];
|
|
99
|
-
/**
|
|
100
|
-
* Timeout in milliseconds for JWKS endpoint requests.
|
|
101
|
-
* Requests that do not complete within this window are aborted and the
|
|
102
|
-
* token is rejected, treating the request as unauthenticated.
|
|
103
|
-
* @default 5000
|
|
104
|
-
*/
|
|
105
|
-
jwksTimeoutMs?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Timeout in milliseconds for upstream proxy requests.
|
|
108
|
-
* Requests that do not complete within this window are aborted with a
|
|
109
|
-
* network error. Defaults to 5 000 ms.
|
|
110
|
-
* @default 5000
|
|
111
|
-
*/
|
|
112
|
-
proxyTimeoutMs?: number;
|
|
113
|
-
/**
|
|
114
|
-
* Timeout in milliseconds for opaque (non-JWT) session token validation
|
|
115
|
-
* via the backend's `GET /sessions/me` endpoint. Tokens that cannot be
|
|
116
|
-
* validated within this window are treated as invalid.
|
|
117
|
-
* @default 5000
|
|
118
|
-
*/
|
|
119
|
-
opaqueTokenTimeoutMs?: number;
|
|
120
|
-
/**
|
|
121
|
-
* Optional hook called when a `POST /sessions/exchange` response is
|
|
122
|
-
* proxied back to the browser. Receives the upstream `Response` after
|
|
123
|
-
* hop-by-hop stripping and cookie upgrading. Return a modified
|
|
124
|
-
* `Response` to add custom headers, extra `Set-Cookie` values, or
|
|
125
|
-
* transform the body.
|
|
126
|
-
*
|
|
127
|
-
* The callback runs on the server — it has access to the full response
|
|
128
|
-
* including `Set-Cookie` headers that are `HttpOnly` and invisible to
|
|
129
|
-
* client-side JavaScript. It fires **after** the upstream has processed
|
|
130
|
-
* the exchange; it cannot prevent the exchange itself (return a 403
|
|
131
|
-
* `Response` to block the browser from receiving it).
|
|
132
|
-
*
|
|
133
|
-
* **Capabilities:**
|
|
134
|
-
*
|
|
135
|
-
* - **Add or modify cookies** — append `Set-Cookie` headers for
|
|
136
|
-
* user-preferences, analytics IDs, or any server-side state.
|
|
137
|
-
* - **Make additional fetch calls** — enrich the session by calling
|
|
138
|
-
* your own backend, a profile service, or any external API. The
|
|
139
|
-
* response body can be read with `response.json()` to extract
|
|
140
|
-
* session details like `user_id`.
|
|
141
|
-
* - **Map or transform response properties** — reshape the JSON body
|
|
142
|
-
* before it reaches the browser (e.g. strip internal fields, add
|
|
143
|
-
* computed properties).
|
|
144
|
-
* - **Logging and auditing** — clone the response, read its body for
|
|
145
|
-
* audit trails, and return the original unchanged.
|
|
146
|
-
*
|
|
147
|
-
* @example Add a cookie
|
|
148
|
-
* ```ts
|
|
149
|
-
* onExchangeResponse: async (response) => {
|
|
150
|
-
* const headers = new Headers(response.headers);
|
|
151
|
-
* headers.append("Set-Cookie", "theme=dark; Path=/; SameSite=Lax");
|
|
152
|
-
* return new Response(response.body, {
|
|
153
|
-
* status: response.status,
|
|
154
|
-
* headers,
|
|
155
|
-
* });
|
|
156
|
-
* },
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
* @example Fetch additional data and set a cookie from it
|
|
160
|
-
* ```ts
|
|
161
|
-
* onExchangeResponse: async (response) => {
|
|
162
|
-
* const body = await response.json();
|
|
163
|
-
* const profile = await fetch(
|
|
164
|
-
* `https://api.example.com/users/${body.session.user_id}`,
|
|
165
|
-
* );
|
|
166
|
-
* const { locale } = await profile.json();
|
|
167
|
-
* const headers = new Headers(response.headers);
|
|
168
|
-
* headers.append("Set-Cookie", `locale=${locale}; Path=/; SameSite=Lax`);
|
|
169
|
-
* return new Response(JSON.stringify(body), {
|
|
170
|
-
* status: response.status,
|
|
171
|
-
* headers,
|
|
172
|
-
* });
|
|
173
|
-
* },
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* @example Log the exchange for auditing (pass-through)
|
|
177
|
-
* ```ts
|
|
178
|
-
* onExchangeResponse: async (response) => {
|
|
179
|
-
* const cloned = response.clone();
|
|
180
|
-
* const body = await cloned.json();
|
|
181
|
-
* await auditLog.record("session_exchange", body.session.session_id);
|
|
182
|
-
* return response;
|
|
183
|
-
* },
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* @example Modify existing cookies (e.g. tighten the session cookie path)
|
|
187
|
-
* ```ts
|
|
188
|
-
* onExchangeResponse: async (response) => {
|
|
189
|
-
* const headers = new Headers();
|
|
190
|
-
* for (const [key, value] of response.headers.entries()) {
|
|
191
|
-
* if (key.toLowerCase() !== "set-cookie") headers.set(key, value);
|
|
192
|
-
* }
|
|
193
|
-
* for (const cookie of response.headers.getSetCookie()) {
|
|
194
|
-
* if (cookie.startsWith("__nextgen_session=")) {
|
|
195
|
-
* headers.append("set-cookie", cookie.replace("Path=/", "Path=/app"));
|
|
196
|
-
* } else {
|
|
197
|
-
* headers.append("set-cookie", cookie);
|
|
198
|
-
* }
|
|
199
|
-
* }
|
|
200
|
-
* return new Response(response.body, { status: response.status, headers });
|
|
201
|
-
* },
|
|
202
|
-
* ```
|
|
203
|
-
*/
|
|
204
|
-
onExchangeResponse?: (response: Response) => Response | Promise<Response>;
|
|
205
|
-
};
|
|
206
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,sEAAsE;IACtE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG;IAAE,eAAe,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AAE3E,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG;IAAE,eAAe,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAEpE,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmFG;IACH,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3E,CAAC"}
|
package/dist/types.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types for the Nextgen SDK middleware layer.
|
|
3
|
-
*
|
|
4
|
-
* These types are consumed by both `sdk-next` and `sdk-nuxt`. Each SDK
|
|
5
|
-
* re-exports them from its own public surface so consumers don't need
|
|
6
|
-
* to add a direct `sdk-core` dependency.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|