@smg-automotive/auth 7.1.0-auth0-update-root.1 → 7.1.0-auth0-update-tweaks.2

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.
Files changed (96) hide show
  1. package/dist/{Auth-BnjTWorx.d.ts → Auth-DVS7k3hQ.d.ts} +1 -1
  2. package/dist/cjs/client/contexts/index.d.ts +1 -1
  3. package/dist/cjs/client/helpers/switchSelectedTenant.js +8 -16
  4. package/dist/cjs/client/helpers/switchSelectedTenant.js.map +1 -1
  5. package/dist/cjs/client/hooks/useAuthConfig.d.ts +1 -1
  6. package/dist/cjs/index.d.ts +1 -0
  7. package/dist/cjs/index.js +5 -0
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/lib/enrichUser/auth0.js +2 -2
  10. package/dist/cjs/lib/enrichUser/auth0.js.map +1 -1
  11. package/dist/cjs/node_modules/jose/dist/webapi/lib/base64.js +16 -0
  12. package/dist/cjs/node_modules/jose/dist/webapi/lib/base64.js.map +1 -0
  13. package/dist/cjs/node_modules/jose/dist/webapi/lib/buffer_utils.js +7 -0
  14. package/dist/cjs/node_modules/jose/dist/webapi/lib/buffer_utils.js.map +1 -0
  15. package/dist/cjs/node_modules/jose/dist/webapi/lib/is_object.js +21 -0
  16. package/dist/cjs/node_modules/jose/dist/webapi/lib/is_object.js.map +1 -0
  17. package/dist/cjs/node_modules/jose/dist/webapi/util/base64url.js +26 -0
  18. package/dist/cjs/node_modules/jose/dist/webapi/util/base64url.js.map +1 -0
  19. package/dist/cjs/node_modules/jose/dist/webapi/util/decode_jwt.js +38 -0
  20. package/dist/cjs/node_modules/jose/dist/webapi/util/decode_jwt.js.map +1 -0
  21. package/dist/cjs/node_modules/jose/dist/webapi/util/errors.js +19 -0
  22. package/dist/cjs/node_modules/jose/dist/webapi/util/errors.js.map +1 -0
  23. package/dist/cjs/node_modules/whatwg-fetch/fetch.js +650 -0
  24. package/dist/cjs/node_modules/whatwg-fetch/fetch.js.map +1 -0
  25. package/dist/cjs/server/helpers/getAuthProps.d.ts +3 -0
  26. package/dist/cjs/server/helpers/getAuthProps.js.map +1 -1
  27. package/dist/cjs/server/helpers/getUser.d.ts +4 -1
  28. package/dist/cjs/server/helpers/getUser.js +4 -2
  29. package/dist/cjs/server/helpers/getUser.js.map +1 -1
  30. package/dist/cjs/server/hooks/onCallbackFactory.js +2 -2
  31. package/dist/cjs/server/hooks/onCallbackFactory.js.map +1 -1
  32. package/dist/cjs/server/middleware/index.js +7 -9
  33. package/dist/cjs/server/middleware/index.js.map +1 -1
  34. package/dist/cjs/server/middleware/login.d.ts +6 -1
  35. package/dist/cjs/server/middleware/login.js +12 -0
  36. package/dist/cjs/server/middleware/login.js.map +1 -1
  37. package/dist/cjs/server/middleware/logout.d.ts +1 -1
  38. package/dist/cjs/server/middleware/logout.js.map +1 -1
  39. package/dist/cjs/server/middleware/token.d.ts +1 -3
  40. package/dist/cjs/server/middleware/token.js +1 -15
  41. package/dist/cjs/server/middleware/token.js.map +1 -1
  42. package/dist/cjs/test/mocks.d.ts +1 -0
  43. package/dist/cjs/test/mocks.js +5 -0
  44. package/dist/cjs/test/mocks.js.map +1 -0
  45. package/dist/cjs/test/setup.d.ts +2 -0
  46. package/dist/cjs/test/setup.js +28 -0
  47. package/dist/cjs/test/setup.js.map +1 -0
  48. package/dist/esm/client/contexts/index.d.ts +1 -1
  49. package/dist/esm/client/helpers/switchSelectedTenant.js +8 -16
  50. package/dist/esm/client/helpers/switchSelectedTenant.js.map +1 -1
  51. package/dist/esm/client/hooks/useAuthConfig.d.ts +1 -1
  52. package/dist/esm/index.d.ts +1 -0
  53. package/dist/esm/index.js +1 -0
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/lib/enrichUser/auth0.js +1 -1
  56. package/dist/esm/node_modules/jose/dist/webapi/lib/base64.js +14 -0
  57. package/dist/esm/node_modules/jose/dist/webapi/lib/base64.js.map +1 -0
  58. package/dist/esm/node_modules/jose/dist/webapi/lib/buffer_utils.js +5 -0
  59. package/dist/esm/node_modules/jose/dist/webapi/lib/buffer_utils.js.map +1 -0
  60. package/dist/esm/node_modules/jose/dist/webapi/lib/is_object.js +19 -0
  61. package/dist/esm/node_modules/jose/dist/webapi/lib/is_object.js.map +1 -0
  62. package/dist/esm/node_modules/jose/dist/webapi/util/base64url.js +24 -0
  63. package/dist/esm/node_modules/jose/dist/webapi/util/base64url.js.map +1 -0
  64. package/dist/esm/node_modules/jose/dist/webapi/util/decode_jwt.js +36 -0
  65. package/dist/esm/node_modules/jose/dist/webapi/util/decode_jwt.js.map +1 -0
  66. package/dist/esm/node_modules/jose/dist/webapi/util/errors.js +16 -0
  67. package/dist/esm/node_modules/jose/dist/webapi/util/errors.js.map +1 -0
  68. package/dist/esm/node_modules/whatwg-fetch/fetch.js +645 -0
  69. package/dist/esm/node_modules/whatwg-fetch/fetch.js.map +1 -0
  70. package/dist/esm/server/helpers/getAuthProps.d.ts +3 -0
  71. package/dist/esm/server/helpers/getAuthProps.js.map +1 -1
  72. package/dist/esm/server/helpers/getUser.d.ts +4 -1
  73. package/dist/esm/server/helpers/getUser.js +4 -2
  74. package/dist/esm/server/helpers/getUser.js.map +1 -1
  75. package/dist/esm/server/hooks/onCallbackFactory.js +1 -1
  76. package/dist/esm/server/middleware/index.js +8 -10
  77. package/dist/esm/server/middleware/index.js.map +1 -1
  78. package/dist/esm/server/middleware/login.d.ts +6 -1
  79. package/dist/esm/server/middleware/login.js +12 -1
  80. package/dist/esm/server/middleware/login.js.map +1 -1
  81. package/dist/esm/server/middleware/logout.d.ts +1 -1
  82. package/dist/esm/server/middleware/logout.js.map +1 -1
  83. package/dist/esm/server/middleware/token.d.ts +1 -3
  84. package/dist/esm/server/middleware/token.js +1 -15
  85. package/dist/esm/server/middleware/token.js.map +1 -1
  86. package/dist/esm/test/mocks.d.ts +1 -0
  87. package/dist/esm/test/mocks.js +2 -0
  88. package/dist/esm/test/mocks.js.map +1 -0
  89. package/dist/esm/test/setup.d.ts +2 -0
  90. package/dist/esm/test/setup.js +26 -0
  91. package/dist/esm/test/setup.js.map +1 -0
  92. package/dist/fixtures.d.ts +1 -1
  93. package/dist/index.d.ts +22 -3
  94. package/dist/server.d.ts +5 -2
  95. package/dist/{sessionUser-DL32W6UV.d.ts → sessionUser-8ZPIZ_oX.d.ts} +3 -1
  96. package/package.json +10 -3
