@nibssplc/cams-sdk-react 1.0.0-rc.43 → 1.0.0-rc.45
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/components/DefaultLoginPage.d.ts +0 -1
- package/dist/hooks/useCAMSMSALAuth.d.ts +1 -0
- package/dist/index.cjs.js +141 -156
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +141 -156
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -41,162 +41,6 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
41
41
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
|
|
42
42
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
|
|
43
43
|
|
|
44
|
-
// Crypto polyfill for MSAL browser compatibility
|
|
45
|
-
if (typeof window !== "undefined") {
|
|
46
|
-
// Run immediately and synchronously
|
|
47
|
-
// Ensure crypto object exists
|
|
48
|
-
if (!window.crypto) {
|
|
49
|
-
window.crypto = {};
|
|
50
|
-
}
|
|
51
|
-
// Polyfill getRandomValues
|
|
52
|
-
if (!window.crypto.getRandomValues) {
|
|
53
|
-
window.crypto.getRandomValues = function (array) {
|
|
54
|
-
var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
55
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
56
|
-
bytes[i] = Math.floor(Math.random() * 256);
|
|
57
|
-
}
|
|
58
|
-
return array;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62
|
-
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;
|
|
63
|
-
return __generator(this, function (_a) {
|
|
64
|
-
toUint8 = function (src) {
|
|
65
|
-
if (src instanceof ArrayBuffer)
|
|
66
|
-
return new Uint8Array(src);
|
|
67
|
-
if (ArrayBuffer.isView(src)) {
|
|
68
|
-
var view = src;
|
|
69
|
-
return new Uint8Array(view.buffer, view.byteOffset || 0, view.byteLength);
|
|
70
|
-
}
|
|
71
|
-
throw new TypeError("Unsupported BufferSource");
|
|
72
|
-
};
|
|
73
|
-
bytes = toUint8(data);
|
|
74
|
-
hash = new Uint32Array(8);
|
|
75
|
-
k = new Uint32Array([
|
|
76
|
-
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
|
77
|
-
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
78
|
-
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
|
79
|
-
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
80
|
-
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
|
81
|
-
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
82
|
-
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
|
83
|
-
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
84
|
-
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
|
85
|
-
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
86
|
-
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
87
|
-
]);
|
|
88
|
-
hash[0] = 0x6a09e667;
|
|
89
|
-
hash[1] = 0xbb67ae85;
|
|
90
|
-
hash[2] = 0x3c6ef372;
|
|
91
|
-
hash[3] = 0xa54ff53a;
|
|
92
|
-
hash[4] = 0x510e527f;
|
|
93
|
-
hash[5] = 0x9b05688c;
|
|
94
|
-
hash[6] = 0x1f83d9ab;
|
|
95
|
-
hash[7] = 0x5be0cd19;
|
|
96
|
-
ml = bytes.length * 8;
|
|
97
|
-
msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
|
|
98
|
-
msg.set(bytes);
|
|
99
|
-
msg[bytes.length] = 0x80;
|
|
100
|
-
dv = new DataView(msg.buffer);
|
|
101
|
-
high = Math.floor(ml / 0x100000000);
|
|
102
|
-
low = ml >>> 0;
|
|
103
|
-
dv.setUint32(msg.length - 8, high, false);
|
|
104
|
-
dv.setUint32(msg.length - 4, low, false);
|
|
105
|
-
for (i = 0; i < msg.length; i += 64) {
|
|
106
|
-
w = new Uint32Array(64);
|
|
107
|
-
for (j = 0; j < 16; j++)
|
|
108
|
-
w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
|
|
109
|
-
for (j = 16; j < 64; j++) {
|
|
110
|
-
s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^
|
|
111
|
-
((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^
|
|
112
|
-
(w[j - 15] >>> 3);
|
|
113
|
-
s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^
|
|
114
|
-
((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^
|
|
115
|
-
(w[j - 2] >>> 10);
|
|
116
|
-
w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
|
|
117
|
-
}
|
|
118
|
-
a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
|
|
119
|
-
for (j = 0; j < 64; j++) {
|
|
120
|
-
S1 = ((e >>> 6) | (e << 26)) ^
|
|
121
|
-
((e >>> 11) | (e << 21)) ^
|
|
122
|
-
((e >>> 25) | (e << 7));
|
|
123
|
-
ch = (e & f) ^ (~e & g);
|
|
124
|
-
temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
|
|
125
|
-
S0 = ((a >>> 2) | (a << 30)) ^
|
|
126
|
-
((a >>> 13) | (a << 19)) ^
|
|
127
|
-
((a >>> 22) | (a << 10));
|
|
128
|
-
maj = (a & b) ^ (a & c) ^ (b & c);
|
|
129
|
-
temp2 = (S0 + maj) >>> 0;
|
|
130
|
-
h = g;
|
|
131
|
-
g = f;
|
|
132
|
-
f = e;
|
|
133
|
-
e = (d + temp1) >>> 0;
|
|
134
|
-
d = c;
|
|
135
|
-
c = b;
|
|
136
|
-
b = a;
|
|
137
|
-
a = (temp1 + temp2) >>> 0;
|
|
138
|
-
}
|
|
139
|
-
hash[0] = (hash[0] + a) >>> 0;
|
|
140
|
-
hash[1] = (hash[1] + b) >>> 0;
|
|
141
|
-
hash[2] = (hash[2] + c) >>> 0;
|
|
142
|
-
hash[3] = (hash[3] + d) >>> 0;
|
|
143
|
-
hash[4] = (hash[4] + e) >>> 0;
|
|
144
|
-
hash[5] = (hash[5] + f) >>> 0;
|
|
145
|
-
hash[6] = (hash[6] + g) >>> 0;
|
|
146
|
-
hash[7] = (hash[7] + h) >>> 0;
|
|
147
|
-
}
|
|
148
|
-
result = new Uint8Array(32);
|
|
149
|
-
for (i = 0; i < 8; i++)
|
|
150
|
-
new DataView(result.buffer).setUint32(i * 4, hash[i], false);
|
|
151
|
-
return [2 /*return*/, result.buffer];
|
|
152
|
-
});
|
|
153
|
-
}); };
|
|
154
|
-
// Store reference to original subtle if it exists
|
|
155
|
-
var originalSubtle_1 = window.crypto.subtle;
|
|
156
|
-
// Create the polyfilled subtle object
|
|
157
|
-
var polyfillSubtle = {
|
|
158
|
-
digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
-
var alg;
|
|
160
|
-
return __generator(this, function (_a) {
|
|
161
|
-
alg = typeof algorithm === "string"
|
|
162
|
-
? algorithm
|
|
163
|
-
: algorithm.name;
|
|
164
|
-
if (alg === "SHA-256")
|
|
165
|
-
return [2 /*return*/, sha256_1(data)];
|
|
166
|
-
if (originalSubtle_1 === null || originalSubtle_1 === void 0 ? void 0 : originalSubtle_1.digest)
|
|
167
|
-
return [2 /*return*/, originalSubtle_1.digest(algorithm, data)];
|
|
168
|
-
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
169
|
-
});
|
|
170
|
-
}); },
|
|
171
|
-
};
|
|
172
|
-
// Try to define the property, fallback to assignment if needed
|
|
173
|
-
try {
|
|
174
|
-
Object.defineProperty(window.crypto, "subtle", {
|
|
175
|
-
configurable: true,
|
|
176
|
-
enumerable: true,
|
|
177
|
-
writable: true,
|
|
178
|
-
value: polyfillSubtle,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
catch (_a) {
|
|
182
|
-
// Some environments prevent redefining built-ins
|
|
183
|
-
window.crypto.subtle = polyfillSubtle;
|
|
184
|
-
}
|
|
185
|
-
// Polyfill randomUUID
|
|
186
|
-
if (!window.crypto.randomUUID) {
|
|
187
|
-
window.crypto.randomUUID =
|
|
188
|
-
function () {
|
|
189
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
190
|
-
var r = (Math.random() * 16) | 0;
|
|
191
|
-
var v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
192
|
-
return v.toString(16);
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
// Log success for debugging
|
|
197
|
-
console.log("Crypto polyfill loaded successfully");
|
|
198
|
-
}
|
|
199
|
-
|
|
200
44
|
/******************************************************************************
|
|
201
45
|
Copyright (c) Microsoft Corporation.
|
|
202
46
|
|
|
@@ -426,6 +270,147 @@ function useCAMSAuth(options) {
|
|
|
426
270
|
};
|
|
427
271
|
}
|
|
428
272
|
|
|
273
|
+
var _a;
|
|
274
|
+
// Crypto polyfill for MSAL browser compatibility
|
|
275
|
+
// Only apply if crypto.subtle is completely missing
|
|
276
|
+
if (typeof window !== "undefined" && !((_a = window.crypto) === null || _a === void 0 ? void 0 : _a.subtle)) {
|
|
277
|
+
// Ensure crypto object exists
|
|
278
|
+
if (!window.crypto) {
|
|
279
|
+
window.crypto = {};
|
|
280
|
+
}
|
|
281
|
+
// Polyfill getRandomValues
|
|
282
|
+
if (!window.crypto.getRandomValues) {
|
|
283
|
+
window.crypto.getRandomValues = function (array) {
|
|
284
|
+
var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
285
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
286
|
+
bytes[i] = Math.floor(Math.random() * 256);
|
|
287
|
+
}
|
|
288
|
+
return array;
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
292
|
+
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;
|
|
293
|
+
return __generator(this, function (_a) {
|
|
294
|
+
toUint8 = function (src) {
|
|
295
|
+
if (src instanceof ArrayBuffer)
|
|
296
|
+
return new Uint8Array(src);
|
|
297
|
+
if (ArrayBuffer.isView(src)) {
|
|
298
|
+
var view = src;
|
|
299
|
+
return new Uint8Array(view.buffer, view.byteOffset || 0, view.byteLength);
|
|
300
|
+
}
|
|
301
|
+
throw new TypeError("Unsupported BufferSource");
|
|
302
|
+
};
|
|
303
|
+
bytes = toUint8(data);
|
|
304
|
+
hash = new Uint32Array(8);
|
|
305
|
+
k = new Uint32Array([
|
|
306
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
|
307
|
+
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
308
|
+
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
|
309
|
+
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
310
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
|
311
|
+
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
312
|
+
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
|
313
|
+
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
314
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
|
315
|
+
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
316
|
+
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
317
|
+
]);
|
|
318
|
+
hash[0] = 0x6a09e667;
|
|
319
|
+
hash[1] = 0xbb67ae85;
|
|
320
|
+
hash[2] = 0x3c6ef372;
|
|
321
|
+
hash[3] = 0xa54ff53a;
|
|
322
|
+
hash[4] = 0x510e527f;
|
|
323
|
+
hash[5] = 0x9b05688c;
|
|
324
|
+
hash[6] = 0x1f83d9ab;
|
|
325
|
+
hash[7] = 0x5be0cd19;
|
|
326
|
+
ml = bytes.length * 8;
|
|
327
|
+
msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
|
|
328
|
+
msg.set(bytes);
|
|
329
|
+
msg[bytes.length] = 0x80;
|
|
330
|
+
dv = new DataView(msg.buffer);
|
|
331
|
+
high = Math.floor(ml / 0x100000000);
|
|
332
|
+
low = ml >>> 0;
|
|
333
|
+
dv.setUint32(msg.length - 8, high, false);
|
|
334
|
+
dv.setUint32(msg.length - 4, low, false);
|
|
335
|
+
for (i = 0; i < msg.length; i += 64) {
|
|
336
|
+
w = new Uint32Array(64);
|
|
337
|
+
for (j = 0; j < 16; j++)
|
|
338
|
+
w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
|
|
339
|
+
for (j = 16; j < 64; j++) {
|
|
340
|
+
s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^
|
|
341
|
+
((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^
|
|
342
|
+
(w[j - 15] >>> 3);
|
|
343
|
+
s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^
|
|
344
|
+
((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^
|
|
345
|
+
(w[j - 2] >>> 10);
|
|
346
|
+
w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
|
|
347
|
+
}
|
|
348
|
+
a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
|
|
349
|
+
for (j = 0; j < 64; j++) {
|
|
350
|
+
S1 = ((e >>> 6) | (e << 26)) ^
|
|
351
|
+
((e >>> 11) | (e << 21)) ^
|
|
352
|
+
((e >>> 25) | (e << 7));
|
|
353
|
+
ch = (e & f) ^ (~e & g);
|
|
354
|
+
temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
|
|
355
|
+
S0 = ((a >>> 2) | (a << 30)) ^
|
|
356
|
+
((a >>> 13) | (a << 19)) ^
|
|
357
|
+
((a >>> 22) | (a << 10));
|
|
358
|
+
maj = (a & b) ^ (a & c) ^ (b & c);
|
|
359
|
+
temp2 = (S0 + maj) >>> 0;
|
|
360
|
+
h = g;
|
|
361
|
+
g = f;
|
|
362
|
+
f = e;
|
|
363
|
+
e = (d + temp1) >>> 0;
|
|
364
|
+
d = c;
|
|
365
|
+
c = b;
|
|
366
|
+
b = a;
|
|
367
|
+
a = (temp1 + temp2) >>> 0;
|
|
368
|
+
}
|
|
369
|
+
hash[0] = (hash[0] + a) >>> 0;
|
|
370
|
+
hash[1] = (hash[1] + b) >>> 0;
|
|
371
|
+
hash[2] = (hash[2] + c) >>> 0;
|
|
372
|
+
hash[3] = (hash[3] + d) >>> 0;
|
|
373
|
+
hash[4] = (hash[4] + e) >>> 0;
|
|
374
|
+
hash[5] = (hash[5] + f) >>> 0;
|
|
375
|
+
hash[6] = (hash[6] + g) >>> 0;
|
|
376
|
+
hash[7] = (hash[7] + h) >>> 0;
|
|
377
|
+
}
|
|
378
|
+
result = new Uint8Array(32);
|
|
379
|
+
for (i = 0; i < 8; i++)
|
|
380
|
+
new DataView(result.buffer).setUint32(i * 4, hash[i], false);
|
|
381
|
+
return [2 /*return*/, result.buffer];
|
|
382
|
+
});
|
|
383
|
+
}); };
|
|
384
|
+
// Create the polyfilled subtle object
|
|
385
|
+
var polyfillSubtle = {
|
|
386
|
+
digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
387
|
+
var alg;
|
|
388
|
+
return __generator(this, function (_a) {
|
|
389
|
+
alg = typeof algorithm === "string"
|
|
390
|
+
? algorithm
|
|
391
|
+
: algorithm.name;
|
|
392
|
+
if (alg === "SHA-256")
|
|
393
|
+
return [2 /*return*/, sha256_1(data)];
|
|
394
|
+
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
395
|
+
});
|
|
396
|
+
}); },
|
|
397
|
+
};
|
|
398
|
+
// Set the polyfilled subtle object
|
|
399
|
+
window.crypto.subtle = polyfillSubtle;
|
|
400
|
+
// Polyfill randomUUID
|
|
401
|
+
if (!window.crypto.randomUUID) {
|
|
402
|
+
window.crypto.randomUUID =
|
|
403
|
+
function () {
|
|
404
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
405
|
+
var r = (Math.random() * 16) | 0;
|
|
406
|
+
var v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
407
|
+
return v.toString(16);
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
console.log("Crypto polyfill applied (native crypto.subtle not available)");
|
|
412
|
+
}
|
|
413
|
+
|
|
429
414
|
var setCookie = function (name, value, days) {
|
|
430
415
|
if (days === void 0) { days = 1; }
|
|
431
416
|
var expires = new Date(Date.now() + days * 24 * 60 * 60 * 1000).toUTCString();
|