diff --git a/rust-app/Cargo.lock b/rust-app/Cargo.lock index b187c0a..70d9847 100644 --- a/rust-app/Cargo.lock +++ b/rust-app/Cargo.lock @@ -11,6 +11,18 @@ dependencies = [ "regex 0.1.80", ] +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aho-corasick" version = "0.5.3" @@ -83,6 +95,12 @@ dependencies = [ "which", ] +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + [[package]] name = "bitflags" version = "1.3.2" @@ -101,6 +119,18 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd769563b4ea2953e2825c9e6b7470a5f55f67e0be00030bf3e390a2a6071f64" +[[package]] +name = "bytemuck" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "cc" version = "1.0.78" @@ -139,6 +169,46 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "either" version = "1.9.0" @@ -166,6 +236,50 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "exr" +version = "1.72.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" +dependencies = [ + "bit_field", + "flume", + "half", + "lebe", + "miniz_oxide 0.7.4", + "rayon-core", + "smallvec", + "zune-inflate", +] + +[[package]] +name = "fdeflate" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8090f921a24b04994d9929e204f50b498a33ea6ba559ffaa05e04f7ee7fb5ab" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "flate2" +version = "1.0.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.0", +] + +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "spin", +] + [[package]] name = "generic-array" version = "0.14.6" @@ -178,9 +292,9 @@ dependencies = [ [[package]] name = "gif" -version = "0.11.4" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" +checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" dependencies = [ "color_quant", "weezl", @@ -192,6 +306,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "home" version = "0.5.9" @@ -202,12 +326,31 @@ dependencies = [ ] [[package]] -name = "include_gif" -version = "1.0.1" +name = "image" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "132290d08a42868f8f90e96a9206e955b0aae1e5a5df54c0029e8c2ab8652625" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "exr", "gif", + "jpeg-decoder", + "num-traits", + "png", + "qoi", + "tiff", +] + +[[package]] +name = "include_gif" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8511434ad4b61bf0be7c61707d0172b6ad091519da93bf95d66555f3f0d994ac" +dependencies = [ + "flate2", + "image", "syn 1.0.107", ] @@ -230,6 +373,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "jpeg-decoder" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" +dependencies = [ + "rayon", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -252,6 +404,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + [[package]] name = "ledger-crypto-helpers" version = "0.2.1" @@ -350,6 +508,16 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.20" @@ -377,6 +545,25 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "nom" version = "7.1.3" @@ -477,6 +664,19 @@ dependencies = [ "syn 1.0.107", ] +[[package]] +name = "png" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.0", +] + [[package]] name = "prettyplease" version = "0.2.16" @@ -496,6 +696,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + [[package]] name = "quote" version = "1.0.35" @@ -511,6 +720,26 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "regex" version = "0.1.80" @@ -578,12 +807,39 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + [[package]] name = "syn" version = "1.0.107" @@ -625,6 +881,17 @@ dependencies = [ "thread-id", ] +[[package]] +name = "tiff" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + [[package]] name = "trie-enum" version = "0.1.0" @@ -659,9 +926,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "weezl" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "which" @@ -824,3 +1091,12 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] diff --git a/rust-app/Cargo.toml b/rust-app/Cargo.toml index a3cb1f4..c070780 100644 --- a/rust-app/Cargo.toml +++ b/rust-app/Cargo.toml @@ -57,8 +57,8 @@ overflow-checks = false [package.metadata.ledger] name = "IOTA Rebased" -# Testnet, IOTA, Shimmer -path = ["44'/1'", "44'/4218'", "44'/4219'"] +# Testnet, IOTA +path = ["44'/1'", "44'/4218'"] curve = ["ed25519"] flags = "0" diff --git a/rust-app/src/implementation.rs b/rust-app/src/implementation.rs index 55b7124..767f7ba 100644 --- a/rust-app/src/implementation.rs +++ b/rust-app/src/implementation.rs @@ -60,13 +60,9 @@ pub const BIP32_TESTNET_PREFIX: [u32; 5] = ledger_device_sdk::ecc::make_bip32_path(b"m/44'/1'/123'/0'/0'"); pub const BIP32_IOTA_PREFIX: [u32; 5] = ledger_device_sdk::ecc::make_bip32_path(b"m/44'/4218'/123'/0'/0'"); -pub const BIP32_SMR_PREFIX: [u32; 5] = - ledger_device_sdk::ecc::make_bip32_path(b"m/44'/4219'/123'/0'/0'"); fn is_bip_prefix_valid(path: &[u32]) -> bool { - path.starts_with(&BIP32_TESTNET_PREFIX[0..2]) - || path.starts_with(&BIP32_IOTA_PREFIX[0..2]) - || path.starts_with(&BIP32_SMR_PREFIX[0..2]) + path.starts_with(&BIP32_TESTNET_PREFIX[0..2]) || path.starts_with(&BIP32_IOTA_PREFIX[0..2]) } pub async fn get_address_apdu(io: HostIO, prompt: bool) { diff --git a/ts-tests/common.ts b/ts-tests/common.ts index 00d3a8b..f73ab46 100644 --- a/ts-tests/common.ts +++ b/ts-tests/common.ts @@ -4,7 +4,7 @@ import Iota from "./Iota"; import { expect } from 'chai'; const IOTA_BIP_PATH = "44'/4218'/0'/0'/0'"; -const SHIMMER_BIP_PATH = "44'/4219'/0'/0'/0'"; +const TESTNET_BIP_PATH = "44'/1'/0'/0'/0'"; export const VERSION = { major: 0, @@ -201,4 +201,4 @@ let toggleBlindSigningSettings = async function () { await Axios.post(BASE_URL + "/button/left", { "action": "press-and-release" }); } -export { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, SHIMMER_BIP_PATH, sendCommandExpectFail, toggleBlindSigningSettings } +export { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, TESTNET_BIP_PATH, sendCommandExpectFail, toggleBlindSigningSettings } diff --git a/ts-tests/public-key-tests.ts b/ts-tests/public-key-tests.ts index a876852..ae8e424 100644 --- a/ts-tests/public-key-tests.ts +++ b/ts-tests/public-key-tests.ts @@ -1,15 +1,15 @@ -import { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, SHIMMER_BIP_PATH } from "./common"; +import { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, TESTNET_BIP_PATH } from "./common"; import { expect } from 'chai'; import { describe, it } from 'mocha'; import Axios from 'axios'; import type Iota from "./Iota"; // Public key and address for default speculos mnemonic: "glory promote mansion idle axis finger extra february uncover one trip resource lawn turtle enact monster seven myth punch hobby comfort wild raise skin" -// with BIP32 Path: 44'/4218'/0'/0'/0' (Shimmer: 44'/4219'/0'/0'/0') +// with BIP32 Path: 44'/4218'/0'/0'/0' (Testnet: 44'/1'/0'/0'/0') const IOTA_PUBLIC_KEY = "f0a9c612b7e69f1a114aa9189c1f32997d395d09d183368ddfd6d5dc49e34647"; -const SHIMMER_PUBLIC_KEY = "d8e6a30365c5720f873feacc4002c5c75b91a0e813db4676b47f47aaad47e123"; +const TESTNET_PUBLIC_KEY = "f9e5d9f4437cf656ef76da8fa17d38f66569ec61cca09b28d7210d0ed18b59f0"; export const IOTA_ADDRESS = "1b3669e321893ee49c387a08fc251dbfff37cd2a981e6c473a5b2afde19d363e"; -export const SHIMMER_ADDRESS = "006699dd01f2ec78dd0dfc62ee416952480de084aa90e356729ee341db92fcba"; +export const TESTNET_ADDRESS = "3a0de157f4b6c4bed40caf93def86c3e6946ed35d27c7121ef264336973e9955"; describe('public key tests', () => { @@ -28,12 +28,12 @@ describe('public key tests', () => { }, []); }); - it('provides a public key shimmer coin type', async () => { + it('provides a public key testnet coin type', async () => { await sendCommandAndAccept(async (client: Iota) => { - const rv = await client.getPublicKey(SHIMMER_BIP_PATH); - expect(new Buffer(rv.publicKey).toString('hex')).to.equal(SHIMMER_PUBLIC_KEY); - expect(new Buffer(rv.address).toString('hex')).to.equal(SHIMMER_ADDRESS); + const rv = await client.getPublicKey(TESTNET_BIP_PATH); + expect(new Buffer(rv.publicKey).toString('hex')).to.equal(TESTNET_PUBLIC_KEY); + expect(new Buffer(rv.address).toString('hex')).to.equal(TESTNET_ADDRESS); return; }, []); }); diff --git a/ts-tests/signing-tests.ts b/ts-tests/signing-tests.ts index 80f9bab..29b8b23 100644 --- a/ts-tests/signing-tests.ts +++ b/ts-tests/signing-tests.ts @@ -1,4 +1,4 @@ -import { VERSION, sendCommandAndAccept, BASE_URL, sendCommandExpectFail, toggleBlindSigningSettings, IOTA_BIP_PATH, SHIMMER_BIP_PATH } from "./common"; +import { VERSION, sendCommandAndAccept, BASE_URL, sendCommandExpectFail, toggleBlindSigningSettings, IOTA_BIP_PATH, TESTNET_BIP_PATH } from "./common"; import { expect } from 'chai'; import { describe, it } from 'mocha'; import Axios from 'axios'; @@ -115,7 +115,7 @@ describe("Signing tests", function () { }); it("can blind sign an unknown transaction", async function () { - const path = SHIMMER_BIP_PATH; + const path = TESTNET_BIP_PATH; const txn = Buffer.from("00000000050205546e7f126d2f40331a543b9608439b582fd0d103000000000000002080fdabcc90498e7eb8413b140c4334871eeafa5a86203fd9cfdb032f604f49e1284af431cf032b5d85324135bf9a3073e920d7f5020000000000000020a06f410c175e828c24cee84cb3bd95cff25c33fbbdcb62c6596e8e423784ffe702d08074075c7097f361e8b443e2075a852a2292e8a08074075c7097f361e8b443e2075a852a2292e80180969800000000001643fb2578ff7191c643079a62c1cca8ec2752bc05546e7f126d2f40331a543b9608439b582fd0d103000000000000002080fdabcc90498e7eb8413b140c4334871eeafa5a86203fd9cfdb032f604f49e101000000000000002c01000000000000", "hex"); const prompts = [