diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000000000000000000000000000000000000..ba71f181546c13cfea5262078b6a0b69fed1853d
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,864 @@
+# 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 = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
+
+[[package]]
+name = "aes"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5"
+dependencies = [
+ "aes-soft",
+ "aesni",
+ "block-cipher",
+]
+
+[[package]]
+name = "aes-soft"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7"
+dependencies = [
+ "block-cipher",
+ "byteorder",
+ "opaque-debug",
+]
+
+[[package]]
+name = "aesni"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264"
+dependencies = [
+ "block-cipher",
+ "opaque-debug",
+]
+
+[[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"
+
+[[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.55"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598"
+dependencies = [
+ "addr2line",
+ "cfg-if 1.0.0",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
+[[package]]
+name = "base64"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
+
+[[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",
+]
+
+[[package]]
+name = "block-cipher"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "bs58"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb"
+
+[[package]]
+name = "bumpalo"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
+
+[[package]]
+name = "byteorder"
+version = "1.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
+
+[[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 = "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 = "constant_time_eq"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
+
+[[package]]
+name = "crypto-mac"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
+dependencies = [
+ "generic-array",
+ "subtle",
+]
+
+[[package]]
+name = "cryptoxide"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da24927b5b899890bcb29205436c957b7892ec3a3fbffce81d710b9611e77778"
+
+[[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.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "dubp_rs"
+version = "0.1.0"
+dependencies = [
+ "allo-isolate",
+ "cbindgen",
+ "dart-bindgen",
+ "dup-crypto",
+ "ffi_helpers",
+ "thiserror",
+]
+
+[[package]]
+name = "dup-crypto"
+version = "0.36.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ed9887f92b29910736ad29f5631abcbd8fc6b2bd2dd5510dc1edd32b0265d04"
+dependencies = [
+ "aes",
+ "arrayvec",
+ "base64",
+ "blake3",
+ "bs58",
+ "byteorder",
+ "cryptoxide",
+ "getrandom",
+ "once_cell",
+ "ring",
+ "serde",
+ "thiserror",
+ "zerocopy",
+ "zeroize",
+]
+
+[[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 = "ffi_helpers"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36a21261040ffbc3999698b39170d6e951f2823dd9ad7b50469309156060a50c"
+dependencies = [
+ "failure",
+ "failure_derive",
+ "libc",
+]
+
+[[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 = "getrandom"
+version = "0.1.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
+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 = "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 = "itoa"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
+
+[[package]]
+name = "js-sys"
+version = "0.3.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175"
+dependencies = [
+ "wasm-bindgen",
+]
+
+[[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 = "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 = "miniz_oxide"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
+dependencies = [
+ "adler",
+ "autocfg",
+]
+
+[[package]]
+name = "object"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397"
+
+[[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 = "ppv-lite86"
+version = "0.2.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
+
+[[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.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
+dependencies = [
+ "getrandom",
+ "libc",
+ "rand_chacha",
+ "rand_core",
+ "rand_hc",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "rand_hc"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+dependencies = [
+ "rand_core",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.1.57"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
+
+[[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 = "ring"
+version = "0.16.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226"
+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 = "ryu"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
+
+[[package]]
+name = "serde"
+version = "1.0.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
+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 = "spin"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
+
+[[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.57"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6"
+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.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
+dependencies = [
+ "cfg-if 0.1.10",
+ "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.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "toml"
+version = "0.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "typenum"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
+
+[[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 = "untrusted"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
+
+[[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 = "wasi"
+version = "0.9.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e"
+dependencies = [
+ "cfg-if 1.0.0",
+ "wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62"
+dependencies = [
+ "bumpalo",
+ "lazy_static",
+ "log",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-backend",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
+
+[[package]]
+name = "web-sys"
+version = "0.3.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[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 = "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
new file mode 100644
index 0000000000000000000000000000000000000000..81a6dfc02d0110ca9375a5c1f2de34dcd0afc1ea
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,7 @@
+[workspace]
+members = ["native/dubp_rs"]
+
+[profile.release]
+lto = true
+codegen-units = 1
+debug = true
\ No newline at end of file
diff --git a/Makefile.toml b/Makefile.toml
new file mode 100644
index 0000000000000000000000000000000000000000..be8c8f7798840f8ee091b30f5621b8d1f10170b8
--- /dev/null
+++ b/Makefile.toml
@@ -0,0 +1,301 @@
+[env]
+CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
+CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/dubp_rs"]
+ANDROID_PLATFORM_VERSION = "22"
+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"]
+
+[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"]
+
+[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.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 = "copy-lib"
+
+[tasks.post-android-armv7]
+private = true
+env = { ANDROID_TARGET = "armv7-linux-androideabi", JNI_LIB_DIR = "armeabi-v7a" }
+run_task = "copy-lib"
+
+[tasks.post-android-i686]
+private = true
+env = { ANDROID_TARGET = "i686-linux-android", JNI_LIB_DIR = "x86" }
+run_task = "copy-lib"
+
+
+[tasks.post-android-x86_64]
+private = true
+env = { ANDROID_TARGET = "x86_64-linux-android", JNI_LIB_DIR = "x86_64" }
+run_task = "copy-lib"
+
+[tasks.post-android]
+dependencies = ["restore-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]
+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"
+    if ${is_android}
+      crate_type = set "cdylib"
+    elseif ${is_ios}
+      crate_type = set "staticlib"
+    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}
+    """,
+]
+
+[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"
+    if ${is_android}
+      crate_type = set "cdylib"
+    elseif ${is_ios}
+      crate_type = set "staticlib"
+    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/native/dubp_rs/Cargo.toml b/native/dubp_rs/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..c3d7073c33f309c764bc596a50eb22bf03db6040
--- /dev/null
+++ b/native/dubp_rs/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "dubp_rs"
+version = "0.1.0"
+authors = ["Éloïs SANCHEZ <elois@duniter.org>"]
+edition = "2018"
+
+[lib]
+name = "dubp_rs"
+crate-type = ["rlib"]
+
+[dependencies]
+allo-isolate = "0.1.6"
+dup-crypto = { version = "0.36.0", features = ["dewif", "mnemonic", "mnemonic_french", "rand", "scrypt"] }
+ffi_helpers = "0.2"
+thiserror = "1.0.23"
+
+[build-dependencies]
+cbindgen = "0.14.3"
+dart-bindgen = "0.1.7"
\ No newline at end of file
diff --git a/native/dubp_rs/build.rs b/native/dubp_rs/build.rs
new file mode 100644
index 0000000000000000000000000000000000000000..2122423884e85b4952f7fb844c5a03005dda0f56
--- /dev/null
+++ b/native/dubp_rs/build.rs
@@ -0,0 +1,53 @@
+//  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 <https://www.gnu.org/licenses/>.
+
+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(),
+        ..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/dewif.rs b/native/dubp_rs/src/dewif.rs
new file mode 100644
index 0000000000000000000000000000000000000000..0244a167078a8d7e89042c233ab04cd35228f5ba
--- /dev/null
+++ b/native/dubp_rs/src/dewif.rs
@@ -0,0 +1,216 @@
+//  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 <https://www.gnu.org/licenses/>.
+
+use crate::*;
+
+pub(super) fn gen_pin6() -> Result<String, DubpError> {
+    let i = dup_crypto::rand::gen_u32().map_err(|_| DubpError::RandErr)?;
+    Ok(gen_pin6_inner(i))
+}
+pub(super) fn gen_pin8() -> Result<String, DubpError> {
+    let i = dup_crypto::rand::gen_u32().map_err(|_| DubpError::RandErr)?;
+    let i2 = dup_crypto::rand::gen_u32().map_err(|_| DubpError::RandErr)?;
+    let mut pin = gen_pin6_inner(i);
+    gen_pin2_inner(i2, &mut pin);
+    Ok(pin)
+}
+pub(super) fn gen_pin10() -> Result<String, DubpError> {
+    let i = dup_crypto::rand::gen_u32().map_err(|_| DubpError::RandErr)?;
+    let i2 = dup_crypto::rand::gen_u32().map_err(|_| DubpError::RandErr)?;
+    let mut pin = gen_pin6_inner(i);
+    gen_pin4_inner(i2, &mut pin);
+    Ok(pin)
+}
+
+pub(super) fn change_pin(
+    currency: &str,
+    dewif: &str,
+    old_pin: &str,
+    new_pin: &str,
+) -> Result<String, DubpError> {
+    let currency = parse_currency(currency)?;
+    let mut keypairs = dup_crypto::dewif::read_dewif_file_content(
+        ExpectedCurrency::Specific(currency),
+        dewif,
+        old_pin,
+    )
+    .map_err(DubpError::DewifReadError)?;
+    if let Some(KeyPairEnum::Ed25519(keypair)) = keypairs.next() {
+        Ok(dup_crypto::dewif::write_dewif_v1_content(
+            currency, &keypair, new_pin,
+        ))
+    } else {
+        Err(DubpError::DewifReadError(DewifReadError::CorruptedContent))
+    }
+}
+
+pub(super) fn gen_dewif(
+    currency: &str,
+    language: u32,
+    mnemonic: &str,
+    pin: &str,
+) -> Result<String, DubpError> {
+    let currency = parse_currency(currency)?;
+    let mnemonic = Mnemonic::from_phrase(mnemonic, u32_to_language(language)?)
+        .map_err(|_| DubpError::WrongLanguage)?;
+    let seed = dup_crypto::mnemonic::mnemonic_to_seed(&mnemonic);
+    let keypair = KeyPairFromSeed32Generator::generate(seed);
+    Ok(dup_crypto::dewif::write_dewif_v1_content(
+        currency, &keypair, pin,
+    ))
+}
+
+pub(super) fn get_pubkey(currency: &str, dewif: &str, pin: &str) -> Result<String, DubpError> {
+    let currency = parse_currency(currency)?;
+    let mut keypairs = dup_crypto::dewif::read_dewif_file_content(
+        ExpectedCurrency::Specific(currency),
+        dewif,
+        &pin,
+    )
+    .map_err(DubpError::DewifReadError)?;
+    if let Some(KeyPairEnum::Ed25519(keypair)) = keypairs.next() {
+        Ok(keypair.public_key().to_base58())
+    } else {
+        Err(DubpError::DewifReadError(DewifReadError::CorruptedContent))
+    }
+}
+
+pub(super) fn sign(currency: &str, dewif: &str, pin: &str, msg: &str) -> Result<String, DubpError> {
+    let currency = parse_currency(currency)?;
+    let mut keypairs = dup_crypto::dewif::read_dewif_file_content(
+        ExpectedCurrency::Specific(currency),
+        dewif,
+        &pin,
+    )
+    .map_err(DubpError::DewifReadError)?;
+    if let Some(KeyPairEnum::Ed25519(keypair)) = keypairs.next() {
+        Ok(keypair.generate_signator().sign(msg.as_bytes()).to_base64())
+    } else {
+        Err(DubpError::DewifReadError(DewifReadError::CorruptedContent))
+    }
+}
+
+pub(super) fn sign_several(
+    currency: &str,
+    dewif: &str,
+    pin: &str,
+    msgs: &str,
+) -> Result<Vec<String>, DubpError> {
+    let currency = parse_currency(currency)?;
+    let mut keypairs = dup_crypto::dewif::read_dewif_file_content(
+        ExpectedCurrency::Specific(currency),
+        dewif,
+        &pin,
+    )
+    .map_err(DubpError::DewifReadError)?;
+    if let Some(KeyPairEnum::Ed25519(keypair)) = keypairs.next() {
+        let signator = keypair.generate_signator();
+        Ok(msgs
+            .split("\n\t\n")
+            .map(|msg| signator.sign(msg.as_bytes()).to_base64())
+            .collect())
+    } else {
+        Err(DubpError::DewifReadError(DewifReadError::CorruptedContent))
+    }
+}
+
+fn parse_currency(currency: &str) -> Result<Currency, DubpError> {
+    let currency_code = match currency {
+        "g1" => G1_CURRENCY,
+        "g1-test" | "gt" => G1_TEST_CURRENCY,
+        _ => return Err(DubpError::UnknownCurrencyName),
+    };
+    Ok(Currency::from(currency_code))
+}
+
+fn gen_pin2_inner(mut i: u32, pin: &mut String) {
+    for _ in 0..2 {
+        pin.push(to_char(i));
+        i /= 35;
+    }
+}
+fn gen_pin4_inner(mut i: u32, pin: &mut String) {
+    for _ in 0..4 {
+        pin.push(to_char(i));
+        i /= 35;
+    }
+}
+fn gen_pin6_inner(mut i: u32) -> String {
+    let mut pin = String::new();
+
+    for _ in 0..6 {
+        pin.push(to_char(i));
+        i /= 35;
+    }
+
+    pin
+}
+
+fn to_char(i: u32) -> char {
+    match i % 35 {
+        0 => 'Z',
+        1 => '1',
+        2 => '2',
+        3 => '3',
+        4 => '4',
+        5 => '5',
+        6 => '6',
+        7 => '7',
+        8 => '8',
+        9 => '9',
+        10 => 'A',
+        11 => 'B',
+        12 => 'C',
+        13 => 'D',
+        14 => 'E',
+        15 => 'F',
+        16 => 'G',
+        17 => 'H',
+        18 => 'I',
+        19 => 'J',
+        20 => 'K',
+        21 => 'L',
+        22 => 'M',
+        23 => 'N',
+        24 => 'O',
+        25 => 'P',
+        26 => 'Q',
+        27 => 'R',
+        28 => 'S',
+        29 => 'T',
+        30 => 'U',
+        31 => 'V',
+        32 => 'W',
+        33 => 'X',
+        34 => 'Y',
+        _ => unreachable!(),
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_gen_pin_6() {
+        assert_eq!("ZZZZZZ", &gen_pin6_inner(0));
+        assert_eq!("YZZZZZ", &gen_pin6_inner(34));
+        assert_eq!("Z1ZZZZ", &gen_pin6_inner(35));
+        assert_eq!("ZZ1ZZZ", &gen_pin6_inner(1225));
+        assert_eq!("2Z1ZZZ", &gen_pin6_inner(1227));
+        assert_eq!("Z11ZZZ", &gen_pin6_inner(1260));
+        assert_eq!("111ZZZ", &gen_pin6_inner(1261));
+    }
+}
diff --git a/native/dubp_rs/src/lib.rs b/native/dubp_rs/src/lib.rs
new file mode 100644
index 0000000000000000000000000000000000000000..f83f48feb30cfacf91287e8c12b9e6ccf171c964
--- /dev/null
+++ b/native/dubp_rs/src/lib.rs
@@ -0,0 +1,228 @@
+//  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 <https://www.gnu.org/licenses/>.
+
+#![allow(clippy::missing_safety_doc, clippy::not_unsafe_ptr_arg_deref)]
+
+mod dewif;
+mod mnemonic;
+
+use allo_isolate::Isolate;
+use dup_crypto::{
+    bases::b58::ToBase58,
+    dewif::{Currency, DewifReadError, ExpectedCurrency, G1_CURRENCY, G1_TEST_CURRENCY},
+    keys::{
+        ed25519::KeyPairFromSeed32Generator, KeyPair as _, KeyPairEnum, Signator as _,
+        Signature as _,
+    },
+    mnemonic::{Language, Mnemonic, MnemonicType},
+};
+use ffi_helpers::null_pointer_check;
+use std::{ffi::CStr, io, os::raw};
+use thiserror::Error;
+
+/// Dubp error
+#[derive(Debug, Error)]
+pub enum DubpError {
+    #[error("{0}")]
+    DewifReadError(DewifReadError),
+    #[error("I/O error: {0}")]
+    IoErr(io::Error),
+    #[error("fail to generate random bytes")]
+    RandErr,
+    #[error("Unknown currency name")]
+    UnknownCurrencyName,
+    #[error("Unknown language")]
+    UnknownLanguage,
+    #[error("Wrong language")]
+    WrongLanguage,
+}
+
+impl From<io::Error> for DubpError {
+    fn from(e: io::Error) -> Self {
+        Self::IoErr(e)
+    }
+}
+
+macro_rules! error {
+    ($result:expr) => {
+        error!($result, 0);
+    };
+    ($result:expr, $error:expr) => {
+        match $result {
+            Ok(value) => value,
+            Err(e) => {
+                ffi_helpers::update_last_error(e);
+                return $error;
+            }
+        }
+    };
+}
+
+macro_rules! cstr {
+    ($ptr:expr) => {
+        cstr!($ptr, 0);
+    };
+    ($ptr:expr, $error:expr) => {{
+        null_pointer_check!($ptr);
+        error!(unsafe { CStr::from_ptr($ptr).to_str() }, $error)
+    }};
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn last_error_length() -> i32 {
+    ffi_helpers::error_handling::last_error_length()
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn error_message_utf8(buf: *mut raw::c_char, length: i32) -> i32 {
+    ffi_helpers::error_handling::error_message_utf8(buf, length)
+}
+
+#[no_mangle]
+pub extern "C" fn change_dewif_pin(
+    port: i64,
+    currency: *const raw::c_char,
+    dewif: *const raw::c_char,
+    old_pin: *const raw::c_char,
+    new_pin: *const raw::c_char,
+) -> i32 {
+    let currency = cstr!(currency);
+    let dewif = cstr!(dewif);
+    let old_pin = cstr!(old_pin);
+    let new_pin = cstr!(new_pin);
+    Isolate::new(port).post(error!(dewif::change_pin(currency, dewif, old_pin, new_pin)));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn gen_dewif(
+    port: i64,
+    currency: *const raw::c_char,
+    language: u32,
+    mnemonic: *const raw::c_char,
+    pin: *const raw::c_char,
+) -> i32 {
+    let currency = cstr!(currency);
+    let mnemonic = cstr!(mnemonic);
+    let pin = cstr!(pin);
+    Isolate::new(port).post(error!(dewif::gen_dewif(currency, language, mnemonic, pin)));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn gen_mnemonic(port: i64, language: u32) -> i32 {
+    Isolate::new(port).post(error!(mnemonic::gen_mnemonic(language)));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn gen_pin6(port: i64) -> i32 {
+    Isolate::new(port).post(error!(dewif::gen_pin6()));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn gen_pin8(port: i64) -> i32 {
+    Isolate::new(port).post(error!(dewif::gen_pin8()));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn gen_pin10(port: i64) -> i32 {
+    Isolate::new(port).post(error!(dewif::gen_pin10()));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn get_dewif_pubkey(
+    port: i64,
+    currency: *const raw::c_char,
+    dewif: *const raw::c_char,
+    pin: *const raw::c_char,
+) -> i32 {
+    let currency = cstr!(currency);
+    let dewif = cstr!(dewif);
+    let pin = cstr!(pin);
+    Isolate::new(port).post(error!(dewif::get_pubkey(
+        currency,
+        dewif,
+        &pin.to_ascii_uppercase()
+    )));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn mnemonic_to_pubkey(
+    port: i64,
+    language: u32,
+    mnemonic_phrase: *const raw::c_char,
+) -> i32 {
+    let mnemonic_phrase = cstr!(mnemonic_phrase);
+    Isolate::new(port).post(error!(mnemonic::mnemonic_to_pubkey(
+        language,
+        mnemonic_phrase
+    )));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn sign(
+    port: i64,
+    currency: *const raw::c_char,
+    dewif: *const raw::c_char,
+    pin: *const raw::c_char,
+    msg: *const raw::c_char,
+) -> i32 {
+    let currency = cstr!(currency);
+    let dewif = cstr!(dewif);
+    let pin = cstr!(pin);
+    let msg = cstr!(msg);
+    Isolate::new(port).post(error!(dewif::sign(
+        currency,
+        dewif,
+        &pin.to_ascii_uppercase(),
+        msg
+    )));
+    1
+}
+
+#[no_mangle]
+pub extern "C" fn sign_several(
+    port: i64,
+    currency: *const raw::c_char,
+    dewif: *const raw::c_char,
+    pin: *const raw::c_char,
+    msgs: *const raw::c_char,
+) -> i32 {
+    let currency = cstr!(currency);
+    let dewif = cstr!(dewif);
+    let pin = cstr!(pin);
+    let msgs = cstr!(msgs);
+    Isolate::new(port).post(error!(dewif::sign_several(
+        currency,
+        dewif,
+        &pin.to_ascii_uppercase(),
+        msgs
+    )));
+    1
+}
+
+fn u32_to_language(i: u32) -> Result<Language, DubpError> {
+    match i {
+        0 => Ok(Language::English),
+        1 => Ok(Language::French),
+        _ => Err(DubpError::UnknownLanguage),
+    }
+}
diff --git a/native/dubp_rs/src/mnemonic.rs b/native/dubp_rs/src/mnemonic.rs
new file mode 100644
index 0000000000000000000000000000000000000000..765427dde2477d365e7b028310eb512a08744cf1
--- /dev/null
+++ b/native/dubp_rs/src/mnemonic.rs
@@ -0,0 +1,30 @@
+//  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 <https://www.gnu.org/licenses/>.
+
+use crate::*;
+
+pub(super) fn gen_mnemonic(language: u32) -> Result<String, DubpError> {
+    let mnemonic = Mnemonic::new(MnemonicType::Words12, u32_to_language(language)?)
+        .map_err(|_| DubpError::RandErr)?;
+    Ok(mnemonic.phrase().to_owned())
+}
+
+pub(super) fn mnemonic_to_pubkey(language: u32, mnemonic: &str) -> Result<String, DubpError> {
+    let mnemonic = Mnemonic::from_phrase(mnemonic, u32_to_language(language)?)
+        .map_err(|_| DubpError::WrongLanguage)?;
+    let seed = dup_crypto::mnemonic::mnemonic_to_seed(&mnemonic);
+    let keypair = KeyPairFromSeed32Generator::generate(seed);
+    Ok(keypair.public_key().to_base58())
+}