@nsshunt/stsoauth2plugin 1.0.39 → 1.0.41

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.
@@ -1,4 +1,7 @@
1
- var __defProp = Object.defineProperty;
1
+ (function(global2, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("debug"), require("node:worker_threads"), require("@nsshunt/stsutils"), require("@nsshunt/stsvueutils"), require("pinia"), require("@nsshunt/stspublisherserver"), require("node:https"), require("colors"), require("axios"), require("@nsshunt/stsinstrumentation")) : typeof define === "function" && define.amd ? define(["exports", "vue", "debug", "node:worker_threads", "@nsshunt/stsutils", "@nsshunt/stsvueutils", "pinia", "@nsshunt/stspublisherserver", "node:https", "colors", "axios", "@nsshunt/stsinstrumentation"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsoauth2plugin"] = {}, global2.vue, global2.debug, global2.worker_threads, global2.stsutils, global2.stsvueutils, global2.pinia, global2.stspublisherserver, global2.https, null, global2.axios, global2.stsinstrumentation));
3
+ })(this, function(exports2, vue, Debug, wt, stsutils, stsvueutils, pinia, stspublisherserver, https, colors, axios, stsinstrumentation) {
4
+ "use strict";var __defProp = Object.defineProperty;
2
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
6
  var __publicField = (obj, key, value) => {
4
7
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -30,26 +33,23 @@ var __privateWrapper = (obj, member, setter, getter) => ({
30
33
  return __privateGet(obj, member, getter);
31
34
  }
32
35
  });
33
- (function(global2, factory) {
34
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("debug"), require("node:worker_threads"), require("@nsshunt/stsutils"), require("@nsshunt/stsvueutils"), require("pinia"), require("@nsshunt/stspublisherserver"), require("node:https"), require("colors"), require("axios"), require("@nsshunt/stsinstrumentation")) : typeof define === "function" && define.amd ? define(["exports", "vue", "debug", "node:worker_threads", "@nsshunt/stsutils", "@nsshunt/stsvueutils", "pinia", "@nsshunt/stspublisherserver", "node:https", "colors", "axios", "@nsshunt/stsinstrumentation"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsoauth2plugin"] = {}, global2.vue, global2.debug, global2.worker_threads, global2.stsutils, global2.stsvueutils, global2.pinia, global2.stspublisherserver, global2.https, null, global2.axios, global2.stsinstrumentation));
35
- })(this, function(exports2, vue, Debug, wt, stsutils, stsvueutils, pinia, stspublisherserver, https, colors, axios, stsinstrumentation) {
36
+
36
37
  var _crypto, _router, _cUtils, _qParams, _STORAGE_AUTHORIZE_OPTIONS_KEY, _STORAGE_SESSION_KEY, _aic, _options, _messages, _oauth2ManagerPort, _messageId, _messageHandlers, _messageTimeout, _worker, _transactionStore, _operationSemaphore, _maxSemaphoreRetries, _semaphoreRetrySleep, _ProcessMessageResponse, _PostMessage, _HandleLogEvent, _HandleUpdateInstrumentEvent, _GetStore, _HandleErrorEvent, _HandleAuthenticateEvent, _SetupRoute, _clientSessionStore, _cUtils2, _qParams2, _STORAGE_SESSION_KEY2, _oauthWorkerPort, _options2, _httpsAgent, _HandleAuthenticateEvent2, _HandleErrorEvent2, _LogMessage, _GetAccessToken, _GetCookies, _UpdateInstrument, _ProcessCommand, _RestoreSession, _Authorize, _HandleRedirect, _GetTokenFromBroker, _GetToken, _RefreshToken, _Logout;
37
- "use strict";
38
- function _interopNamespaceDefault(e2) {
39
- const n2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
40
- if (e2) {
41
- for (const k in e2) {
38
+ function _interopNamespaceDefault(e) {
39
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
40
+ if (e) {
41
+ for (const k in e) {
42
42
  if (k !== "default") {
43
- const d = Object.getOwnPropertyDescriptor(e2, k);
44
- Object.defineProperty(n2, k, d.get ? d : {
43
+ const d = Object.getOwnPropertyDescriptor(e, k);
44
+ Object.defineProperty(n, k, d.get ? d : {
45
45
  enumerable: true,
46
- get: () => e2[k]
46
+ get: () => e[k]
47
47
  });
48
48
  }
49
49
  }
50
50
  }
51
- n2.default = e2;
52
- return Object.freeze(n2);
51
+ n.default = e;
52
+ return Object.freeze(n);
53
53
  }
54
54
  const wt__namespace = /* @__PURE__ */ _interopNamespaceDefault(wt);
55
55
  const STSOAuth2ManagerPluginKey = Symbol();
@@ -58,10 +58,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
58
58
  function getDefaultExportFromCjs(x) {
59
59
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
60
60
  }
61
- function getAugmentedNamespace(n2) {
62
- if (n2.__esModule)
63
- return n2;
64
- var f = n2.default;
61
+ function getAugmentedNamespace(n) {
62
+ if (n.__esModule)
63
+ return n;
64
+ var f = n.default;
65
65
  if (typeof f == "function") {
66
66
  var a = function a2() {
67
67
  if (this instanceof a2) {
@@ -73,12 +73,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
73
73
  } else
74
74
  a = {};
75
75
  Object.defineProperty(a, "__esModule", { value: true });
76
- Object.keys(n2).forEach(function(k) {
77
- var d = Object.getOwnPropertyDescriptor(n2, k);
76
+ Object.keys(n).forEach(function(k) {
77
+ var d = Object.getOwnPropertyDescriptor(n, k);
78
78
  Object.defineProperty(a, k, d.get ? d : {
79
79
  enumerable: true,
80
80
  get: function() {
81
- return n2[k];
81
+ return n[k];
82
82
  }
83
83
  });
84
84
  });
@@ -485,7 +485,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
485
485
  stringify: function(wordArray) {
486
486
  try {
487
487
  return decodeURIComponent(escape(Latin1.stringify(wordArray)));
488
- } catch (e2) {
488
+ } catch (e) {
489
489
  throw new Error("Malformed UTF-8 data");
490
490
  }
491
491
  },
@@ -717,29 +717,29 @@ var __privateWrapper = (obj, member, setter, getter) => ({
717
717
  var H = [];
718
718
  var K = [];
719
719
  (function() {
720
- function isPrime(n3) {
721
- var sqrtN = Math2.sqrt(n3);
720
+ function isPrime(n2) {
721
+ var sqrtN = Math2.sqrt(n2);
722
722
  for (var factor = 2; factor <= sqrtN; factor++) {
723
- if (!(n3 % factor)) {
723
+ if (!(n2 % factor)) {
724
724
  return false;
725
725
  }
726
726
  }
727
727
  return true;
728
728
  }
729
- function getFractionalBits(n3) {
730
- return (n3 - (n3 | 0)) * 4294967296 | 0;
729
+ function getFractionalBits(n2) {
730
+ return (n2 - (n2 | 0)) * 4294967296 | 0;
731
731
  }
732
- var n2 = 2;
732
+ var n = 2;
733
733
  var nPrime = 0;
734
734
  while (nPrime < 64) {
735
- if (isPrime(n2)) {
735
+ if (isPrime(n)) {
736
736
  if (nPrime < 8) {
737
- H[nPrime] = getFractionalBits(Math2.pow(n2, 1 / 2));
737
+ H[nPrime] = getFractionalBits(Math2.pow(n, 1 / 2));
738
738
  }
739
- K[nPrime] = getFractionalBits(Math2.pow(n2, 1 / 3));
739
+ K[nPrime] = getFractionalBits(Math2.pow(n, 1 / 3));
740
740
  nPrime++;
741
741
  }
742
- n2++;
742
+ n++;
743
743
  }
744
744
  })();
745
745
  var W = [];
@@ -753,7 +753,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
753
753
  var b = H2[1];
754
754
  var c = H2[2];
755
755
  var d = H2[3];
756
- var e2 = H2[4];
756
+ var e = H2[4];
757
757
  var f = H2[5];
758
758
  var g = H2[6];
759
759
  var h = H2[7];
@@ -767,16 +767,16 @@ var __privateWrapper = (obj, member, setter, getter) => ({
767
767
  var gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
768
768
  W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
769
769
  }
770
- var ch = e2 & f ^ ~e2 & g;
770
+ var ch = e & f ^ ~e & g;
771
771
  var maj = a & b ^ a & c ^ b & c;
772
772
  var sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
773
- var sigma1 = (e2 << 26 | e2 >>> 6) ^ (e2 << 21 | e2 >>> 11) ^ (e2 << 7 | e2 >>> 25);
773
+ var sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
774
774
  var t1 = h + sigma1 + ch + K[i] + W[i];
775
775
  var t2 = sigma0 + maj;
776
776
  h = g;
777
777
  g = f;
778
- f = e2;
779
- e2 = d + t1 | 0;
778
+ f = e;
779
+ e = d + t1 | 0;
780
780
  d = c;
781
781
  c = b;
782
782
  b = a;
@@ -786,7 +786,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
786
786
  H2[1] = H2[1] + b | 0;
787
787
  H2[2] = H2[2] + c | 0;
788
788
  H2[3] = H2[3] + d | 0;
789
- H2[4] = H2[4] + e2 | 0;
789
+ H2[4] = H2[4] + e | 0;
790
790
  H2[5] = H2[5] + f | 0;
791
791
  H2[6] = H2[6] + g | 0;
792
792
  H2[7] = H2[7] + h | 0;
@@ -1012,57 +1012,60 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1012
1012
  IOauth2ListenerCommand2["EXECUTE_REFRESH_TOKEN"] = "__EXECUTE_REFRESH_TOKEN";
1013
1013
  return IOauth2ListenerCommand2;
1014
1014
  })(IOauth2ListenerCommand || {});
1015
- function e(e2) {
1016
- this.message = e2;
1015
+ class InvalidTokenError extends Error {
1017
1016
  }
1018
- e.prototype = new Error(), e.prototype.name = "InvalidCharacterError";
1019
- var r = "undefined" != typeof window && window.atob && window.atob.bind(window) || function(r2) {
1020
- var t2 = String(r2).replace(/=+$/, "");
1021
- if (t2.length % 4 == 1)
1022
- throw new e("'atob' failed: The string to be decoded is not correctly encoded.");
1023
- for (var n2, o2, a = 0, i = 0, c = ""; o2 = t2.charAt(i++); ~o2 && (n2 = a % 4 ? 64 * n2 + o2 : o2, a++ % 4) ? c += String.fromCharCode(255 & n2 >> (-2 * a & 6)) : 0)
1024
- o2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o2);
1025
- return c;
1026
- };
1027
- function t(e2) {
1028
- var t2 = e2.replace(/-/g, "+").replace(/_/g, "/");
1029
- switch (t2.length % 4) {
1017
+ InvalidTokenError.prototype.name = "InvalidTokenError";
1018
+ function b64DecodeUnicode(str) {
1019
+ return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
1020
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
1021
+ if (code.length < 2) {
1022
+ code = "0" + code;
1023
+ }
1024
+ return "%" + code;
1025
+ }));
1026
+ }
1027
+ function base64UrlDecode(str) {
1028
+ let output = str.replace(/-/g, "+").replace(/_/g, "/");
1029
+ switch (output.length % 4) {
1030
1030
  case 0:
1031
1031
  break;
1032
1032
  case 2:
1033
- t2 += "==";
1033
+ output += "==";
1034
1034
  break;
1035
1035
  case 3:
1036
- t2 += "=";
1036
+ output += "=";
1037
1037
  break;
1038
1038
  default:
1039
- throw "Illegal base64url string!";
1039
+ throw new Error("base64 string is not of the correct length");
1040
1040
  }
1041
1041
  try {
1042
- return function(e3) {
1043
- return decodeURIComponent(r(e3).replace(/(.)/g, function(e4, r2) {
1044
- var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
1045
- return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
1046
- }));
1047
- }(t2);
1048
- } catch (e3) {
1049
- return r(t2);
1042
+ return b64DecodeUnicode(output);
1043
+ } catch (err) {
1044
+ return atob(output);
1050
1045
  }
1051
1046
  }
1052
- function n(e2) {
1053
- this.message = e2;
1054
- }
1055
- function o(e2, r2) {
1056
- if ("string" != typeof e2)
1057
- throw new n("Invalid token specified");
1058
- var o2 = true === (r2 = r2 || {}).header ? 0 : 1;
1047
+ function jwtDecode(token, options) {
1048
+ if (typeof token !== "string") {
1049
+ throw new InvalidTokenError("Invalid token specified: must be a string");
1050
+ }
1051
+ options || (options = {});
1052
+ const pos = options.header === true ? 0 : 1;
1053
+ const part = token.split(".")[pos];
1054
+ if (typeof part !== "string") {
1055
+ throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
1056
+ }
1057
+ let decoded;
1058
+ try {
1059
+ decoded = base64UrlDecode(part);
1060
+ } catch (e) {
1061
+ throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
1062
+ }
1059
1063
  try {
1060
- return JSON.parse(t(e2.split(".")[o2]));
1061
- } catch (e3) {
1062
- throw new n("Invalid token specified: " + e3.message);
1064
+ return JSON.parse(decoded);
1065
+ } catch (e) {
1066
+ throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
1063
1067
  }
1064
1068
  }
1065
- n.prototype = new Error(), n.prototype.name = "InvalidTokenError";
1066
1069
  const STSOauth2Store = pinia.defineStore("__sts__STSOauth2Store", {
1067
1070
  state: () => {
1068
1071
  return {
@@ -1097,7 +1100,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1097
1100
  UserDetails: (state) => {
1098
1101
  if (state.id_token) {
1099
1102
  const id_token = state.id_token;
1100
- const decodedIdToken = o(id_token);
1103
+ const decodedIdToken = jwtDecode(id_token);
1101
1104
  return decodedIdToken;
1102
1105
  } else {
1103
1106
  return null;
@@ -1985,7 +1988,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1985
1988
  const currentSessionData = sessionData.tokenResponse;
1986
1989
  const refresh_token = currentSessionData.refresh_token;
1987
1990
  console.log(refresh_token);
1988
- const decodedRefreshToken = o(refresh_token);
1991
+ const decodedRefreshToken = jwtDecode(refresh_token);
1989
1992
  console.log(decodedRefreshToken);
1990
1993
  const sessionId = decodedRefreshToken.sts_session;
1991
1994
  console.log(sessionId);