@cosmjs/crypto
Advanced tools
Comparing version 0.29.4 to 0.29.5
@@ -53,10 +53,14 @@ "use strict"; | ||
async function getSubtle() { | ||
const g = globalThis; | ||
let subtle = g.crypto && g.crypto.subtle; | ||
if (!subtle) { | ||
const crypto = await getCryptoModule(); | ||
if (crypto && crypto.webcrypto && crypto.webcrypto.subtle) { | ||
subtle = crypto.webcrypto.subtle; | ||
} | ||
} | ||
// From Node.js 15 onwards, webcrypto is available in globalThis. | ||
// In version 15 and 16 this was stored under the webcrypto key. | ||
// With Node.js 17 it was moved to the same locations where browsers | ||
// make it available. | ||
// Loading `require("crypto")` here seems unnecessary since it only | ||
// causes issues with bundlers and does not increase compatibility. | ||
var _a, _b, _c; | ||
// Browsers and Node.js 17+ | ||
let subtle = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.subtle; | ||
// Node.js 15+ | ||
if (!subtle) | ||
subtle = (_c = (_b = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _b === void 0 ? void 0 : _b.webcrypto) === null || _c === void 0 ? void 0 : _c.subtle; | ||
return subtle; | ||
@@ -63,0 +67,0 @@ } |
{ | ||
"name": "@cosmjs/crypto", | ||
"version": "0.29.4", | ||
"version": "0.29.5", | ||
"description": "Cryptography resources for blockchain projects", | ||
@@ -44,5 +44,5 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/encoding": "^0.29.4", | ||
"@cosmjs/math": "^0.29.4", | ||
"@cosmjs/utils": "^0.29.4", | ||
"@cosmjs/encoding": "^0.29.5", | ||
"@cosmjs/math": "^0.29.5", | ||
"@cosmjs/utils": "^0.29.5", | ||
"@noble/hashes": "^1", | ||
@@ -83,3 +83,3 @@ "bn.js": "^5.2.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.4.1", | ||
"prettier": "^2.8.1", | ||
"ses": "^0.11.0", | ||
@@ -86,0 +86,0 @@ "source-map-support": "^0.5.19", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139191
3422
Updated@cosmjs/encoding@^0.29.5
Updated@cosmjs/math@^0.29.5
Updated@cosmjs/utils@^0.29.5