telegram-mtproto
Version:
Telegram MTProto library
36 lines (31 loc) • 749 B
JavaScript
import { isNode } from '../runtime';
function testWebCrypto() {
var webCrypto = void 0;
try {
/* eslint-disable */
if (typeof window !== 'undefined') {
if (window.crypto) {
webCrypto = window.crypto.subtle || window.crypto.webkitSubtle;
} else if (window.msCrypto) {
webCrypto = window.msCrypto.subtle;
}
}
} finally {
return webCrypto;
}
}
var cryptoCommon = (() => {
var webCrypto = testWebCrypto();
var useWebCrypto = !!webCrypto;
return {
webCrypto,
use: {
webCrypto: useWebCrypto,
sha1Crypto: useWebCrypto,
sha256Crypto: useWebCrypto,
webworker: !isNode
}
};
})();
export default cryptoCommon;
//# sourceMappingURL=common-provider.js.map