@sphereon/ssi-sdk-ext.x509-utils
Version:
Sphereon SSI-SDK plugin functions for X.509 Certificate handling.
28 lines • 887 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.globalCrypto = void 0;
const globalCrypto = (setGlobal, suppliedCrypto) => {
var _a, _b;
let webcrypto;
if (typeof suppliedCrypto !== 'undefined') {
webcrypto = suppliedCrypto;
}
else if (typeof crypto !== 'undefined') {
webcrypto = crypto;
}
else if (typeof global.crypto !== 'undefined') {
webcrypto = global.crypto;
}
else if (typeof ((_b = (_a = global.window) === null || _a === void 0 ? void 0 : _a.crypto) === null || _b === void 0 ? void 0 : _b.subtle) !== 'undefined') {
webcrypto = global.window.crypto;
}
else {
webcrypto = require('crypto');
}
if (setGlobal) {
global.crypto = webcrypto;
}
return webcrypto;
};
exports.globalCrypto = globalCrypto;
//# sourceMappingURL=crypto.js.map