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