@nibssplc/cams-sdk-react 1.0.0-rc.36 → 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 +34 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +34 -18
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -110,8 +110,30 @@ import https from 'https';
|
|
|
110
110
|
}); };
|
|
111
111
|
// Force override crypto.subtle
|
|
112
112
|
var originalSubtle = window.crypto.subtle;
|
|
113
|
-
|
|
114
|
-
|
|
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 = {
|
|
115
137
|
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
116
138
|
var alg;
|
|
117
139
|
return __generator(this, function (_a) {
|
|
@@ -123,23 +145,17 @@ import https from 'https';
|
|
|
123
145
|
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
124
146
|
});
|
|
125
147
|
}); }
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
configurable: true
|
|
129
|
-
});
|
|
148
|
+
};
|
|
149
|
+
}
|
|
130
150
|
// Polyfill randomUUID
|
|
131
|
-
if (!
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
},
|
|
140
|
-
writable: true,
|
|
141
|
-
configurable: true
|
|
142
|
-
});
|
|
151
|
+
if (!globalThis.crypto.randomUUID) {
|
|
152
|
+
globalThis.crypto.randomUUID = function () {
|
|
153
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
154
|
+
var r = (Math.random() * 16) | 0;
|
|
155
|
+
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
156
|
+
return v.toString(16);
|
|
157
|
+
});
|
|
158
|
+
};
|
|
143
159
|
}
|
|
144
160
|
})();
|
|
145
161
|
|