@nibssplc/cams-sdk-react 1.0.0-rc.30 → 1.0.0-rc.31
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 +6 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +6 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -75,12 +75,8 @@ if (typeof window !== 'undefined') {
|
|
|
75
75
|
// Ignore if getRandomValues cannot be defined
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
window.location.protocol === 'http:' ||
|
|
81
|
-
window.location.hostname === 'localhost' ||
|
|
82
|
-
window.location.hostname === '127.0.0.1');
|
|
83
|
-
if (needsSubtlePolyfill) {
|
|
78
|
+
// Force polyfill crypto.subtle on localhost and non-HTTPS contexts
|
|
79
|
+
if (window.crypto) {
|
|
84
80
|
var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
85
81
|
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;
|
|
86
82
|
return __generator(this, function (_a) {
|
|
@@ -150,6 +146,7 @@ if (typeof window !== 'undefined') {
|
|
|
150
146
|
return [2 /*return*/, result.buffer];
|
|
151
147
|
});
|
|
152
148
|
}); };
|
|
149
|
+
var originalSubtle_1 = window.crypto.subtle;
|
|
153
150
|
try {
|
|
154
151
|
Object.defineProperty(window.crypto, 'subtle', {
|
|
155
152
|
value: {
|
|
@@ -159,7 +156,9 @@ if (typeof window !== 'undefined') {
|
|
|
159
156
|
alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
|
|
160
157
|
if (alg === 'SHA-256')
|
|
161
158
|
return [2 /*return*/, sha256_1(data)];
|
|
162
|
-
|
|
159
|
+
// Fallback to original if available
|
|
160
|
+
if (originalSubtle_1 === null || originalSubtle_1 === void 0 ? void 0 : originalSubtle_1.digest)
|
|
161
|
+
return [2 /*return*/, originalSubtle_1.digest(algorithm, data)];
|
|
163
162
|
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
164
163
|
});
|
|
165
164
|
}); }
|