From ca812123a5a2c1d7ad0f346af2b994fab135253c Mon Sep 17 00:00:00 2001 From: poka Date: Sun, 19 Dec 2021 14:55:47 +0100 Subject: [PATCH] First try: Delete all rust dependencies, replaced by durt lib --- .cargo/config.toml | 3 - .gitignore | 8 - .gitlab-ci.yml | 18 +- .rusty-hook.toml | 5 - Cargo.lock | 2026 ----------------- Cargo.toml | 10 - Makefile.toml | 369 --- README.md | 29 +- deny.toml | 55 - lib/models/change_pin.dart | 8 +- lib/models/generate_wallets.dart | 34 +- lib/models/wallet_options.dart | 28 +- lib/models/wallets_profiles.dart | 28 +- lib/screens/home.dart | 2 - lib/screens/myWallets/change_pin.dart | 2 +- .../myWallets/confirm_wallet_storage.dart | 3 +- lib/screens/myWallets/generate_wallets.dart | 4 +- lib/screens/myWallets/unlocking_wallet.dart | 9 +- lib/screens/onBoarding/11.dart | 3 +- lib/screens/onBoarding/12.dart | 2 +- lib/screens/onBoarding/7.dart | 4 +- lib/screens/onBoarding/8.dart | 5 - lib/screens/settings.dart | 2 +- native/dubp_rs/Cargo.toml | 27 - native/dubp_rs/build.rs | 54 - native/dubp_rs/src/async.rs | 42 - native/dubp_rs/src/dewif.rs | 193 -- native/dubp_rs/src/dewif/bip32.rs | 436 ---- native/dubp_rs/src/dewif/classic.rs | 58 - native/dubp_rs/src/error.rs | 135 -- native/dubp_rs/src/inputs.rs | 142 -- native/dubp_rs/src/legacy.rs | 89 - native/dubp_rs/src/lib.rs | 536 ----- native/dubp_rs/src/mnemonic.rs | 30 - native/dubp_rs/src/payment.rs | 66 - native/dubp_rs/src/pubkey.rs | 27 - native/dubp_rs/src/secret_code.rs | 159 -- packages/dubp_rs/.metadata | 10 - packages/dubp_rs/LICENSE | 661 ------ packages/dubp_rs/README.md | 198 -- packages/dubp_rs/analysis_options.yaml | 12 - packages/dubp_rs/android/.gitignore | 8 - .../plugins/GeneratedPluginRegistrant.java | 25 - packages/dubp_rs/android/build.gradle | 43 - packages/dubp_rs/android/gradle.properties | 4 - .../gradle/wrapper/gradle-wrapper.properties | 5 - packages/dubp_rs/android/settings.gradle | 1 - .../android/src/main/AndroidManifest.xml | 3 - .../kotlin/com/example/dubp/DubpPlugin.kt | 53 - packages/dubp_rs/ios/.gitignore | 37 - packages/dubp_rs/ios/Assets/.gitkeep | 0 packages/dubp_rs/ios/Classes/DubpPlugin.h | 4 - packages/dubp_rs/ios/Classes/DubpPlugin.m | 15 - .../dubp_rs/ios/Classes/SwiftDubpPlugin.swift | 18 - packages/dubp_rs/ios/Classes/binding.h | 240 -- packages/dubp_rs/ios/dubp.podspec | 26 - packages/dubp_rs/lib/dubp.dart | 504 ---- packages/dubp_rs/pubspec.lock | 189 -- packages/dubp_rs/pubspec.yaml | 28 - pubspec.lock | 75 +- pubspec.yaml | 13 +- 61 files changed, 106 insertions(+), 6717 deletions(-) delete mode 100644 .cargo/config.toml delete mode 100644 .rusty-hook.toml delete mode 100644 Cargo.lock delete mode 100644 Cargo.toml delete mode 100644 Makefile.toml delete mode 100644 deny.toml delete mode 100644 native/dubp_rs/Cargo.toml delete mode 100644 native/dubp_rs/build.rs delete mode 100644 native/dubp_rs/src/async.rs delete mode 100644 native/dubp_rs/src/dewif.rs delete mode 100644 native/dubp_rs/src/dewif/bip32.rs delete mode 100644 native/dubp_rs/src/dewif/classic.rs delete mode 100644 native/dubp_rs/src/error.rs delete mode 100644 native/dubp_rs/src/inputs.rs delete mode 100644 native/dubp_rs/src/legacy.rs delete mode 100644 native/dubp_rs/src/lib.rs delete mode 100644 native/dubp_rs/src/mnemonic.rs delete mode 100644 native/dubp_rs/src/payment.rs delete mode 100644 native/dubp_rs/src/pubkey.rs delete mode 100644 native/dubp_rs/src/secret_code.rs delete mode 100644 packages/dubp_rs/.metadata delete mode 100644 packages/dubp_rs/LICENSE delete mode 100644 packages/dubp_rs/README.md delete mode 100644 packages/dubp_rs/analysis_options.yaml delete mode 100644 packages/dubp_rs/android/.gitignore delete mode 100644 packages/dubp_rs/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java delete mode 100644 packages/dubp_rs/android/build.gradle delete mode 100644 packages/dubp_rs/android/gradle.properties delete mode 100644 packages/dubp_rs/android/gradle/wrapper/gradle-wrapper.properties delete mode 100644 packages/dubp_rs/android/settings.gradle delete mode 100644 packages/dubp_rs/android/src/main/AndroidManifest.xml delete mode 100644 packages/dubp_rs/android/src/main/kotlin/com/example/dubp/DubpPlugin.kt delete mode 100644 packages/dubp_rs/ios/.gitignore delete mode 100644 packages/dubp_rs/ios/Assets/.gitkeep delete mode 100644 packages/dubp_rs/ios/Classes/DubpPlugin.h delete mode 100644 packages/dubp_rs/ios/Classes/DubpPlugin.m delete mode 100644 packages/dubp_rs/ios/Classes/SwiftDubpPlugin.swift delete mode 100644 packages/dubp_rs/ios/Classes/binding.h delete mode 100644 packages/dubp_rs/ios/dubp.podspec delete mode 100644 packages/dubp_rs/lib/dubp.dart delete mode 100644 packages/dubp_rs/pubspec.lock delete mode 100644 packages/dubp_rs/pubspec.yaml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 393611e..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -[alias] -bd = "make android-dev32" -br = "make" diff --git a/.gitignore b/.gitignore index 557066e..8b9021a 100644 --- a/.gitignore +++ b/.gitignore @@ -44,14 +44,6 @@ android/key.properties # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -# Autogenerated dart/rust binding code -native/dubp_rs/binding.h -packages/dubp_rs/lib/ffi.dart - -# Rust compiled libs for android or ios -**/*.a -**/*.so - # Rust things /target diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e92115c..73c5265 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,9 +8,6 @@ stages: image: axiomteam/gecko-ci:v0.0.8 tags: - redshift - before_script: - - rustup show - - rustc --version && cargo --version format: extends: .env @@ -20,10 +17,6 @@ format: - if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID - when: manual stage: format - script: - - cargo fmt -- --version - - cargo fmt -- --check - - flutter format --set-exit-if-changed lib packages/dubp_rs/lib/dubp.dart build_and_test: extends: .env @@ -35,11 +28,8 @@ build_and_test: stage: build_and_test tags: - redshift - script: - - RUSTFLAGS="-D warnings" cargo make - - cd packages/dubp_rs && flutter pub get && cd ../.. + script: - flutter analyze - - cargo test # - flutter test lint: @@ -50,9 +40,6 @@ lint: - if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID - when: manual stage: quality - script: - - cargo clippy -- -V - - cargo clippy --all --tests -- -D warnings --verbose audit_dependencies: extends: .env @@ -62,9 +49,6 @@ audit_dependencies: - if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID - when: manual stage: quality - script: - - cargo deny -V - - cargo deny check releases:test: extends: .env diff --git a/.rusty-hook.toml b/.rusty-hook.toml deleted file mode 100644 index aaeaea8..0000000 --- a/.rusty-hook.toml +++ /dev/null @@ -1,5 +0,0 @@ -[hooks] -pre-commit = "cargo fmt -- --check && flutter format --set-exit-if-changed lib packages/dubp_rs/lib/dubp.dart" - -[logging] -verbose = true diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 6f815cf..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,2026 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "allo-isolate" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff09da612ca86c794c3c8f70613a3e6652b5f1313b938937b32cae80df28fdb1" - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" -dependencies = [ - "serde", -] - -[[package]] -name = "ascii" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" - -[[package]] -name = "assert_matches" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" - -[[package]] -name = "async-compression" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72c1f1154e234325b50864a349b9c8e56939e266a4c307c0f159812df2f9537" -dependencies = [ - "flate2", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-oneshot" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f4770cbbff928c30a991de67fb3976f44d8e3e202f8c79ef91b47006e04904" -dependencies = [ - "futures-micro", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "backtrace" -version = "0.3.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" -dependencies = [ - "addr2line", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "beef" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6736e2428df2ca2848d846c43e88745121a6654696e349ce0054a420815a7409" - -[[package]] -name = "bincode" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" -dependencies = [ - "byteorder", - "serde", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "blake3" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" - -[[package]] -name = "bytes" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" - -[[package]] -name = "cbindgen" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e03a705df2e735cc5486f104a48e25a8f72ae06eaea5b7753a81270ed00859" -dependencies = [ - "clap", - "heck", - "log", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", - "tempfile", - "toml", -] - -[[package]] -name = "cc" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "ci_info" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f638c70e8c5753795cc9a8c07c44da91554a09e4cf11a7326e8161b0a3c45e" -dependencies = [ - "envmnt", -] - -[[package]] -name = "clang" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4d78574d27fc037d9079fbd79a4b092e0ccb6a806756ded47e77e8639a03bd" -dependencies = [ - "clang-sys", - "libc", -] - -[[package]] -name = "clang-sys" -version = "0.29.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" -dependencies = [ - "glob", - "libc", -] - -[[package]] -name = "clap" -version = "2.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "combine" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" -dependencies = [ - "ascii", - "byteorder", - "either", - "memchr", - "unreachable", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.4", - "subtle", -] - -[[package]] -name = "cryptoxide" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46212f5d1792f89c3e866fb10636139464060110c568edd7f73ab5e9f736c26d" - -[[package]] -name = "dart-bindgen" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78a5a59086ea83b86183d5ada358815f62ee1842537333fb828ae9a9c896751" -dependencies = [ - "clang", - "log", - "thiserror", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.4", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "dubp" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5cee825e59cde21a3622de781d15f74cbea92f01eb1554a8c73818eb61a5998" -dependencies = [ - "dubp-common", - "dubp-documents", - "dubp-documents-parser", - "dubp-wallet", - "dup-crypto", -] - -[[package]] -name = "dubp-client" -version = "0.1.0" -source = "git+https://git.duniter.org/libs/dubp-rs-client-lib?branch=master#8db2379f84006966c80b7488084a7158a6a70302" -dependencies = [ - "arrayvec", - "bincode", - "cfg-if 1.0.0", - "dubp", - "duniter-bca-types", - "fast-threadpool 0.3.1-alpha.0", - "flume", - "graphql_client", - "maybe-async", - "rand", - "reqwest", - "resiter", - "serde", - "static_assertions", - "thiserror", -] - -[[package]] -name = "dubp-common" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc000f2a3366c1bd985015f95adb3520e8e0b007ca5f77882eea1ea119d84f4" -dependencies = [ - "dup-crypto", - "serde", - "serde_json", - "thiserror", - "zerocopy", -] - -[[package]] -name = "dubp-documents" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e96808a8ced0617ba93ed6fee00d88902f33e2f61a36ec9a841e8972ef5cd3a" -dependencies = [ - "beef", - "dubp-wallet", - "log", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "dubp-documents-parser" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c60f5c2804a9906777f96a62514c1f9f58abaab4c57f01db4fa7c45624e6fb" -dependencies = [ - "dubp-documents", - "json-pest-parser", - "pest", - "pest_derive", - "serde_json", - "thiserror", -] - -[[package]] -name = "dubp-wallet" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f277bed6bc228981f76f207f4112051656302b5c50c0a858ab138ae2215d49fe" -dependencies = [ - "byteorder", - "dubp-common", - "serde", - "smallvec", - "thiserror", - "zerocopy", -] - -[[package]] -name = "dubp_rs" -version = "0.1.0" -dependencies = [ - "allo-isolate", - "assert_matches", - "cbindgen", - "dart-bindgen", - "dubp-client", - "fast-threadpool 0.3.0", - "once_cell", - "parking_lot", - "rusty-hook", - "thiserror", -] - -[[package]] -name = "duniter-bca-types" -version = "0.1.0" -source = "git+https://git.duniter.org/nodes/rust/modules/duniter-gva#4ee272b85d6420ed6640b9503019cfa04864c851" -dependencies = [ - "arrayvec", - "bincode", - "dubp", - "serde", - "smallvec", - "thiserror", -] - -[[package]] -name = "dup-crypto" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c530e25cc0a03ae36229401ca322002931b55fc180e6001bdab20a9087f297c" -dependencies = [ - "arrayvec", - "base64", - "blake3", - "bs58", - "byteorder", - "cryptoxide", - "ed25519-bip32", - "getrandom", - "hex", - "once_cell", - "ring", - "serde", - "thiserror", - "zerocopy", - "zeroize", -] - -[[package]] -name = "ed25519-bip32" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8827180a2b511141fbe49141e50b31a8d542465e0fb572f81f36feea2addfe92" -dependencies = [ - "cryptoxide", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "encoding_rs" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "envmnt" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" -dependencies = [ - "fsio", - "indexmap", -] - -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fast-threadpool" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccb66774e02743b4be61c19e09bf59de9058e9a7b4096040689003e7a901a3d" -dependencies = [ - "async-oneshot", - "flume", - "num_cpus", -] - -[[package]] -name = "fast-threadpool" -version = "0.3.1-alpha.0" -source = "git+https://github.com/librelois/fast-threadpool?branch=main#1a271710677ecc43cbfe43234ec21c954dfdbef7" -dependencies = [ - "async-oneshot", - "flume", - "num_cpus", -] - -[[package]] -name = "flate2" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" -dependencies = [ - "cfg-if 1.0.0", - "crc32fast", - "libc", - "miniz_oxide", -] - -[[package]] -name = "flume" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0362ef9c4c1fa854ff95b4cb78045a86e810d804dc04937961988b45427104a9" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project", - "spinning_top", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" -dependencies = [ - "matches", - "percent-encoding", -] - -[[package]] -name = "fsio" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3" - -[[package]] -name = "futures-channel" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" - -[[package]] -name = "futures-io" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" - -[[package]] -name = "futures-macro" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-micro" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9325be55c5581082cd110294fa988c1f920bc573ec370ef201e33c469a95a" - -[[package]] -name = "futures-sink" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" - -[[package]] -name = "futures-task" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" - -[[package]] -name = "futures-util" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" -dependencies = [ - "futures-core", - "futures-io", - "futures-macro", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "getrandom" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "gimli" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" - -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - -[[package]] -name = "graphql-introspection-query" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "610aac641dbd2a457ad4cef34aa2827dae3f035fd214cb38c2d62d8543f3973f" -dependencies = [ - "serde", -] - -[[package]] -name = "graphql-parser" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5613c31f18676f164112732202124f373bb2103ff017b3b85ca954ea6a66ada" -dependencies = [ - "combine", - "failure", -] - -[[package]] -name = "graphql_client" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bb4f09181e4f80018d01c612125b07e0156f3753bfac37055fe2a25e031ca8" -dependencies = [ - "doc-comment", - "graphql_query_derive", - "serde", - "serde_json", -] - -[[package]] -name = "graphql_client_codegen" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e304c223c809b3bff4614018f8e6d9edb176b31d64ed9ea48b6ae8b1a03abb9" -dependencies = [ - "failure", - "graphql-introspection-query", - "graphql-parser", - "heck", - "lazy_static", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", -] - -[[package]] -name = "graphql_query_derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1f6b14d5ce549227aa9e649cd9d36d008b91021275a8e0a67d71cef815adc2f" -dependencies = [ - "failure", - "graphql_client_codegen", - "proc-macro2", - "syn", -] - -[[package]] -name = "h2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc018e188373e2777d0ef2467ebff62a08e66c3f5857b23c8fbec3018210dc00" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - -[[package]] -name = "heck" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "http" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" - -[[package]] -name = "httpdate" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" - -[[package]] -name = "hyper" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" -dependencies = [ - "futures-util", - "hyper", - "log", - "rustls", - "tokio", - "tokio-rustls", - "webpki", -] - -[[package]] -name = "idna" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "ipnet" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" - -[[package]] -name = "itoa" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" - -[[package]] -name = "js-sys" -version = "0.3.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "json-pest-parser" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bc5c84a2bceeda1ce3bd58497bde2d8cba61ca0b45873ef502401f0ff2ae8ed" -dependencies = [ - "pest", - "pest_derive", - "thiserror", - "unwrap", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" - -[[package]] -name = "lock_api" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" - -[[package]] -name = "maybe-async" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb8e1fec4e9a343755fdcd6adc9394c0ac0bb764eb36b3aecfdf151a44e8c83" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "memchr" -version = "2.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "mio" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - -[[package]] -name = "nanorand" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1378b66f7c93a1c0f8464a19bf47df8795083842e5090f4b7305973d5a22d0" -dependencies = [ - "getrandom", -] - -[[package]] -name = "nias" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0" - -[[package]] -name = "ntapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" -dependencies = [ - "winapi", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" - -[[package]] -name = "once_cell" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "parking_lot" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1", -] - -[[package]] -name = "pin-project" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "ppv-lite86" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" - -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - -[[package]] -name = "proc-macro2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -dependencies = [ - "bitflags", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "reqwest" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" -dependencies = [ - "async-compression", - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "rustls", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls", - "tokio-util", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "resiter" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd69ab1e90258b7769f0b5c46bfd802b8206d0707ced4ca4b9d5681b744de1be" - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" - -[[package]] -name = "rustls" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" -dependencies = [ - "base64", - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rusty-hook" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cee9be61be7e1cbadd851e58ed7449c29c620f00b23df937cb9cbc04ac21a3" -dependencies = [ - "ci_info", - "getopts", - "nias", - "toml", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sct" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "serde" -version = "1.0.123" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.123" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer", - "digest 0.8.1", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spinning_top" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e529d73e80d64b5f2631f9035113347c578a1c9c7774b83a2b880788459ab36" -dependencies = [ - "lock_api", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "subtle" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" - -[[package]] -name = "syn" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "synstructure" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "tempfile" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinyvec" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "num_cpus", - "pin-project-lite", -] - -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-util" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" -dependencies = [ - "serde", -] - -[[package]] -name = "tower-service" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" - -[[package]] -name = "tracing" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" -dependencies = [ - "cfg-if 1.0.0", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" - -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -dependencies = [ - "void", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "unwrap" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e33648dd74328e622c7be51f3b40a303c63f93e6fa5f08778b6203a4c25c20f" - -[[package]] -name = "url" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" -dependencies = [ - "form_urlencoded", - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasm-bindgen" -version = "0.2.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" -dependencies = [ - "cfg-if 1.0.0", - "serde", - "serde_json", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" - -[[package]] -name = "web-sys" -version = "0.3.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" -dependencies = [ - "webpki", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winreg" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" -dependencies = [ - "winapi", -] - -[[package]] -name = "zerocopy" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6580539ad917b7c026220c4b3f2c08d52ce54d6ce0dc491e66002e35388fab46" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 90c3171..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[workspace] -members = ["native/dubp_rs"] - -[profile.release] -lto = true -codegen-units = 1 -debug = true - -[patch.crates-io] -#dup-crypto = { path = "/home/elois/dev/duniter/libs/dubp-rs-libs/crypto" } diff --git a/Makefile.toml b/Makefile.toml deleted file mode 100644 index 76ead5d..0000000 --- a/Makefile.toml +++ /dev/null @@ -1,369 +0,0 @@ -[env] -CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true -CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/dubp_rs"] -ANDROID_PLATFORM_VERSION = "21" -TARGET_OS = "unknown" -RELEASE = true -DEV = false -LIB_OUT_DIR = "release" - -[env.debug] -DEV = true -RELEASE = false -LIB_OUT_DIR = "debug" - -[tasks.test-flow] -disabled = true - -[tasks.android-dev32] -description = "development android i686 emulator" -category = "Build" -dependencies = [ - "setup-crate-type-android", - "pre-android", - "android-i686", - "android-i686-release", - "post-android-i686", - "post-android", - ] - -[tasks.android-dev] -description = "development android x86_64 emulator" -category = "Build" -dependencies = [ - "setup-crate-type-android", - "pre-android", - "android-x86_64", - "android-x86_64-release", - "post-android-x86_64", - "post-android", - ] - -[tasks.android-arm] -description = "build android ARM64 for actual device" -category = "Build" -dependencies = [ - "setup-crate-type-android", - "pre-android", - "android-aarch64", - "android-aarch64-release", - "post-android-aarch64", - "post-android", - ] - - -[tasks.build] -description = "Runs the rust compiler." -category = "Build" -dependencies = ["android"] - -[tasks.build.mac] -description = "Runs the rust compiler." -category = "Build" -dependencies = ["android", "ios"] - -# ANDROID - -[tasks.android] -description = "Build android targets." -category = "Build" -dependencies = [ - "setup-crate-type-android", - "pre-android", - "android-aarch64", - "android-aarch64-release", - "post-android-aarch64", - "android-armv7", - "android-armv7-release", - "post-android-armv7", - #"android-i686", - #"android-i686-release", - #"post-android-i686", - #"android-x86_64", - #"android-x86_64-release", - #"post-android-x86_64", - "post-android" -] - -[tasks.android-build] -private = true -condition = { env_true = ["DEV"], env_set = ["ANDROID_TARGET"] } -command = "cargo" -args = [ - "ndk", - "--platform", - "${ANDROID_PLATFORM_VERSION}", - "--target", - "${ANDROID_TARGET}", - "build", -] - -[tasks.android-build-release] -private = true -condition = { env_true = ["RELEASE"], env_set = ["ANDROID_TARGET"] } -command = "cargo" -args = [ - "ndk", - "--platform", - "${ANDROID_PLATFORM_VERSION}", - "--target", - "${ANDROID_TARGET}", - "build", - "--release" -] - -[tasks.android-aarch64] -private = true -condition = { env_true = ["DEV"] } -env = { ANDROID_TARGET = "aarch64-linux-android" } -run_task = "android-build" - -[tasks.android-armv7] -private = true -condition = { env_true = ["DEV"] } -env = { ANDROID_TARGET = "armv7-linux-androideabi" } -run_task = "android-build" - -[tasks.android-i686] -private = true -condition = { env_true = ["DEV"] } -env = { ANDROID_TARGET = "i686-linux-android" } -run_task = "android-build" - -[tasks.android-x86_64] -private = true -condition = { env_true = ["DEV"] } -env = { ANDROID_TARGET = "x86_64-linux-android" } -run_task = "android-build" - -[tasks.android-aarch64-release] -private = true -condition = { env_true = ["RELEASE"] } -env = { ANDROID_TARGET = "aarch64-linux-android" } -run_task = "android-build-release" - -[tasks.android-armv7-release] -private = true -condition = { env_true = ["RELEASE"] } -env = { ANDROID_TARGET = "armv7-linux-androideabi" } -run_task = "android-build-release" - -[tasks.android-i686-release] -private = true -condition = { env_true = ["RELEASE"] } -env = { ANDROID_TARGET = "i686-linux-android" } -run_task = "android-build-release" - -[tasks.android-x86_64-release] -private = true -condition = { env_true = ["RELEASE"] } -env = { ANDROID_TARGET = "x86_64-linux-android" } -run_task = "android-build-release" - -[tasks.pre-android] -private = true -script_runner = "@duckscript" -script = [ - "mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/android/src/main/jniLibs/arm64-v8a", - "mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/android/src/main/jniLibs/armeabi-v7a", - "mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/android/src/main/jniLibs/x86", - "mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/android/src/main/jniLibs/x86_64", -] - -[tasks.android-copy-lib] -private = true -condition = { env_set = ["ANDROID_TARGET", "JNI_LIB_DIR"] } -script_runner = "@duckscript" -script = [ - """ - cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${ANDROID_TARGET}/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so \ - ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/android/src/main/jniLibs/${JNI_LIB_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so - """, -] - -[tasks.post-android-aarch64] -private = true -env = { ANDROID_TARGET = "aarch64-linux-android", JNI_LIB_DIR = "arm64-v8a" } -run_task = "android-copy-lib" - -[tasks.post-android-armv7] -private = true -env = { ANDROID_TARGET = "armv7-linux-androideabi", JNI_LIB_DIR = "armeabi-v7a" } -run_task = "android-copy-lib" - -[tasks.post-android-i686] -private = true -env = { ANDROID_TARGET = "i686-linux-android", JNI_LIB_DIR = "x86" } -run_task = "android-copy-lib" - -[tasks.post-android-x86_64] -private = true -env = { ANDROID_TARGET = "x86_64-linux-android", JNI_LIB_DIR = "x86_64" } -run_task = "android-copy-lib" - -[tasks.post-android] -dependencies = ["restore-crate-type"] - -# IOS - -[tasks.ios] -description = "build iOS targets" -category = "Build" -dependencies = ["ios-build", "ios-release", "post-ios"] - -[tasks.ios-build] -condition = { platforms = ["mac"], env_true = ["DEV"] } -description = "Build ios targets." -category = "Build" -command = "cargo" -args = ["lipo"] -dependencies = [ - "setup-crate-type-ios", -] - -[tasks.ios-release] -condition = { platforms = ["mac"], env_true = ["RELEASE"] } -description = "Build ios targets." -category = "Build" -command = "cargo" -args = ["lipo", "--release"] -dependencies = [ - "setup-crate-type-ios", -] - -[tasks.post-ios] -script_runner = "@duckscript" -condition = { platforms = ["mac"] } -script = [ - """ - cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/universal/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.a \ - ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/ios/lib${CARGO_MAKE_CRATE_FS_NAME}.a - """, - """ - cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/binding.h \ - ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/ios/Classes/binding.h - """, -] -dependencies = ["restore-crate-type"] - -# LINUX - -[tasks.linux] -description = "Build linux targets." -category = "Build" -dependencies = [ - "setup-crate-type-linux", - "pre-linux", - "linux-x86_64-release", - "linux-copy-lib", - "post-linux" -] - -[tasks.pre-linux] -private = true -script_runner = "@duckscript" -script = [ - "mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/linux", -] - -[tasks.linux-x86_64-release] -private = true -condition = { env_true = ["RELEASE"] } -env = { LINUX_TARGET = "x86_64-unknown-linux-gnu" } -run_task = "linux-build-release" - -[tasks.linux-build-release] -private = true -condition = { env_true = ["RELEASE"], env_set = ["LINUX_TARGET"] } -command = "cargo" -args = [ - "build", - "--release", - "--target", - "${LINUX_TARGET}" -] - -[tasks.linux-copy-lib] -private = true -condition = { env_set = ["LINUX_TARGET"] } -script_runner = "@duckscript" -script = [ - """ - cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LINUX_TARGET}/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so \ - ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME}/linux/lib${CARGO_MAKE_CRATE_FS_NAME}.so - """, -] - -[tasks.post-linux] -dependencies = ["restore-crate-type"] - -# SETUP CRATE TYPE - -[tasks.setup-crate-type-android] -private = true -env = { TARGET_OS = "android" } -run_task = "setup-crate-type" - -[tasks.setup-crate-type-ios] -private = true -env = { TARGET_OS = "ios" } -run_task = "setup-crate-type" - -[tasks.setup-crate-type-linux] -private = true -env = { TARGET_OS = "linux" } -run_task = "setup-crate-type" - -[tasks.setup-crate-type] -private = true -script_runner = "@duckscript" -script = [ - """ - toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml - crate_type = set "" - os = get_env TARGET_OS - is_android = eq ${os} "android" - is_ios = eq ${os} "ios" - is_linux = eq ${os} "linux" - if ${is_android} - crate_type = set "cdylib" - elseif ${is_ios} - crate_type = set "staticlib" - elseif ${is_linux} - crate_type = set "cdylib" - else - crate_type = set "rlib" - end - val = replace ${toml} "rlib" ${crate_type} - result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml ${val} - assert ${result} - """, -] - -# RESTORE CRATE TYPE - -[tasks.restore-crate-type] -private = true -script_runner = "@duckscript" -script = [ - """ - toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml - crate_type = set "" - os = get_env TARGET_OS - is_android = eq ${os} "android" - is_ios = eq ${os} "ios" - is_linux = eq ${os} "linux" - if ${is_android} - crate_type = set "cdylib" - elseif ${is_ios} - crate_type = set "staticlib" - elseif ${is_linux} - crate_type = set "cdylib" - else - crate_type = set "rlib" - end - val = replace ${toml} ${crate_type} "rlib" - result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml ${val} - assert ${result} - """, -] \ No newline at end of file diff --git a/README.md b/README.md index 27ed9d8..8eb43a8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ğecko -Ğecko is a transaction client owned by [Axiom-Team association] and written in Dart. It is fast and secure thanks to native code compilation, Rust cryptography bindings and Duniter's new GraphQL API (GVA). It is not intended to manage member accounts, but rather simple wallets. +Ğecko is a transaction client owned by [Axiom-Team association] and written in Dart. It is fast and secure thanks to native code compilation. It is not intended to manage member accounts, but rather simple wallets. The development is quite early, you can participate in the discussion [on the Duniter forum](https://forum.duniter.org/t/gecko-nouveau-client-de-paiements-1-sur-mobile-en-cours-de-developpement-dart-flutter/7857) (mostly FR) @@ -27,7 +27,6 @@ To contribute to the code, we advise you to install the following development en - Android NDK 1. Flutter SDK 1. VSCode/Codium Flutter extension -1. Rust toolchain This will take about 12GB on your drive and 30 min of your time (with a good connection). Don't hesitate to ask on the forum for a peer-coding session if you are stuck. @@ -58,12 +57,6 @@ Flutter is a powerfull SDK to develop Android apps. [Install it](https://flutter We are using VSCode and therefore document the process for this IDE. Of course you're free to use whatever you want. Clone the ğecko repo and open a dart file (e.g. `lib/main.dart`). VSCode will suggest you to insall relevant extensions. -### Rust toolchain - -After installing Rust with the standard [rustup install script](https://www.rust-lang.org/tools/install), -follow the instructions to build Rust dependencies [in this separate README](./packages/dubp_rs/README.md). -If you installed a 32bits VM, use the 32bits build command. - ### Build the app In a dart file (e.g. `lib/main.dart`), type the `F5` key to build the code. The app should open automatically in your VM which is running. @@ -72,28 +65,10 @@ In a dart file (e.g. `lib/main.dart`), type the `F5` key to build the code. The #### Linux -Install dependancies: - -`sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev` - -Then build debug for linux: +Build debug for linux: `flutter run -d linux` -If you get this error: - -``` -flutter /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal) -``` - -Please try: - -`sudo apt install liblzma-dev` - -then - -`flutter clean && flutter run -d linux` - ## Roadmap - v0.1.0 (expected date: 21-08-16) diff --git a/deny.toml b/deny.toml deleted file mode 100644 index e214658..0000000 --- a/deny.toml +++ /dev/null @@ -1,55 +0,0 @@ -[bans] -multiple-versions = "warn" -deny = [ - # color-backtrace is nice but brings in too many dependencies and that are often outdated, so not worth it for us. - { name = "color-backtrace" }, - - # deprecated - { name = "quickersort" }, - - # term is not fully maintained, and termcolor is replacing it - { name = "term" }, -] -skip-tree = [ - { name = "winapi", version = "<= 0.3" }, -] - -[licenses] -unlicensed = "deny" -# We want really high confidence when inferring licenses from text -confidence-threshold = 0.8 -allow = [ - "AGPL-3.0", - "Apache-2.0", - "BSD-2-Clause", - "BSD-3-Clause", - "CC0-1.0", - "ISC", - "MIT", - "MPL-2.0", - "OpenSSL", - "Zlib" -] - -[[licenses.clarify]] -name = "ring" -# SPDX considers OpenSSL to encompass both the OpenSSL and SSLeay licenses -# https://spdx.org/licenses/OpenSSL.html -# ISC - Both BoringSSL and ring use this for their new files -# MIT - "Files in third_party/ have their own licenses, as described therein. The MIT -# license, for third_party/fiat, which, unlike other third_party directories, is -# compiled into non-test libraries, is included below." -# OpenSSL - Obviously -expression = "ISC AND MIT AND OpenSSL" -license-files = [ - { path = "LICENSE", hash = 0xbd0eed23 }, -] - -[sources] -unknown-registry = "deny" -unknown-git = "deny" -allow-git = [ - "https://git.duniter.org/libs/dubp-rs-client-lib", - "https://git.duniter.org/nodes/rust/modules/duniter-gva", - "https://github.com/librelois/fast-threadpool" -] \ No newline at end of file diff --git a/lib/models/change_pin.dart b/lib/models/change_pin.dart index 43f8bc4..2bd4e08 100644 --- a/lib/models/change_pin.dart +++ b/lib/models/change_pin.dart @@ -1,4 +1,4 @@ -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/material.dart'; import 'dart:async'; import 'package:gecko/globals.dart'; @@ -14,12 +14,12 @@ class ChangePinProvider with ChangeNotifier { try { final _dewif = chestBox.get(configBox.get('currentChest')).dewif; - NewWallet newWalletFile = await DubpRust.changeDewifPin( + NewWallet newWalletFile = Dewif().changePassword( dewif: _dewif, - oldPin: _oldPin.toUpperCase(), + oldPassword: _oldPin.toUpperCase(), ); - newPin.text = pinToGive = newWalletFile.pin; + newPin.text = pinToGive = newWalletFile.password; ischangedPin = true; notifyListeners(); return newWalletFile; diff --git a/lib/models/generate_wallets.dart b/lib/models/generate_wallets.dart index 57d3d3b..cf89914 100644 --- a/lib/models/generate_wallets.dart +++ b/lib/models/generate_wallets.dart @@ -1,6 +1,6 @@ import 'dart:math'; import 'dart:typed_data'; -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; @@ -152,9 +152,9 @@ class GenerateWalletsProvider with ChangeNotifier { notifyListeners(); } - Future generateMnemonic() async { + Future genMnemonic() async { try { - generatedMnemonic = await DubpRust.genMnemonic(language: Language.french); + generatedMnemonic = generateMnemonic(lang: 'french'); actualWallet = await generateWallet(generatedMnemonic, isImport: false); walletIsGenerated = true; } catch (e) { @@ -166,18 +166,16 @@ class GenerateWalletsProvider with ChangeNotifier { Future generateWallet(String generatedMnemonic, {@required bool isImport}) async { try { - actualWallet = await DubpRust.genWalletFromMnemonic( - language: Language.french, - mnemonic: generatedMnemonic, - secretCodeType: SecretCodeType.letters, - ); + actualWallet = Dewif().generateDewif( + generatedMnemonic, randomSecretCode(5), + lang: 'french'); } catch (e) { log.e(e); } if (!isImport) { mnemonicController.text = generatedMnemonic; - pin.text = actualWallet.pin; + pin.text = actualWallet.password; } // notifyListeners(); @@ -185,12 +183,12 @@ class GenerateWalletsProvider with ChangeNotifier { } Future changePinCode({bool reload}) async { - actualWallet = await DubpRust.changeDewifPin( + actualWallet = Dewif().changePassword( dewif: actualWallet.dewif, - oldPin: actualWallet.pin, + oldPassword: actualWallet.password, ); - pin.text = actualWallet.pin; + pin.text = actualWallet.password; isPinChanged = true; if (reload) { notifyListeners(); @@ -238,13 +236,13 @@ class GenerateWalletsProvider with ChangeNotifier { Future generateCesiumWalletPubkey( String _cesiumID, String _cesiumPWD) async { - actualWallet = await DubpRust.genWalletFromDeprecatedSaltPassword( - salt: _cesiumID, password: _cesiumPWD); - String _walletPubkey = await DubpRust.getLegacyPublicKey( - salt: _cesiumID, password: _cesiumPWD); + var cesiumWallet = CesiumWallet(_cesiumID, _cesiumPWD); + actualWallet = + Dewif().generateCesiumDewif(cesiumWallet.seed, randomSecretCode(5)); + String _walletPubkey = cesiumWallet.pubkey; cesiumPubkey.text = _walletPubkey; - pin.text = actualWallet.pin; + pin.text = actualWallet.password; isPinChanged = true; log.d(_walletPubkey); } @@ -314,7 +312,7 @@ class GenerateWalletsProvider with ChangeNotifier { } Future> generateWordList() async { - final String _sentance = await generateMnemonic(); + final String _sentance = await genMnemonic(); List _wordsList = []; String word; int _nbr = 1; diff --git a/lib/models/wallet_options.dart b/lib/models/wallet_options.dart index a1c3582..fdd6f4f 100644 --- a/lib/models/wallet_options.dart +++ b/lib/models/wallet_options.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:crypto/crypto.dart'; -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:fast_base58/fast_base58.dart'; import 'package:flutter/material.dart'; import 'dart:async'; @@ -43,9 +43,8 @@ class WalletOptionsProvider with ChangeNotifier { } if (derivation != -1) { try { - List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys( - dewif: _dewif, secretCode: _pin, accountsIndex: [derivation]); - _pubkey = _pubkeysTmp[0]; + final _wallet = HdWallet.fromDewif(_dewif, _pin); + _pubkey = _wallet.getPubkey(derivation); pubkey.text = _pubkey; notifyListeners(); @@ -58,7 +57,7 @@ class WalletOptionsProvider with ChangeNotifier { } } else { try { - _pubkey = await DubpRust.getDewifPublicKey(dewif: _dewif, pin: _pin); + _pubkey = CesiumWallet.fromDewif(_dewif, _pin).pubkey; pubkey.text = _pubkey; notifyListeners(); return _pubkey; @@ -111,17 +110,18 @@ class WalletOptionsProvider with ChangeNotifier { } int getPinLenght(_walletNbr) { - String _localDewif; - if (_walletNbr is int || _walletNbr == null) { - _localDewif = chestBox.get(configBox.get('currentChest')).dewif; - } else { - _localDewif = _walletNbr; - } + // TODO: Get real Dewif lenght + // String _localDewif; + // if (_walletNbr is int || _walletNbr == null) { + // _localDewif = chestBox.get(configBox.get('currentChest')).dewif; + // } else { + // _localDewif = _walletNbr; + // } - final int _pinLenght = DubpRust.getDewifSecretCodeLen( - dewif: _localDewif, secretCodeType: SecretCodeType.letters); + // final int _pinLenght = DubpRust.getDewifSecretCodeLen( + // dewif: _localDewif, secretCodeType: SecretCodeType.letters); - return _pinLenght; + return 5; } void _renameWallet(List _walletID, _newName, {bool isCesium}) async { diff --git a/lib/models/wallets_profiles.dart b/lib/models/wallets_profiles.dart index 21e0b05..67726b5 100644 --- a/lib/models/wallets_profiles.dart +++ b/lib/models/wallets_profiles.dart @@ -1,4 +1,4 @@ -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/my_wallets.dart'; @@ -64,26 +64,20 @@ class WalletsProfilesProvider with ChangeNotifier { int derivation; if (chestBox.get(currentChest).isCesium) { - derivation = 0; + derivation = -1; } else { derivation = defaultWallet.derivation; } - try { - await DubpRust.simplePaymentFromTransparentAccount( - accountIndex: derivation, - amount: double.parse(payAmount.text), - txComment: payComment.text, - dewif: dewif, - gvaEndpoint: endPointGVA, - secretCode: pinCode, - recipient: pubkey); - return "Success"; - } catch (e) { - log.e("ERROR DUBP PAYMENTS"); - log.e(e); - return "Payments errors: $e"; - } + String result = await Gva(node: endPointGVA).pay( + recipient: pubkey, + amount: double.parse(payAmount.text), + dewif: dewif, + password: pinCode, + comment: payComment.text, + derivation: derivation); + + return result; } bool isPubkey(pubkey) { diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 776da46..4c65be5 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1,5 +1,4 @@ import 'package:bubble/bubble.dart'; -import 'package:dubp/dubp.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/chest_provider.dart'; import 'package:gecko/models/wallets_profiles.dart'; @@ -86,7 +85,6 @@ class HomeScreen extends StatelessWidget { builder: (ctx) => StatefulWrapper( onInit: () { WidgetsBinding.instance.addPostFrameCallback((_) { - DubpRust.setup(); if (isWalletsExists) homeClass.snackNode(ctx); }); }, diff --git a/lib/screens/myWallets/change_pin.dart b/lib/screens/myWallets/change_pin.dart index b429efb..e10a52f 100644 --- a/lib/screens/myWallets/change_pin.dart +++ b/lib/screens/myWallets/change_pin.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/change_pin.dart'; diff --git a/lib/screens/myWallets/confirm_wallet_storage.dart b/lib/screens/myWallets/confirm_wallet_storage.dart index fe7dc15..0cab27f 100644 --- a/lib/screens/myWallets/confirm_wallet_storage.dart +++ b/lib/screens/myWallets/confirm_wallet_storage.dart @@ -1,6 +1,5 @@ import 'dart:async'; - -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; diff --git a/lib/screens/myWallets/generate_wallets.dart b/lib/screens/myWallets/generate_wallets.dart index 0adf9d5..370a8c6 100644 --- a/lib/screens/myWallets/generate_wallets.dart +++ b/lib/screens/myWallets/generate_wallets.dart @@ -25,7 +25,7 @@ class GenerateFastChestScreen extends StatelessWidget { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); GenerateWalletsProvider _generateWalletProvider = Provider.of(context); - _generateWalletProvider.generateMnemonic(); + _generateWalletProvider.genMnemonic(); return Scaffold( appBar: AppBar( @@ -40,7 +40,7 @@ class GenerateFastChestScreen extends StatelessWidget { child: FittedBox( child: FloatingActionButton( heroTag: "buttonGenerateWallet", - onPressed: () => _generateWalletProvider.generateMnemonic(), + onPressed: () => _generateWalletProvider.genMnemonic(), child: SizedBox( height: 40.0, width: 40.0, diff --git a/lib/screens/myWallets/unlocking_wallet.dart b/lib/screens/myWallets/unlocking_wallet.dart index 77701af..65ce3d6 100644 --- a/lib/screens/myWallets/unlocking_wallet.dart +++ b/lib/screens/myWallets/unlocking_wallet.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'package:dubp/dubp.dart'; import 'package:flutter/services.dart'; import 'package:gecko/models/chest_data.dart'; import 'package:gecko/models/wallets_profiles.dart'; @@ -28,8 +27,6 @@ class UnlockingWallet extends StatelessWidget { var walletPin = ''; String resultPay; - Future get badWallet => null; - @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); @@ -225,15 +222,15 @@ class UnlockingWallet extends StatelessWidget { } Future _paymentsResult(context) { - if (resultPay != "Success") log.i(resultPay); + if (resultPay != "success") log.i(resultPay); return showDialog( context: context, barrierDismissible: true, // user must tap button! builder: (BuildContext context) { return AlertDialog( - title: Text(resultPay == "Success" + title: Text(resultPay == "success" ? 'Paiement effecuté avec succès !' - : "Une erreur s'est produite lors du paiement"), + : "Une erreur s'est produite lors du paiement:\n$resultPay"), content: const SingleChildScrollView(child: Text('')), actions: [ TextButton( diff --git a/lib/screens/onBoarding/11.dart b/lib/screens/onBoarding/11.dart index 58e6878..0c8a7a8 100644 --- a/lib/screens/onBoarding/11.dart +++ b/lib/screens/onBoarding/11.dart @@ -1,6 +1,5 @@ // ignore_for_file: file_names - -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; diff --git a/lib/screens/onBoarding/12.dart b/lib/screens/onBoarding/12.dart index ecbc27f..4169dd4 100644 --- a/lib/screens/onBoarding/12.dart +++ b/lib/screens/onBoarding/12.dart @@ -1,7 +1,7 @@ // ignore_for_file: file_names import 'dart:async'; -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; diff --git a/lib/screens/onBoarding/7.dart b/lib/screens/onBoarding/7.dart index 6604b5b..5fc2b9c 100644 --- a/lib/screens/onBoarding/7.dart +++ b/lib/screens/onBoarding/7.dart @@ -96,9 +96,7 @@ class OnboardingStepNine extends StatelessWidget { FaderTransition( page: OnboardingStepTen( generatedMnemonic: - _generateWalletProvider.generatedMnemonic, - generatedWallet: - _generateWalletProvider.actualWallet), + _generateWalletProvider.generatedMnemonic), isFast: true), ); }, diff --git a/lib/screens/onBoarding/8.dart b/lib/screens/onBoarding/8.dart index 3426035..06de8dd 100644 --- a/lib/screens/onBoarding/8.dart +++ b/lib/screens/onBoarding/8.dart @@ -1,6 +1,4 @@ // ignore_for_file: file_names - -import 'package:dubp/dubp.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; @@ -14,12 +12,9 @@ class OnboardingStepTen extends StatelessWidget { OnboardingStepTen({ Key validationKey, @required this.generatedMnemonic, - @required this.generatedWallet, }) : super(key: validationKey); String generatedMnemonic; - NewWallet generatedWallet; - TextEditingController tplController = TextEditingController(); TextEditingController wordController = TextEditingController(); final TextEditingController _mnemonicController = TextEditingController(); diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 8211062..9b6699c 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:dubp/dubp.dart'; +import 'package:durt/durt.dart'; import 'package:flutter/services.dart'; import 'package:gecko/models/my_wallets.dart'; import 'package:gecko/screens/myWallets/generate_wallets.dart'; diff --git a/native/dubp_rs/Cargo.toml b/native/dubp_rs/Cargo.toml deleted file mode 100644 index 4359111..0000000 --- a/native/dubp_rs/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "dubp_rs" -version = "0.1.0" -authors = ["Éloïs SANCHEZ "] -license = "AGPL-3.0" -edition = "2018" - -[lib] -name = "dubp_rs" -crate-type = ["rlib"] - -[dependencies] -allo-isolate = "0.1.6" -dubp-client = { git = "https://git.duniter.org/libs/dubp-rs-client-lib", branch = "master", features = ["blocking"], default-features = false } -#dubp-client= { path = "../dubp-rs-client-lib", features = ["blocking"], default-features = false } -fast-threadpool = { version = "0.3.0", default-features = false } -once_cell = { version = "1.3.1", default-features = false, features = ["std"] } -parking_lot = "0.11.1" -thiserror = "1.0.24" - -[build-dependencies] -cbindgen = "0.14.3" -dart-bindgen = "0.1.7" - -[dev-dependencies] -assert_matches = "1.5.0" -rusty-hook = "^0.11.2" \ No newline at end of file diff --git a/native/dubp_rs/build.rs b/native/dubp_rs/build.rs deleted file mode 100644 index 39fd1b6..0000000 --- a/native/dubp_rs/build.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use dart_bindgen::{config::*, Codegen}; - -fn main() { - let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); - let config = cbindgen::Config { - language: cbindgen::Language::C, - braces: cbindgen::Braces::SameLine, - cpp_compat: true, - style: cbindgen::Style::Both, - ..Default::default() - }; - cbindgen::Builder::new() - .with_crate(crate_dir) - .with_config(config) - .generate() - .expect("Unable to generate bindings") - .write_to_file("binding.h"); - let config = DynamicLibraryConfig { - ios: DynamicLibraryCreationMode::Executable.into(), - android: DynamicLibraryCreationMode::open("libdubp_rs.so").into(), - linux: DynamicLibraryCreationMode::open("libdubp_rs.so").into(), - ..Default::default() - }; - // load the c header file, with config and lib name - let codegen = Codegen::builder() - .with_src_header("binding.h") - .with_lib_name("libdubp") - .with_config(config) - .with_allo_isolate() - .build() - .unwrap(); - // generate the dart code and get the bindings back - let bindings = codegen.generate().unwrap(); - // write the bindings to your dart package - // and start using it to write your own high level abstraction. - bindings - .write_to_file("../../packages/dubp_rs/lib/ffi.dart") - .unwrap(); -} diff --git a/native/dubp_rs/src/async.rs b/native/dubp_rs/src/async.rs deleted file mode 100644 index b7ce764..0000000 --- a/native/dubp_rs/src/async.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -static THREAD_POOL: Lazy> = Lazy::new(|| { - ThreadPool::start(ThreadPoolConfig::low().queue_size(Some(16)), ()).into_sync_handler() -}); - -pub(crate) fn exec_async(port: i64, parse_params: F, async_job: F2) -where - P: 'static + Send + Sync, - F: FnOnce() -> Result, - F2: 'static + Send + Sync + FnOnce(P) -> R, - DartRes: From, -{ - match parse_params() { - Ok(parsed_params) => { - if THREAD_POOL - .launch(move |_| Isolate::new(port).post(DartRes::from(async_job(parsed_params)))) - .is_err() - { - Isolate::new(port).post(DartRes::err("thread pool panicked")); - } - } - Err(e) => { - Isolate::new(port).post(DartRes::err(e)); - } - } -} diff --git a/native/dubp_rs/src/dewif.rs b/native/dubp_rs/src/dewif.rs deleted file mode 100644 index 84f3eee..0000000 --- a/native/dubp_rs/src/dewif.rs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -pub mod bip32; -pub mod classic; - -use crate::*; - -pub(super) fn change_secret_code( - dewif: &str, - old_secret_code: &str, - member_wallet: bool, - secret_code_type: SecretCodeType, - system_memory: i64, -) -> Result, DubpError> { - let new_log_n = log_n(system_memory); - let new_secret_code = gen_secret_code(member_wallet, secret_code_type, new_log_n)?; - - let new_dewif = dubp_client::crypto::dewif::change_dewif_passphrase( - dewif, - old_secret_code, - &new_secret_code, - ) - .map_err(DubpError::DewifReadError)?; - - Ok(vec![new_dewif, new_secret_code]) -} - -pub(super) fn gen_dewif( - currency: &str, - language: Language, - mnemonic: &str, - member_wallet: bool, - secret_code_type: SecretCodeType, - system_memory: i64, -) -> Result, DubpError> { - let currency = parse_currency(currency)?; - let mnemonic = - Mnemonic::from_phrase(mnemonic, language).map_err(|_| DubpError::WrongLanguage)?; - - let log_n = log_n(system_memory); - let secret_code = gen_secret_code(member_wallet, secret_code_type, log_n)?; - - let dewif = - dubp_client::crypto::dewif::create_dewif_v1(currency, log_n, &mnemonic, &secret_code) - .map_err(|_| DubpError::RandErr)?; - - Ok(vec![dewif, secret_code]) -} - -pub(super) fn get_dewif_meta( - dewif: &str, - member_wallet: bool, - secret_code_type: SecretCodeType, -) -> Result, DubpError> { - let dubp_client::crypto::dewif::DewifMeta { - algo, - currency, - log_n, - version, - } = dubp_client::crypto::dewif::read_dewif_meta(dewif).map_err(DubpError::DewifReadError)?; - - let secret_code_len = - crate::secret_code::compute_secret_code_len(member_wallet, secret_code_type, log_n)?; - - Ok(vec![ - if algo == KeysAlgo::Bip32Ed25519 { - "Bip32Ed25519".to_owned() - } else { - "Ed25519".to_owned() - }, - currency.to_string(), - secret_code_len.to_string(), - version.to_string(), - ]) -} - -pub(super) fn get_pubkey( - account_index_opt: Option, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, -) -> Result { - if let Some(account_index) = account_index_opt { - dewif::bip32::get_bip32_pubkey( - account_index, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - ) - } else if address_index_opt.is_none() && external_opt.is_none() { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - - match payload { - DewifPayload::Ed25519(keypair) => Ok(keypair.public_key().to_base58()), - DewifPayload::Bip32Ed25519(_) => Err(DubpError::GetMasterPubkeyOfHdWallet), - } - } else { - Err(DubpError::GiveExternalBoolOrAddressIndexForLegacyWallet) - } -} - -pub(super) fn get_secret_code_len( - dewif: *const raw::c_char, - member_wallet: u32, - secret_code_type: u32, -) -> Result { - let dewif = char_ptr_to_str(dewif)?; - let member_wallet = member_wallet != 0; - let secret_code_type = SecretCodeType::from(secret_code_type); - - let log_n = dubp_client::crypto::dewif::read_dewif_log_n(ExpectedCurrency::Any, dewif) - .map_err(DubpError::DewifReadError)?; - - crate::secret_code::compute_secret_code_len(member_wallet, secret_code_type, log_n) -} - -pub(crate) fn log_n(system_memory: i64) -> u8 { - if system_memory > 3_000_000_000 { - 15 - } else { - 12 - } -} - -pub(super) fn sign( - account_index_opt: Option, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, - msg: &str, -) -> Result { - if let Some(account_index) = account_index_opt { - dewif::bip32::sign_bip32( - account_index, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msg, - ) - } else { - dewif::classic::sign(currency, dewif, secret_code, msg) - } -} - -pub(super) fn sign_several( - account_index_opt: Option, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, - msgs: &[&str], -) -> Result, DubpError> { - if let Some(account_index) = account_index_opt { - dewif::bip32::sign_several_bip32( - account_index, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msgs, - ) - } else { - dewif::classic::sign_several(currency, dewif, secret_code, msgs) - } -} diff --git a/native/dubp_rs/src/dewif/bip32.rs b/native/dubp_rs/src/dewif/bip32.rs deleted file mode 100644 index a90ede2..0000000 --- a/native/dubp_rs/src/dewif/bip32.rs +++ /dev/null @@ -1,436 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -#[derive(Debug)] -struct OpaqueAccount { - address_index: u32, - chain_code: ChainCode, - public_key: PublicKey, -} - -static CHAINING_EXTERNAL_PUBKEYS: Lazy>>> = - Lazy::new(|| Arc::new(Mutex::new(HashMap::new()))); - -pub(crate) fn get_accounts_pubkeys( - currency: Currency, - dewif: &str, - secret_code: &str, - accounts_indexs: Vec, -) -> Result, DubpError> { - if accounts_indexs.contains(&U31::new(0)?) { - verify_member_secret_code(currency, dewif, secret_code)?; - } - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => { - let master_keypair = KeyPair::from_mnemonic(&mnemonic); - Ok(accounts_indexs - .into_iter() - .map(|account_index| { - PrivateDerivationPath::transparent(account_index) - .map(|path| master_keypair.derive(path).public_key().to_base58()) - }) - .collect::, InvalidAccountIndex>>()?) - } - _ => Err(DubpError::NotHdWallet), - } -} - -pub(crate) fn get_bip32_keypair( - account_index: u32, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, -) -> Result { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - - if account_index == 0 { - verify_member_secret_code(currency, dewif, secret_code)?; - } - - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => { - let master_keypair = KeyPair::from_mnemonic(&mnemonic); - Ok(KeyPairEnum::Bip32Ed25519(master_keypair.derive( - z_get_derivation_path(account_index, address_index_opt, external_opt)?, - ))) - } - _ => Err(DubpError::NotHdWallet), - } -} - -pub(crate) fn get_bip32_pubkey( - account_index: u32, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, -) -> Result { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - - if account_index == 0 { - verify_member_secret_code(currency, dewif, secret_code)?; - } - - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => { - let master_keypair = KeyPair::from_mnemonic(&mnemonic); - Ok(master_keypair - .derive(z_get_derivation_path( - account_index, - address_index_opt, - external_opt, - )?) - .public_key() - .to_base58()) - } - _ => Err(DubpError::NotHdWallet), - } -} - -pub(crate) fn get_opaque_account_next_external_address( - account_index: U31, -) -> Result { - let mut guard = CHAINING_EXTERNAL_PUBKEYS.lock(); - if let Some(opaque_account) = guard.get_mut(&account_index.into_u32()) { - let next_address = PublicKeyWithChainCode { - chain_code: opaque_account.chain_code, - public_key: opaque_account.public_key, - } - .derive(U31::new(opaque_account.address_index).expect("unreachable")) - .expect("unreachable") - .public_key; - - opaque_account.address_index += 1; - - Ok(next_address.to_base58()) - } else { - Err(DubpError::OpaqueAccountNotLoaded) - } -} - -pub(crate) fn get_mnemonic( - currency: Currency, - dewif: &str, - secret_code: &str, -) -> Result { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => Ok(mnemonic.phrase().to_owned()), - _ => Err(DubpError::NotHdWallet), - } -} - -pub(crate) fn load_opaque_bip32_accounts( - accounts_indexs: Vec, - currency: Currency, - dewif: &str, - secret_code: &str, -) -> Result<(), DubpError> { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => { - let master_keypair = KeyPair::from_mnemonic(&mnemonic); - for account_index in accounts_indexs { - let external_path = PrivateDerivationPath::opaque(account_index, true, None)?; - let external_kp = master_keypair.derive(external_path); - let opaque_account = OpaqueAccount { - address_index: 0, - public_key: external_kp.public_key(), - chain_code: external_kp.chain_code(), - }; - - let mut guard = CHAINING_EXTERNAL_PUBKEYS.lock(); - guard.insert(account_index.into_u32(), opaque_account); - } - Ok(()) - } - _ => Err(DubpError::NotHdWallet), - } -} - -pub(crate) fn sign_bip32( - account_index: u32, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, - msg: &str, -) -> Result { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - - if account_index == 0 { - verify_member_secret_code(currency, dewif, secret_code)?; - } - - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => { - let master_keypair = KeyPair::from_mnemonic(&mnemonic); - sign_bip32_inner( - account_index, - address_index_opt, - external_opt, - master_keypair, - msg, - ) - } - _ => Err(DubpError::NotHdWallet), - } -} - -pub(crate) fn sign_several_bip32( - account_index: u32, - address_index_opt: Option, - currency: Currency, - dewif: &str, - external_opt: Option, - secret_code: &str, - msgs: &[&str], -) -> Result, DubpError> { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - - if account_index == 0 { - verify_member_secret_code(currency, dewif, secret_code)?; - } - - match payload { - DewifPayload::Bip32Ed25519(mnemonic) => { - let master_keypair = KeyPair::from_mnemonic(&mnemonic); - sign_several_bip32_inner( - account_index, - address_index_opt, - external_opt, - master_keypair, - msgs, - ) - } - _ => Err(DubpError::NotHdWallet), - } -} - -fn sign_bip32_inner( - account_index: u32, - address_index_opt: Option, - external_opt: Option, - master_keypair: KeyPair, - msg: &str, -) -> Result { - Ok(master_keypair - .derive(z_get_derivation_path( - account_index, - address_index_opt, - external_opt, - )?) - .generate_signator() - .sign(msg.as_bytes()) - .to_base64()) -} - -fn sign_several_bip32_inner( - account_index: u32, - address_index_opt: Option, - external_opt: Option, - master_keypair: KeyPair, - msgs: &[&str], -) -> Result, DubpError> { - let signator = master_keypair - .derive(z_get_derivation_path( - account_index, - address_index_opt, - external_opt, - )?) - .generate_signator(); - - Ok(msgs - .iter() - .map(|msg| signator.sign(msg.as_bytes()).to_base64()) - .collect()) -} - -fn verify_member_secret_code( - currency: Currency, - dewif: &str, - secret_code: &str, -) -> Result<(), DubpError> { - if crate::secret_code::is_ascii_letters(secret_code) { - let log_n = dubp_client::crypto::dewif::read_dewif_log_n( - ExpectedCurrency::Specific(currency), - dewif, - ) - .map_err(DubpError::DewifReadError)?; - let expected_secret_code_len = - crate::secret_code::compute_secret_code_len(true, SecretCodeType::Letters, log_n)?; - - if secret_code.len() < expected_secret_code_len { - Err(DubpError::SecretCodeTooShort) - } else { - Ok(()) - } - } else { - Err(DubpError::InvalidSecretCodeType) - } -} - -fn z_get_derivation_path( - account_index: u32, - address_index_opt: Option, - external_opt: Option, -) -> Result { - let account_index_u31 = U31::new(account_index)?; - match account_index % 3 { - 0 => Ok(PrivateDerivationPath::transparent(account_index_u31)?), - 1 => { - if let Some(external) = external_opt { - if external { - if address_index_opt.is_none() { - Ok(PrivateDerivationPath::semi_opaque_external( - account_index_u31, - )?) - } else { - Err(DubpError::InvalidAccountIndex(InvalidAccountIndex)) - } - } else if address_index_opt.is_some() { - Ok(PrivateDerivationPath::semi_opaque_internal( - account_index_u31, - address_index_opt, - )?) - } else { - Err(DubpError::TryToSignWithInternalChainingAddress) - } - } else { - Err(DubpError::MissingExternalBool) - } - } - 2 => { - if address_index_opt.is_some() { - if let Some(external) = external_opt { - Ok(PrivateDerivationPath::opaque( - account_index_u31, - external, - address_index_opt, - )?) - } else { - Err(DubpError::MissingExternalBool) - } - } else { - Err(DubpError::TryToSignWithChainingAddress) - } - } - _ => unreachable!(), - } -} - -#[cfg(test)] -mod tests { - use super::*; - use assert_matches::assert_matches; - - const MNEMONIC: &str = - "tongue cute mail fossil great frozen same social weasel impact brush kind"; - - #[test] - fn test_get_accounts_pubkeys() -> Result<(), DubpError> { - let vec = crate::dewif::gen_dewif( - "g1", - Language::English, - MNEMONIC, - false, - SecretCodeType::Letters, - 1_000, - )?; - let dewif = &vec[0]; - let secret_code = &vec[1]; - //println!("TMP: secret_code={}", secret_code); - - assert_matches!( - get_accounts_pubkeys( - Currency::from(G1_CURRENCY), - dewif, - secret_code, - vec![U31::new(0).expect("unreachable")], - ), - Err(DubpError::SecretCodeTooShort) - ); - - Ok(()) - } - - #[test] - fn test_sign_bip32() { - assert_matches!( - z_get_derivation_path(1, None, None), - Err(DubpError::MissingExternalBool) - ); - assert_matches!( - z_get_derivation_path(2, None, None), - Err(DubpError::TryToSignWithChainingAddress) - ); - assert_matches!(z_get_derivation_path(3, None, None), Ok(_)); - assert_matches!( - z_get_derivation_path(1, None, Some(false)), - Err(DubpError::TryToSignWithInternalChainingAddress) - ); - assert_matches!( - z_get_derivation_path(2, None, Some(true)), - Err(DubpError::TryToSignWithChainingAddress) - ); - assert_matches!( - z_get_derivation_path(1, Some(U31::new(5).expect("unreachable")), Some(true),), - Err(DubpError::InvalidAccountIndex(_)) - ); - } -} diff --git a/native/dubp_rs/src/dewif/classic.rs b/native/dubp_rs/src/dewif/classic.rs deleted file mode 100644 index 19b6f59..0000000 --- a/native/dubp_rs/src/dewif/classic.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -pub(crate) fn sign( - currency: Currency, - dewif: &str, - secret_code: &str, - msg: &str, -) -> Result { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - if let DewifPayload::Ed25519(keypair) = payload { - Ok(keypair.generate_signator().sign(msg.as_bytes()).to_base64()) - } else { - Err(DubpError::DewifReadError(DewifReadError::CorruptedContent)) - } -} - -pub(crate) fn sign_several( - currency: Currency, - dewif: &str, - secret_code: &str, - msgs: &[&str], -) -> Result, DubpError> { - let DewifContent { payload, .. } = dubp_client::crypto::dewif::read_dewif_content( - ExpectedCurrency::Specific(currency), - dewif, - &secret_code.to_ascii_uppercase(), - ) - .map_err(DubpError::DewifReadError)?; - if let DewifPayload::Ed25519(keypair) = payload { - let signator = keypair.generate_signator(); - Ok(msgs - .iter() - .map(|msg| signator.sign(msg.as_bytes()).to_base64()) - .collect()) - } else { - Err(DubpError::DewifReadError(DewifReadError::CorruptedContent)) - } -} diff --git a/native/dubp_rs/src/error.rs b/native/dubp_rs/src/error.rs deleted file mode 100644 index 479b0c2..0000000 --- a/native/dubp_rs/src/error.rs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -/// Dubp error -#[allow(clippy::large_enum_variant)] -#[derive(Debug, Error)] -pub(crate) enum DubpError { - #[error("{0}")] - DewifReadError(DewifReadError), - #[error("Digits secret code forbid for member wallet")] - DigitsCodeForbidForMemberWallet, - #[error("It is forbidden to retrieve the master public key of an HD wallet.")] - GetMasterPubkeyOfHdWallet, - #[error("Give external bool or address index for legacy wallet.")] - GiveExternalBoolOrAddressIndexForLegacyWallet, - #[error("{0}")] - GvaClientError(dubp_client::GvaClientError), - #[error("I/O error: {0}")] - IoErr(io::Error), - #[error("{0}")] - InvalidAccountIndex(InvalidAccountIndex), - #[error("{0}")] - InvalidPubkey(PublicKeyFromStrErr), - #[error("{0}")] - InvalidScript(dubp_client::documents_parser::TextParseError), - #[error("{0}")] - InvalidU31(U31Error), - #[error("Invalid secret code type")] - InvalidSecretCodeType, - #[error("Missing external bool")] - MissingExternalBool, - #[error("this wallet is not an HD wallet")] - NotHdWallet, - #[error("A given parameter is null")] - NullParamErr, - #[error("Opaque account not loaded")] - OpaqueAccountNotLoaded, - #[error("Payment error: {0}")] - PaymentError(String), - #[error("Secret code too short: please change your secret code")] - SecretCodeTooShort, - #[error("The chaining address cannot be used to sign with opaque account")] - TryToSignWithChainingAddress, - #[error("The internal chaining address cannot be used to sign with semi-opaque account")] - TryToSignWithInternalChainingAddress, - #[error("fail to generate random bytes")] - RandErr, - #[error("Unknown currency name")] - UnknownCurrencyName, - #[error("Unknown language")] - UnknownLanguage, - //#[error("Unsupported DEWIF version")] - //UnsupportedDewifVersion, - #[error("{0}")] - Utf8Error(std::str::Utf8Error), - #[error("Wrong language")] - WrongLanguage, -} - -impl From for DubpError { - fn from(e: io::Error) -> Self { - Self::IoErr(e) - } -} - -impl From for DubpError { - fn from(e: InvalidAccountIndex) -> Self { - Self::InvalidAccountIndex(e) - } -} - -impl From for DubpError { - fn from(e: U31Error) -> Self { - Self::InvalidU31(e) - } -} - -pub(crate) struct DartRes(allo_isolate::ffi::DartCObject); -impl DartRes { - pub(crate) fn err(e: E) -> allo_isolate::ffi::DartCObject { - vec![format!("DUBP_RS_ERROR: {}", e.to_string())].into_dart() - } -} -impl IntoDart for DartRes { - fn into_dart(self) -> allo_isolate::ffi::DartCObject { - self.0.into_dart() - } -} -impl From> for DartRes -where - E: ToString, -{ - fn from(res: Result<(), E>) -> Self { - match res { - Ok(()) => Self("".into_dart()), - Err(e) => Self(format!("DUBP_RS_ERROR: {}", e.to_string()).into_dart()), - } - } -} -impl From> for DartRes -where - E: ToString, -{ - fn from(res: Result) -> Self { - match res { - Ok(string) => Self(string.into_dart()), - Err(e) => Self(format!("DUBP_RS_ERROR: {}", e.to_string()).into_dart()), - } - } -} -impl From, E>> for DartRes -where - E: ToString, -{ - fn from(res: Result, E>) -> Self { - match res { - Ok(vec_string) => Self(vec_string.into_dart()), - Err(e) => Self(vec![format!("DUBP_RS_ERROR: {}", e.to_string())].into_dart()), - } - } -} diff --git a/native/dubp_rs/src/inputs.rs b/native/dubp_rs/src/inputs.rs deleted file mode 100644 index bd6fcc9..0000000 --- a/native/dubp_rs/src/inputs.rs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -#[derive(Clone, Copy, Debug)] -pub(crate) enum SecretCodeType { - Digits, - Letters, -} -impl From for SecretCodeType { - fn from(i: u32) -> Self { - if i == 0 { - SecretCodeType::Digits - } else { - SecretCodeType::Letters - } - } -} -#[derive(Clone, Copy, Debug)] -pub(crate) enum WalletType { - Ed25519, - Bip32Ed25519, -} -impl From for WalletType { - fn from(i: u32) -> Self { - if i == 1 { - WalletType::Bip32Ed25519 - } else { - WalletType::Ed25519 - } - } -} - -pub(crate) fn char_ptr_to_str<'a>(c_char_ptr: *const raw::c_char) -> Result<&'a str, DubpError> { - if c_char_ptr.is_null() { - Err(DubpError::NullParamErr) - } else { - unsafe { CStr::from_ptr(c_char_ptr).to_str() }.map_err(DubpError::Utf8Error) - } -} - -pub(crate) fn char_ptr_to_opt_string( - c_char_ptr: *const raw::c_char, -) -> Result, DubpError> { - Ok(if c_char_ptr.is_null() { - None - } else { - Some( - unsafe { CStr::from_ptr(c_char_ptr).to_str() } - .map_err(DubpError::Utf8Error)? - .to_owned(), - ) - }) -} - -pub(crate) fn char_ptr_prt_to_vec_u31( - u32_ptr: *const u32, - len: u32, -) -> Result, DubpError> { - u32_ptr_to_vec_u32(u32_ptr, len) - .into_iter() - .map(|ai| U31::new(ai).map_err(DubpError::InvalidU31)) - .collect() -} - -pub(crate) fn char_ptr_prt_to_vec_str<'a>( - char_ptr_ptr: *const *const raw::c_char, - len: u32, -) -> Result, DubpError> { - let len = len as usize; - let char_ptr_slice: &[*const raw::c_char] = - unsafe { std::slice::from_raw_parts(char_ptr_ptr, len) }; - let mut str_vec = Vec::with_capacity(len); - for char_ptr in char_ptr_slice { - str_vec.push(char_ptr_to_str(*char_ptr)?); - } - Ok(str_vec) -} - -pub(crate) fn i32_to_opt_bool(i: i32) -> Option { - match i { - 1 => Some(true), - 0 => Some(false), - _ => None, - } -} - -pub(crate) fn i32_to_opt_u31(i: i32) -> Result, DubpError> { - if i >= 0 { - Ok(Some(U31::new(i as u32)?)) - } else { - Ok(None) - } -} - -pub(crate) fn i32_to_opt_u32(i: i32) -> Option { - if i >= 0 { - Some(i as u32) - } else { - None - } -} - -pub(crate) fn parse_currency(currency: &str) -> Result { - let currency_code = match currency { - "g1" => G1_CURRENCY, - "g1-test" | "gt" => G1_TEST_CURRENCY, - _ => return Err(DubpError::UnknownCurrencyName), - }; - Ok(Currency::from(currency_code)) -} - -pub(crate) fn u32_ptr_to_vec_u32(u32_ptr: *const u32, len: u32) -> Vec { - let len = len as usize; - let u32_slice: &[u32] = unsafe { std::slice::from_raw_parts(u32_ptr, len) }; - let mut vec = Vec::with_capacity(len); - for u32_ in u32_slice { - vec.push(*u32_); - } - vec -} - -pub(crate) fn u32_to_language(i: u32) -> Result { - match i { - 0 => Ok(Language::English), - 1 => Ok(Language::French), - _ => Err(DubpError::UnknownLanguage), - } -} diff --git a/native/dubp_rs/src/legacy.rs b/native/dubp_rs/src/legacy.rs deleted file mode 100644 index 1522aee..0000000 --- a/native/dubp_rs/src/legacy.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; -use dubp_client::crypto::keys::ed25519::{KeyPairFromSaltedPasswordGenerator, SaltedPassword}; - -#[allow(deprecated)] -pub(super) fn gen_dewif_from_legacy( - currency: &str, - salt: String, - password: String, - member_wallet: bool, - secret_code_type: SecretCodeType, - system_memory: i64, -) -> Result, DubpError> { - let currency = parse_currency(currency)?; - let keypair = KeyPairFromSaltedPasswordGenerator::with_default_parameters() - .generate(SaltedPassword::new(salt.clone(), password.clone())); - - let log_n = crate::dewif::log_n(system_memory); - let secret_code = gen_secret_code(member_wallet, secret_code_type, log_n)?; - let dewif = dubp_client::crypto::dewif::create_dewif_v1_legacy( - currency, - log_n, - password, - salt, - &secret_code, - ) - .map_err(|_| DubpError::RandErr)?; - let pubkey = keypair.public_key().to_base58(); - Ok(vec![dewif, secret_code, pubkey]) -} - -pub(super) fn get_pubkey(salt: &str, password: &str) -> String { - KeyPairFromSaltedPasswordGenerator::with_default_parameters() - .generate(SaltedPassword::new(salt.to_owned(), password.to_owned())) - .public_key() - .to_base58() -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_dewif_legacy() -> Result<(), DubpError> { - let wallet = gen_dewif_from_legacy( - "g1", - "salt".to_owned(), - "pass".to_owned(), - false, - SecretCodeType::Letters, - 1_000_000_000, - )?; - let dewif = &wallet[0]; - let secret_code = &wallet[1]; - let pubkey = &wallet[2]; - - assert_eq!(pubkey, "3YumN7F7D8c2hmkHLHf3ZD8wc3tBHiECEK9zLPkaJtAF"); - - assert_eq!(get_pubkey("salt", "pass"), pubkey.to_owned()); - - assert_eq!( - crate::dewif::get_pubkey( - None, - None, - Currency::from(G1_CURRENCY), - &dewif, - None, - &secret_code - )?, - pubkey.to_owned() - ); - - Ok(()) - } -} diff --git a/native/dubp_rs/src/lib.rs b/native/dubp_rs/src/lib.rs deleted file mode 100644 index 64876fc..0000000 --- a/native/dubp_rs/src/lib.rs +++ /dev/null @@ -1,536 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#![allow(clippy::missing_safety_doc, clippy::not_unsafe_ptr_arg_deref)] - -mod r#async; -mod dewif; -mod error; -mod inputs; -mod legacy; -mod mnemonic; -mod payment; -mod pubkey; -mod secret_code; - -use crate::error::{DartRes, DubpError}; -use crate::inputs::*; -use crate::r#async::exec_async; -use crate::secret_code::gen_secret_code; -use allo_isolate::{IntoDart, Isolate}; -use dubp_client::crypto::{ - bases::b58::ToBase58, - dewif::{ - Currency, DewifContent, DewifPayload, DewifReadError, ExpectedCurrency, G1_CURRENCY, - G1_TEST_CURRENCY, - }, - keys::{ - ed25519::bip32::{ - ChainCode, InvalidAccountIndex, KeyPair, PrivateDerivationPath, PublicKeyWithChainCode, - }, - ed25519::{KeyPairFromSeed32Generator, PublicKey, PublicKeyFromStrErr}, - KeyPair as _, KeyPairEnum, KeysAlgo, PublicKey as _, Signator as _, Signature as _, - }, - mnemonic::{Language, Mnemonic, MnemonicType}, - utils::{U31Error, U31}, -}; -use fast_threadpool::{ThreadPool, ThreadPoolConfig, ThreadPoolSyncHandler}; -use once_cell::sync::Lazy; -use parking_lot::Mutex; -use std::{collections::HashMap, ffi::CStr, io, os::raw, sync::Arc}; -use thiserror::Error; - -#[no_mangle] -pub extern "C" fn change_dewif_secret_code( - port: i64, - dewif: *const raw::c_char, - old_secret_code: *const raw::c_char, - member_wallet: u32, - secret_code_type: u32, - system_memory: i64, -) { - exec_async( - port, - || { - let dewif = char_ptr_to_str(dewif)?; - let old_secret_code = char_ptr_to_str(old_secret_code)?; - let member_wallet = member_wallet != 0; - let secret_code_type = SecretCodeType::from(secret_code_type); - Ok(( - dewif, - old_secret_code, - member_wallet, - secret_code_type, - system_memory, - )) - }, - |(dewif, old_secret_code, member_wallet, secret_code_type, system_memory)| { - dewif::change_secret_code( - dewif, - old_secret_code, - member_wallet, - secret_code_type, - system_memory, - ) - }, - ) -} - -#[no_mangle] -pub extern "C" fn check_pubkey(port: i64, pubkey: *const raw::c_char) { - exec_async(port, || char_ptr_to_str(pubkey), pubkey::check_pubkey) -} - -#[no_mangle] -pub extern "C" fn compute_checksum(port: i64, pubkey: *const raw::c_char) { - exec_async(port, || char_ptr_to_str(pubkey), pubkey::compute_checksum) -} - -#[no_mangle] -pub extern "C" fn gen_dewif( - port: i64, - currency: *const raw::c_char, - language: u32, - mnemonic: *const raw::c_char, - member_wallet: u32, - secret_code_type: u32, - system_memory: i64, -) { - exec_async( - port, - || { - let currency = char_ptr_to_str(currency)?; - let language = u32_to_language(language)?; - let mnemonic = char_ptr_to_str(mnemonic)?; - let member_wallet = member_wallet != 0; - let secret_code_type = SecretCodeType::from(secret_code_type); - Ok(( - currency, - language, - mnemonic, - member_wallet, - secret_code_type, - system_memory, - )) - }, - |(currency, language, mnemonic, member_wallet, secret_code_type, system_memory)| { - dewif::gen_dewif( - currency, - language, - mnemonic, - member_wallet, - secret_code_type, - system_memory, - ) - }, - ) -} - -#[no_mangle] -pub extern "C" fn gen_dewif_from_legacy( - port: i64, - currency: *const raw::c_char, - salt: *const raw::c_char, - password: *const raw::c_char, - member_wallet: u32, - secret_code_type: u32, - system_memory: i64, -) { - exec_async( - port, - || { - let currency = char_ptr_to_str(currency)?; - let salt = char_ptr_to_str(salt)?.to_owned(); - let password = char_ptr_to_str(password)?.to_owned(); - let member_wallet = member_wallet != 0; - let secret_code_type = SecretCodeType::from(secret_code_type); - Ok(( - currency, - salt, - password, - member_wallet, - secret_code_type, - system_memory, - )) - }, - |(currency, salt, password, member_wallet, secret_code_type, system_memory)| { - legacy::gen_dewif_from_legacy( - currency, - salt, - password, - member_wallet, - secret_code_type, - system_memory, - ) - }, - ) -} - -#[no_mangle] -pub extern "C" fn gen_mnemonic(port: i64, language: u32) { - exec_async(port, || u32_to_language(language), mnemonic::gen_mnemonic) -} - -#[no_mangle] -pub extern "C" fn get_bip32_dewif_accounts_pubkeys( - port: i64, - currency: *const raw::c_char, - dewif: *const raw::c_char, - secret_code: *const raw::c_char, - accounts_indexs_len: u32, - accounts_indexs: *const u32, -) { - exec_async( - port, - || { - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let secret_code = char_ptr_to_str(secret_code)?; - let accounts_indexs = char_ptr_prt_to_vec_u31(accounts_indexs, accounts_indexs_len)?; - Ok((currency, dewif, secret_code, accounts_indexs)) - }, - |(currency, dewif, secret_code, accounts_indexs)| { - dewif::bip32::get_accounts_pubkeys(currency, dewif, secret_code, accounts_indexs) - }, - ) -} - -#[no_mangle] -pub extern "C" fn get_bip32_dewif_mnemonic( - port: i64, - currency: *const raw::c_char, - dewif: *const raw::c_char, - secret_code: *const raw::c_char, -) { - exec_async( - port, - || { - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let secret_code = char_ptr_to_str(secret_code)?; - Ok((currency, dewif, secret_code)) - }, - |(currency, dewif, secret_code)| dewif::bip32::get_mnemonic(currency, dewif, secret_code), - ) -} - -#[no_mangle] -pub extern "C" fn get_dewif_meta( - port: i64, - dewif: *const raw::c_char, - member_wallet: u32, - secret_code_type: u32, -) { - exec_async( - port, - || { - let dewif = char_ptr_to_str(dewif)?; - let member_wallet = member_wallet != 0; - let secret_code_type = SecretCodeType::from(secret_code_type); - Ok((dewif, member_wallet, secret_code_type)) - }, - |(dewif, member_wallet, secret_code_type)| { - dewif::get_dewif_meta(dewif, member_wallet, secret_code_type) - }, - ) -} - -#[no_mangle] -pub extern "C" fn get_dewif_secret_code_len( - dewif: *const raw::c_char, - member_wallet: u32, - secret_code_type: u32, -) -> i32 { - if let Ok(secret_code_len) = dewif::get_secret_code_len(dewif, member_wallet, secret_code_type) - { - secret_code_len as i32 - } else { - -1 - } -} - -#[no_mangle] -pub extern "C" fn get_dewif_pubkey( - port: i64, - account_index: i32, - address_index: i32, - currency: *const raw::c_char, - dewif: *const raw::c_char, - external_opt: i32, - pin: *const raw::c_char, -) { - exec_async( - port, - || { - let account_index_opt = i32_to_opt_u32(account_index); - let address_index_opt = i32_to_opt_u31(address_index)?; - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let external_opt = i32_to_opt_bool(external_opt); - let pin = char_ptr_to_str(pin)?; - Ok(( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - pin, - )) - }, - |(account_index_opt, address_index_opt, currency, dewif, external_opt, pin)| { - dewif::get_pubkey( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - pin, - ) - }, - ) -} - -#[no_mangle] -pub extern "C" fn get_opaque_account_next_external_address(port: i64, account_index: u32) { - exec_async( - port, - || { - let account_index = U31::new(account_index)?; - Ok(account_index) - }, - dewif::bip32::get_opaque_account_next_external_address, - ) -} - -#[no_mangle] -pub extern "C" fn load_opaque_bip32_accounts( - port: i64, - accounts_indexs_len: u32, - accounts_indexs: *const u32, - currency: *const raw::c_char, - dewif: *const raw::c_char, - secret_code: *const raw::c_char, -) { - exec_async( - port, - || { - let accounts_indexs = char_ptr_prt_to_vec_u31(accounts_indexs, accounts_indexs_len)?; - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let secret_code = char_ptr_to_str(secret_code)?; - Ok((accounts_indexs, currency, dewif, secret_code)) - }, - |(accounts_indexs, currency, dewif, secret_code)| { - dewif::bip32::load_opaque_bip32_accounts(accounts_indexs, currency, dewif, secret_code) - }, - ) -} - -#[no_mangle] -pub extern "C" fn get_legacy_pubkey( - port: i64, - salt: *const raw::c_char, - password: *const raw::c_char, -) { - exec_async( - port, - || { - let salt = char_ptr_to_str(salt)?; - let password = char_ptr_to_str(password)?; - Ok((salt, password)) - }, - |(salt, password)| Ok::<_, DubpError>(legacy::get_pubkey(salt, password)), - ) -} - -#[no_mangle] -pub extern "C" fn mnemonic_to_pubkey( - port: i64, - language: u32, - mnemonic_phrase: *const raw::c_char, -) { - exec_async( - port, - || { - let language = u32_to_language(language)?; - let mnemonic_phrase = char_ptr_to_str(mnemonic_phrase)?; - Ok((language, mnemonic_phrase)) - }, - |(language, mnemonic_phrase)| mnemonic::mnemonic_to_pubkey(language, mnemonic_phrase), - ) -} - -#[no_mangle] -pub extern "C" fn sign( - port: i64, - account_index: i32, - address_index: i32, - currency: *const raw::c_char, - dewif: *const raw::c_char, - external_opt: i32, - secret_code: *const raw::c_char, - msg: *const raw::c_char, -) { - exec_async( - port, - || { - let account_index_opt = i32_to_opt_u32(account_index); - let address_index_opt = i32_to_opt_u31(address_index)?; - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let external_opt = i32_to_opt_bool(external_opt); - let secret_code = char_ptr_to_str(secret_code)?; - let msg = char_ptr_to_str(msg)?; - Ok(( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msg, - )) - }, - |( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msg, - )| { - dewif::sign( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msg, - ) - }, - ) -} - -#[no_mangle] -pub extern "C" fn sign_several( - port: i64, - account_index: i32, - address_index: i32, - currency: *const raw::c_char, - dewif: *const raw::c_char, - external_opt: i32, - secret_code: *const raw::c_char, - msgs_len: u32, - msgs: *const *const raw::c_char, -) { - exec_async( - port, - || { - let account_index_opt = i32_to_opt_u32(account_index); - let address_index_opt = i32_to_opt_u31(address_index)?; - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let external_opt = i32_to_opt_bool(external_opt); - let secret_code = char_ptr_to_str(secret_code)?; - let msgs = char_ptr_prt_to_vec_str(msgs, msgs_len)?; - Ok(( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msgs, - )) - }, - |( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - msgs, - )| { - dewif::sign_several( - account_index_opt, - address_index_opt, - currency, - dewif, - external_opt, - secret_code, - &msgs, - ) - }, - ) -} - -#[no_mangle] -pub extern "C" fn simple_payment_bip32( - port: i64, - account_index: u32, - amount: f64, - currency: *const raw::c_char, - dewif: *const raw::c_char, - gva_endpoint: *const raw::c_char, - recipient: *const raw::c_char, - secret_code: *const raw::c_char, - tx_comment: *const raw::c_char, -) { - exec_async( - port, - || { - let currency = parse_currency(char_ptr_to_str(currency)?)?; - let dewif = char_ptr_to_str(dewif)?; - let gva_endpoint = char_ptr_to_str(gva_endpoint)?; - let recipient = char_ptr_to_str(recipient)?; - let secret_code = char_ptr_to_str(secret_code)?; - let tx_comment = char_ptr_to_opt_string(tx_comment)?; - Ok(( - account_index, - amount, - currency, - dewif, - gva_endpoint, - secret_code, - recipient, - tx_comment, - )) - }, - |( - account_index, - amount, - currency, - dewif, - gva_endpoint, - secret_code, - recipient, - tx_comment, - )| { - payment::simple_payment( - account_index, - amount, - currency, - dewif, - gva_endpoint, - secret_code, - recipient, - tx_comment, - ) - }, - ) -} diff --git a/native/dubp_rs/src/mnemonic.rs b/native/dubp_rs/src/mnemonic.rs deleted file mode 100644 index 0b9849a..0000000 --- a/native/dubp_rs/src/mnemonic.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -pub(super) fn gen_mnemonic(language: Language) -> Result { - let mnemonic = - Mnemonic::new(MnemonicType::Words12, language).map_err(|_| DubpError::RandErr)?; - Ok(mnemonic.phrase().to_owned()) -} - -pub(super) fn mnemonic_to_pubkey(language: Language, mnemonic: &str) -> Result { - let mnemonic = - Mnemonic::from_phrase(mnemonic, language).map_err(|_| DubpError::WrongLanguage)?; - let seed = dubp_client::crypto::mnemonic::mnemonic_to_seed(&mnemonic); - let keypair = KeyPairFromSeed32Generator::generate(seed); - Ok(keypair.public_key().to_base58()) -} diff --git a/native/dubp_rs/src/payment.rs b/native/dubp_rs/src/payment.rs deleted file mode 100644 index b4c4a5f..0000000 --- a/native/dubp_rs/src/payment.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; -use dubp_client::wallet::prelude::*; -use dubp_client::{GvaClient, NaiveGvaClient}; - -#[allow(clippy::too_many_arguments)] -pub(super) fn simple_payment( - account_index: u32, - amount: f64, - currency: Currency, - dewif: &str, - gva_endpoint: &str, - secret_code: &str, - recipient: &str, - tx_comment: Option, -) -> Result<(), DubpError> { - let keypair = crate::dewif::bip32::get_bip32_keypair( - account_index, - None, - currency, - dewif, - None, - secret_code, - )?; - - let gva_client = NaiveGvaClient::new(gva_endpoint).expect("invalid' endpoint"); - - let amount = dubp_client::Amount::Uds(amount); - - let recipient = if let Ok(pubkey) = PublicKey::from_base58(recipient) { - WalletScriptV10::single_sig(pubkey) - } else { - dubp_client::documents_parser::wallet_script_from_str(recipient) - .map_err(DubpError::InvalidScript)? - }; - - let res = match keypair.generate_signator() { - dubp_client::crypto::keys::SignatorEnum::Ed25519(signator) => gva_client - .simple_payment(amount, &signator, recipient, tx_comment, None) - .map_err(DubpError::GvaClientError)?, - dubp_client::crypto::keys::SignatorEnum::Schnorr() => unreachable!(), - dubp_client::crypto::keys::SignatorEnum::Bip32Ed25519(signator) => gva_client - .simple_payment(amount, &signator, recipient, tx_comment, None) - .map_err(DubpError::GvaClientError)?, - }; - - if let dubp_client::PaymentResult::Errors(errors) = res { - Err(DubpError::PaymentError(format!("{:?}", errors))) - } else { - Ok(()) - } -} diff --git a/native/dubp_rs/src/pubkey.rs b/native/dubp_rs/src/pubkey.rs deleted file mode 100644 index 6c33825..0000000 --- a/native/dubp_rs/src/pubkey.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -pub(crate) fn check_pubkey(pubkey: &str) -> Result<(), DubpError> { - PublicKey::from_base58_with_checksum_opt(pubkey).map_err(DubpError::InvalidPubkey)?; - Ok(()) -} - -pub(crate) fn compute_checksum(pubkey: &str) -> Result { - Ok(PublicKey::from_base58(pubkey) - .map_err(|e| DubpError::InvalidPubkey(PublicKeyFromStrErr::BaseConversionError(e)))? - .checksum()) -} diff --git a/native/dubp_rs/src/secret_code.rs b/native/dubp_rs/src/secret_code.rs deleted file mode 100644 index ab6efc1..0000000 --- a/native/dubp_rs/src/secret_code.rs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2020 Éloïs SANCHEZ. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -use crate::*; - -pub(crate) fn compute_secret_code_len( - member_wallet: bool, - secret_code_type: SecretCodeType, - log_n: u8, -) -> Result { - match secret_code_type { - SecretCodeType::Digits => { - if member_wallet { - Err(DubpError::DigitsCodeForbidForMemberWallet) - } else if log_n >= 15 { - Ok(7) - } else { - Ok(8) - } - } - SecretCodeType::Letters => { - if member_wallet { - if log_n >= 15 { - Ok(7) - } else { - Ok(8) - } - } else if log_n >= 15 { - Ok(5) - } else { - Ok(6) - } - } - } -} - -pub(crate) fn gen_secret_code( - member_wallet: bool, - secret_code_type: SecretCodeType, - log_n: u8, -) -> Result { - let secret_code_len = compute_secret_code_len(member_wallet, secret_code_type, log_n)?; - match secret_code_type { - SecretCodeType::Digits => gen_random_digits(secret_code_len), - SecretCodeType::Letters => gen_random_letters(secret_code_len), - } -} - -pub(crate) fn is_ascii_letters(secret_code: &str) -> bool { - secret_code.len() - == secret_code - .chars() - .filter(|char| char.is_ascii_alphabetic()) - .count() -} - -fn gen_random_digits(n: usize) -> Result { - let mut digits_string = dubp_client::crypto::rand::gen_u32() - .map_err(|_| DubpError::RandErr)? - .to_string(); - digits_string.truncate(n); - - if digits_string.len() == n { - Ok(digits_string) - } else { - let missing_digits = n - digits_string.len(); - let mut digits_string_ = String::with_capacity(n); - for _ in 0..missing_digits { - digits_string_.push('0'); - } - digits_string_.push_str(&digits_string); - Ok(digits_string_) - } -} - -fn gen_random_letters(mut n: usize) -> Result { - let mut letters = String::with_capacity(n); - while n >= 6 { - letters.push_str(&gen_random_letters_inner(6)?); - n -= 6; - } - letters.push_str(&gen_random_letters_inner(n)?); - - Ok(letters) -} - -fn gen_random_letters_inner(n: usize) -> Result { - let mut i = dubp_client::crypto::rand::gen_u32().map_err(|_| DubpError::RandErr)?; - let mut letters = String::new(); - - for _ in 0..n { - letters.push(to_char(i)); - i /= 26; - } - - Ok(letters) -} - -fn to_char(i: u32) -> char { - match i % 26 { - 0 => 'A', - 1 => 'B', - 2 => 'C', - 3 => 'D', - 4 => 'E', - 5 => 'F', - 6 => 'G', - 7 => 'H', - 8 => 'I', - 9 => 'J', - 10 => 'K', - 11 => 'L', - 12 => 'M', - 13 => 'N', - 14 => 'O', - 15 => 'P', - 16 => 'Q', - 17 => 'R', - 18 => 'S', - 19 => 'T', - 20 => 'U', - 21 => 'V', - 22 => 'W', - 23 => 'X', - 24 => 'Y', - 25 => 'Z', - _ => unreachable!(), - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_gen_random_digits() -> Result<(), DubpError> { - assert_eq!(gen_random_digits(8)?.len(), 8); - //println!("TMP: {}", gen_random_digits(8)?); - Ok(()) - } - #[test] - fn test_gen_random_letters() -> Result<(), DubpError> { - assert_eq!(gen_random_letters(6)?.len(), 6); - //println!("TMP: {}", gen_random_letters(6)?); - Ok(()) - } -} diff --git a/packages/dubp_rs/.metadata b/packages/dubp_rs/.metadata deleted file mode 100644 index 4b7663f..0000000 --- a/packages/dubp_rs/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: f7a6a7906be96d2288f5d63a5a54c515a6e987fe - channel: stable - -project_type: plugin diff --git a/packages/dubp_rs/LICENSE b/packages/dubp_rs/LICENSE deleted file mode 100644 index dba13ed..0000000 --- a/packages/dubp_rs/LICENSE +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. diff --git a/packages/dubp_rs/README.md b/packages/dubp_rs/README.md deleted file mode 100644 index 6be3629..0000000 --- a/packages/dubp_rs/README.md +++ /dev/null @@ -1,198 +0,0 @@ -# dubp - -Flutter package that bind [dubp-rs-libs] Rust crates. - -## Setup - -### Prerequisites - -* Android SDK -* Android **N**DK (**Native** Development Kit) -* Rust and cargo -* Cargo plugin cargo-make: `cargo install cargo-make` -* LLVM/Clang (see dedicated section below) - -You must indicate where the SDK and NDK are located via the `ANDROID_SDK_ROOT` and `ANDROID_NDK_HOME` environment variables. -For example: - - export ANDROID_SDK_ROOT="/home/user/dev/android_sdk" - export ANDROID_NDK_HOME="/home/user/dev/android_sdk/ndk/22.0.7026061" - -You will also need to add targets for all Android architectures: - -```sh -rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android -``` - -If you develop on mac, you can also add targets for iOS: - -```sh -rustup target add aarch64-apple-ios x86_64-apple-ios -``` - -### LLVM/Clang - -The project use [`dart-bindgen`](https://github.com/sunshine-protocol/dart-bindgen) which requires LLVM/Clang. Install LLVM (10+) in the following way: - -#### ubuntu/linux - -1. Install libclangdev - `sudo apt-get install libclang-dev`. - -#### Windows - -1. Install Visual Studio with C++ development support. -2. Install [LLVM](https://releases.llvm.org/download.html) or `winget install -e --id LLVM.LLVM`. - -#### MacOS - -1. Install Xcode. -2. Install LLVM - `brew install llvm`. - -## Compile - -### For development - -**To reduce the compilation time of the Rust code** during your development, you can **compile only for the target corresponding to your android emulator**. Here is how to do it **depending on the architecture of your emulator**: - -* 32bit emulator (`x86`/`i686` architecture) - -```sh -cargo bd -``` - -* 64bit emulator (`x86_64` architecture) - -```sh -cargo make android-dev -``` - -### For release - -In the Root of the project simply run: - -```sh -cargo br -``` - -WARNING: This will take a lot of time because the Rust code will have to be recompiled for each different architecture, 4 times for android and 2 times for iOS! - -## Use - -You must execute this instruction at startup of your application: - -```dart -DubpRust.setup(); -``` - -### Generate a random Mnemonic - -#### Function signature - -```dart -static Future DubpRust.genMnemonic({Language language = Language.english}); -``` - -#### Usage example - -```dart -String mnemonic = await DubpRust.genMnemonic(); -``` - -You can choose a language (english by default): - -```dart -String mnemonic = await DubpRust.genMnemonic(language: Language.french); -``` - -### Generate a wallet - -#### Function signature - -```dart -static Future genWalletFromMnemonic({ - String currency = "g1", - Language language = Language.english, - String mnemonic, - SecretCodeType secretCodeType = SecretCodeType.letters -}); -``` - -If the mnemonic is not in english, you must indicate the language of the mnemonic (necessary for the verification of its validity). -If the wallet to be generated is not dedicated to the Ğ1 currency, you must indicate the currency for which this wallet will be used. - -#### Usage example - -```dart -NewWallet new_wallet = await DubpRust.genWalletFromMnemonic( - language: Language.english, - mnemonic: "tongue cute mail fossil great frozen same social weasel impact brush kind" -); -``` - -You can choose a different secret code type: - -```dart -NewWallet new_wallet = await DubpRust.genWalletFromMnemonic( - language: Language.english, - mnemonic: "tongue cute mail fossil great frozen same social weasel impact brush kind", - secretCodeType: SecretCodeType.digits -); -``` - -### Sign a message - -#### Function signature - -```dart -static Future sign({ - int accountIndex, - int addressIndexOpt, - String currency = "g1", - String dewif, - bool externalOpt, - String secretCode, - String message -}); -``` - -If the wallet is not dedicated to the Ğ1 currency, you must indicate the currency. - -#### Usage example - -```dart -String signature = await DubpRust.sign( - accountIndex: 3, - dewif: "AAAAARAAAAGfFDAs+jVZYkfhBlHZZ2fEQIvBqnG16g5+02cY18wSOjW0cUg2JV3SUTJYN2CrbQeRDwGazWnzSFBphchMmiL0", - pin: "CDJ4UB", - message: "toto" -); -``` - -### Change secret code - -You can change the secret code that encrypts the [DEWIF]. - -#### Function signature - -```dart -static Future changeDewifPin({ - String currency = "g1", - String dewif, - String oldPin, - SecretCodeType secretCodeType = SecretCodeType.letters -}); -``` - -If the wallet is not dedicated to the Ğ1 currency, you must indicate the currency. - -#### Usage example - -```dart -NewWallet new_wallet = await DubpRust.changeDewifPin( - dewif: "AAAAARAAAAGfFDAs+jVZYkfhBlHZZ2fEQIvBqnG16g5+02cY18wSOjW0cUg2JV3SUTJYN2CrbQeRDwGazWnzSFBphchMmiL0", - oldPin: "CDJAUB", -); -``` - -[dubp-rs-libs]: https://git.duniter.org/libs/dubp-rs-libs -[DEWIF]: https://git.duniter.org/documents/rfcs/blob/dewif/rfc/0013_Duniter_Encrypted_Wallet_Import_Format.md diff --git a/packages/dubp_rs/analysis_options.yaml b/packages/dubp_rs/analysis_options.yaml deleted file mode 100644 index 572b2c2..0000000 --- a/packages/dubp_rs/analysis_options.yaml +++ /dev/null @@ -1,12 +0,0 @@ -include: package:effective_dart/analysis_options.yaml - -analyzer: - exclude: - - lib/ffi.dart - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - omit_local_variable_types: false diff --git a/packages/dubp_rs/android/.gitignore b/packages/dubp_rs/android/.gitignore deleted file mode 100644 index c6cbe56..0000000 --- a/packages/dubp_rs/android/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures diff --git a/packages/dubp_rs/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/packages/dubp_rs/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java deleted file mode 100644 index 9f52030..0000000 --- a/packages/dubp_rs/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.flutter.plugins; - -import io.flutter.plugin.common.PluginRegistry; -import com.example.dubp.DubpPlugin; - -/** - * Generated file. Do not edit. - */ -public final class GeneratedPluginRegistrant { - public static void registerWith(PluginRegistry registry) { - if (alreadyRegisteredWith(registry)) { - return; - } - DubpPlugin.registerWith(registry.registrarFor("com.example.dubp.DubpPlugin")); - } - - private static boolean alreadyRegisteredWith(PluginRegistry registry) { - final String key = GeneratedPluginRegistrant.class.getCanonicalName(); - if (registry.hasPlugin(key)) { - return true; - } - registry.registrarFor(key); - return false; - } -} diff --git a/packages/dubp_rs/android/build.gradle b/packages/dubp_rs/android/build.gradle deleted file mode 100644 index a11bf58..0000000 --- a/packages/dubp_rs/android/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -group 'com.example.dubp' -version '1.0-SNAPSHOT' - -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -rootProject.allprojects { - repositories { - google() - jcenter() - } -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion 28 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - defaultConfig { - minSdkVersion 16 - } - lintOptions { - disable 'InvalidPackage' - } -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/packages/dubp_rs/android/gradle.properties b/packages/dubp_rs/android/gradle.properties deleted file mode 100644 index 38c8d45..0000000 --- a/packages/dubp_rs/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true -android.useAndroidX=true -android.enableJetifier=true diff --git a/packages/dubp_rs/android/gradle/wrapper/gradle-wrapper.properties b/packages/dubp_rs/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 01a286e..0000000 --- a/packages/dubp_rs/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/packages/dubp_rs/android/settings.gradle b/packages/dubp_rs/android/settings.gradle deleted file mode 100644 index ae6f0f7..0000000 --- a/packages/dubp_rs/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'dubp' diff --git a/packages/dubp_rs/android/src/main/AndroidManifest.xml b/packages/dubp_rs/android/src/main/AndroidManifest.xml deleted file mode 100644 index 6206217..0000000 --- a/packages/dubp_rs/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/packages/dubp_rs/android/src/main/kotlin/com/example/dubp/DubpPlugin.kt b/packages/dubp_rs/android/src/main/kotlin/com/example/dubp/DubpPlugin.kt deleted file mode 100644 index e0945fc..0000000 --- a/packages/dubp_rs/android/src/main/kotlin/com/example/dubp/DubpPlugin.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.example.dubp - -import androidx.annotation.NonNull; - -import io.flutter.embedding.engine.plugins.FlutterPlugin -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result -import io.flutter.plugin.common.PluginRegistry.Registrar - -/** DubpPlugin */ -public class DubpPlugin: FlutterPlugin, MethodCallHandler { - /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private lateinit var channel : MethodChannel - - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "dubp") - channel.setMethodCallHandler(this); - } - - // This static function is optional and equivalent to onAttachedToEngine. It supports the old - // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting - // plugin registration via this function while apps migrate to use the new Android APIs - // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. - // - // It is encouraged to share logic between onAttachedToEngine and registerWith to keep - // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called - // depending on the user's project. onAttachedToEngine or registerWith must both be defined - // in the same class. - companion object { - @JvmStatic - fun registerWith(registrar: Registrar) { - val channel = MethodChannel(registrar.messenger(), "dubp") - channel.setMethodCallHandler(DubpPlugin()) - } - } - - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { - if (call.method == "getPlatformVersion") { - result.success("Android ${android.os.Build.VERSION.RELEASE}") - } else { - result.notImplemented() - } - } - - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) - } -} diff --git a/packages/dubp_rs/ios/.gitignore b/packages/dubp_rs/ios/.gitignore deleted file mode 100644 index aa479fd..0000000 --- a/packages/dubp_rs/ios/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -.idea/ -.vagrant/ -.sconsign.dblite -.svn/ - -.DS_Store -*.swp -profile - -DerivedData/ -build/ -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m - -.generated/ - -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 - -!default.pbxuser -!default.mode1v3 -!default.mode2v3 -!default.perspectivev3 - -xcuserdata - -*.moved-aside - -*.pyc -*sync/ -Icon? -.tags* - -/Flutter/Generated.xcconfig -/Flutter/flutter_export_environment.sh \ No newline at end of file diff --git a/packages/dubp_rs/ios/Assets/.gitkeep b/packages/dubp_rs/ios/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/packages/dubp_rs/ios/Classes/DubpPlugin.h b/packages/dubp_rs/ios/Classes/DubpPlugin.h deleted file mode 100644 index b0e2d33..0000000 --- a/packages/dubp_rs/ios/Classes/DubpPlugin.h +++ /dev/null @@ -1,4 +0,0 @@ -#import - -@interface DubpPlugin : NSObject -@end diff --git a/packages/dubp_rs/ios/Classes/DubpPlugin.m b/packages/dubp_rs/ios/Classes/DubpPlugin.m deleted file mode 100644 index 4144f90..0000000 --- a/packages/dubp_rs/ios/Classes/DubpPlugin.m +++ /dev/null @@ -1,15 +0,0 @@ -#import "DubpPlugin.h" -#if __has_include() -#import -#else -// Support project import fallback if the generated compatibility header -// is not copied when this plugin is created as a library. -// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 -#import "dubp-Swift.h" -#endif - -@implementation DubpPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - [SwiftDubpPlugin registerWithRegistrar:registrar]; -} -@end diff --git a/packages/dubp_rs/ios/Classes/SwiftDubpPlugin.swift b/packages/dubp_rs/ios/Classes/SwiftDubpPlugin.swift deleted file mode 100644 index 7108aa4..0000000 --- a/packages/dubp_rs/ios/Classes/SwiftDubpPlugin.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Flutter -import UIKit - -public class SwiftDubpPlugin: NSObject, FlutterPlugin { - public static func register(with registrar: FlutterPluginRegistrar) { - let channel = FlutterMethodChannel(name: "dubp", binaryMessenger: registrar.messenger()) - let instance = SwiftDubpPlugin() - registrar.addMethodCallDelegate(instance, channel: channel) - } - - public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - result("iOS " + UIDevice.current.systemVersion) - } - - public static func dummyMethodToEnforceBundling() { - last_error_length() - } -} diff --git a/packages/dubp_rs/ios/Classes/binding.h b/packages/dubp_rs/ios/Classes/binding.h deleted file mode 100644 index cc4acf2..0000000 --- a/packages/dubp_rs/ios/Classes/binding.h +++ /dev/null @@ -1,240 +0,0 @@ -#include -#include -#include -#include - -/** - * A Dart_CObject is used for representing Dart objects as native C - * data outside the Dart heap. These objects are totally detached from - * the Dart heap. Only a subset of the Dart objects have a - * representation as a Dart_CObject. - * - * The string encoding in the 'value.as_string' is UTF-8. - * - * All the different types from dart:typed_data are exposed as type - * kTypedData. The specific type from dart:typed_data is in the type - * field of the as_typed_data structure. The length in the - * as_typed_data structure is always in bytes. - * - * The data for kTypedData is copied on message send and ownership remains with - * the caller. The ownership of data for kExternalTyped is passed to the VM on - * message send and returned when the VM invokes the - * Dart_WeakPersistentHandleFinalizer callback; a non-NULL callback must be - * provided. - */ -typedef struct DartCObject DartCObject; -enum DartCObjectType -#ifdef __cplusplus - : int32_t -#endif // __cplusplus -{ - DartNull = 0, - DartBool = 1, - DartInt32 = 2, - DartInt64 = 3, - DartDouble = 4, - DartString = 5, - DartArray = 6, - DartTypedData = 7, - DartExternalTypedData = 8, - DartSendPort = 9, - DartCapability = 10, - DartUnsupported = 11, - DartNumberOfTypes = 12, -}; -#ifndef __cplusplus -typedef int32_t DartCObjectType; -#endif // __cplusplus - -enum DartTypedDataType -#ifdef __cplusplus - : int32_t -#endif // __cplusplus -{ - kByteData = 0, - kInt8 = 1, - kUint8 = 2, - kUint8Clamped = 3, - kInt16 = 4, - kUint16 = 5, - kInt32 = 6, - kUint32 = 7, - kInt64 = 8, - kUint64 = 9, - kFloat32 = 10, - kFloat64 = 11, - kFloat32x4 = 12, - kInvalid = 13, -}; -#ifndef __cplusplus -typedef int32_t DartTypedDataType; -#endif // __cplusplus - -typedef void *RuntimePtr; - -/** - * A port is used to send or receive inter-isolate messages - */ -typedef int64_t DartPort; - -typedef struct DartNativeSendPort -{ - DartPort id; - DartPort origin_id; -} DartNativeSendPort; - -typedef struct DartNativeCapability -{ - int64_t id; -} DartNativeCapability; - -typedef struct DartNativeArray -{ - intptr_t length; - DartCObject **values; -} DartNativeArray; - -typedef struct DartNativeTypedData -{ - DartTypedDataType type_; - intptr_t length; - uint8_t *values; -} DartNativeTypedData; - -typedef struct _DartWeakPersistentHandle -{ - uint8_t _unused[0]; -} _DartWeakPersistentHandle; - -typedef _DartWeakPersistentHandle *DartWeakPersistentHandle; - -typedef void (*DartWeakPersistentHandleFinalizer)(void *isolate_callback_data, DartWeakPersistentHandle handle, void *peer); - -typedef struct DartNativeExternalTypedData -{ - DartTypedDataType type_; - intptr_t length; - uint8_t *data; - void *peer; - DartWeakPersistentHandleFinalizer callback; -} DartNativeExternalTypedData; - -typedef union DartCObjectValue { - bool as_bool; - int32_t as_int32; - int64_t as_int64; - double as_double; - char *as_string; - DartNativeSendPort as_send_port; - DartNativeCapability as_capability; - DartNativeArray as_array; - DartNativeTypedData as_typed_data; - DartNativeExternalTypedData as_external_typed_data; - uint64_t _bindgen_union_align[5]; -} DartCObjectValue; - -typedef struct DartCObject -{ - DartCObjectType type_; - DartCObjectValue value; -} DartCObject; - -/** - * Posts a message on some port. The message will contain the - * Dart_CObject object graph rooted in 'message'. - * - * While the message is being sent the state of the graph of - * Dart_CObject structures rooted in 'message' should not be accessed, - * as the message generation will make temporary modifications to the - * data. When the message has been sent the graph will be fully - * restored. - * - * port_id The destination port. - * message The message to send. - * - * return true if the message was posted. - */ -typedef bool (*DartPostCObjectFnPtr)(DartPort port_id, DartCObject *message); - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -void change_dewif_secret_code(int64_t port, - const char *dewif, - const char *old_secret_code, - uint32_t member_wallet, - uint32_t secret_code_type, - int64_t system_memory); - -void gen_dewif(int64_t port, - const char *currency, - uint32_t language, - const char *mnemonic, - uint32_t member_wallet, - uint32_t secret_code_type, - int64_t system_memory, - uint32_t wallet_type); - -void gen_dewif_from_legacy(int64_t port, - const char *currency, - const char *salt, - const char *password, - uint32_t member_wallet, - uint32_t secret_code_type, - int64_t system_memory); - -void gen_mnemonic(int64_t port, uint32_t language); - -void get_bip32_dewif_accounts_pubkeys(int64_t port, - const char *currency, - const char *dewif, - const char *secret_code, - uint32_t accounts_indexs_len, - const uint32_t *accounts_indexs); - -void get_dewif_meta(int64_t port, - const char *dewif, - uint32_t member_wallet, - uint32_t secret_code_type); - -void get_dewif_pubkey(int64_t port, const char *currency, const char *dewif, const char *pin); - -int32_t get_dewif_secret_code_len(const char *dewif, - uint32_t member_wallet, - uint32_t secret_code_type); - -void get_legacy_pubkey(int64_t port, const char *salt, const char *password); - -void mnemonic_to_pubkey(int64_t port, uint32_t language, const char *mnemonic_phrase); - -void sign(int64_t port, const char *currency, const char *dewif, const char *pin, const char *msg); - -void sign_bip32_transparent(int64_t port, - uint32_t account_index, - const char *currency, - const char *dewif, - const char *secret_code, - const char *msg); - -void sign_legacy(int64_t port, const char *salt, const char *password, const char *msg); - -void sign_several(int64_t port, - const char *currency, - const char *dewif, - const char *pin, - uint32_t msgs_len, - const char *const *msgs); - -void sign_several_bip32_transparent(int64_t port, - uint32_t account_index, - const char *currency, - const char *dewif, - const char *pin, - uint32_t msgs_len, - const char *const *msgs); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus diff --git a/packages/dubp_rs/ios/dubp.podspec b/packages/dubp_rs/ios/dubp.podspec deleted file mode 100644 index 459e34b..0000000 --- a/packages/dubp_rs/ios/dubp.podspec +++ /dev/null @@ -1,26 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint dubp.podspec' to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'dubp' - s.version = '0.0.1' - s.summary = 'A new flutter plugin project.' - s.description = <<-DESC -A new flutter plugin project. - DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - s.source = { :path => '.' } - s.public_header_files = 'Classes**/*.h' - s.source_files = 'Classes/**/*' - s.static_framework = true - s.vendored_libraries = "**/*.a" - s.dependency 'Flutter' - s.platform = :ios, '8.0' - - # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } - s.swift_version = '5.0' -end diff --git a/packages/dubp_rs/lib/dubp.dart b/packages/dubp_rs/lib/dubp.dart deleted file mode 100644 index b6d1d30..0000000 --- a/packages/dubp_rs/lib/dubp.dart +++ /dev/null @@ -1,504 +0,0 @@ -import 'dart:async'; -import 'dart:ffi'; -import 'package:ffi/ffi.dart'; -import 'package:isolate/ports.dart'; -import "package:system_info/system_info.dart"; - -import 'ffi.dart' as native; - -/// DEWIF meta data -class DewifMetaData { - /// Currency name - String currency; - - /// Secret code length - int secretCodeLen; - - /// DEWIF version - int version; - - /// Wallet type - WalletType walletType; - - DewifMetaData._(this.currency, this.secretCodeLen, this.version) { - if (version == 4) { - walletType = WalletType.bip32Ed25519; - } else { - walletType = WalletType.ed25519; - } - } -} - -/// Language -enum Language { - /// English - english, - - /// French - french, -} - -/// New wallet -class NewWallet { - /// DEWIF: Encrypted wallet - String dewif; - - /// Secret code - String pin; - - NewWallet._(this.dewif, this.pin); -} - -/// Secret code type -enum SecretCodeType { - /// Digits - digits, - - /// Letters - letters, -} - -/// Wallet type -enum WalletType { - /// Ed25519 - ed25519, - - /// BIP32-Ed25519 - bip32Ed25519, -} - -// ignore: avoid_classes_with_only_static_members -/// DUBP Rust utilities -/// -/// All the functions of this package are static methods of this -/// class `DubpRust`. -class DubpRust { - /// Must be called only once at the start of your application. - static void setup() { - native.store_dart_post_cobject(NativeApi.postCObject); - print("DUBP_RS Setup Done"); - } - - /// Change the secret code that encrypts the `dewif` keypair. - static Future changeDewifPin({ - String dewif, - String oldPin, - SecretCodeType secretCodeType = SecretCodeType.letters, - }) async { - int ram = SysInfo.getTotalPhysicalMemory(); - - final completer = Completer>(); - final sendPort = singleCompletePort, List>(completer, - callback: _handleErrList); - native.change_dewif_secret_code( - sendPort.nativePort, - // utf8.encoder(dewif), - StringUtf8Pointer(dewif).toNativeUtf8(), - StringUtf8Pointer(oldPin).toNativeUtf8(), - 0, - secretCodeType.index, - ram, - ); - List newWallet = await completer.future; - - return Future.value(NewWallet._(newWallet[0], newWallet[1])); - } - - /// Check validity of a base58 public key with its checksum - static Future checkPublicKey({String pubkey}) { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErrVoid); - native.check_pubkey( - sendPort.nativePort, - StringUtf8Pointer(pubkey).toNativeUtf8(), - ); - return completer.future; - } - - /// Compute public key checksum - static Future computeChecksum({String pubkey}) { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.compute_checksum( - sendPort.nativePort, - StringUtf8Pointer(pubkey).toNativeUtf8(), - ); - return completer.future; - } - - /// Generate a random mnemonic - static Future genMnemonic({Language language = Language.english}) { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.gen_mnemonic( - sendPort.nativePort, - language.index, - ); - return completer.future; - } - - /// Generate a wallet from a deprecated salt + password couple. - /// - /// This deprecated method must be used only for compatibility purpose ! - static Future genWalletFromDeprecatedSaltPassword({ - String currency = "g1", - String salt, - String password, - SecretCodeType secretCodeType = SecretCodeType.letters, - bool isMember = false, - }) async { - int ram = SysInfo.getTotalPhysicalMemory(); - print('ram=$ram'); - - final completer = Completer>(); - final sendPort = singleCompletePort, List>(completer, - callback: _handleErrList); - native.gen_dewif_from_legacy( - sendPort.nativePort, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(salt).toNativeUtf8(), - StringUtf8Pointer(password).toNativeUtf8(), - isMember ? 1 : 0, - secretCodeType.index, - ram, - ); - List newWallet = await completer.future; - - return Future.value(NewWallet._(newWallet[0], newWallet[1])); - } - - /// Generate a wallet from a mnemonic phrase. - /// - /// If the mnemonic is not in English, you must indicate the language of - /// the mnemonic (necessary for the verification of its validity). - /// - /// If the wallet to be generated is not dedicated to the Ğ1 currency, you - /// must indicate the currency for which this wallet will be used. - static Future genWalletFromMnemonic({ - String currency = "g1", - Language language = Language.english, - String mnemonic, - SecretCodeType secretCodeType = SecretCodeType.letters, - }) async { - int ram = SysInfo.getTotalPhysicalMemory(); - print('ram=$ram'); - - final completer = Completer>(); - final sendPort = singleCompletePort, List>(completer, - callback: _handleErrList); - native.gen_dewif( - sendPort.nativePort, - StringUtf8Pointer(currency).toNativeUtf8(), - language.index, - StringUtf8Pointer(mnemonic).toNativeUtf8(), - 0, - secretCodeType.index, - ram, - ); - List newWallet = await completer.future; - - return Future.value(NewWallet._(newWallet[0], newWallet[1])); - } - - /// Get next external public key of a specific opaque account - static Future getOpaqueAccountNextExternalPublicKey( - {int accountIndex}) async { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.get_opaque_account_next_external_address( - sendPort.nativePort, accountIndex.toUnsigned(31)); - return completer.future; - } - - /// Get BIP32 accounts public keys (in base 58) of `dewif` master keypair. - static Future> getBip32DewifAccountsPublicKeys( - {String currency = "g1", - String dewif, - String secretCode, - List accountsIndex}) async { - final completer = Completer>(); - final sendPort = singleCompletePort, List>(completer, - callback: _handleErrList); - native.get_bip32_dewif_accounts_pubkeys( - sendPort.nativePort, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - StringUtf8Pointer(secretCode).toNativeUtf8(), - accountsIndex.length, - _listIntToPtrUint32(accountsIndex)); - return completer.future; - } - - /// Get mnemonic phrase of `dewif` (algo Bip32-Ed25519 only). - static Future getBip32DewifMnemonic( - {String currency = "g1", String dewif, String secretCode}) async { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.get_bip32_dewif_mnemonic( - sendPort.nativePort, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - StringUtf8Pointer(secretCode).toNativeUtf8(), - ); - return completer.future; - } - - /// Get `dewif` keypair meta data. - static Future getDewifMetaData( - {String dewif, - SecretCodeType secretCodeType = SecretCodeType.letters}) async { - final completer = Completer>(); - final sendPort = singleCompletePort, List>(completer, - callback: _handleErrList); - native.get_dewif_meta(sendPort.nativePort, - StringUtf8Pointer(dewif).toNativeUtf8(), 0, secretCodeType.index); - List dewifMetaData = await completer.future; - - return Future.value(DewifMetaData._(dewifMetaData[0], - int.parse(dewifMetaData[1]), int.parse(dewifMetaData[2]))); - } - - /// Get public key (in base 58) of `dewif` keypair. - static Future getDewifPublicKey( - {int accountIndexOpt, - int addressIndexOpt, - String currency = "g1", - String dewif, - bool externalOpt, - String pin}) async { - var externalOptInt = -1; - if (externalOpt != null) { - externalOptInt = externalOpt ? 1 : 0; - } - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.get_dewif_pubkey( - sendPort.nativePort, - accountIndexOpt ?? -1, - addressIndexOpt ?? -1, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - externalOptInt, - StringUtf8Pointer(pin).toNativeUtf8(), - ); - return completer.future; - } - - /// Get secret code length of `dewif` keypair. - static int getDewifSecretCodeLen( - {String currency = "g1", - String dewif, - SecretCodeType secretCodeType = SecretCodeType.letters}) { - int res = native.get_dewif_secret_code_len( - StringUtf8Pointer(dewif).toNativeUtf8(), - 0, - secretCodeType.index, - ); - if (res == -1) { - print('DUBP_RS_ERROR: DEWIF file content is corrupted.'); - throw 'DUBP_RS_ERROR: DEWIF file content is corrupted.'; - } else { - return res; - } - } - - /// Get public key (in base 58) of legacy wallet (password + salt) - /// - /// This deprecated method must be used only for compatibility purpose ! - static Future getLegacyPublicKey({String password, String salt}) { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.get_legacy_pubkey( - sendPort.nativePort, - StringUtf8Pointer(salt).toNativeUtf8(), - StringUtf8Pointer(password).toNativeUtf8(), - ); - return completer.future; - } - - /// Load opaque accounts - static Future loadOpaqueAccounts( - List accountsIndex, - String currency, - String dewif, - String secretCode, - ) { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErrVoid); - native.load_opaque_bip32_accounts( - sendPort.nativePort, - accountsIndex.length, - _listIntToPtrUint32(accountsIndex), - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - StringUtf8Pointer(secretCode).toNativeUtf8()); - return completer.future; - } - - /// Sign the message `message` with `dewif` keypair encryted - /// in DEWIF format. - /// - /// If you have several messages to sign, use `signSeveral` - /// method instead. - static Future sign( - {int accountIndexOpt, - int addressIndexOpt, - String currency = "g1", - String dewif, - bool externalOpt, - String secretCode, - String message}) { - var externalOptInt = -1; - if (externalOpt != null) { - externalOptInt = externalOpt ? 1 : 0; - } - - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErr); - native.sign( - sendPort.nativePort, - accountIndexOpt ?? -1, - addressIndexOpt ?? -1, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - externalOptInt, - StringUtf8Pointer(secretCode).toNativeUtf8(), - StringUtf8Pointer(message).toNativeUtf8(), - ); - return completer.future; - } - - /// Sign several messages `messages` with `dewif` keypair encryted in DEWIF - /// format. - /// - /// This method is optimized to sign several messages at once. If you have - /// several messages to sign, avoid calling the `sign` method for each - /// message. Use this `signSeveral` method instead. - static Future> signSeveral( - {int accountIndexOpt, - int addressIndexOpt, - String currency = "g1", - String dewif, - bool externalOpt, - String secretCode, - List messages}) { - var externalOptInt = -1; - if (externalOpt != null) { - externalOptInt = externalOpt ? 1 : 0; - } - - final completer = Completer>(); - final sendPort = singleCompletePort, List>(completer, - callback: _handleErrList); - - native.sign_several( - sendPort.nativePort, - accountIndexOpt ?? -1, - addressIndexOpt ?? -1, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - externalOptInt, - StringUtf8Pointer(secretCode).toNativeUtf8(), - messages.length, - _listStringToPtr(messages), - ); - - return completer.future; - } - - /// Make a simple payment from a transparent account - static Future simplePaymentFromTransparentAccount( - {int accountIndex, - double amount, - String currency = "g1", - String dewif, - String gvaEndpoint, - String recipient, - String secretCode, - String txComment}) { - final completer = Completer(); - final sendPort = - singleCompletePort(completer, callback: _handleErrVoid); - - native.simple_payment_bip32( - sendPort.nativePort, - accountIndex, - amount, - StringUtf8Pointer(currency).toNativeUtf8(), - StringUtf8Pointer(dewif).toNativeUtf8(), - StringUtf8Pointer(gvaEndpoint).toNativeUtf8(), - StringUtf8Pointer(recipient).toNativeUtf8(), - StringUtf8Pointer(secretCode).toNativeUtf8(), - StringUtf8Pointer(txComment).toNativeUtf8(), - ); - - return completer.future; - } - - static Pointer _listIntToPtrUint32(List list) { - final listUint32 = list.map((i) => i.toUnsigned(31)).toList(); - final Pointer ptr = malloc.allocate(listUint32.length); - for (var i = 0; i < listUint32.length; i++) { - ptr[i] = listUint32[i]; - } - return ptr; - } - - static Pointer> _listStringToPtr(List list) { - final listUtf8 = - list.map((s) => StringUtf8Pointer(s).toNativeUtf8()).toList(); - final Pointer> ptr = malloc.allocate(listUtf8.length); - for (var i = 0; i < listUtf8.length; i++) { - ptr[i] = listUtf8[i]; - } - return ptr; - } - - static String _handleErr(String res) { - if (res.startsWith('DUBP_RS_ERROR: ')) { - final error = res; - print(error); - throw error; - } else { - return res; - } - } - - static List _handleErrList(List res) { - final List arr = res.cast(); - if (arr.isNotEmpty && arr[0].startsWith('DUBP_RS_ERROR: ')) { - final error = arr[0]; - print(error); - throw error; - } else { - return arr; - } - } - - static void _handleErrVoid(String res) { - if (res.startsWith('DUBP_RS_ERROR: ')) { - final error = res; - print(error); - throw error; - } - } - - /*static int _handleErrInt(String res) { - if (res.startsWith('DUBP_RS_ERROR: ')) { - final error = res; - print(error); - throw error; - } else { - return int.parse(res); - } - }*/ -} diff --git a/packages/dubp_rs/pubspec.lock b/packages/dubp_rs/pubspec.lock deleted file mode 100644 index e6f0b3d..0000000 --- a/packages/dubp_rs/pubspec.lock +++ /dev/null @@ -1,189 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - effective_dart: - dependency: "direct dev" - description: - name: effective_dart - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - ffi: - dependency: "direct main" - description: - name: ffi - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - file_utils: - dependency: transitive - description: - name: file_utils - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - globbing: - dependency: transitive - description: - name: globbing - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - isolate: - dependency: "direct main" - description: - name: isolate - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.10" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - system_info: - dependency: "direct main" - description: - name: system_info - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.2" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" -sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.10.0" diff --git a/packages/dubp_rs/pubspec.yaml b/packages/dubp_rs/pubspec.yaml deleted file mode 100644 index bd3f658..0000000 --- a/packages/dubp_rs/pubspec.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: dubp -description: dubp-rs-libs binding for flutter. -version: 0.0.1 - -environment: - sdk: '>=2.7.0 <3.0.0' - flutter: '>=1.10.0' - -dependencies: - flutter: - sdk: flutter - ffi: ^1.0.0 - isolate: ^2.0.3 - system_info: ^1.0.0 - -dev_dependencies: - effective_dart: ^1.3.1 - flutter_test: - sdk: flutter - -flutter: - plugin: - platforms: - android: - package: com.example.dubp - pluginClass: DubpPlugin - ios: - pluginClass: DubpPlugin diff --git a/pubspec.lock b/pubspec.lock index 92ac05a..175b79c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -50,6 +50,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + bip32_ed25519: + dependency: transitive + description: + name: bip32_ed25519 + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1" + bip39_multi_nullsafety: + dependency: transitive + description: + name: bip39_multi_nullsafety + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.7" boolean_selector: dependency: transitive description: @@ -274,13 +288,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.4" - dubp: + durt: dependency: "direct main" description: - path: "packages/dubp_rs" - relative: true - source: path - version: "0.0.1" + name: durt + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3+3" fake_async: dependency: transitive description: @@ -309,13 +323,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.1.2" - file_utils: - dependency: transitive - description: - name: file_utils - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" fixnum: dependency: transitive description: @@ -397,13 +404,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" - globbing: - dependency: transitive - description: - name: globbing - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" gql: dependency: transitive description: @@ -474,6 +474,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + hex: + dependency: transitive + description: + name: hex + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" hive: dependency: "direct main" description: @@ -577,13 +584,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.3" - isolate: - dependency: transitive - description: - name: isolate - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" jdenticon_dart: dependency: "direct main" description: @@ -836,6 +836,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.3.0" + pinenacl: + dependency: transitive + description: + name: pinenacl + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" platform: dependency: transitive description: @@ -850,6 +857,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" + pointycastle: + dependency: transitive + description: + name: pointycastle + url: "https://pub.dartlang.org" + source: hosted + version: "3.4.0" pool: dependency: transitive description: @@ -1107,13 +1121,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.3.0" - system_info: - dependency: transitive - description: - name: system_info - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" term_glyph: dependency: transitive description: @@ -1248,5 +1255,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.14.4 <3.0.0" flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 76e9a95..a9d694e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,19 +10,17 @@ version: 0.0.3+14 environment: sdk: ">=2.7.0 <3.0.0" -dependencies: +dependencies: + flutter: + sdk: flutter + flutter_driver: + sdk: flutter assorted_layout_widgets: ^5.2.1 bubble: ^1.2.1 carousel_slider: ^4.0.0 confirm_dialog: ^1.0.0 crypto: ^3.0.1 - dubp: - path: packages/dubp_rs fast_base58: ^0.2.0 - flutter: - sdk: flutter - flutter_driver: - sdk: flutter flutter_launcher_icons: ^0.9.2 flutter_lints: ^1.0.4 flutter_logs: ^2.1.4 @@ -58,6 +56,7 @@ dependencies: xml: ^5.3.0 pull_to_refresh: ^2.0.0 dio: ^4.0.4 + durt: ^0.1.3+3 flutter_icons: android: "ic_launcher"