@nibssplc/cams-sdk-react 1.0.0-rc.34 → 1.0.0-rc.36
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 +113 -141
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +113 -141
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -21,155 +21,127 @@ import axios from 'axios';
|
|
|
21
21
|
import https from 'https';
|
|
22
22
|
|
|
23
23
|
// Crypto polyfill for MSAL browser compatibility
|
|
24
|
-
|
|
24
|
+
(function () {
|
|
25
|
+
var _this = this;
|
|
26
|
+
if (typeof window === 'undefined')
|
|
27
|
+
return;
|
|
25
28
|
// Ensure crypto object exists
|
|
26
29
|
if (!window.crypto) {
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(window, 'crypto', {
|
|
29
|
-
value: {},
|
|
30
|
-
writable: true,
|
|
31
|
-
configurable: true
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
// Ignore if crypto cannot be defined
|
|
36
|
-
}
|
|
30
|
+
window.crypto = {};
|
|
37
31
|
}
|
|
38
32
|
// Polyfill getRandomValues
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return array;
|
|
48
|
-
},
|
|
49
|
-
writable: true,
|
|
50
|
-
configurable: true
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
// Ignore if getRandomValues cannot be defined
|
|
55
|
-
}
|
|
33
|
+
if (!window.crypto.getRandomValues) {
|
|
34
|
+
window.crypto.getRandomValues = function (array) {
|
|
35
|
+
var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
36
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
37
|
+
bytes[i] = Math.floor(Math.random() * 256);
|
|
38
|
+
}
|
|
39
|
+
return array;
|
|
40
|
+
};
|
|
56
41
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
new
|
|
87
|
-
for (
|
|
88
|
-
w = new
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^ (w[j - 2] >>> 10);
|
|
94
|
-
w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
|
|
95
|
-
}
|
|
96
|
-
a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
|
|
97
|
-
for (j = 0; j < 64; j++) {
|
|
98
|
-
S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
|
|
99
|
-
ch = (e & f) ^ (~e & g);
|
|
100
|
-
temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
|
|
101
|
-
S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
|
|
102
|
-
maj = (a & b) ^ (a & c) ^ (b & c);
|
|
103
|
-
temp2 = (S0 + maj) >>> 0;
|
|
104
|
-
h = g;
|
|
105
|
-
g = f;
|
|
106
|
-
f = e;
|
|
107
|
-
e = (d + temp1) >>> 0;
|
|
108
|
-
d = c;
|
|
109
|
-
c = b;
|
|
110
|
-
b = a;
|
|
111
|
-
a = (temp1 + temp2) >>> 0;
|
|
112
|
-
}
|
|
113
|
-
hash[0] = (hash[0] + a) >>> 0;
|
|
114
|
-
hash[1] = (hash[1] + b) >>> 0;
|
|
115
|
-
hash[2] = (hash[2] + c) >>> 0;
|
|
116
|
-
hash[3] = (hash[3] + d) >>> 0;
|
|
117
|
-
hash[4] = (hash[4] + e) >>> 0;
|
|
118
|
-
hash[5] = (hash[5] + f) >>> 0;
|
|
119
|
-
hash[6] = (hash[6] + g) >>> 0;
|
|
120
|
-
hash[7] = (hash[7] + h) >>> 0;
|
|
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;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
bytes = new Uint8Array(data);
|
|
46
|
+
hash = new Uint32Array(8);
|
|
47
|
+
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
|
|
56
|
+
]);
|
|
57
|
+
hash[0] = 0x6a09e667;
|
|
58
|
+
hash[1] = 0xbb67ae85;
|
|
59
|
+
hash[2] = 0x3c6ef372;
|
|
60
|
+
hash[3] = 0xa54ff53a;
|
|
61
|
+
hash[4] = 0x510e527f;
|
|
62
|
+
hash[5] = 0x9b05688c;
|
|
63
|
+
hash[6] = 0x1f83d9ab;
|
|
64
|
+
hash[7] = 0x5be0cd19;
|
|
65
|
+
ml = bytes.length * 8;
|
|
66
|
+
msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
|
|
67
|
+
msg.set(bytes);
|
|
68
|
+
msg[bytes.length] = 0x80;
|
|
69
|
+
new DataView(msg.buffer).setUint32(msg.length - 4, ml, false);
|
|
70
|
+
for (i = 0; i < msg.length; i += 64) {
|
|
71
|
+
w = new Uint32Array(64);
|
|
72
|
+
for (j = 0; j < 16; j++)
|
|
73
|
+
w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
|
|
74
|
+
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);
|
|
77
|
+
w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
|
|
121
78
|
}
|
|
122
|
-
|
|
123
|
-
for (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
79
|
+
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
|
+
for (j = 0; j < 64; j++) {
|
|
81
|
+
S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
|
|
82
|
+
ch = (e & f) ^ (~e & g);
|
|
83
|
+
temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
|
|
84
|
+
S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
|
|
85
|
+
maj = (a & b) ^ (a & c) ^ (b & c);
|
|
86
|
+
temp2 = (S0 + maj) >>> 0;
|
|
87
|
+
h = g;
|
|
88
|
+
g = f;
|
|
89
|
+
f = e;
|
|
90
|
+
e = (d + temp1) >>> 0;
|
|
91
|
+
d = c;
|
|
92
|
+
c = b;
|
|
93
|
+
b = a;
|
|
94
|
+
a = (temp1 + temp2) >>> 0;
|
|
95
|
+
}
|
|
96
|
+
hash[0] = (hash[0] + a) >>> 0;
|
|
97
|
+
hash[1] = (hash[1] + b) >>> 0;
|
|
98
|
+
hash[2] = (hash[2] + c) >>> 0;
|
|
99
|
+
hash[3] = (hash[3] + d) >>> 0;
|
|
100
|
+
hash[4] = (hash[4] + e) >>> 0;
|
|
101
|
+
hash[5] = (hash[5] + f) >>> 0;
|
|
102
|
+
hash[6] = (hash[6] + g) >>> 0;
|
|
103
|
+
hash[7] = (hash[7] + h) >>> 0;
|
|
104
|
+
}
|
|
105
|
+
result = new Uint8Array(32);
|
|
106
|
+
for (i = 0; i < 8; i++)
|
|
107
|
+
new DataView(result.buffer).setUint32(i * 4, hash[i], false);
|
|
108
|
+
return [2 /*return*/, result.buffer];
|
|
109
|
+
});
|
|
110
|
+
}); };
|
|
111
|
+
// Force override crypto.subtle
|
|
112
|
+
var originalSubtle = window.crypto.subtle;
|
|
113
|
+
Object.defineProperty(window.crypto, 'subtle', {
|
|
114
|
+
value: {
|
|
115
|
+
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
116
|
+
var alg;
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
|
|
119
|
+
if (alg === 'SHA-256')
|
|
120
|
+
return [2 /*return*/, sha256(data)];
|
|
121
|
+
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
122
|
+
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
123
|
+
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
124
|
+
});
|
|
125
|
+
}); }
|
|
126
|
+
},
|
|
127
|
+
writable: true,
|
|
128
|
+
configurable: true
|
|
129
|
+
});
|
|
153
130
|
// Polyfill randomUUID
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
catch (e) {
|
|
169
|
-
// Ignore if randomUUID cannot be defined
|
|
170
|
-
}
|
|
131
|
+
if (!window.crypto.randomUUID) {
|
|
132
|
+
Object.defineProperty(window.crypto, 'randomUUID', {
|
|
133
|
+
value: function () {
|
|
134
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
135
|
+
var r = (Math.random() * 16) | 0;
|
|
136
|
+
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
137
|
+
return v.toString(16);
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
writable: true,
|
|
141
|
+
configurable: true
|
|
142
|
+
});
|
|
171
143
|
}
|
|
172
|
-
}
|
|
144
|
+
})();
|
|
173
145
|
|
|
174
146
|
/******************************************************************************
|
|
175
147
|
Copyright (c) Microsoft Corporation.
|