diff --git a/.pnp.cjs b/.pnp.cjs index 79e3942650..ee5b461126 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -564,7 +564,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ],\ [\ "@types/libsodium-wrappers",\ - "npm:0.7.9"\ + "npm:0.7.10"\ + ],\ + [\ + "@types/libsodium-wrappers-sumo",\ + "npm:0.7.5"\ ],\ [\ "@types/long",\ @@ -1851,12 +1855,12 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "npm:0.4.1"\ ],\ [\ - "libsodium",\ - "npm:0.7.9"\ + "libsodium-sumo",\ + "npm:0.7.11"\ ],\ [\ - "libsodium-wrappers",\ - "npm:0.7.9"\ + "libsodium-wrappers-sumo",\ + "npm:0.7.11"\ ],\ [\ "load-json-file",\ @@ -3336,7 +3340,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/karma-firefox-launcher", "npm:2.1.0"],\ ["@types/karma-jasmine", "npm:4.0.2"],\ ["@types/karma-jasmine-html-reporter", "npm:1.5.1"],\ - ["@types/libsodium-wrappers", "npm:0.7.9"],\ + ["@types/libsodium-wrappers-sumo", "npm:0.7.5"],\ ["@types/node", "npm:18.15.11"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ @@ -3358,7 +3362,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["karma-firefox-launcher", "npm:2.1.0"],\ ["karma-jasmine", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.1.0"],\ ["karma-jasmine-html-reporter", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:1.6.0"],\ - ["libsodium-wrappers", "npm:0.7.9"],\ + ["libsodium-wrappers-sumo", "npm:0.7.11"],\ ["nyc", "npm:15.1.0"],\ ["prettier", "npm:2.8.1"],\ ["ses", "npm:0.11.1"],\ @@ -4725,10 +4729,20 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["@types/libsodium-wrappers", [\ - ["npm:0.7.9", {\ - "packageLocation": "./.yarn/cache/@types-libsodium-wrappers-npm-0.7.9-4b14af299f-5ddf61b804.zip/node_modules/@types/libsodium-wrappers/",\ + ["npm:0.7.10", {\ + "packageLocation": "./.yarn/cache/@types-libsodium-wrappers-npm-0.7.10-1977488a6a-717054ebcb.zip/node_modules/@types/libsodium-wrappers/",\ + "packageDependencies": [\ + ["@types/libsodium-wrappers", "npm:0.7.10"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@types/libsodium-wrappers-sumo", [\ + ["npm:0.7.5", {\ + "packageLocation": "./.yarn/cache/@types-libsodium-wrappers-sumo-npm-0.7.5-b503484acd-27846e49cd.zip/node_modules/@types/libsodium-wrappers-sumo/",\ "packageDependencies": [\ - ["@types/libsodium-wrappers", "npm:0.7.9"]\ + ["@types/libsodium-wrappers-sumo", "npm:0.7.5"],\ + ["@types/libsodium-wrappers", "npm:0.7.10"]\ ],\ "linkType": "HARD"\ }]\ @@ -9536,21 +9550,21 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["libsodium", [\ - ["npm:0.7.9", {\ - "packageLocation": "./.yarn/cache/libsodium-npm-0.7.9-98a3b621b1-1c922c9972.zip/node_modules/libsodium/",\ + ["libsodium-sumo", [\ + ["npm:0.7.11", {\ + "packageLocation": "./.yarn/cache/libsodium-sumo-npm-0.7.11-aaac6bcc6c-9efac902a0.zip/node_modules/libsodium-sumo/",\ "packageDependencies": [\ - ["libsodium", "npm:0.7.9"]\ + ["libsodium-sumo", "npm:0.7.11"]\ ],\ "linkType": "HARD"\ }]\ ]],\ - ["libsodium-wrappers", [\ - ["npm:0.7.9", {\ - "packageLocation": "./.yarn/cache/libsodium-wrappers-npm-0.7.9-be74b30f7d-b5b1b9e1b4.zip/node_modules/libsodium-wrappers/",\ + ["libsodium-wrappers-sumo", [\ + ["npm:0.7.11", {\ + "packageLocation": "./.yarn/cache/libsodium-wrappers-sumo-npm-0.7.11-08fe1b2cf4-26c7aaf8c4.zip/node_modules/libsodium-wrappers-sumo/",\ "packageDependencies": [\ - ["libsodium-wrappers", "npm:0.7.9"],\ - ["libsodium", "npm:0.7.9"]\ + ["libsodium-wrappers-sumo", "npm:0.7.11"],\ + ["libsodium-sumo", "npm:0.7.11"]\ ],\ "linkType": "HARD"\ }]\ diff --git a/.yarn/cache/@types-libsodium-wrappers-npm-0.7.10-1977488a6a-717054ebcb.zip b/.yarn/cache/@types-libsodium-wrappers-npm-0.7.10-1977488a6a-717054ebcb.zip new file mode 100644 index 0000000000..f09315f217 --- /dev/null +++ b/.yarn/cache/@types-libsodium-wrappers-npm-0.7.10-1977488a6a-717054ebcb.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac794f03e5eaea3e1f172e612012fa4654ff1e9ecace8470dc6c4fe5945cfd14 +size 5080 diff --git a/.yarn/cache/@types-libsodium-wrappers-npm-0.7.9-4b14af299f-5ddf61b804.zip b/.yarn/cache/@types-libsodium-wrappers-npm-0.7.9-4b14af299f-5ddf61b804.zip deleted file mode 100644 index fbf4a51db3..0000000000 --- a/.yarn/cache/@types-libsodium-wrappers-npm-0.7.9-4b14af299f-5ddf61b804.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7aaa3e7fceeef29caebd167e5472f433991ee64c01d1d5029110ade92fc9cec6 -size 5037 diff --git a/.yarn/cache/@types-libsodium-wrappers-sumo-npm-0.7.5-b503484acd-27846e49cd.zip b/.yarn/cache/@types-libsodium-wrappers-sumo-npm-0.7.5-b503484acd-27846e49cd.zip new file mode 100644 index 0000000000..6aac97a60f --- /dev/null +++ b/.yarn/cache/@types-libsodium-wrappers-sumo-npm-0.7.5-b503484acd-27846e49cd.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10baa92bb8e0dc5a5970d7537fcf4433a45a302bda52189af659b263900e0e9e +size 4628 diff --git a/.yarn/cache/libsodium-npm-0.7.9-98a3b621b1-1c922c9972.zip b/.yarn/cache/libsodium-npm-0.7.9-98a3b621b1-1c922c9972.zip deleted file mode 100644 index f46659340e..0000000000 --- a/.yarn/cache/libsodium-npm-0.7.9-98a3b621b1-1c922c9972.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1b3c8235a253e0661880db4eca8e03c71126ffd39125f63156984a4c0a88629f -size 201730 diff --git a/.yarn/cache/libsodium-sumo-npm-0.7.11-aaac6bcc6c-9efac902a0.zip b/.yarn/cache/libsodium-sumo-npm-0.7.11-aaac6bcc6c-9efac902a0.zip new file mode 100644 index 0000000000..636f38cdfd --- /dev/null +++ b/.yarn/cache/libsodium-sumo-npm-0.7.11-aaac6bcc6c-9efac902a0.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25e51d5178085e56b2cd4f2d1bf226f0be99edb2966686c1c67382ea88373c78 +size 295986 diff --git a/.yarn/cache/libsodium-wrappers-npm-0.7.9-be74b30f7d-b5b1b9e1b4.zip b/.yarn/cache/libsodium-wrappers-npm-0.7.9-be74b30f7d-b5b1b9e1b4.zip deleted file mode 100644 index 016b4681d5..0000000000 --- a/.yarn/cache/libsodium-wrappers-npm-0.7.9-be74b30f7d-b5b1b9e1b4.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f41eda3550a7c3568d94a56309c403f1bcf29083afc014f21ab902bec9d42dad -size 17397 diff --git a/.yarn/cache/libsodium-wrappers-sumo-npm-0.7.11-08fe1b2cf4-26c7aaf8c4.zip b/.yarn/cache/libsodium-wrappers-sumo-npm-0.7.11-08fe1b2cf4-26c7aaf8c4.zip new file mode 100644 index 0000000000..787b93ca56 --- /dev/null +++ b/.yarn/cache/libsodium-wrappers-sumo-npm-0.7.11-08fe1b2cf4-26c7aaf8c4.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:463d1a7463025385514de5413ead157b540820375648588318a4ec09636ece6a +size 17871 diff --git a/CHANGELOG.md b/CHANGELOG.md index bb059965e6..e60e2b1122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to ## [Unreleased] +### Fixed + +- @cosmjs/crypto: Migrate to `libsodium-wrappers-sumo` to be able to use the + `crypto_pwhash` functions ([#1429]). + +[#1429]: https://github.com/cosmos/cosmjs/issues/1429 + ### Added - @cosmjs/cosmwasm-stargate: Add `SigningCosmWasmClient.instantiate2` ([#1407]). diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 3a738030b1..268f0d50c0 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -47,7 +47,7 @@ "@noble/hashes": "^1", "bn.js": "^5.2.0", "elliptic": "^6.5.4", - "libsodium-wrappers": "^0.7.6" + "libsodium-wrappers-sumo": "^0.7.11" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", @@ -58,7 +58,7 @@ "@types/karma-firefox-launcher": "^2", "@types/karma-jasmine": "^4", "@types/karma-jasmine-html-reporter": "^1", - "@types/libsodium-wrappers": "^0.7.7", + "@types/libsodium-wrappers-sumo": "^0.7.5", "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/parser": "^5.54.0", diff --git a/packages/crypto/src/libsodium.ts b/packages/crypto/src/libsodium.ts index 0776a0c68a..27d41d98c3 100644 --- a/packages/crypto/src/libsodium.ts +++ b/packages/crypto/src/libsodium.ts @@ -4,7 +4,10 @@ // libsodium.js API: https://gist.github.com/webmaster128/b2dbe6d54d36dd168c9fabf441b9b09c import { isNonNullObject } from "@cosmjs/utils"; -import sodium from "libsodium-wrappers"; +// Using crypto_pwhash requires sumo. Once we migrate to a standalone +// Argon2 implementation, we can use the normal libsodium-wrappers +// again: https://github.com/cosmos/cosmjs/issues/1031 +import sodium from "libsodium-wrappers-sumo"; export interface Argon2idOptions { /** Output length in bytes */ diff --git a/yarn.lock b/yarn.lock index 09da77467e..0ba49fdcc2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -456,7 +456,7 @@ __metadata: "@types/karma-firefox-launcher": ^2 "@types/karma-jasmine": ^4 "@types/karma-jasmine-html-reporter": ^1 - "@types/libsodium-wrappers": ^0.7.7 + "@types/libsodium-wrappers-sumo": ^0.7.5 "@types/node": ^18 "@typescript-eslint/eslint-plugin": ^5.54.0 "@typescript-eslint/parser": ^5.54.0 @@ -478,7 +478,7 @@ __metadata: karma-firefox-launcher: ^2.1.0 karma-jasmine: ^5 karma-jasmine-html-reporter: ^1.5.4 - libsodium-wrappers: ^0.7.6 + libsodium-wrappers-sumo: ^0.7.11 nyc: ^15.1.0 prettier: ^2.8.1 ses: ^0.11.0 @@ -1700,10 +1700,19 @@ __metadata: languageName: node linkType: hard -"@types/libsodium-wrappers@npm:^0.7.7": - version: 0.7.9 - resolution: "@types/libsodium-wrappers@npm:0.7.9" - checksum: 5ddf61b8047e38f00c1509369ad868a724235a67940971cc671b070ab9d6b2e6872407253be1163b174f742ecbb0986fda7b91aa0b7069437359b4671bfc529b +"@types/libsodium-wrappers-sumo@npm:^0.7.5": + version: 0.7.5 + resolution: "@types/libsodium-wrappers-sumo@npm:0.7.5" + dependencies: + "@types/libsodium-wrappers": "*" + checksum: 27846e49cd54556c05011ff475cc6564ce8dde8f9a02a542740e3ebaab7de21ed2dfb4afdc182510d7058d3475f748bab0aa4a41178cd105b9f8618a00f8ef3f + languageName: node + linkType: hard + +"@types/libsodium-wrappers@npm:*": + version: 0.7.10 + resolution: "@types/libsodium-wrappers@npm:0.7.10" + checksum: 717054ebcb5fa553e378144b8d564bed8b691905c0d4e90b95c64d77ba24ec9fe798cb2c58cd61dad545ceacb1f05ab69b5597217f9829f2da7a23f0688d11d0 languageName: node linkType: hard @@ -5083,19 +5092,19 @@ __metadata: languageName: node linkType: hard -"libsodium-wrappers@npm:^0.7.6": - version: 0.7.9 - resolution: "libsodium-wrappers@npm:0.7.9" - dependencies: - libsodium: ^0.7.0 - checksum: b5b1b9e1b4aa5662e07df244934125f9e3cd2ba7fe0ec45191a5ffc822d22f4d2f6e09e42d91c30c4f48ca0c7f810a176fdf5e32eed6722d7d82a2a719459f56 +"libsodium-sumo@npm:^0.7.11": + version: 0.7.11 + resolution: "libsodium-sumo@npm:0.7.11" + checksum: 9efac902a05002e1caca1c1df3a7cd838ac370588cfa31107d6e787cb5a181f4ca46c7961e3136943c8b07b1d543c0283b91e08a141f9b55a74f10808c3017ef languageName: node linkType: hard -"libsodium@npm:^0.7.0": - version: 0.7.9 - resolution: "libsodium@npm:0.7.9" - checksum: 1c922c9972cf97ddb7207ee4f810dd291e0610dd57ea0e47f2343968392546aaa629945a2fb39ae5f19d067f6ed0bb7330f32cc9a680a847a662e9a210ce7bfb +"libsodium-wrappers-sumo@npm:^0.7.11": + version: 0.7.11 + resolution: "libsodium-wrappers-sumo@npm:0.7.11" + dependencies: + libsodium-sumo: ^0.7.11 + checksum: 26c7aaf8c4b6da6b06ef17637e5541e16c796be9611b194d795501f021ac04abfeda09cadae66b3b515308993cd57361a571eefabdf9d9b3377b070a17535440 languageName: node linkType: hard