remove gpg module

This commit is contained in:
creating2morrow 2024-04-07 10:43:18 -04:00
parent e245be7143
commit 80b57bbc9b
33 changed files with 227 additions and 1688 deletions

View file

@ -22,6 +22,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt install -y libssl-dev build-essential libgpgme-dev
run: sudo apt install -y libssl-dev build-essential
- name: Audit
run: cargo install cargo-audit && cargo audit

View file

@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt install -y libssl-dev build-essential libgpgme-dev
run: sudo apt install -y libssl-dev build-essential
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT

View file

@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt install -y libssl-dev build-essential libgpgme-dev
run: sudo apt install -y libssl-dev build-essential
- name: Build
run: cargo build --verbose
- name: Run tests

145
Cargo.lock generated
View file

@ -300,12 +300,6 @@ dependencies = [
"objc2-encode",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.13.0"
@ -373,16 +367,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cfg-expr"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "215c0072ecc28f92eeb0eea38ba63ddfcb65c2828c46311d646f1a3ff5f9841c"
dependencies = [
"smallvec",
"target-lexicon",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -510,15 +494,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.17.0"
@ -641,16 +616,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -678,12 +643,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "deflate"
version = "0.8.6"
@ -1283,47 +1242,6 @@ dependencies = [
"gl_generator",
]
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.153",
"memoffset 0.7.1",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.153",
"libgpg-error-sys",
"system-deps",
"winreg 0.10.1",
]
[[package]]
name = "h2"
version = "0.3.26"
@ -1697,17 +1615,6 @@ version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg 0.10.1",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -1847,15 +1754,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.9.0"
@ -2028,7 +1926,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -2725,7 +2622,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg 0.50.0",
"winreg",
]
[[package]]
@ -3136,12 +3033,6 @@ dependencies = [
"loom",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "str-buf"
version = "1.0.6"
@ -3215,25 +3106,6 @@ dependencies = [
"libc 0.2.153",
]
[[package]]
name = "system-deps"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5fa6fb9ee296c0dc2df41a656ca7948546d061958115ddb0bcaae43ad0d17d2"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml",
"version-compare",
]
[[package]]
name = "target-lexicon"
version = "0.12.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac"
[[package]]
name = "tempfile"
version = "3.6.0"
@ -3661,12 +3533,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@ -4128,15 +3994,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]]
name = "winreg"
version = "0.50.0"

View file

@ -7,22 +7,22 @@ NEVidebla-EKOnomia (invisible economy)
![home](./assets/home.png)
### gpg and i2p made simple for E2EE marketplace, messaging and more
### i2p made simple for E2EE marketplace, messaging and more
## About
* send messages over the invisible internet
* vanity base32 addresses (advanced)
* automated mandatory gpg key encryption
* automated mandatory message encipher
* self-hosted i2p marketplace
* xmr multisig / payment integration
## Dev
* stack - rust (egui, rocket), lmdb, i2p-zero, monero(rpc, daemon), gpg
* stack - rust (egui, rocket), lmdb, i2p-zero, monero(rpc, daemon)
* install dependencies
* ubuntu example: `sudo apt update -y && sudo apt upgrade -y`
* `sudo apt install -y libssl-dev build-essential libgpgme-dev`
* `sudo apt install -y libssl-dev build-essential`
* `git clone https://github.com/creating2morrow/neveko`
* `cd neveko && ./scripts/build_all_and_run.sh "-- -h"`
* Example to start neveko with remote stagenet node / i2p proxy remote for development:

View file

