@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.esm.js
CHANGED
|
@@ -78,7 +78,6 @@ import https from 'https';
|
|
|
78
78
|
msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
|
|
79
79
|
msg.set(bytes);
|
|
80
80
|
msg[bytes.length] = 0x80;
|
|
81
|
-
new DataView(msg.buffer).setUint32(msg.length - 4, ml, false);
|
|
82
81
|
dv = new DataView(msg.buffer);
|
|
83
82
|
high = Math.floor(ml / 0x100000000);
|
|
84
83
|
low = ml >>> 0;
|
|
@@ -133,50 +132,40 @@ import https from 'https';
|
|
|
133
132
|
return [2 /*return*/, result.buffer];
|
|
134
133
|
});
|
|
135
134
|
}); };
|
|
136
|
-
//
|
|
135
|
+
// Store reference to original subtle if it exists
|
|
137
136
|
var originalSubtle = window.crypto.subtle;
|
|
137
|
+
// Create the polyfilled subtle object
|
|
138
|
+
var polyfillSubtle = {
|
|
139
|
+
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
140
|
+
var alg;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
alg = typeof algorithm === "string"
|
|
143
|
+
? algorithm
|
|
144
|
+
: algorithm.name;
|
|
145
|
+
if (alg === "SHA-256")
|
|
146
|
+
return [2 /*return*/, sha256(data)];
|
|
147
|
+
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
148
|
+
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
149
|
+
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
150
|
+
});
|
|
151
|
+
}); },
|
|
152
|
+
};
|
|
153
|
+
// Try to define the property, fallback to assignment if needed
|
|
138
154
|
try {
|
|
139
155
|
Object.defineProperty(window.crypto, "subtle", {
|
|
140
156
|
configurable: true,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
145
|
-
var alg;
|
|
146
|
-
return __generator(this, function (_a) {
|
|
147
|
-
alg = typeof algorithm === "string"
|
|
148
|
-
? algorithm
|
|
149
|
-
: algorithm.name;
|
|
150
|
-
if (alg === "SHA-256")
|
|
151
|
-
return [2 /*return*/, sha256(data)];
|
|
152
|
-
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
153
|
-
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
154
|
-
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
155
|
-
});
|
|
156
|
-
}); },
|
|
157
|
-
};
|
|
158
|
-
},
|
|
157
|
+
enumerable: true,
|
|
158
|
+
writable: true,
|
|
159
|
+
value: polyfillSubtle,
|
|
159
160
|
});
|
|
160
161
|
}
|
|
161
162
|
catch (_a) {
|
|
162
|
-
// Some environments prevent redefining built-ins
|
|
163
|
-
window.crypto.subtle =
|
|
164
|
-
digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
165
|
-
var alg;
|
|
166
|
-
return __generator(this, function (_a) {
|
|
167
|
-
alg = typeof algorithm === "string" ? algorithm : algorithm.name;
|
|
168
|
-
if (alg === "SHA-256")
|
|
169
|
-
return [2 /*return*/, sha256(data)];
|
|
170
|
-
if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
|
|
171
|
-
return [2 /*return*/, originalSubtle.digest(algorithm, data)];
|
|
172
|
-
throw new Error("Unsupported algorithm: ".concat(alg));
|
|
173
|
-
});
|
|
174
|
-
}); },
|
|
175
|
-
};
|
|
163
|
+
// Some environments prevent redefining built-ins
|
|
164
|
+
window.crypto.subtle = polyfillSubtle;
|
|
176
165
|
}
|
|
177
166
|
// Polyfill randomUUID
|
|
178
|
-
if (!
|
|
179
|
-
|
|
167
|
+
if (!window.crypto.randomUUID) {
|
|
168
|
+
window.crypto.randomUUID =
|
|
180
169
|
function () {
|
|
181
170
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
182
171
|
var r = (Math.random() * 16) | 0;
|
|
@@ -185,6 +174,8 @@ import https from 'https';
|
|
|
185
174
|
});
|
|
186
175
|
};
|
|
187
176
|
}
|
|
177
|
+
// Log success for debugging
|
|
178
|
+
console.log("Crypto polyfill loaded successfully");
|
|
188
179
|
})();
|
|
189
180
|
|
|
190
181
|
/******************************************************************************
|