@nibssplc/cams-sdk-react 1.0.0-rc.37 → 1.0.0-rc.38
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 +39 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +39 -15
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -110,22 +110,46 @@ import https from 'https';
|
|
|
110
110
|
}); };
|
|
111
111
|
// Force override crypto.subtle
|
|
112
112
|
var originalSubtle = window.crypto.subtle;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
try {
|
|
114
|
+
Object.defineProperty(window.crypto, 'subtle', {
|
|
115
|
+
configurable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
var _this = this;
|
|
118
|
+
return {
|
|
119
|
+
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
120
|
+
var alg;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
|
|
123
|
+
if (alg === 'SHA-256')
|
|
124
|
+
return [2 /*return*/, sha256(data)];
|
|
125
|
+
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
126
|
+
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
127
|
+
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
128
|
+
});
|
|
129
|
+
}); }
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (_a) {
|
|
135
|
+
// Some environments prevent redefining built-ins; fallback to a typed assertion assignment
|
|
136
|
+
window.crypto.subtle = {
|
|
137
|
+
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
138
|
+
var alg;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
|
|
141
|
+
if (alg === 'SHA-256')
|
|
142
|
+
return [2 /*return*/, sha256(data)];
|
|
143
|
+
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
144
|
+
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
145
|
+
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
146
|
+
});
|
|
147
|
+
}); }
|
|
148
|
+
};
|
|
149
|
+
}
|
|
126
150
|
// Polyfill randomUUID
|
|
127
|
-
if (!
|
|
128
|
-
|
|
151
|
+
if (!globalThis.crypto.randomUUID) {
|
|
152
|
+
globalThis.crypto.randomUUID = function () {
|
|
129
153
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
130
154
|
var r = (Math.random() * 16) | 0;
|
|
131
155
|
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|