@@ -1,5 +1,5 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- import { A as Auth0Config, E as EnrichedSessionUser } from './sessionUser-DL32W6UV.js';
2
+ import { A as Auth0Config, E as EnrichedSessionUser } from './sessionUser-8ZPIZ_oX.js';
3
3
 
4
4
  type AuthProviderProps = {
5
5
  config: Auth0Config;
@@ -1 +1 @@
1
- export { AuthProvider } from './Auth';
1
+ export { AuthProvider, AuthProviderProps } from './Auth';
@@ -1,24 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var errors = require('@auth0/nextjs-auth0/errors');
3
+ var authLinks = require('../../lib/authLinks.js');
4
4
 
5
5
  const switchSelectedTenant = async ({ config, sellerId, }) => {
6
- const tokenResponse = await fetch(`${config.tokenEndpoint}?sellerId=${sellerId}`, {
7
- method: 'GET',
8
- headers: {
9
- 'Content-Type': 'application/json',
10
- },
6
+ const location = window.location;
7
+ const returnTo = location.pathname + location.search + location.hash;
8
+ const loginUrl = authLinks.getLoginLink({
9
+ returnTo,
10
+ auth0Config: config,
11
+ selectedSellerId: sellerId,
11
12
  });
12
- if (!tokenResponse.ok) {
13
- let accessTokenError;
14
- try {
15
- accessTokenError = await tokenResponse.json();
16
- }
17
- catch {
18
- throw new Error('Unexpected error when switching selected tenant');
19
- }
20
- throw new errors.AccessTokenError(accessTokenError.error.code, accessTokenError.error.message);
21
- }
13
+ window.location.href = loginUrl;
22
14
  };
23
15
 
24
16
  exports.switchSelectedTenant = switchSelectedTenant;
@@ -1 +1 @@
1
- {"version":3,"file":"switchSelectedTenant.js","sources":["../../../../../src/client/helpers/switchSelectedTenant.ts"],"sourcesContent":[null],"names":["AccessTokenError"],"mappings":";;;;AAIO,MAAM,oBAAoB,GAAG,OAAO,EACzC,MAAM,EACN,QAAQ,GAIT,KAAmB;AAClB,IAAA,MAAM,aAAa,GAAG,MAAM,KAAK,CAC/B,CAAA,EAAG,MAAM,CAAC,aAAa,CAAA,UAAA,EAAa,QAAQ,CAAA,CAAE,EAC9C;AACE,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,OAAO,EAAE;AACP,YAAA,cAAc,EAAE,kBAAkB;AACnC,SAAA;AACF,KAAA,CACF;AAED,IAAA,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE;AACrB,QAAA,IAAI,gBAAgB;AAEpB,QAAA,IAAI;AACF,YAAA,gBAAgB,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE;QAC/C;AAAE,QAAA,MAAM;AACN,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;QACpE;AAEA,QAAA,MAAM,IAAIA,uBAAgB,CACxB,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAC3B,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAC/B;IACH;AACF;;;;"}
1
+ {"version":3,"file":"switchSelectedTenant.js","sources":["../../../../../src/client/helpers/switchSelectedTenant.ts"],"sourcesContent":[null],"names":["getLoginLink"],"mappings":";;;;AAGO,MAAM,oBAAoB,GAAG,OAAO,EACzC,MAAM,EACN,QAAQ,GAIT,KAAI;AACH,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ;AAChC,IAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI;IAEpE,MAAM,QAAQ,GAAGA,sBAAY,CAAC;QAC5B,QAAQ;AACR,QAAA,WAAW,EAAE,MAAM;AACnB,QAAA,gBAAgB,EAAE,QAAQ;AAC3B,KAAA,CAAC;AAEF,IAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ;AACjC;;;;"}
@@ -1 +1 @@
1
- export declare const useAuthConfig: () => import("../../types").Auth0Config;
1
+ export declare const useAuthConfig: () => import("../..").Auth0Config;
@@ -2,3 +2,4 @@ export * from './client/contexts';
2
2
  export * from './client/helpers';
3
3
  export * from './client/hooks';
4
4
  export * from './lib/authLinks';
5
+ export * from './types';
package/dist/cjs/index.js CHANGED
@@ -6,6 +6,7 @@ var switchSelectedTenant = require('./client/helpers/switchSelectedTenant.js');
6
6
  var useUser = require('./client/hooks/useUser.js');
7
7
  var useAuthConfig = require('./client/hooks/useAuthConfig.js');
8
8
  var authLinks = require('./lib/authLinks.js');
9
+ var user = require('./types/auth0/user.js');
9
10
 
10
11
 
11
12
 
@@ -16,4 +17,8 @@ exports.useUser = useUser.useUser;
16
17
  exports.useAuthConfig = useAuthConfig.useAuthConfig;
17
18
  exports.getLoginLink = authLinks.getLoginLink;
18
19
  exports.getLogoutLink = authLinks.getLogoutLink;
20
+ Object.defineProperty(exports, "Auth0UserType", {
21
+ enumerable: true,
22
+ get: function () { return user.Auth0UserType; }
23
+ });
19
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var jose = require('jose');
4
3
  var user = require('../../types/auth0/user.js');
5
4
  var getSeller = require('../../api/seller/getSeller.js');
6
5
  require('../../api/seller/client.js');
6
+ var decode_jwt = require('../../node_modules/jose/dist/webapi/util/decode_jwt.js');
7
7
 
8
8
  const enrichUser = async ({ auth0User, accessToken, userHasSelectedSeller = false, }) => {
9
9
  if (!accessToken) {
10
10
  throw new Error('Please provide an access token to enrich the user');
11
11
  }
12
- const decodedToken = jose.decodeJwt(accessToken);
12
+ const decodedToken = decode_jwt.decodeJwt(accessToken);
13
13
  const isMultiTenantUser = !!decodedToken.isMultiTenantUser;
14
14
  const forceTenantSelection = isMultiTenantUser && !userHasSelectedSeller;
15
15
  const sellerId = parseInt(decodedToken.sellerIds[0], 10);
@@ -1 +1 @@
1
- {"version":3,"file":"auth0.js","sources":["../../../../../src/lib/enrichUser/auth0.ts"],"sourcesContent":[null],"names":["decodeJwt","getSeller","Auth0UserType"],"mappings":";;;;;;;AAWO,MAAM,UAAU,GAAG,OAAO,EAC/B,SAAS,EACT,WAAW,EACX,qBAAqB,GAAG,KAAK,GAK9B,KAAkD;IACjD,IAAI,CAAC,WAAW,EAAE;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC;IACtE;AAEA,IAAA,MAAM,YAAY,GAAGA,cAAS,CAAkB,WAAW,CAAC;AAC5D,IAAA,MAAM,iBAAiB,GAAG,CAAC,CAAC,YAAY,CAAC,iBAAiB;AAC1D,IAAA,MAAM,oBAAoB,GAAG,iBAAiB,IAAI,CAAC,qBAAqB;AACxE,IAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACxD,IAAA,MAAM,UAAU,GAA0B;AACxC,QAAA,GAAG,SAAS;AACZ,QAAA,cAAc,EAAE,CAAC,CAAC,YAAY,CAAC,cAAc;AAC7C,QAAA,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE;QACvC,oBAAoB;QACpB,iBAAiB;KAClB;AAED,IAAA,MAAM,MAAM,GAAG,MAAMC,mBAAS,CAAC;AAC7B,QAAA,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;AAC3B,KAAA,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE;;AAEX,QAAA,OAAO,CAAC,IAAI,CACV,qDAAqD,QAAQ,CAAA,CAAE,CAChE;IACH;AAEA,IAAA,MAAM,YAAY,GAAgB;AAChC,QAAA,GAAG,UAAU;AACb,QAAA,QAAQ,EAAE,MAAM,EAAE,IAAI,IAAIC,kBAAa,CAAC,OAAO;AAC/C,QAAA,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;KAC9B;AACD,IAAA,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"auth0.js","sources":["../../../../../src/lib/enrichUser/auth0.ts"],"sourcesContent":[null],"names":["decodeJwt","getSeller","Auth0UserType"],"mappings":";;;;;;;AAWO,MAAM,UAAU,GAAG,OAAO,EAC/B,SAAS,EACT,WAAW,EACX,qBAAqB,GAAG,KAAK,GAK9B,KAAkD;IACjD,IAAI,CAAC,WAAW,EAAE;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC;IACtE;AAEA,IAAA,MAAM,YAAY,GAAGA,oBAAS,CAAkB,WAAW,CAAC;AAC5D,IAAA,MAAM,iBAAiB,GAAG,CAAC,CAAC,YAAY,CAAC,iBAAiB;AAC1D,IAAA,MAAM,oBAAoB,GAAG,iBAAiB,IAAI,CAAC,qBAAqB;AACxE,IAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACxD,IAAA,MAAM,UAAU,GAA0B;AACxC,QAAA,GAAG,SAAS;AACZ,QAAA,cAAc,EAAE,CAAC,CAAC,YAAY,CAAC,cAAc;AAC7C,QAAA,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE;QACvC,oBAAoB;QACpB,iBAAiB;KAClB;AAED,IAAA,MAAM,MAAM,GAAG,MAAMC,mBAAS,CAAC;AAC7B,QAAA,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;AAC3B,KAAA,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE;;AAEX,QAAA,OAAO,CAAC,IAAI,CACV,qDAAqD,QAAQ,CAAA,CAAE,CAChE;IACH;AAEA,IAAA,MAAM,YAAY,GAAgB;AAChC,QAAA,GAAG,UAAU;AACb,QAAA,QAAQ,EAAE,MAAM,EAAE,IAAI,IAAIC,kBAAa,CAAC,OAAO;AAC/C,QAAA,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;KAC9B;AACD,IAAA,OAAO,YAAY;AACrB;;;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ function decodeBase64(encoded) {
4
+ if (Uint8Array.fromBase64) {
5
+ return Uint8Array.fromBase64(encoded);
6
+ }
7
+ const binary = atob(encoded);
8
+ const bytes = new Uint8Array(binary.length);
9
+ for (let i = 0; i < binary.length; i++) {
10
+ bytes[i] = binary.charCodeAt(i);
11
+ }
12
+ return bytes;
13
+ }
14
+
15
+ exports.decodeBase64 = decodeBase64;
16
+ //# sourceMappingURL=base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64.js","sources":["../../../../../../../node_modules/jose/dist/webapi/lib/base64.js"],"sourcesContent":["export function encodeBase64(input) {\n if (Uint8Array.prototype.toBase64) {\n return input.toBase64();\n }\n const CHUNK_SIZE = 0x8000;\n const arr = [];\n for (let i = 0; i < input.length; i += CHUNK_SIZE) {\n arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));\n }\n return btoa(arr.join(''));\n}\nexport function decodeBase64(encoded) {\n if (Uint8Array.fromBase64) {\n return Uint8Array.fromBase64(encoded);\n }\n const binary = atob(encoded);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n}\n"],"names":[],"mappings":";;AAWO,SAAS,YAAY,CAAC,OAAO,EAAE;AACtC,IAAI,IAAI,UAAU,CAAC,UAAU,EAAE;AAC/B,QAAQ,OAAO,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;AAC7C,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;AAChC,IAAI,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/C,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC5C,QAAQ,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AACvC,IAAI;AACJ,IAAI,OAAO,KAAK;AAChB;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ new TextEncoder();
4
+ const decoder = new TextDecoder();
5
+
6
+ exports.decoder = decoder;
7
+ //# sourceMappingURL=buffer_utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer_utils.js","sources":["../../../../../../../node_modules/jose/dist/webapi/lib/buffer_utils.js"],"sourcesContent":["export const encoder = new TextEncoder();\nexport const decoder = new TextDecoder();\nconst MAX_INT32 = 2 ** 32;\nexport function concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0);\n const buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers) {\n buf.set(buffer, i);\n i += buffer.length;\n }\n return buf;\n}\nfunction writeUInt32BE(buf, value, offset) {\n if (value < 0 || value >= MAX_INT32) {\n throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);\n }\n buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset);\n}\nexport function uint64be(value) {\n const high = Math.floor(value / MAX_INT32);\n const low = value % MAX_INT32;\n const buf = new Uint8Array(8);\n writeUInt32BE(buf, high, 0);\n writeUInt32BE(buf, low, 4);\n return buf;\n}\nexport function uint32be(value) {\n const buf = new Uint8Array(4);\n writeUInt32BE(buf, value);\n return buf;\n}\n"],"names":[],"mappings":";;AAAuB,IAAI,WAAW;AAC1B,MAAC,OAAO,GAAG,IAAI,WAAW;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ function isObjectLike(value) {
4
+ return typeof value === 'object' && value !== null;
5
+ }
6
+ var isObject = (input) => {
7
+ if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {
8
+ return false;
9
+ }
10
+ if (Object.getPrototypeOf(input) === null) {
11
+ return true;
12
+ }
13
+ let proto = input;
14
+ while (Object.getPrototypeOf(proto) !== null) {
15
+ proto = Object.getPrototypeOf(proto);
16
+ }
17
+ return Object.getPrototypeOf(input) === proto;
18
+ };
19
+
20
+ module.exports = isObject;
21
+ //# sourceMappingURL=is_object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is_object.js","sources":["../../../../../../../node_modules/jose/dist/webapi/lib/is_object.js"],"sourcesContent":["function isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\nexport default (input) => {\n if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {\n return false;\n }\n if (Object.getPrototypeOf(input) === null) {\n return true;\n }\n let proto = input;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(input) === proto;\n};\n"],"names":[],"mappings":";;AAAA,SAAS,YAAY,CAAC,KAAK,EAAE;AAC7B,IAAI,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AACtD;AACA,eAAe,CAAC,KAAK,KAAK;AAC1B,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,EAAE;AAC7F,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,IAAI,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;AAC/C,QAAQ,OAAO,IAAI;AACnB,IAAI;AACJ,IAAI,IAAI,KAAK,GAAG,KAAK;AACrB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;AAClD,QAAQ,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;AAC5C,IAAI;AACJ,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,KAAK;AACjD,CAAC;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var buffer_utils = require('../lib/buffer_utils.js');
4
+ var base64 = require('../lib/base64.js');
5
+
6
+ function decode(input) {
7
+ if (Uint8Array.fromBase64) {
8
+ return Uint8Array.fromBase64(typeof input === 'string' ? input : buffer_utils.decoder.decode(input), {
9
+ alphabet: 'base64url',
10
+ });
11
+ }
12
+ let encoded = input;
13
+ if (encoded instanceof Uint8Array) {
14
+ encoded = buffer_utils.decoder.decode(encoded);
15
+ }
16
+ encoded = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\s/g, '');
17
+ try {
18
+ return base64.decodeBase64(encoded);
19
+ }
20
+ catch {
21
+ throw new TypeError('The input to be decoded is not correctly encoded.');
22
+ }
23
+ }
24
+
25
+ exports.decode = decode;
26
+ //# sourceMappingURL=base64url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64url.js","sources":["../../../../../../../node_modules/jose/dist/webapi/util/base64url.js"],"sourcesContent":["import { encoder, decoder } from '../lib/buffer_utils.js';\nimport { encodeBase64, decodeBase64 } from '../lib/base64.js';\nexport function decode(input) {\n if (Uint8Array.fromBase64) {\n return Uint8Array.fromBase64(typeof input === 'string' ? input : decoder.decode(input), {\n alphabet: 'base64url',\n });\n }\n let encoded = input;\n if (encoded instanceof Uint8Array) {\n encoded = decoder.decode(encoded);\n }\n encoded = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\\s/g, '');\n try {\n return decodeBase64(encoded);\n }\n catch {\n throw new TypeError('The input to be decoded is not correctly encoded.');\n }\n}\nexport function encode(input) {\n let unencoded = input;\n if (typeof unencoded === 'string') {\n unencoded = encoder.encode(unencoded);\n }\n if (Uint8Array.prototype.toBase64) {\n return unencoded.toBase64({ alphabet: 'base64url', omitPadding: true });\n }\n return encodeBase64(unencoded).replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n}\n"],"names":["decoder","decodeBase64"],"mappings":";;;;;AAEO,SAAS,MAAM,CAAC,KAAK,EAAE;AAC9B,IAAI,IAAI,UAAU,CAAC,UAAU,EAAE;AAC/B,QAAQ,OAAO,UAAU,CAAC,UAAU,CAAC,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAGA,oBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;AAChG,YAAY,QAAQ,EAAE,WAAW;AACjC,SAAS,CAAC;AACV,IAAI;AACJ,IAAI,IAAI,OAAO,GAAG,KAAK;AACvB,IAAI,IAAI,OAAO,YAAY,UAAU,EAAE;AACvC,QAAQ,OAAO,GAAGA,oBAAO,CAAC,MAAM,CAAC,OAAO,CAAC;AACzC,IAAI;AACJ,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAC9E,IAAI,IAAI;AACR,QAAQ,OAAOC,mBAAY,CAAC,OAAO,CAAC;AACpC,IAAI;AACJ,IAAI,MAAM;AACV,QAAQ,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC;AAChF,IAAI;AACJ;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var base64url = require('./base64url.js');
4
+ var buffer_utils = require('../lib/buffer_utils.js');
5
+ var is_object = require('../lib/is_object.js');
6
+ var errors = require('./errors.js');
7
+
8
+ function decodeJwt(jwt) {
9
+ if (typeof jwt !== 'string')
10
+ throw new errors.JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');
11
+ const { 1: payload, length } = jwt.split('.');
12
+ if (length === 5)
13
+ throw new errors.JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');
14
+ if (length !== 3)
15
+ throw new errors.JWTInvalid('Invalid JWT');
16
+ if (!payload)
17
+ throw new errors.JWTInvalid('JWTs must contain a payload');
18
+ let decoded;
19
+ try {
20
+ decoded = base64url.decode(payload);
21
+ }
22
+ catch {
23
+ throw new errors.JWTInvalid('Failed to base64url decode the payload');
24
+ }
25
+ let result;
26
+ try {
27
+ result = JSON.parse(buffer_utils.decoder.decode(decoded));
28
+ }
29
+ catch {
30
+ throw new errors.JWTInvalid('Failed to parse the decoded payload as JSON');
31
+ }
32
+ if (!is_object(result))
33
+ throw new errors.JWTInvalid('Invalid JWT Claims Set');
34
+ return result;
35
+ }
36
+
37
+ exports.decodeJwt = decodeJwt;
38
+ //# sourceMappingURL=decode_jwt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode_jwt.js","sources":["../../../../../../../node_modules/jose/dist/webapi/util/decode_jwt.js"],"sourcesContent":["import { decode as b64u } from './base64url.js';\nimport { decoder } from '../lib/buffer_utils.js';\nimport isObject from '../lib/is_object.js';\nimport { JWTInvalid } from './errors.js';\nexport function decodeJwt(jwt) {\n if (typeof jwt !== 'string')\n throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');\n const { 1: payload, length } = jwt.split('.');\n if (length === 5)\n throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');\n if (length !== 3)\n throw new JWTInvalid('Invalid JWT');\n if (!payload)\n throw new JWTInvalid('JWTs must contain a payload');\n let decoded;\n try {\n decoded = b64u(payload);\n }\n catch {\n throw new JWTInvalid('Failed to base64url decode the payload');\n }\n let result;\n try {\n result = JSON.parse(decoder.decode(decoded));\n }\n catch {\n throw new JWTInvalid('Failed to parse the decoded payload as JSON');\n }\n if (!isObject(result))\n throw new JWTInvalid('Invalid JWT Claims Set');\n return result;\n}\n"],"names":["JWTInvalid","b64u","decoder","isObject"],"mappings":";;;;;;;AAIO,SAAS,SAAS,CAAC,GAAG,EAAE;AAC/B,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAC/B,QAAQ,MAAM,IAAIA,iBAAU,CAAC,+DAA+D,CAAC;AAC7F,IAAI,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;AACjD,IAAI,IAAI,MAAM,KAAK,CAAC;AACpB,QAAQ,MAAM,IAAIA,iBAAU,CAAC,0DAA0D,CAAC;AACxF,IAAI,IAAI,MAAM,KAAK,CAAC;AACpB,QAAQ,MAAM,IAAIA,iBAAU,CAAC,aAAa,CAAC;AAC3C,IAAI,IAAI,CAAC,OAAO;AAChB,QAAQ,MAAM,IAAIA,iBAAU,CAAC,6BAA6B,CAAC;AAC3D,IAAI,IAAI,OAAO;AACf,IAAI,IAAI;AACR,QAAQ,OAAO,GAAGC,gBAAI,CAAC,OAAO,CAAC;AAC/B,IAAI;AACJ,IAAI,MAAM;AACV,QAAQ,MAAM,IAAID,iBAAU,CAAC,wCAAwC,CAAC;AACtE,IAAI;AACJ,IAAI,IAAI,MAAM;AACd,IAAI,IAAI;AACR,QAAQ,MAAM,GAAG,IAAI,CAAC,KAAK,CAACE,oBAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACpD,IAAI;AACJ,IAAI,MAAM;AACV,QAAQ,MAAM,IAAIF,iBAAU,CAAC,6CAA6C,CAAC;AAC3E,IAAI;AACJ,IAAI,IAAI,CAACG,SAAQ,CAAC,MAAM,CAAC;AACzB,QAAQ,MAAM,IAAIH,iBAAU,CAAC,wBAAwB,CAAC;AACtD,IAAI,OAAO,MAAM;AACjB;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ class JOSEError extends Error {
4
+ static code = 'ERR_JOSE_GENERIC';
5
+ code = 'ERR_JOSE_GENERIC';
6
+ constructor(message, options) {
7
+ super(message, options);
8
+ this.name = this.constructor.name;
9
+ Error.captureStackTrace?.(this, this.constructor);
10
+ }
11
+ }
12
+ class JWTInvalid extends JOSEError {
13
+ static code = 'ERR_JWT_INVALID';
14
+ code = 'ERR_JWT_INVALID';
15
+ }
16
+
17
+ exports.JOSEError = JOSEError;
18
+ exports.JWTInvalid = JWTInvalid;
19
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["../../../../../../../node_modules/jose/dist/webapi/util/errors.js"],"sourcesContent":["export class JOSEError extends Error {\n static code = 'ERR_JOSE_GENERIC';\n code = 'ERR_JOSE_GENERIC';\n constructor(message, options) {\n super(message, options);\n this.name = this.constructor.name;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\nexport class JWTClaimValidationFailed extends JOSEError {\n static code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\n code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\n claim;\n reason;\n payload;\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nexport class JWTExpired extends JOSEError {\n static code = 'ERR_JWT_EXPIRED';\n code = 'ERR_JWT_EXPIRED';\n claim;\n reason;\n payload;\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nexport class JOSEAlgNotAllowed extends JOSEError {\n static code = 'ERR_JOSE_ALG_NOT_ALLOWED';\n code = 'ERR_JOSE_ALG_NOT_ALLOWED';\n}\nexport class JOSENotSupported extends JOSEError {\n static code = 'ERR_JOSE_NOT_SUPPORTED';\n code = 'ERR_JOSE_NOT_SUPPORTED';\n}\nexport class JWEDecryptionFailed extends JOSEError {\n static code = 'ERR_JWE_DECRYPTION_FAILED';\n code = 'ERR_JWE_DECRYPTION_FAILED';\n constructor(message = 'decryption operation failed', options) {\n super(message, options);\n }\n}\nexport class JWEInvalid extends JOSEError {\n static code = 'ERR_JWE_INVALID';\n code = 'ERR_JWE_INVALID';\n}\nexport class JWSInvalid extends JOSEError {\n static code = 'ERR_JWS_INVALID';\n code = 'ERR_JWS_INVALID';\n}\nexport class JWTInvalid extends JOSEError {\n static code = 'ERR_JWT_INVALID';\n code = 'ERR_JWT_INVALID';\n}\nexport class JWKInvalid extends JOSEError {\n static code = 'ERR_JWK_INVALID';\n code = 'ERR_JWK_INVALID';\n}\nexport class JWKSInvalid extends JOSEError {\n static code = 'ERR_JWKS_INVALID';\n code = 'ERR_JWKS_INVALID';\n}\nexport class JWKSNoMatchingKey extends JOSEError {\n static code = 'ERR_JWKS_NO_MATCHING_KEY';\n code = 'ERR_JWKS_NO_MATCHING_KEY';\n constructor(message = 'no applicable key found in the JSON Web Key Set', options) {\n super(message, options);\n }\n}\nexport class JWKSMultipleMatchingKeys extends JOSEError {\n [Symbol.asyncIterator];\n static code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\n code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\n constructor(message = 'multiple matching keys found in the JSON Web Key Set', options) {\n super(message, options);\n }\n}\nexport class JWKSTimeout extends JOSEError {\n static code = 'ERR_JWKS_TIMEOUT';\n code = 'ERR_JWKS_TIMEOUT';\n constructor(message = 'request timed out', options) {\n super(message, options);\n }\n}\nexport class JWSSignatureVerificationFailed extends JOSEError {\n static code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n constructor(message = 'signature verification failed', options) {\n super(message, options);\n }\n}\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS,SAAS,KAAK,CAAC;AACrC,IAAI,OAAO,IAAI,GAAG,kBAAkB;AACpC,IAAI,IAAI,GAAG,kBAAkB;AAC7B,IAAI,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,QAAQ,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/B,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI;AACzC,QAAQ,KAAK,CAAC,iBAAiB,GAAG,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC;AACzD,IAAI;AACJ;AAkDO,MAAM,UAAU,SAAS,SAAS,CAAC;AAC1C,IAAI,OAAO,IAAI,GAAG,iBAAiB;AACnC,IAAI,IAAI,GAAG,iBAAiB;AAC5B;;;;;","x_google_ignoreList":[0]}