@nibssplc/cams-sdk-react 1.0.0-rc.30 → 1.0.0-rc.32
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.esm.js
CHANGED
|
@@ -54,12 +54,8 @@ if (typeof window !== 'undefined') {
|
|
|
54
54
|
// Ignore if getRandomValues cannot be defined
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
window.location.protocol === 'http:' ||
|
|
60
|
-
window.location.hostname === 'localhost' ||
|
|
61
|
-
window.location.hostname === '127.0.0.1');
|
|
62
|
-
if (needsSubtlePolyfill) {
|
|
57
|
+
// Force polyfill crypto.subtle on localhost and non-HTTPS contexts
|
|
58
|
+
if (window.crypto) {
|
|
63
59
|
var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
64
60
|
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;
|
|
65
61
|
return __generator(this, function (_a) {
|
|
@@ -129,6 +125,7 @@ if (typeof window !== 'undefined') {
|
|
|
129
125
|
return [2 /*return*/, result.buffer];
|
|
130
126
|
});
|
|
131
127
|
}); };
|
|
128
|
+
var originalSubtle_1 = window.crypto.subtle;
|
|
132
129
|
try {
|
|
133
130
|
Object.defineProperty(window.crypto, 'subtle', {
|
|
134
131
|
value: {
|
|
@@ -138,7 +135,9 @@ if (typeof window !== 'undefined') {
|
|
|
138
135
|
alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
|
|
139
136
|
if (alg === 'SHA-256')
|
|
140
137
|
return [2 /*return*/, sha256_1(data)];
|
|
141
|
-
|
|
138
|
+
// Fallback to original if available
|
|
139
|
+
if (originalSubtle_1 === null || originalSubtle_1 === void 0 ? void 0 : originalSubtle_1.digest)
|
|
140
|
+
return [2 /*return*/, originalSubtle_1.digest(algorithm, data)];
|
|
142
141
|
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
143
142
|
});
|
|
144
143
|
}); }
|