@ -39,7 +39,7 @@ curl -iv http://bob.b32.i2p/xmr/version -H 'proof: eyJhbGciOiJIUzUxMiJ9...'
## add contact
```bash
curl -iv -X POST http://localhost:9044/contact -d '{"cid": "KEEP EMPTY", "gpg_key": [1,2,3...], "i2p_address": "", "xmr_address": ""}' -H 'Content-Type: application/json'
curl -iv -X POST http://localhost:9044/contact -d '{"cid": "KEEP EMPTY", "npmk": "string", "i2p_address": "", "xmr_address": ""}' -H 'Content-Type: application/json'
```
## view contacts
@ -66,8 +66,8 @@ curl -iv http://alice.b32.i2p/message/rx -d '{"uid":"", "mid": "", "body": [1,2,
curl -iv http://localhost:9045/messages
```
## decrypt message
## decipher message
```bash
curl -iv http://localhost:9045/message/decrypt/<MESSAGE_ID>
curl -iv http://localhost:9045/message/decipher/<MESSAGE_ID>
```

View file

@ -24,9 +24,8 @@
* go to `AddressBook` in the gui
* enter .b32.i2p address of contact and click add
* if all goes well you will have imported their public neveko gpg app key
* dont reuse the app gpg keys anywhere else!
* don't forget to trust the contact with `sign key` in the `check status` window
* if all goes well you will have imported their public neveko message public key
* dont reuse the neveko message keys anywhere else!
### Create JWP
@ -38,7 +37,7 @@
* click `check status` and `Create JWP`
* when authorizing to send to contact an invoice will be generated
* authorize payment and tx proof generation in the prompt
* this tx proof will be used to create an encrypted json web proof of payment with each contact
* this tx proof will be used to create an enciphered json web proof of payment with each contact
* think of it as a reusable, unforgeable coupon or ticket
* the invoice shows payment per blocks (time)
* default is 1 piconero per day
@ -55,7 +54,7 @@
* verify recipient (.b32.i2p address) and press `send`
* plain text messages never leave your machine
* you can click `Refresh` button in the Mailbox to check for new messages
* messages must be decrypted by clicking `decrypt`
* messages must be deciphered by clicking `decipher`
### fts (failed-to-send)

181
neveko-auth/Cargo.lock generated
View file

@ -162,12 +162,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -186,15 +180,6 @@ version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-expr"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a35b255461940a32985c627ce82900867c61db1659764d3675ea81963f72a4c6"
dependencies = [
"smallvec",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -283,15 +268,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.17.0"
@ -338,16 +314,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -375,12 +341,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "cxx"
version = "1.0.94"
@ -576,7 +536,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.5.11",
"toml",
"uncased",
"version_check",
]
@ -722,47 +682,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.140",
"memoffset",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.140",
"libgpg-error-sys",
"system-deps",
"winreg",
]
[[package]]
name = "h2"
version = "0.3.16"
@ -1044,17 +963,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -1161,15 +1069,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.17"
@ -1245,7 +1144,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -1891,15 +1789,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -2003,12 +1892,6 @@ dependencies = [
"loom",
]
[[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.10.0"
@ -2043,19 +1926,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555fc8147af6256f3931a36bb83ad0023240ce9cf2b319dec8236fd1f220b05f"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.7.3",
"version-compare",
]
[[package]]
name = "tempfile"
version = "3.5.0"
@ -2223,40 +2093,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -2418,12 +2254,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@ -2715,15 +2545,6 @@ version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6e62c256dc6d40b8c8707df17df8d774e60e39db723675241e7c15e910bce7"
[[package]]
name = "winnow"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"

View file

@ -162,12 +162,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -186,15 +180,6 @@ version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-expr"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a35b255461940a32985c627ce82900867c61db1659764d3675ea81963f72a4c6"
dependencies = [
"smallvec",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -283,15 +268,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.17.0"
@ -338,16 +314,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -375,12 +341,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "cxx"
version = "1.0.94"
@ -576,7 +536,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.5.11",
"toml",
"uncased",
"version_check",
]
@ -722,47 +682,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.140",
"memoffset",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.140",
"libgpg-error-sys",
"system-deps",
"winreg",
]
[[package]]
name = "h2"
version = "0.3.16"
@ -1044,17 +963,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -1161,15 +1069,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.17"
@ -1245,7 +1144,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -1891,15 +1789,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -2003,12 +1892,6 @@ dependencies = [
"loom",
]
[[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.10.0"
@ -2043,19 +1926,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555fc8147af6256f3931a36bb83ad0023240ce9cf2b319dec8236fd1f220b05f"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.7.3",
"version-compare",
]
[[package]]
name = "tempfile"
version = "3.5.0"
@ -2223,40 +2093,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -2418,12 +2254,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@ -2715,15 +2545,6 @@ version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6e62c256dc6d40b8c8707df17df8d774e60e39db723675241e7c15e910bce7"
[[package]]
name = "winnow"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"

View file

@ -37,13 +37,6 @@ pub async fn get_contacts(_token: auth::BearerToken) -> Custom<Json<Vec<Contact>
Custom(Status::Ok, Json(contacts))
}
/// trust contact
#[post("/<key>")]
pub async fn trust_contact(key: String, _token: auth::BearerToken) -> Status {
contact::trust_gpg(key);
Status::Ok
}
/// prove payment
#[get("/<contact>", data = "<proof_req>")]
pub async fn prove_payment(

View file

@ -15,7 +15,6 @@ async fn rocket() -> _ {
env_logger::init();
log::info!("neveko-contact is online");
rocket::custom(&config)
.mount("/trust", routes![controller::trust_contact])
.mount("/prove", routes![controller::prove_payment])
.mount("/contact", routes![controller::add_contact])
.mount("/contacts", routes![controller::get_contacts])

181
neveko-core/Cargo.lock generated
View file

@ -162,12 +162,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -186,15 +180,6 @@ version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-expr"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a35b255461940a32985c627ce82900867c61db1659764d3675ea81963f72a4c6"
dependencies = [
"smallvec",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -283,15 +268,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.17.0"
@ -338,16 +314,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -375,12 +341,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "cxx"
version = "1.0.94"
@ -576,7 +536,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.5.11",
"toml",
"uncased",
"version_check",
]
@ -722,47 +682,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.140",
"memoffset",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.140",
"libgpg-error-sys",
"system-deps",
"winreg",
]
[[package]]
name = "h2"
version = "0.3.16"
@ -1044,17 +963,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -1161,15 +1069,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.17"
@ -1235,7 +1134,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -1881,15 +1779,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -1993,12 +1882,6 @@ dependencies = [
"loom",
]
[[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.10.0"
@ -2033,19 +1916,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555fc8147af6256f3931a36bb83ad0023240ce9cf2b319dec8236fd1f220b05f"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.7.3",
"version-compare",
]
[[package]]
name = "tempfile"
version = "3.5.0"
@ -2213,40 +2083,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -2408,12 +2244,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@ -2705,15 +2535,6 @@ version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6e62c256dc6d40b8c8707df17df8d774e60e39db723675241e7c15e910bce7"
[[package]]
name = "winnow"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"

View file

@ -11,7 +11,6 @@ clap = { version = "4.1.4", features = ["derive"] }
curve25519-dalek = "4.1.2"
diqwest = "1.1.1"
env_logger = "0.10.0"
gpgme = "0.11.0"
hex = "0.4.3"
hmac = "0.12.1"
jwt = "0.16.0"

View file

@ -92,13 +92,6 @@ pub struct Args {
/// Marketplace admin port
#[arg(long, help = "Set app marketplace admin port", default_value = "9046")]
pub marketplace_port: u16,
/// Auto trust contact gpg keys (DISABLED)
#[arg(
long,
help = "FUTURE FEATURE. Auto trust contacts. DISABLED",
default_value = "false"
)]
pub auto_trust: bool,
/// Start with gui
#[arg(
long,

View file

@ -1,10 +1,10 @@
// Contact repo/service layer
use crate::{
db,
gpg,
i2p,
models::*,
monero,
neveko25519,
reqres,
utils,
};
@ -41,7 +41,7 @@ pub async fn create(c: &Json<Contact>) -> Contact {
info!("creating contact: {}", f_cid);
let new_contact = Contact {
cid: String::from(&f_cid),
gpg_key: c.gpg_key.iter().cloned().collect(),
nmpk: String::from(&c.nmpk),
i2p_address: String::from(&c.i2p_address),
is_vendor: false,
xmr_address: String::from(&c.xmr_address),
@ -50,8 +50,6 @@ pub async fn create(c: &Json<Contact>) -> Contact {
if !is_valid {
return Default::default();
}
let import = c.gpg_key.iter().cloned().collect();
gpg::import_key(String::from(&f_cid), import).unwrap();
debug!("insert contact: {:?}", &new_contact);
let s = db::Interface::open();
let k = &new_contact.cid;
@ -115,7 +113,7 @@ async fn validate_contact(j: &Json<Contact>) -> bool {
j.cid.len() < utils::string_limit()
&& j.i2p_address.len() < utils::string_limit()
&& j.i2p_address.contains(".b32.i2p")
&& j.gpg_key.len() < utils::gpg_key_limit()
&& j.nmpk.len() < utils::npmk_limit()
&& validate_address.result.valid
}
@ -130,12 +128,13 @@ pub async fn share() -> Contact {
monero::open_wallet(&wallet_name, &wallet_password).await;
let m_address: reqres::XmrRpcAddressResponse = monero::get_address().await;
monero::close_wallet(&wallet_name, &wallet_password).await;
let gpg_key = gpg::export_key().unwrap_or(Vec::new());
let nmk = neveko25519::generate_neveko_message_keys().await;
let nmpk = nmk.hex_nmpk;
let i2p_address = i2p::get_destination(None);
let xmr_address = m_address.result.address;
Contact {
cid: utils::empty_string(),
gpg_key,
nmpk,
i2p_address,
is_vendor,
xmr_address,
@ -151,19 +150,6 @@ pub fn exists(from: &String) -> bool {
return addresses.contains(from);
}
/// Sign for trusted nevmes contacts
///
/// UI/UX should have some prompt about the implication of trusting keys
///
/// however that is beyond the scope of this app. nevmes assumes contacts
///
/// using the app already have some level of knowledge about each other.
///
/// Without signing the key message encryption and sending is not possible.
pub fn trust_gpg(key: String) {
gpg::sign_key(&key).unwrap();
}
/// Get invoice for jwp creation
pub async fn request_invoice(contact: String) -> Result<reqres::Invoice, Box<dyn Error>> {
let host = utils::get_i2p_http_proxy();
@ -189,15 +175,13 @@ pub async fn request_invoice(contact: String) -> Result<reqres::Invoice, Box<dyn
}
}
/// Send the request to contact to add them. Set the prune arg to 1
///
/// for gpg key removal.
pub async fn add_contact_request(contact: String, prune: u32) -> Result<Contact, Box<dyn Error>> {
/// Send the request to contact to add them.
pub async fn add_contact_request(contact: String) -> Result<Contact, Box<dyn Error>> {
let host = utils::get_i2p_http_proxy();
let proxy = reqwest::Proxy::http(&host)?;
let client = reqwest::Client::builder().proxy(proxy).build();
match client?
.get(format!("http://{}/share/{}", contact, prune))
.get(format!("http://{}/share", contact))
.send()
.await
{

View file

@ -1,193 +0,0 @@
use crate::{
i2p,
utils,
};
use gpgme::*;
use log::{
debug,
error,
info,
};
use std::{
error::Error,
fs::File,
io::Write,
process::Command,
};
// TODO(c2m): remove this module and use monero public keys for text encryption
/// Searches for key, returns empty string if none exists
pub fn find_key() -> Result<String, Box<dyn Error>> {
info!("searching for application gpg key");
let proto = Protocol::OpenPgp;
let mode = KeyListMode::LOCAL;
let mut ctx = Context::from_protocol(proto)?;
ctx.set_key_list_mode(mode)?;
let name = i2p::get_destination(None);
let mut keys = ctx.find_keys([&name])?;
let mut k: String = utils::empty_string();
for key in keys.by_ref().filter_map(|x| x.ok()) {
let r_key: &str = key.id().unwrap_or("");
if String::from(r_key) != utils::empty_string() {
k = String::from(r_key);
break;
} else {
error!("error finding gpg key");
}
}
if keys.finish()?.is_truncated() {
error!("key listing unexpectedly truncated");
}
Ok(k)
}
pub fn gen_key() {
info!("creating gpg key");
let output = Command::new("gpg")
.args(["--batch", "--gen-key", "genkey-batch"])
.spawn()
.expect("gpg key generation failed");
debug!("{:?}", output.stdout);
}
/// Export ascii armor app public gpg key
pub fn export_key() -> Result<Vec<u8>, Box<dyn Error>> {
info!("exporting public key");
let mut ctx = Context::from_protocol(Protocol::OpenPgp)?;
ctx.set_armor(true);
let name = i2p::get_destination(None);
let keys = {
let mut key_iter = ctx.find_keys([&name])?;
let keys: Vec<_> = key_iter.by_ref().collect::<Result<_, _>>()?;
if key_iter.finish()?.is_truncated() {
Err("key listing unexpectedly truncated")?;
}
keys
};
let mode = gpgme::ExportMode::empty();
let mut output = Vec::new();
ctx.export_keys(&keys, mode, &mut output)
.map_err(|e| format!("export failed: {:?}", e))?;
Ok(output)
}
/// Import gpg keys from contacts
pub fn import_key(cid: String, key: Vec<u8>) -> Result<(), Box<dyn Error>> {
info!("importing key: {}", hex::encode(&key));
let filename = format!("{}.neveko", &cid);
let mut f = File::create(&filename)?;
f.write_all(&key)?;
let mut ctx = Context::from_protocol(gpgme::Protocol::OpenPgp)?;
println!("reading file `{}'", &filename);
let input = File::open(&filename)?;
let mut data = Data::from_seekable_stream(input)?;
let mode = None;
mode.map(|m| data.set_encoding(m));
ctx.import(&mut data)
.map_err(|e| format!("import failed {:?}", e))?;
utils::stage_cleanup(filename);
Ok(())
}
pub fn encrypt(name: String, body: &Vec<u8>) -> Result<Vec<u8>, Box<dyn Error>> {
let proto = Protocol::OpenPgp;
let mut ctx = Context::from_protocol(proto)?;
ctx.set_armor(true);
let keys: Vec<Key> = ctx
.find_keys([&name])?
.filter_map(|x| x.ok())
.filter(|k| k.can_encrypt())
.collect();
let filename = format!("{}.neveko", name);
let mut f = File::create(&filename)?;
f.write_all(body)?;
let mut input =
File::open(&filename).map_err(|e| format!("can't open file `{}': {}", filename, e))?;
let mut output = Vec::new();
ctx.encrypt(&keys, &mut input, &mut output)
.map_err(|e| format!("encrypting failed: {:?}", e))?;
debug!(
"encrypted message body: {}",
String::from_utf8(output.iter().cloned().collect()).unwrap_or(utils::empty_string())
);
utils::stage_cleanup(filename);
Ok(output)
}
pub fn decrypt(mid: &String, body: &Vec<u8>) -> Result<Vec<u8>, Box<dyn Error>> {
// bad things will happen if we get empty bytes
if body.is_empty() {
log::error!("no bytes to decrypt");
return Ok(Vec::new());
}
let proto = Protocol::OpenPgp;
let mut ctx = Context::from_protocol(proto)?;
ctx.set_armor(true);
let filename = format!("{}.neveko", mid);
let mut f = File::create(&filename)?;
f.write_all(&body)?;
let mut input =
File::open(&filename).map_err(|e| format!("can't open file `{}': {}", filename, e))?;
let mut output = Vec::new();
ctx.decrypt(&mut input, &mut output)
.map_err(|e| format!("decrypting failed: {:?}", e))?;
utils::stage_cleanup(filename);
Ok(output)
}
pub fn write_gen_batch() -> Result<(), Box<dyn Error>> {
let name = i2p::get_destination(None);
let data = format!(
"%no-protection
Key-Type: RSA
Key-Length: 4096
Subkey-Type: ECC
Subkey-Curve: Curve25519
Name-Real: {}
Name-Email: {}
Expire-Date: 0",
name, name
);
let filename = format!("genkey-batch");
let mut f = File::create(&filename)?;
f.write_all(&data.into_bytes())?;
Ok(())
}
pub fn sign_key(key: &str) -> Result<(), Box<dyn Error>> {
let mut ctx = Context::from_protocol(gpgme::Protocol::OpenPgp)?;
let mut keys = ctx.find_keys([key])?;
let mut k: String = utils::empty_string();
for ak in keys.by_ref().filter_map(|x| x.ok()) {
let r_key: &str = ak.id().unwrap_or("");
if String::from(r_key) != utils::empty_string() {
k = String::from(r_key);
break;
} else {
error!("error finding gpg key");
}
}
debug!("key-id match: {}", k);
let mut k2s_ctx = Context::from_protocol(gpgme::Protocol::OpenPgp)?;
let key_to_sign = k2s_ctx
.get_key(k)
.map_err(|e| format!("no key matched given key-id: {:?}", e))?;
let name = Some(i2p::get_destination(None));
if let Some(app_key) = name {
let key = k2s_ctx
.get_secret_key(app_key)
.map_err(|e| format!("unable to find signing key: {:?}", e))?;
debug!("app key: {:?}", key.id());
k2s_ctx
.add_signer(&key)
.map_err(|e| format!("add_signer() failed: {:?}", e))?;
}
k2s_ctx
.sign_key(&key_to_sign, None::<String>, Default::default())
.map_err(|e| format!("signing failed: {:?}", e))?;
println!("Signed key for {}", key);
Ok(())
}

