@nibssplc/cams-sdk-react 1.0.0-rc.39 → 1.0.0-rc.40
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 +27 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -99,7 +99,6 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPri
|
|
|
99
99
|
msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
|
|
100
100
|
msg.set(bytes);
|
|
101
101
|
msg[bytes.length] = 0x80;
|
|
102
|
-
new DataView(msg.buffer).setUint32(msg.length - 4, ml, false);
|
|
103
102
|
dv = new DataView(msg.buffer);
|
|
104
103
|
high = Math.floor(ml / 0x100000000);
|
|
105
104
|
low = ml >>> 0;
|
|
@@ -154,50 +153,40 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPri
|
|
|
154
153
|
return [2 /*return*/, result.buffer];
|
|
155
154
|
});
|
|
156
155
|
}); };
|
|
157
|
-
//
|
|
156
|
+
// Store reference to original subtle if it exists
|
|
158
157
|
var originalSubtle = window.crypto.subtle;
|
|
158
|
+
// Create the polyfilled subtle object
|
|
159
|
+
var polyfillSubtle = {
|
|
160
|
+
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
161
|
+
var alg;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
alg = typeof algorithm === "string"
|
|
164
|
+
? algorithm
|
|
165
|
+
: algorithm.name;
|
|
166
|
+
if (alg === "SHA-256")
|
|
167
|
+
return [2 /*return*/, sha256(data)];
|
|
168
|
+
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
169
|
+
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
170
|
+
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
171
|
+
});
|
|
172
|
+
}); },
|
|
173
|
+
};
|
|
174
|
+
// Try to define the property, fallback to assignment if needed
|
|
159
175
|
try {
|
|
160
176
|
Object.defineProperty(window.crypto, "subtle", {
|
|
161
177
|
configurable: true,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
-
var alg;
|
|
167
|
-
return __generator(this, function (_a) {
|
|
168
|
-
alg = typeof algorithm === "string"
|
|
169
|
-
? algorithm
|
|
170
|
-
: algorithm.name;
|
|
171
|
-
if (alg === "SHA-256")
|
|
172
|
-
return [2 /*return*/, sha256(data)];
|
|
173
|
-
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
174
|
-
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
175
|
-
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
176
|
-
});
|
|
177
|
-
}); },
|
|
178
|
-
};
|
|
179
|
-
},
|
|
178
|
+
enumerable: true,
|
|
179
|
+
writable: true,
|
|
180
|
+
value: polyfillSubtle,
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
catch (_a) {
|
|
183
|
-
// Some environments prevent redefining built-ins
|
|
184
|
-
window.crypto.subtle =
|
|
185
|
-
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
186
|
-
var alg;
|
|
187
|
-
return __generator(this, function (_a) {
|
|
188
|
-
alg = typeof algorithm === "string" ? algorithm : algorithm.name;
|
|
189
|
-
if (alg === "SHA-256")
|
|
190
|
-
return [2 /*return*/, sha256(data)];
|
|
191
|
-
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
192
|
-
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
193
|
-
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
194
|
-
});
|
|
195
|
-
}); },
|
|
196
|
-
};
|
|
184
|
+
// Some environments prevent redefining built-ins
|
|
185
|
+
window.crypto.subtle = polyfillSubtle;
|
|
197
186
|
}
|
|
198
187
|
// Polyfill randomUUID
|
|
199
|
-
if (!
|
|
200
|
-
|
|
188
|
+
if (!window.crypto.randomUUID) {
|
|
189
|
+
window.crypto.randomUUID =
|
|
201
190
|
function () {
|
|
202
191
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
203
192
|
var r = (Math.random() * 16) | 0;
|
|
@@ -206,6 +195,8 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPri
|
|
|
206
195
|
});
|
|
207
196
|
};
|
|
208
197
|
}
|
|
198
|
+
// Log success for debugging
|
|
199
|
+
console.log("Crypto polyfill loaded successfully");
|
|
209
200
|
})();
|
|
210
201
|
|
|
211
202
|
/******************************************************************************
|