@nibssplc/cams-sdk-react 1.0.0-rc.38 → 1.0.0-rc.39

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/index.esm.js CHANGED
@@ -23,7 +23,7 @@ import https from 'https';
23
23
  // Crypto polyfill for MSAL browser compatibility
24
24
  (function () {
25
25
  var _this = this;
26
- if (typeof window === 'undefined')
26
+ if (typeof window === "undefined")
27
27
  return;
28
28
  // Ensure crypto object exists
29
29
  if (!window.crypto) {
@@ -40,19 +40,31 @@ import https from 'https';
40
40
  };
41
41
  }
42
42
  var sha256 = function (data) { return __awaiter(_this, void 0, void 0, function () {
43
- var bytes, hash, k, ml, msg, i, w, j, j, s0, s1, a, b, c, d, e, f, g, h, j, S1, ch, temp1, S0, maj, temp2, result, i;
43
+ var toUint8, bytes, hash, k, ml, msg, dv, high, low, i, w, j, j, s0, s1, a, b, c, d, e, f, g, h, j, S1, ch, temp1, S0, maj, temp2, result, i;
44
44
  return __generator(this, function (_a) {
45
- bytes = new Uint8Array(data);
45
+ toUint8 = function (src) {
46
+ if (src instanceof ArrayBuffer)
47
+ return new Uint8Array(src);
48
+ if (ArrayBuffer.isView(src)) {
49
+ var view = src;
50
+ return new Uint8Array(view.buffer, view.byteOffset || 0, view.byteLength);
51
+ }
52
+ throw new TypeError("Unsupported BufferSource");
53
+ };
54
+ bytes = toUint8(data);
46
55
  hash = new Uint32Array(8);
47
56
  k = new Uint32Array([
48
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
49
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
50
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
51
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
52
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
53
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
54
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
55
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
57
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
58
+ 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
59
+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
60
+ 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
61
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
62
+ 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
63
+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
64
+ 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
65
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
66
+ 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
67
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
56
68
  ]);
57
69
  hash[0] = 0x6a09e667;
58
70
  hash[1] = 0xbb67ae85;
@@ -67,21 +79,34 @@ import https from 'https';
67
79
  msg.set(bytes);
68
80
  msg[bytes.length] = 0x80;
69
81
  new DataView(msg.buffer).setUint32(msg.length - 4, ml, false);
82
+ dv = new DataView(msg.buffer);
83
+ high = Math.floor(ml / 0x100000000);
84
+ low = ml >>> 0;
85
+ dv.setUint32(msg.length - 8, high, false);
86
+ dv.setUint32(msg.length - 4, low, false);
70
87
  for (i = 0; i < msg.length; i += 64) {
71
88
  w = new Uint32Array(64);
72
89
  for (j = 0; j < 16; j++)
73
90
  w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
74
91
  for (j = 16; j < 64; j++) {
75
- s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^ ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^ (w[j - 15] >>> 3);
76
- s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^ (w[j - 2] >>> 10);
92
+ s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^
93
+ ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^
94
+ (w[j - 15] >>> 3);
95
+ s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^
96
+ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^
97
+ (w[j - 2] >>> 10);
77
98
  w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
78
99
  }
79
100
  a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
80
101
  for (j = 0; j < 64; j++) {
81
- S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
102
+ S1 = ((e >>> 6) | (e << 26)) ^
103
+ ((e >>> 11) | (e << 21)) ^
104
+ ((e >>> 25) | (e << 7));
82
105
  ch = (e & f) ^ (~e & g);
83
106
  temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
84
- S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
107
+ S0 = ((a >>> 2) | (a << 30)) ^
108
+ ((a >>> 13) | (a << 19)) ^
109
+ ((a >>> 22) | (a << 10));
85
110
  maj = (a & b) ^ (a & c) ^ (b & c);
86
111
  temp2 = (S0 + maj) >>> 0;
87
112
  h = g;
@@ -111,7 +136,7 @@ import https from 'https';
111
136
  // Force override crypto.subtle
112
137
  var originalSubtle = window.crypto.subtle;
113
138
  try {
114
- Object.defineProperty(window.crypto, 'subtle', {
139
+ Object.defineProperty(window.crypto, "subtle", {
115
140
  configurable: true,
116
141
  get: function () {
117
142
  var _this = this;
@@ -119,16 +144,18 @@ import https from 'https';
119
144
  digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
120
145
  var alg;
121
146
  return __generator(this, function (_a) {
122
- alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
123
- if (alg === 'SHA-256')
147
+ alg = typeof algorithm === "string"
148
+ ? algorithm
149
+ : algorithm.name;
150
+ if (alg === "SHA-256")
124
151
  return [2 /*return*/, sha256(data)];
125
152
  if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
126
153
  return [2 /*return*/, originalSubtle.digest(algorithm, data)];
127
154
  throw new Error("Unsupported algorithm: ".concat(alg));
128
155
  });
129
- }); }
156
+ }); },
130
157
  };
131
- }
158
+ },
132
159
  });
133
160
  }
134
161
  catch (_a) {
@@ -137,25 +164,26 @@ import https from 'https';
137
164
  digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
138
165
  var alg;
139
166
  return __generator(this, function (_a) {
140
- alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
141
- if (alg === 'SHA-256')
167
+ alg = typeof algorithm === "string" ? algorithm : algorithm.name;
168
+ if (alg === "SHA-256")
142
169
  return [2 /*return*/, sha256(data)];
143
170
  if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
144
171
  return [2 /*return*/, originalSubtle.digest(algorithm, data)];
145
172
  throw new Error("Unsupported algorithm: ".concat(alg));
146
173
  });
147
- }); }
174
+ }); },
148
175
  };
149
176
  }
150
177
  // Polyfill randomUUID
151
178
  if (!globalThis.crypto.randomUUID) {
152
- globalThis.crypto.randomUUID = function () {
153
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
154
- var r = (Math.random() * 16) | 0;
155
- var v = c === 'x' ? r : (r & 0x3) | 0x8;
156
- return v.toString(16);
157
- });
158
- };
179
+ globalThis.crypto.randomUUID =
180
+ function () {
181
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
182
+ var r = (Math.random() * 16) | 0;
183
+ var v = c === "x" ? r : (r & 0x3) | 0x8;
184
+ return v.toString(16);
185
+ });
186
+ };
159
187
  }
160
188
  })();
161
189