View file

@ -4,7 +4,6 @@ pub mod contact; // contact repo/service layer
pub mod neveko25519; // cipher logic
pub mod dispute; // dispute repo/service layer
pub mod db; // lmdb interface
pub mod gpg; // gpgme interface
pub mod i2p; // i2p repo/service layer
pub mod message; // message repo/service layer
pub mod models; // db structs

View file

@ -2,10 +2,10 @@
use crate::{
contact,
db,
gpg,
i2p,
models::*,
monero,
neveko25519,
order,
reqres,
utils,
@ -60,9 +60,12 @@ pub async fn create(m: Json<Message>, jwp: String, m_type: MessageType) -> Messa
}
info!("creating message: {}", &f_mid);
let created = chrono::offset::Utc::now().timestamp();
// get contact public gpg key and encrypt the message
// get contact public gpg key and encipher the message
debug!("sending message: {:?}", &m);
let e_body = gpg::encrypt(String::from(&m.to), &m.body).unwrap_or(Vec::new());
let contact: Contact = contact::find(&m.to);
let hex_nmpk: String = contact.nmpk;
let encipher = Some(String::from(neveko25519::ENCIPHER));
let e_body = neveko25519::cipher(&hex_nmpk, String::from(&m.body), encipher).await;
let new_message = Message {
mid: String::from(&f_mid),
uid: String::from(&m.uid),
@ -107,7 +110,7 @@ pub async fn rx(m: Json<Message>) {
mid: String::from(&f_mid),
uid: String::from(crate::RX_MESSAGE_DB_KEY),
from: String::from(&m.from),
body: m.body.iter().cloned().collect(),
body: String::from(&m.body),
created: chrono::offset::Utc::now().timestamp(),
to: String::from(&m.to),
};
@ -127,8 +130,8 @@ pub async fn rx(m: Json<Message>) {
}
/// Parse the multisig message type and info
fn parse_multisig_message(mid: String) -> MultisigMessageData {
let d: reqres::DecryptedMessageBody = decrypt_body(mid);
async fn parse_multisig_message(mid: String) -> MultisigMessageData {
let d: reqres::DecipheredMessageBody = decipher_body(mid).await;
let mut bytes = hex::decode(d.body.into_bytes()).unwrap_or(Vec::new());
let decoded = String::from_utf8(bytes).unwrap_or(utils::empty_string());
let values = decoded.split(":");
@ -148,7 +151,7 @@ fn parse_multisig_message(mid: String) -> MultisigMessageData {
info = format!("{}:{}", a_info, b_info);
}
bytes = Vec::new();
debug!("zero decryption bytes: {:?}", bytes);
debug!("zero decipher bytes: {:?}", bytes);
MultisigMessageData {
info,
sub_type,
@ -160,7 +163,7 @@ fn parse_multisig_message(mid: String) -> MultisigMessageData {
///
/// Upon multisig message receipt the message is automatically
///
/// decrypted for convenience sake. The client must determine which
/// decipher for convenience sake. The client must determine which
///
/// .b32.i2p address belongs to the vendor / adjudicator.
///
@ -192,7 +195,7 @@ pub async fn rx_multisig(m: Json<Message>) {
mid: String::from(&f_mid),
uid: String::from(crate::RX_MESSAGE_DB_KEY),
from: String::from(&m.from),
body: m.body.iter().cloned().collect(),
body: String::from(&m.body),
created: chrono::offset::Utc::now().timestamp(),
to: String::from(&m.to),
};
@ -211,7 +214,7 @@ pub async fn rx_multisig(m: Json<Message>) {
msg_list, list_key
);
db::Interface::async_write(&s.env, &s.handle, &String::from(list_key), &msg_list).await;
let data: MultisigMessageData = parse_multisig_message(new_message.mid);
let data: MultisigMessageData = parse_multisig_message(new_message.mid).await;
debug!(
"writing multisig message type {} for order {}",
&data.sub_type, &data.orid
@ -310,12 +313,14 @@ async fn send_message(out: &Message, jwp: &str, m_type: MessageType) -> Result<(
}
}
/// Returns decrypted hex string of the encrypted message
pub fn decrypt_body(mid: String) -> reqres::DecryptedMessageBody {
/// Returns deciphered message
pub async fn decipher_body(mid: String) -> reqres::DecipheredMessageBody {
let m = find(&mid);
let d = gpg::decrypt(&mid, &m.body).unwrap();
let body = hex::encode(d);
reqres::DecryptedMessageBody { mid, body }
let contact = contact::find(&m.from);
let nmpk = contact.nmpk;
let message = String::from(&m.body);
let body = neveko25519::cipher(&nmpk, message, None).await;
reqres::DecipheredMessageBody { mid, body }
}
/// Message deletion
@ -488,7 +493,7 @@ fn is_fts_clear(r: String) -> bool {
}
}
/// Encrypts and sends the output from the monero-rpc
/// Enciphers and sends the output from the monero-rpc
///
/// `prepare_multisig_info` method.
pub async fn send_prepare_info(orid: &String, contact: &String) {
@ -504,7 +509,7 @@ pub async fn send_prepare_info(orid: &String, contact: &String) {
PREPARE_MSIG, orid, &prepare_info.result.multisig_info
);
let message: Message = Message {
body: body_str.into_bytes(),
body: body_str,
created: chrono::Utc::now().timestamp(),
to: String::from(contact),
..Default::default()
@ -514,7 +519,7 @@ pub async fn send_prepare_info(orid: &String, contact: &String) {
create(j_message, jwp, MessageType::Multisig).await;
}
/// Encrypts and sends the output from the monero-rpc
/// Enciphers and sends the output from the monero-rpc
///
/// `make_multisig_info` method.
pub async fn send_make_info(orid: &String, contact: &String, info: Vec<String>) {
@ -527,7 +532,7 @@ pub async fn send_make_info(orid: &String, contact: &String, info: Vec<String>)
let jwp = db::Interface::read(&s.env, &s.handle, &k);
let body_str = format!("{}:{}:{}", MAKE_MSIG, orid, &make_info.result.multisig_info);
let message: Message = Message {
body: body_str.into_bytes(),
body: body_str,
created: chrono::Utc::now().timestamp(),
to: String::from(contact),
..Default::default()
@ -537,7 +542,7 @@ pub async fn send_make_info(orid: &String, contact: &String, info: Vec<String>)
create(j_message, jwp, MessageType::Multisig).await;
}
/// Encrypts and sends the output from the monero-rpc
/// Enciphers and sends the output from the monero-rpc
///
/// `exchange_multisig_keys` method.
pub async fn send_exchange_info(
@ -564,7 +569,7 @@ pub async fn send_exchange_info(
);
}
let message: Message = Message {
body: body_str.into_bytes(),
body: body_str,
created: chrono::Utc::now().timestamp(),
to: String::from(contact),
..Default::default()
@ -574,7 +579,7 @@ pub async fn send_exchange_info(
create(j_message, jwp, MessageType::Multisig).await;
}
/// Encrypts and sends the output from the monero-rpc
/// Enciphers and sends the output from the monero-rpc
///
/// `export_multisig_info` method.
pub async fn send_export_info(orid: &String, contact: &String) {
@ -587,7 +592,7 @@ pub async fn send_export_info(orid: &String, contact: &String) {
let jwp = db::Interface::read(&s.env, &s.handle, &k);
let body_str = format!("{}:{}:{}", EXPORT_MSIG, orid, &exchange_info.result.info);
let message: Message = Message {
body: body_str.into_bytes(),
body: body_str,
created: chrono::Utc::now().timestamp(),
to: String::from(contact),
..Default::default()
@ -622,7 +627,7 @@ pub async fn send_import_info(orid: &String, info: &Vec<String>) {
/// Customer begins multisig orchestration by requesting the prepare info
///
/// from the adjudicator and the vendor. In response they create an encrypted
/// from the adjudicator and the vendor. In response they create an enciphered
///
/// multisig message with the requested data. Customer manages multisig by
///

View file

@ -91,14 +91,14 @@ pub struct Contact {
pub i2p_address: String,
pub is_vendor: bool,
pub xmr_address: String,
pub gpg_key: Vec<u8>,
pub nmpk: String,
}
impl Default for Contact {
fn default() -> Self {
Contact {
cid: utils::empty_string(),
gpg_key: Vec::new(),
nmpk: utils::empty_string(),
i2p_address: utils::empty_string(),
is_vendor: false,
xmr_address: utils::empty_string(),
@ -108,16 +108,15 @@ impl Default for Contact {
impl Contact {
pub fn to_db(c: &Contact) -> String {
let gpg = hex::encode(&c.gpg_key);
format!(
"{}!{}!{}!{}",
gpg, c.i2p_address, c.is_vendor, c.xmr_address
c.nmpk, c.i2p_address, c.is_vendor, c.xmr_address
)
}
pub fn from_db(k: String, v: String) -> Contact {
let values = v.split("!");
let mut v: Vec<String> = values.map(|s| String::from(s)).collect();
let gpg_key = hex::decode(v.remove(0)).unwrap_or(Vec::new());
let nmpk = v.remove(0);
let i2p_address = v.remove(0);
let is_vendor = match v.remove(0).parse::<bool>() {
Ok(n) => n,
@ -126,7 +125,7 @@ impl Contact {
let xmr_address = v.remove(0);
Contact {
cid: k,
gpg_key,
nmpk,
i2p_address,
is_vendor,
xmr_address,
@ -139,7 +138,7 @@ impl Contact {
pub struct Message {
pub mid: String,
pub uid: String,
pub body: Vec<u8>,
pub body: String,
pub created: i64,
pub from: String,
pub to: String,
@ -150,7 +149,7 @@ impl Default for Message {
Message {
mid: utils::empty_string(),
uid: utils::empty_string(),
body: Vec::new(),
body: utils::empty_string(),
created: 0,
from: utils::empty_string(),
to: utils::empty_string(),
@ -160,14 +159,13 @@ impl Default for Message {
impl Message {
pub fn to_db(m: &Message) -> String {
let body = hex::encode(&m.body);
format!("{}:{}:{}:{}:{}", m.uid, body, m.created, m.from, m.to)
format!("{}:{}:{}:{}:{}", m.uid, m.body, m.created, m.from, m.to)
}
pub fn from_db(k: String, v: String) -> Message {
let values = v.split(":");
let mut v: Vec<String> = values.map(|s| String::from(s)).collect();
let uid = v.remove(0);
let body = hex::decode(v.remove(0)).unwrap_or(Vec::new());
let body = v.remove(0);
let created_str = v.remove(0);
let created = match created_str.parse::<i64>() {
Ok(n) => n,
@ -325,8 +323,8 @@ pub struct Order {
pub adjudicator_kex_3: String,
pub adjudicator_msig_make: String,
pub adjudicator_msig_prepare: String,
/// Address gpg key encrypted bytes
pub ship_address: Vec<u8>,
/// Address enciphered by nmpk
pub ship_address: String,
pub ship_date: i64,
/// This is the final destination for the payment
pub subaddress: String,
@ -362,7 +360,7 @@ impl Default for Order {
adjudicator_kex_3: utils::empty_string(),
adjudicator_msig_make: utils::empty_string(),
adjudicator_msig_prepare: utils::empty_string(),
ship_address: Vec::new(),
ship_address: utils::empty_string(),
ship_date: 0,
subaddress: utils::empty_string(),
status: utils::empty_string(),
@ -379,7 +377,6 @@ impl Default for Order {
impl Order {
pub fn to_db(o: &Order) -> String {
let ship_address = hex::encode(&o.ship_address);
format!(
"{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}:{}",
o.cid,
@ -398,7 +395,7 @@ impl Order {
o.adjudicator_kex_1,
o.adjudicator_kex_2,
o.adjudicator_kex_3,
ship_address,
o.ship_address,
o.ship_date,
o.subaddress,
o.status,
@ -438,7 +435,7 @@ impl Order {
let adjudicator_kex_1 = v.remove(0);
let adjudicator_kex_2 = v.remove(0);
let adjudicator_kex_3 = v.remove(0);
let ship_address = hex::decode(v.remove(0)).unwrap_or(Vec::new());
let ship_address = v.remove(0);
let ship_date = match v.remove(0).parse::<i64>() {
Ok(d) => d,
Err(_) => 0,
@ -507,7 +504,7 @@ impl Order {
adjudicator_kex_3: String::from(&o.adjudicator_kex_3),
adjudicator_msig_make: String::from(&o.adjudicator_msig_make),
adjudicator_msig_prepare: String::from(&o.adjudicator_msig_prepare),
ship_address: o.ship_address.iter().cloned().collect(),
ship_address: String::from(&o.ship_address),
ship_date: o.ship_date,
subaddress: String::from(&o.subaddress),
status: String::from(&o.status),

View file

@ -78,7 +78,7 @@ fn hash_to_scalar(s: Vec<&str>) -> Scalar {
/// Multiply the NMSK by the ed25519 basepoint to create the
///
/// Neveko Message Public Key.
async fn generate_neveko_message_keys() -> NevekoMessageKeys {
pub async fn generate_neveko_message_keys() -> NevekoMessageKeys {
log::info!("generating neveko message keys");
let password = std::env::var(crate::MONERO_WALLET_PASSWORD).unwrap_or(utils::empty_string());
let filename = String::from(crate::APP_NAME);
@ -109,9 +109,9 @@ async fn generate_neveko_message_keys() -> NevekoMessageKeys {
///
/// `m = "some message to encipher"`
///
/// Return `x = m + h` as a string of the enciphered message
/// Return `x = m + h` as a string of the enciphered message.
///
/// encipher `true` will encipher otherwise decipher
/// Pass `None` to encipher to perform deciphering.
pub async fn cipher(hex_nmpk: &String, message: String, encipher: Option<String>) -> String {
let unwrap_encipher: String = encipher.unwrap_or(utils::empty_string());
let keys: NevekoMessageKeys = generate_neveko_message_keys().await;
@ -192,7 +192,7 @@ mod tests {
#[test]
pub fn encipher_decipher() {
let message = String::from(
"This is message that will be encrypted by the network.
"This is message that will be enciphered by the network.
it is really long for testing and breaking stuff",
);
let do_encipher = Some(String::from(ENCIPHER));

View file

@ -3,10 +3,10 @@ use std::error::Error;
use crate::{
contact,
db,
gpg,
i2p,
models::*,
monero,
neveko25519,
order,
product,
reqres,
@ -56,7 +56,7 @@ pub async fn create(j_order: Json<reqres::OrderRequest>) -> Order {
cid: String::from(&j_order.cid),
pid: String::from(&j_order.pid),
date: ts,
ship_address: j_order.ship_address.iter().cloned().collect(),
ship_address: String::from(&j_order.ship_address),
subaddress,
status: StatusType::MultisigMissing.value(),
quantity: j_order.quantity,
@ -325,6 +325,8 @@ pub async fn cancel_order(orid: &String, signature: &String) -> Order {
pub async fn validate_order_for_ship(orid: &String) -> reqres::FinalizeOrderResponse {
info!("validating order for shipment");
let m_order: Order = find(orid);
let contact: Contact = contact::find(&m_order.cid);
let hex_nmpk: String = contact.nmpk;
let s = db::Interface::async_open().await;
let k = String::from(crate::DELIVERY_INFO_DB_KEY);
let delivery_info: String = db::Interface::async_read(&s.env, &s.handle, &k).await;
@ -344,9 +346,15 @@ pub async fn validate_order_for_ship(orid: &String) -> reqres::FinalizeOrderResp
j_order.status = StatusType::Shipped.value();
order::modify(Json(j_order));
}
let e_delivery_info: String = neveko25519::cipher(
&hex_nmpk,
hex::encode(delivery_info),
Some(String::from(neveko25519::ENCIPHER)),
)
.await;
reqres::FinalizeOrderResponse {
orid: String::from(orid),
delivery_info: hex::decode(delivery_info).unwrap_or(Vec::new()),
delivery_info: e_delivery_info,
vendor_update_success: false,
}
}
@ -386,8 +394,8 @@ pub async fn trigger_nasr(
}
}
/// Write encrypted delivery info to lmdb. Once the customer releases the signed
/// txset
/// Write enciphered delivery info to lmdb. Once the customer releases the
/// signed txset
///
/// This will also attempt to notify the customer to trigger the NASR (neveko
/// auto-ship request).
@ -396,14 +404,20 @@ pub async fn trigger_nasr(
/// etc.)
pub async fn upload_delivery_info(
orid: &String,
delivery_info: &Vec<u8>,
delivery_info: &String,
) -> reqres::FinalizeOrderResponse {
info!("uploading delivery info");
let lookup: Order = order::find(orid);
let e_delivery_info: Vec<u8> =
gpg::encrypt(String::from(&lookup.cid), &delivery_info).unwrap_or(Vec::new());
let contact: Contact = contact::find(&lookup.cid);
let hex_nmpk: String = contact.nmpk;
let e_delivery_info: String = neveko25519::cipher(
&hex_nmpk,
hex::encode(delivery_info),
Some(String::from(neveko25519::ENCIPHER)),
)
.await;
if e_delivery_info.is_empty() {
error!("unable to encrypt delivery info");
error!("unable to encipher delivery info");
}
// get draft payment txset
let wallet_password = utils::empty_string();
@ -421,7 +435,7 @@ pub async fn upload_delivery_info(
m_order.status = StatusType::Shipped.value();
m_order.ship_date = chrono::offset::Utc::now().timestamp();
m_order.vend_msig_txset = sweep.result.multisig_txset;
// delivery info will be stored encrypted and separate from the rest of the
// delivery info will be stored enciphered and separate from the rest of the
// order
let s = db::Interface::async_open().await;
let k = String::from(crate::DELIVERY_INFO_DB_KEY);
@ -439,7 +453,7 @@ pub async fn upload_delivery_info(
return Default::default();
}
reqres::FinalizeOrderResponse {
delivery_info: delivery_info.to_vec(),
delivery_info: e_delivery_info,
orid: String::from(orid),
vendor_update_success: false,
}

View file

@ -1204,17 +1204,17 @@ impl Default for XmrRpcQueryKeyResponse {
}
// END XMR Structs
/// Container for the message decryption
/// Container for the message decipher
#[derive(Serialize, Deserialize)]
#[serde(crate = "rocket::serde")]
pub struct DecryptedMessageBody {
pub struct DecipheredMessageBody {
pub mid: String,
pub body: String,
}
impl Default for DecryptedMessageBody {
impl Default for DecipheredMessageBody {
fn default() -> Self {
DecryptedMessageBody {
DecipheredMessageBody {
mid: utils::empty_string(),
body: utils::empty_string(),
}
@ -1279,7 +1279,7 @@ pub struct OrderRequest {
pub cid: String,
pub adjudicator: String,
pub pid: String,
pub ship_address: Vec<u8>,
pub ship_address: String,
pub quantity: u128,
}
@ -1289,7 +1289,7 @@ impl Default for OrderRequest {
cid: utils::empty_string(),
adjudicator: utils::empty_string(),
pid: utils::empty_string(),
ship_address: Vec::new(),
ship_address: utils::empty_string(),
quantity: 0,
}
}
@ -1346,8 +1346,8 @@ impl Default for SignAndSubmitRequest {
#[serde(crate = "rocket::serde")]
pub struct FinalizeOrderResponse {
pub orid: String,
/// This is encrypted by the customer NEVEKO gpg key
pub delivery_info: Vec<u8>,
/// This is enciphered by the customer Neveko Message Secret Key
pub delivery_info: String,
/// This is used to finalize delivery confirmations
pub vendor_update_success: bool,
}
@ -1356,7 +1356,7 @@ impl Default for FinalizeOrderResponse {
fn default() -> Self {
FinalizeOrderResponse {
orid: utils::empty_string(),
delivery_info: Vec::new(),
delivery_info: utils::empty_string(),
vendor_update_success: false,
}
}

View file

@ -3,7 +3,6 @@ use crate::{
contact,
db,
dispute,
gpg,
i2p,
message,
models,
@ -20,7 +19,6 @@ use log::{
};
use rand_core::RngCore;
use rocket::serde::json::Json;
use std::time::Duration;
extern crate rpassword;
use rpassword::read_password;
use std::io::Write;
@ -41,8 +39,6 @@ pub struct ContactStatus {
pub jwp: String,
/// Alias for contact
pub nick: String,
/// Must sign key for contacts befor messages can be sent
pub signed_key: bool,
/// transaction proof signature of current status check
pub txp: String,
}
@ -56,7 +52,6 @@ impl Default for ContactStatus {
is_vendor: false,
jwp: utils::empty_string(),
nick: String::from("anon"),
signed_key: false,
txp: utils::empty_string(),
}
}
@ -306,7 +301,7 @@ pub fn contact_to_json(c: &models::Contact) -> Json<models::Contact> {
i2p_address: String::from(&c.i2p_address),
is_vendor: c.is_vendor,
xmr_address: String::from(&c.xmr_address),
gpg_key: c.gpg_key.iter().cloned().collect(),
nmpk: String::from(&c.nmpk),
};
Json(r_contact)
}
@ -314,7 +309,7 @@ pub fn contact_to_json(c: &models::Contact) -> Json<models::Contact> {
/// convert message to json so only core module does the work
pub fn message_to_json(m: &models::Message) -> Json<models::Message> {
let r_message: models::Message = models::Message {
body: m.body.iter().cloned().collect(),
body: String::from(&m.body),
mid: String::from(&m.mid),
uid: utils::empty_string(),
created: m.created,
@ -343,7 +338,7 @@ pub fn order_to_json(o: &reqres::OrderRequest) -> Json<reqres::OrderRequest> {
cid: String::from(&o.cid),
adjudicator: String::from(&o.adjudicator),
pid: String::from(&o.pid),
ship_address: o.ship_address.iter().cloned().collect(),
ship_address: String::from(&o.ship_address),
quantity: o.quantity,
};
Json(r_order)
@ -369,8 +364,8 @@ pub const fn string_limit() -> usize {
512
}
pub const fn gpg_key_limit() -> usize {
4096
pub const fn npmk_limit() -> usize {
128
}
pub const fn message_limit() -> usize {
@ -381,20 +376,6 @@ pub const fn image_limit() -> usize {
9999
}
/// Generate application gpg keys at startup if none exist
async fn gen_app_gpg() {
let mut gpg_key = gpg::find_key().unwrap_or(utils::empty_string());
if gpg_key == utils::empty_string() {
info!("no gpg key found for neveko, creating it...");
// wait for key gen
gpg::write_gen_batch().unwrap();
gpg::gen_key();
tokio::time::sleep(Duration::new(9, 0)).await;
gpg_key = gpg::find_key().unwrap_or(utils::empty_string());
}
debug!("gpg key: {}", gpg_key);
}
/// Handles panic! for missing wallet directory
fn create_wallet_dir() {
let file_path = format!(
@ -576,7 +557,6 @@ pub async fn start_up() {
if !args.i2p_advanced {
i2p::start().await;
}
gen_app_gpg().await;
gen_app_wallet(&wallet_password).await;
start_gui();
// start async background tasks here

156
neveko-gui/Cargo.lock generated
View file

@ -388,12 +388,6 @@ dependencies = [
"objc2-encode",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.12.1"
@ -469,16 +463,6 @@ dependencies = [
"nom",
]
[[package]]
name = "cfg-expr"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9"
dependencies = [
"smallvec",
"target-lexicon",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -648,15 +632,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.17.0"
@ -780,16 +755,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -817,12 +782,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "cxx"
version = "1.0.94"
@ -1315,7 +1274,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.5.11",
"toml",
"uncased",
"version_check",
]
@ -1593,47 +1552,6 @@ dependencies = [
"gl_generator",
]
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.142",
"memoffset 0.7.1",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.142",
"libgpg-error-sys",
"system-deps",
"winreg",
]
[[package]]
name = "gpu-alloc"
version = "0.5.3"
@ -2082,17 +2000,6 @@ version = "0.2.142"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -2236,15 +2143,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.8.0"
@ -2455,7 +2353,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -3487,15 +3384,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -3731,25 +3619,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0fe581ad25d11420b873cf9aedaca0419c2b411487b134d4d21065f3d092055"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.7.3",
"version-compare",
]
[[package]]
name = "target-lexicon"
version = "0.12.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5"
[[package]]
name = "tempfile"
version = "3.5.0"
@ -3973,26 +3842,11 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
@ -4001,8 +3855,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
@ -4223,12 +4075,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"

View file

@ -326,7 +326,6 @@ impl eframe::App for AddressBookApp {
ui.label(format!("tx proof: {}", self.status.txp));
ui.label(format!("jwp: {}", self.status.jwp));
ui.label(format!("expiration: {}", self.status.h_exp));
ui.label(format!("signed key: {}", self.status.signed_key));
if self.status.jwp == utils::empty_string()
&& !self.is_pinging
&& status == "online"
@ -344,17 +343,6 @@ impl eframe::App for AddressBookApp {
self.is_approving_jwp = true;
}
}
if !self.status.signed_key {
if ui.button("Sign Key").clicked() {
contact::trust_gpg(self.status.i2p.clone());
utils::write_gui_db(
String::from(crate::GUI_SIGNED_GPG_DB_KEY),
self.status.i2p.clone(),
String::from(crate::SIGNED_GPG_KEY),
);
self.showing_status = false;
}
}
let failed_to_prove = self.status.txp != utils::empty_string()
&& self.status.jwp == utils::empty_string();
if self.status.jwp != utils::empty_string() || failed_to_prove {
@ -418,7 +406,7 @@ impl eframe::App for AddressBookApp {
let i2p_address = self.s_contact.i2p_address.clone();
let is_vendor = self.s_contact.is_vendor;
let xmr_address = self.s_contact.xmr_address.clone();
let gpg_key = self.s_contact.gpg_key.iter().cloned().collect();
let nmpk = self.s_contact.nmpk.clone();
// Contact added confirmation screen
//-----------------------------------------------------------------------------------
@ -455,10 +443,7 @@ impl eframe::App for AddressBookApp {
}
ui.label(format!("i2p: {}", i2p_address));
ui.label(format!("xmr: {}", xmr_address));
ui.label(format!(
"gpg: {}",
String::from_utf8(gpg_key).unwrap_or(utils::empty_string())
));
ui.label(format!("npmk: {}", nmpk));
ui.horizontal(|ui| {
if !is_loading {
if ui.button("Approve").clicked() {
@ -470,7 +455,7 @@ impl eframe::App for AddressBookApp {
i2p_address,
is_vendor,
xmr_address,
gpg_key: self.s_contact.gpg_key.iter().cloned().collect(),
nmpk,
};
send_create_contact_req(
self.contact_add_tx.clone(),
@ -491,13 +476,7 @@ impl eframe::App for AddressBookApp {
if ui.button("Add").clicked() {
// Get the contacts information from the /share API
let contact = self.contact.clone();
let prune = contact::Prune::Full.value();
send_contact_info_req(
self.contact_info_tx.clone(),
ctx.clone(),
contact,
prune,
);
send_contact_info_req(self.contact_info_tx.clone(), ctx.clone(), contact);
add_contact_timeout(self.contact_timeout_tx.clone(), ctx.clone());
self.is_adding = true;
}
@ -592,15 +571,10 @@ impl eframe::App for AddressBookApp {
chrono::NaiveDateTime::from_timestamp_opt(expire, 0)
.unwrap()
.to_string();
// MESSAGES WON'T BE SENT UNTIL KEY IS SIGNED AND TRUSTED!
self.status.signed_key =
check_signed_key(self.status.i2p.clone());
let prune = contact::Prune::Pruned.value();
send_contact_info_req(
self.contact_info_tx.clone(),
ctx.clone(),
self.status.i2p.clone(),
prune,
);
self.showing_status = true;
self.is_pinging = true;
@ -613,7 +587,6 @@ impl eframe::App for AddressBookApp {
Err(_e) => 0,
};
if now < expire
&& self.status.signed_key
&& self.status.jwp != utils::empty_string()
&& c.i2p_address == self.status.i2p
{
@ -632,15 +605,10 @@ impl eframe::App for AddressBookApp {
// Send asyc requests to neveko-core
//------------------------------------------------------------------------------
fn send_contact_info_req(
tx: Sender<models::Contact>,
ctx: egui::Context,
contact: String,
prune: u32,
) {
fn send_contact_info_req(tx: Sender<models::Contact>, ctx: egui::Context, contact: String) {
log::debug!("async send_contact_info_req");
tokio::spawn(async move {
match contact::add_contact_request(contact, prune).await {
match contact::add_contact_request(contact).await {
Ok(contact) => {
let _ = tx.send(contact);
ctx.request_repaint();
@ -825,7 +793,7 @@ fn send_payment_req(
fn send_message_req(tx: Sender<bool>, ctx: egui::Context, body: String, to: String, jwp: String) {
log::debug!("constructing message");
let m: models::Message = models::Message {
body: body.into_bytes(),
body: body,
to,
mid: utils::empty_string(),
uid: utils::empty_string(),
@ -844,11 +812,6 @@ fn send_message_req(tx: Sender<bool>, ctx: egui::Context, body: String, to: Stri
});
}
fn check_signed_key(contact: String) -> bool {
let v = utils::search_gui_db(String::from(crate::GUI_SIGNED_GPG_DB_KEY), contact);
v != utils::empty_string()
}
fn change_nick_req(contact: String, nick: String) {
log::debug!("change nick");
utils::clear_gui_db(String::from(crate::GUI_NICK_DB_KEY), String::from(&contact));

View file

@ -1,28 +1,36 @@
use neveko_core::*;
use neveko_core::{
models::Message,
*,
};
use std::sync::mpsc::{
Receiver,
Sender,
};
pub struct MailBoxApp {
decrypted_message: String,
is_showing_decryption: bool,
deciphered: String,
is_showing_decipher: bool,
messages: Vec<models::Message>,
message_init: bool,
refresh_on_delete_tx: Sender<bool>,
refresh_on_delete_rx: Receiver<bool>,
deciphered_tx: Sender<String>,
deciphered_rx: Receiver<String>,
}
impl Default for MailBoxApp {
fn default() -> Self {
let (refresh_on_delete_tx, refresh_on_delete_rx) = std::sync::mpsc::channel();
let (deciphered_tx, deciphered_rx) = std::sync::mpsc::channel();
MailBoxApp {
decrypted_message: utils::empty_string(),
is_showing_decryption: false,
deciphered: utils::empty_string(),
is_showing_decipher: false,
messages: Vec::new(),
message_init: false,
refresh_on_delete_rx,
refresh_on_delete_tx,
refresh_on_delete_rx,
deciphered_rx,
deciphered_tx,
}
}
}
@ -37,6 +45,10 @@ impl eframe::App for MailBoxApp {
}
}
if let Ok(decipher) = self.deciphered_rx.try_recv() {
self.deciphered = decipher;
}
// initial message load
if !self.message_init {
self.messages = message::find_all();
@ -45,18 +57,18 @@ impl eframe::App for MailBoxApp {
// Compose window
//-----------------------------------------------------------------------------------
let mut is_showing_decryption = self.is_showing_decryption;
egui::Window::new("decrypted message")
.open(&mut is_showing_decryption)
let mut is_showing_decipher = self.is_showing_decipher;
egui::Window::new("decipher message")
.open(&mut is_showing_decipher)
.title_bar(false)
.vscroll(true)
.show(&ctx, |ui| {
ui.heading("Decrypted Message");
ui.label(format!("{}", self.decrypted_message));
ui.heading("Deciphered Message");
ui.label(format!("{}", self.deciphered));
ui.label("\n");
if ui.button("Exit").clicked() {
self.decrypted_message = utils::empty_string();
self.is_showing_decryption = false;
self.deciphered = utils::empty_string();
self.is_showing_decipher = false;
}
});
@ -116,29 +128,19 @@ impl eframe::App for MailBoxApp {
ui.label(format!("{}", m.to));
});
row.col(|ui| {
ui.label(format!(
"{}",
String::from_utf8(m.body.iter().cloned().collect()).unwrap()
));
ui.label(format!("{}", m.body));
});
row.col(|ui| {
ui.style_mut().wrap = Some(false);
ui.horizontal(|ui| {
if m.uid == String::from("rx") {
if ui.button("Decrypt").clicked() {
let mut d = message::decrypt_body(m.mid.clone());
let mut bytes = hex::decode(d.body.into_bytes())
.unwrap_or(Vec::new());
self.decrypted_message = String::from_utf8(bytes)
.unwrap_or(utils::empty_string());
self.is_showing_decryption = true;
d = Default::default();
bytes = Vec::new();
log::debug!(
"cleared decryption bytes: {:?} string: {}",
bytes,
d.body
if ui.button("Decipher").clicked() {
decipher_req(
&m,
self.deciphered_tx.clone(),
ctx.clone(),
);
self.is_showing_decipher = true;
}
}
if ui.button("Delete").clicked() {
@ -160,8 +162,21 @@ impl eframe::App for MailBoxApp {
fn refresh_on_delete_req(tx: Sender<bool>, ctx: egui::Context) {
tokio::spawn(async move {
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
log::error!("refreshing messages....");
log::info!("refreshing messages....");
let _ = tx.send(true);
ctx.request_repaint();
});
}
fn decipher_req(m: &Message, tx: Sender<String>, ctx: egui::Context) {
let from: String = String::from(&m.from);
let body: String = String::from(&m.body);
tokio::spawn(async move {
log::info!("async decipher_req");
let contact = contact::find(&from);
let encipher = Some(String::from(neveko25519::ENCIPHER));
let deciphered = neveko25519::cipher(&contact.nmpk, body, encipher).await;
let _ = tx.send(deciphered);
ctx.request_repaint();
});
}

View file

@ -57,7 +57,7 @@ pub struct MarketApp {
contact_timeout_tx: Sender<bool>,
contact_timeout_rx: Receiver<bool>,
customer_orders: Vec<models::Order>,
decrypted_delivery_info: String,
cipher: String,
find_vendor: String,
get_vendor_products_tx: Sender<Vec<models::Product>>,
get_vendor_products_rx: Receiver<Vec<models::Product>>,
@ -72,7 +72,7 @@ pub struct MarketApp {
is_customer_viewing_orders: bool,
is_managing_multisig: bool,
is_product_image_set: bool,
is_showing_decrypted_delivery_info: bool,
is_showing_deciphered_delivery_info: bool,
is_showing_products: bool,
is_showing_product_image: bool,
is_showing_product_update: bool,
@ -116,6 +116,8 @@ pub struct MarketApp {
submit_txset_rx: Receiver<bool>,
cancel_request_tx: Sender<models::Order>,
cancel_request_rx: Receiver<models::Order>,
ciphered_tx: Sender<String>,
ciphered_rx: Receiver<String>,
dispute_request_tx: Sender<models::Dispute>,
dispute_request_rx: Receiver<models::Dispute>,
// ship_request_tx: Sender<models::Order>,
@ -153,6 +155,7 @@ impl Default for MarketApp {
let (order_funded_tx, order_funded_rx) = std::sync::mpsc::channel();
let (submit_txset_tx, submit_txset_rx) = std::sync::mpsc::channel();
let (upload_dinfo_tx, upload_dinfo_rx) = std::sync::mpsc::channel();
let (ciphered_tx, ciphered_rx) = std::sync::mpsc::channel();
let contents = std::fs::read("./assets/qr.png").unwrap_or(Vec::new());
MarketApp {
contact_info_rx,
@ -160,7 +163,9 @@ impl Default for MarketApp {
contact_timeout_rx,
contact_timeout_tx,
customer_orders: Vec::new(),
decrypted_delivery_info: utils::empty_string(),
cipher: utils::empty_string(),
ciphered_tx,
ciphered_rx,
find_vendor: utils::empty_string(),
get_vendor_products_rx,
get_vendor_products_tx,
@ -175,7 +180,7 @@ impl Default for MarketApp {
is_order_qr_set: false,
is_pinging: false,
is_product_image_set: false,
is_showing_decrypted_delivery_info: false,
is_showing_deciphered_delivery_info: false,
is_showing_orders: false,
is_showing_order_qr: false,
is_showing_products: false,
@ -329,6 +334,10 @@ impl eframe::App for MarketApp {
self.is_loading = false;
}
if let Ok(cipher) = self.ciphered_rx.try_recv() {
self.cipher = cipher;
}
// TODO(c2m): automated trigger for nasr worked successfully
// doesn't seem like this is really needed anymore?
@ -397,7 +406,6 @@ impl eframe::App for MarketApp {
ui.label(format!("tx proof: {}", self.vendor_status.txp));
ui.label(format!("jwp: {}", self.vendor_status.jwp));
ui.label(format!("expiration: {}", self.vendor_status.h_exp));
ui.label(format!("signed key: {}", self.vendor_status.signed_key));
if ui.button("Exit").clicked() {
self.is_showing_vendor_status = false;
}
@ -795,18 +803,18 @@ impl eframe::App for MarketApp {
}
});
let mut is_showing_decryption = self.is_showing_decrypted_delivery_info;
egui::Window::new("decrypted delivery info")
.open(&mut is_showing_decryption)
let mut is_showing_decipher = self.is_showing_deciphered_delivery_info;
egui::Window::new("deciphered delivery info")
.open(&mut is_showing_decipher)
.title_bar(false)
.vscroll(true)
.show(&ctx, |ui| {
ui.heading("Delivery Info");
ui.label(format!("{}", self.decrypted_delivery_info));
ui.label(format!("{}", self.cipher));
ui.label("\n");
if ui.button("Exit").clicked() {
self.decrypted_delivery_info = utils::empty_string();
self.is_showing_decrypted_delivery_info = false;
self.cipher = utils::empty_string();
self.is_showing_deciphered_delivery_info = false;
}
});
@ -890,14 +898,14 @@ impl eframe::App for MarketApp {
String::from(neveko_core::DELIVERY_INFO_DB_KEY),
String::from(&o.orid),
);
let bytes =
hex::decode(e_info.into_bytes()).unwrap_or(Vec::new());
let d_bytes = gpg::decrypt(&String::from(&o.orid), &bytes);
let dinfo: String =
String::from_utf8(d_bytes.unwrap_or(Vec::new()))
.unwrap_or(utils::empty_string());
self.decrypted_delivery_info = dinfo;
self.is_showing_decrypted_delivery_info = true;
cipher_req(
String::from(&o.cid),
e_info,
None,
self.ciphered_tx.clone(),
ctx.clone(),
);
self.is_showing_deciphered_delivery_info = true;
}
});
row.col(|ui| {
@ -990,14 +998,19 @@ impl eframe::App for MarketApp {
}
if qty <= p_qty && qty > 0 {
if ui.button("Submit Order").clicked() {
let address_bytes = self.new_order_shipping_address.clone().into_bytes();
let encrypted_shipping_address =
gpg::encrypt(self.vendor_status.i2p.clone(), &address_bytes);
// encipher the shipping address
cipher_req(
self.new_order.cid.clone(),
self.new_order_shipping_address.clone(),
Some(String::from(neveko25519::ENCIPHER)),
self.ciphered_tx.clone(),
ctx.clone(),
);
let new_order = reqres::OrderRequest {
cid: String::from(&self.new_order.cid),
adjudicator: String::from(&adjudicator),
pid: String::from(&self.new_order.pid),
ship_address: encrypted_shipping_address.unwrap_or(Vec::new()),
ship_address: self.cipher.clone(),
quantity: qty,
..Default::default()
};
@ -1050,7 +1063,7 @@ impl eframe::App for MarketApp {
// upload delivery info
let dinfo_str = String::from(&self.upload_dinfo_str);
upload_dinfo_req(
dinfo_str.into_bytes().iter().cloned().collect(),
dinfo_str,
self.new_order.orid.clone(),
ctx.clone(),
self.upload_dinfo_tx.clone(),
@ -1165,15 +1178,10 @@ impl eframe::App for MarketApp {
)
.unwrap()
.to_string();
// MESSAGES WON'T BE SENT UNTIL KEY IS SIGNED AND
// TRUSTED!
self.vendor_status.signed_key =
check_signed_key(self.vendor_status.i2p.clone());
send_contact_info_req(
self.contact_info_tx.clone(),
ctx.clone(),
self.vendor_status.i2p.clone(),
contact::Prune::Pruned.value(),
);
vendor_status_timeout(
self.contact_timeout_tx.clone(),
@ -1190,7 +1198,6 @@ impl eframe::App for MarketApp {
Err(_e) => 0,
};
if now < expire
&& self.vendor_status.signed_key
&& self.vendor_status.jwp != utils::empty_string()
&& v.i2p_address == self.vendor_status.i2p
&& self.vendor_status.is_vendor
@ -1247,7 +1254,6 @@ impl eframe::App for MarketApp {
ui.label(format!("tx proof: {}", self.vendor_status.txp));
ui.label(format!("jwp: {}", self.vendor_status.jwp));
ui.label(format!("expiration: {}", self.vendor_status.h_exp));
ui.label(format!("signed key: {}", self.vendor_status.signed_key));
if ui.button("Exit").clicked() {
self.is_showing_vendor_status = false;
}
@ -1724,15 +1730,10 @@ fn _refresh_on_delete_product_req(_tx: Sender<bool>, _ctx: egui::Context) {
});
}
fn send_contact_info_req(
tx: Sender<models::Contact>,
ctx: egui::Context,
contact: String,
prune: u32,
) {
fn send_contact_info_req(tx: Sender<models::Contact>, ctx: egui::Context, contact: String) {
log::debug!("async send_contact_info_req");
tokio::spawn(async move {
match contact::add_contact_request(contact, prune).await {
match contact::add_contact_request(contact).await {
Ok(contact) => {
let _ = tx.send(contact);
ctx.request_repaint();
@ -1742,11 +1743,6 @@ fn send_contact_info_req(
});
}
fn check_signed_key(contact: String) -> bool {
let v = utils::search_gui_db(String::from(crate::GUI_SIGNED_GPG_DB_KEY), contact);
v != utils::empty_string()
}
fn send_products_from_vendor_req(
tx: Sender<Vec<models::Product>>,
ctx: egui::Context,
@ -2455,7 +2451,7 @@ fn release_txset(contact: String, orid: String, ctx: egui::Context, tx: Sender<b
});
}
fn upload_dinfo_req(dinfo: Vec<u8>, orid: String, ctx: egui::Context, tx: Sender<bool>) {
fn upload_dinfo_req(dinfo: String, orid: String, ctx: egui::Context, tx: Sender<bool>) {
tokio::spawn(async move {
log::info!("async upload_dinfo_req");
let dinfo = order::upload_delivery_info(&orid, &dinfo).await;
@ -2513,3 +2509,13 @@ fn create_dispute_req(
}
});
}
fn cipher_req(cid: String, m: String, e: Option<String>, tx: Sender<String>, ctx: egui::Context) {
tokio::spawn(async move {
log::info!("async decipher_req");
let contact = contact::find(&cid);
let ciphered = neveko25519::cipher(&contact.nmpk, m, e).await;
let _ = tx.send(ciphered);
ctx.request_repaint();
});
}

View file

@ -14,7 +14,6 @@ pub const GUI_NICK_DB_KEY: &str = "gui-nick";
pub const GUI_OVL_DB_KEY: &str = "gui-ovl";
pub const GUI_TX_SIGNATURE_DB_KEY: &str = "gui-txp-sig";
pub const GUI_TX_HASH_DB_KEY: &str = "gui-txp-hash";
pub const GUI_SIGNED_GPG_DB_KEY: &str = "gui-signed-key";
pub const GUI_TX_SUBADDRESS_DB_KEY: &str = "gui-txp-subaddress";
pub const GUI_MSIG_KEX_ONE_DB_KEY: &str = "gui-kex-1";
@ -27,9 +26,6 @@ pub const GUI_MSIG_PREPARE_DB_KEY: &str = "gui-prepare";
pub const GUI_MSIG_TXSET_DB_KEY: &str = "gui-txset";
// End LMDB keys
/// Designate a contact as verified and trusted
pub const SIGNED_GPG_KEY: &str = "1";
/// key for fetching the login credential hash
pub const CREDENTIAL_KEY: &str = "NEVEKO_GUI_KEY";
/// TODO(c2m): configurable lock screen timeout

188
neveko-market/Cargo.lock generated
View file

@ -167,12 +167,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -191,16 +185,6 @@ version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-expr"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9"
dependencies = [
"smallvec",
"target-lexicon",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -279,15 +263,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.16.2"
@ -342,16 +317,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "ctr"
version = "0.9.2"
@ -388,12 +353,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "cxx"
version = "1.0.89"
@ -589,7 +548,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.5.11",
"toml",
"uncased",
"version_check",
]
@ -745,47 +704,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.153",
"memoffset",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.153",
"libgpg-error-sys",
"system-deps",
"winreg",
]
[[package]]
name = "h2"
version = "0.3.15"
@ -1093,17 +1011,6 @@ version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -1210,15 +1117,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.16"
@ -1284,7 +1182,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -1983,15 +1880,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -2095,12 +1983,6 @@ dependencies = [
"loom",
]
[[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.10.0"
@ -2135,25 +2017,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5fa6fb9ee296c0dc2df41a656ca7948546d061958115ddb0bcaae43ad0d17d2"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.7.4",
"version-compare",
]
[[package]]
name = "target-lexicon"
version = "0.12.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5"
[[package]]
name = "tempfile"
version = "3.3.0"
@ -2322,40 +2185,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -2521,12 +2350,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@ -2786,15 +2609,6 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "winnow"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"

View file

@ -162,12 +162,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "build-rs"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00b8763668c99f8d9101b8a0dd82106f58265464531a79b2cef0d9a30c17dd2"
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -186,15 +180,6 @@ version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-expr"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a35b255461940a32985c627ce82900867c61db1659764d3675ea81963f72a4c6"
dependencies = [
"smallvec",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -283,15 +268,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
dependencies = [
"custom_derive",
]
[[package]]
name = "cookie"
version = "0.17.0"
@ -338,16 +314,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "cstr-argument"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bd9c8e659a473bce955ae5c35b116af38af11a7acb0b480e01f3ed348aeb40"
dependencies = [
"cfg-if",
"memchr",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -375,12 +341,6 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
[[package]]
name = "cxx"
version = "1.0.94"
@ -576,7 +536,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.5.11",
"toml",
"uncased",
"version_check",
]
@ -722,47 +682,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gpg-error"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89aaeddbfb92313378c58e98abadaaa34082b3855f1d455576eeeda08bd592c"
dependencies = [
"libgpg-error-sys",
]
[[package]]
name = "gpgme"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57539732fbe58eacdb984734b72b470ed0bca3ab7a49813271878567025ac44f"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"conv",
"cstr-argument",
"gpg-error",
"gpgme-sys",
"libc 0.2.140",
"memoffset",
"once_cell",
"smallvec",
"static_assertions",
]
[[package]]
name = "gpgme-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509223d659c06e4a26229437d6ac917723f02d31917c86c6ecd50e8369741cf7"
dependencies = [
"build-rs",
"libc 0.2.140",
"libgpg-error-sys",
"system-deps",
"winreg",
]
[[package]]
name = "h2"
version = "0.3.16"
@ -1044,17 +963,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libgpg-error-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c97079310f39c835d3bd73578379d040f779614bb331c7ffbb6630fee6420290"
dependencies = [
"build-rs",
"system-deps",
"winreg",
]
[[package]]
name = "liblmdb-sys"
version = "0.2.2"
@ -1161,15 +1069,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.17"
@ -1235,7 +1134,6 @@ dependencies = [
"curve25519-dalek",
"diqwest",
"env_logger",
"gpgme",
"hex",
"hmac",
"jwt",
@ -1891,15 +1789,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -2003,12 +1892,6 @@ dependencies = [
"loom",
]
[[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.10.0"
@ -2043,19 +1926,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555fc8147af6256f3931a36bb83ad0023240ce9cf2b319dec8236fd1f220b05f"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml 0.7.3",
"version-compare",
]
[[package]]
name = "tempfile"
version = "3.5.0"
@ -2223,40 +2093,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -2418,12 +2254,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@ -2715,15 +2545,6 @@ version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6e62c256dc6d40b8c8707df17df8d774e60e39db723675241e7c15e910bce7"
[[package]]
name = "winnow"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"

View file

@ -39,12 +39,12 @@ pub async fn get_messages(_token: auth::BearerToken) -> Custom<Json<Vec<Message>
Custom(Status::Ok, Json(messages))
}
/// decrypt a message body
/// decipher a message body
#[get("/<mid>")]
pub async fn decrypt(
pub async fn decipher(
mid: String,
_token: auth::BearerToken,
) -> Custom<Json<reqres::DecryptedMessageBody>> {
let d_message = message::decrypt_body(mid);
) -> Custom<Json<reqres::DecipheredMessageBody>> {
let d_message = message::decipher_body(mid).await;
Custom(Status::Ok, Json(d_message))
}

View file

@ -15,7 +15,7 @@ async fn rocket() -> _ {
env_logger::init();
log::info!("neveko-message is online");
rocket::custom(&config)
.mount("/message/decrypt", routes![controller::decrypt])
.mount("/message/decipher", routes![controller::decipher])
.mount("/messages", routes![controller::get_messages])
.mount("/tx", routes![controller::send_message])
}

View file

@ -41,21 +41,10 @@ pub async fn get_i2p_status() -> Custom<Json<i2p::HttpProxyStatus>> {
/// Share your contact information.
///
/// 0 - returns full info with gpg key
///
/// 1 - return pruned info without gpg key
///
/// Protected: false
#[get("/<pruned>")]
pub async fn share_contact_info(pruned: u32) -> Custom<Json<models::Contact>> {
#[get("/")]
pub async fn share_contact_info() -> Custom<Json<models::Contact>> {
let info: models::Contact = contact::share().await;
if pruned == contact::Prune::Pruned.value() {
let p_info: models::Contact = models::Contact {
gpg_key: Vec::new(),
..info
};
return Custom(Status::Ok, Json(p_info));
}
Custom(Status::Ok, Json(info))
}