Compare commits

..

80 Commits

Author SHA1 Message Date
aniampio 5b66701c5d Optimize the identification function 2023-10-17 14:13:23 +01:00
aniampio 3a8b99db10 Add byte calculation for divisible ecash 2023-08-07 21:19:25 +01:00
aniampio 6e7cf42831 Add Wallet, Partial Wallet and Payment to and from bytes converstion 2023-08-07 11:47:38 +01:00
aniampio 0e42f977ee Increase benchmark duration 2023-01-09 14:11:49 +00:00
aniampio ef379cdeb3 Update in divisible ecash benchmark 2022-09-27 13:13:01 +01:00
aniampio 4886312e43 Benchmarks: change the number of public keys 2022-08-31 12:51:04 +03:00
aniampio 3a152366d2 Update benchmarks 2022-08-31 12:39:41 +03:00
aniampio d920bcb2f4 Update compact benchmarks 2022-08-31 11:55:15 +03:00
aniampio 268a1817ab Remove spend verification from the identify function 2022-08-10 18:57:00 +01:00
aniampio f5c493500f Update benchmarks 2022-08-03 19:58:50 +01:00
aniampio 7533f304ff Update benchmarks 2022-08-03 18:58:52 +01:00
aniampio 755d4f2388 Cleaning warnings 2022-08-03 16:03:07 +01:00
aniampio 6884395daa Update for compact e-cash - remove requirement for security tag 2022-08-03 15:46:15 +01:00
aniampio 5299b94f9e Add pairing and exponent benchmarks 2022-07-22 17:11:05 +01:00
aniampio f701787802 Update benchmarks 2022-07-20 14:19:23 +01:00
aniampio 0b58e0ae24 Small updates and code cleaning 2022-07-20 12:19:19 +01:00
aniampio 03226d1487 Add verification of the payments inside identify; speed up the identify checks 2022-07-19 13:18:42 +01:00
aniampio 534f8c6b99 Update the spend function for compact ecash - multi spend 2022-07-15 01:45:58 +01:00
aniampio e544a6d2fa Add all cases for identification 2022-07-15 00:34:27 +01:00
aniampio d696535da5 Add duplicate payinfo check for identify 2022-07-14 23:33:15 +01:00
aniampio 7e444b7c42 Update spend function in the compact ecash 2022-07-14 21:12:26 +01:00
aniampio 0d377d98a7 Remove unused constant 2022-07-06 00:08:42 +01:00
aniampio 5bdbee6dae Fix in the identify function 2022-06-30 18:14:59 +01:00
aniampio 014374e33e Add tests to indetify protocol 2022-06-28 15:35:07 +01:00
aniampio 9adb4fbbbc Add test for identification - case of no double spending 2022-06-23 16:56:59 +01:00
aniampio 5293766856 Add aggregation and e2e test 2022-06-23 14:49:01 +01:00
aniampio a40bb3ae4f Fix the eq 15 for the spend proof 2022-06-09 13:08:21 +01:00
aniampio 226c37cfea Update the verification function for structure preserving signature 2022-06-07 22:17:12 +01:00
aniampio ea8f36dfd2 Add draft of signature verification function 2022-05-26 13:19:41 +01:00
aniampio b466cb6b3d Move the index for signature retrival 2022-05-26 13:12:05 +01:00
aniampio bb0328137a 3 out of 4 pairing tests in the zk proof pass 2022-05-26 13:06:44 +01:00
aniampio e07974ad2b Updates for the assertion and pow function 2022-05-25 17:06:32 +01:00
aniampio e8bb96b7d0 Add assertion check 2022-05-25 14:57:44 +01:00
aniampio 9bd06dbfcc Fix signatures tau_l 2022-05-25 00:28:52 +01:00
aniampio 055b10f7f2 Shifting indices in setup - eq 4 test still passing 2022-05-24 23:53:58 +01:00
aniampio 44ca339ee5 Add eq checks 2022-05-24 23:31:40 +01:00
aniampio b6a43787b3 Add bilinear equations into the zk proof; the last eq passes the tests 2022-05-24 21:16:43 +01:00
aniampio 9cb22d9bde Define spend instance and witness structs 2022-05-12 20:57:16 +01:00
aniampio 68485f8998 Add spend and spend verification functions; fix breaking test for proof of withdrawal 2022-05-10 13:21:53 +01:00
aniampio 9c22c082c0 Draft of the spend function 2022-05-02 17:28:08 +01:00
aniampio 28d7400304 Add issuance and issuance verification - but one of the tests is failing 2022-04-28 13:05:54 +01:00
aniampio 056d189e0e Add key generation functions 2022-04-25 17:12:09 +03:00
aniampio b76eab2363 Update the structure preserving signature to work in the setup function as well 2022-04-25 15:39:10 +03:00
aniampio b8a2ac5719 Rename the package 2022-04-20 13:45:51 +03:00
aniampio c861e40047 Run cargo fmt 2022-04-20 09:58:46 +03:00
aniampio 20426d001e Add explanaition of the benchmark flag 2022-04-20 09:56:28 +03:00
aniampio 2eed9fd247 Add benchmarks 2022-04-19 22:46:58 +03:00
aniampio a1887356dc Run cargo fmt 2022-04-19 19:33:08 +03:00
aniampio ef2420f847 Code cleaning, part 2 2022-04-19 19:32:50 +03:00
aniampio 6f26475055 Code cleaning 2022-04-19 19:11:23 +03:00
aniampio b9bf6e4521 Run cargo fmt 2022-04-19 18:31:50 +03:00
aniampio 7e392ff6c3 Rename capital letter variables 2022-04-19 18:31:21 +03:00
aniampio 9e834ebaef Run cargo fmt 2022-04-19 16:56:27 +03:00
aniampio f96a4ffed3 Update get range proof signature function to return an error 2022-04-19 16:55:57 +03:00
aniampio 8e9c0d2b0d Add into the zk proof the proof that l is within the range 2022-04-19 16:35:16 +03:00
aniampio 33c356b3ec Work in progress: structure preserving signature scheme 2022-04-04 15:24:16 +01:00
aniampio c902e8eaa5 Add divisible ecash crate to the main Cargo 2022-04-01 16:24:56 +01:00
aniampio 1dc8b5894f Add struct for the divisible ecash crate 2022-04-01 16:22:25 +01:00
aniampio ad285af0fa Add test for succesfull identification 2022-04-01 12:45:57 +01:00
aniampio 6621e5c72f Run cargo fmt 2022-04-01 10:57:51 +01:00
aniampio 969a93cf80 Fix the issue with two gamma equations 2022-04-01 10:55:26 +01:00
aniampio f52ee0431c Commit cause need to change branch 2022-03-30 10:08:27 +01:00
aniampio a41cfd47a4 Add S and T into the zk proof for spend 2022-03-28 19:00:42 +01:00
aniampio 0b098687e1 Remove the spend file 2022-03-28 17:47:17 +01:00
aniampio 09709dd8e4 Move signature related structs and functions to utils 2022-03-28 17:45:39 +01:00
aniampio ef0867a7e7 Move spend and spec vfy as functions associated with wallet and payment 2022-03-28 17:36:40 +01:00
aniampio bfa7754ea6 Add identify function 2022-03-28 15:46:03 +01:00
aniampio a4377bf1a6 Add spendVfy function 2022-03-28 13:26:29 +01:00
aniampio 9e30f9a346 Add verification for the spend zkproof and first tests 2022-03-27 14:42:40 +01:00
aniampio 7878895651 Start the spend function and zkproof for spend 2022-03-25 13:25:33 +00:00
aniampio fcc940a4d6 Add new aggregation function and struct for the aggregated wallet 2022-03-24 20:14:10 +00:00
aniampio 036092bb9c Add aggregation into e2e tests 2022-03-23 18:30:19 +00:00
aniampio dcde42c45d Copy and adjust aggregation of verification keys from coconut 2022-03-23 17:34:39 +00:00
aniampio 5b5bbc2a3d Fix bug in the issuance verification 2022-03-23 16:43:59 +00:00
aniampio 0c1cdc4b63 Code cleaning 2022-03-23 16:32:08 +00:00
aniampio 953c1eddd9 Fix a bug in the commitment computation 2022-03-23 15:50:30 +00:00
aniampio 6ae0913aa1 Copy polynomial and ttpcode from Coconut; add first test; add keypair structures 2022-03-22 18:14:13 +00:00
aniampio 92834ff9b8 Add zk proof for withdrawal request 2022-03-22 17:27:01 +00:00
aniampio bfba92de97 Add initial functions 2022-03-21 18:09:05 +00:00
aniampio d37b63f788 Add template for the compact ecash crate 2022-03-21 09:01:12 +00:00
502 changed files with 75945 additions and 32987 deletions
Vendored
BIN
View File
Binary file not shown.
-43
View File
@@ -1,43 +0,0 @@
name: Publish Nym binaries
on:
release:
types: [created]
jobs:
publish-nym:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Check the release tag starts with `nym-binaries-`
if: startsWith(github.ref, 'refs/tags/nym-binaries-') == false
uses: actions/github-script@v3
with:
script: |
core.setFailed('Release tag did not start with nym-binaries-...')
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build all binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --release
- name: Upload to release based on tag name
uses: softprops/action-gh-release@v1
with:
files: |
target/release/nym-client
target/release/nym-gateway
target/release/nym-mixnode
target/release/nym-socks5-client
target/release/nym-validator-api
@@ -1,71 +0,0 @@
name: Publish Nym Wallet (Windows 10)
on:
release:
types: [created]
defaults:
run:
working-directory: nym-wallet
jobs:
publish-tauri:
strategy:
fail-fast: false
matrix:
platform: [windows10]
runs-on: ${{ matrix.platform }}
steps:
- name: Clean up first
continue-on-error: true
working-directory: .
run: |
cd ..
del /s /q /A:H nym
rmdir /s /q nym
- uses: actions/checkout@v3
- name: Check the release tag starts with `nym-wallet-`
if: startsWith(github.ref, 'refs/tags/nym-wallet-') == false
uses: actions/github-script@v3
with:
script: |
core.setFailed('Release tag did not start with nym-wallet-...')
- name: Import signing certificate
env:
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE
certutil -decode certificate/tempCert.txt certificate/certificate.pfx
Remove-Item -path certificate -include tempCert.txt
Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText)
- name: Node v16
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install app dependencies
run: yarn
- name: Build and sign it
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: yarn build
- name: Upload to release based on tag name
uses: softprops/action-gh-release@v1
with:
files: nym-wallet/target/release/bundle/msi/*.msi
Generated
+114 -33
View File
@@ -373,11 +373,24 @@ dependencies = [
"digest 0.9.0",
"ff 0.10.1",
"group 0.10.0",
"pairing",
"pairing 0.20.0",
"rand_core 0.6.3",
"subtle 2.4.1",
]
[[package]]
name = "bls12_381"
version = "0.6.0"
dependencies = [
"digest 0.9.0",
"ff 0.11.0",
"group 0.11.0",
"pairing 0.21.0",
"rand_core 0.6.3",
"subtle 2.4.1",
"zeroize",
]
[[package]]
name = "bs58"
version = "0.4.0"
@@ -549,7 +562,7 @@ dependencies = [
[[package]]
name = "client-core"
version = "1.0.0-rc.1"
version = "0.12.0"
dependencies = [
"config",
"crypto",
@@ -750,31 +763,31 @@ dependencies = [
[[package]]
name = "cosmwasm-crypto"
version = "1.0.0-beta7"
version = "1.0.0-beta6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88c2565b1e73a816fb659ef4838fc356143fbd35f43c48a51d2d7d4e5d6679d3"
checksum = "2dddc1443004c6340e55ca66d98e9d2f1a44aadf4ce2bed2c4f29baa8a15e7b7"
dependencies = [
"digest 0.9.0",
"ed25519-zebra",
"k256 0.9.6",
"rand_core 0.6.3",
"rand_core 0.5.1",
"thiserror",
]
[[package]]
name = "cosmwasm-derive"
version = "1.0.0-beta7"
version = "1.0.0-beta6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa89fcdf8dbbe0088e663d0a814aa7368e7ebe8fb045a3a150fb5fdc2ffe3b45"
checksum = "fe4f0f10f165b8bcc558a13cddb498140960544519aa0581532c766dd80b5598"
dependencies = [
"syn",
]
[[package]]
name = "cosmwasm-std"
version = "1.0.0-beta7"
version = "1.0.0-beta6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcb8f99a61d0b9069e1afc80a4ffea87dcc3523edd992080923870b13a677da0"
checksum = "2f0f3145097b692b2d95fa5d2c7c6fdd60f193ccc709857e7e1987a608725300"
dependencies = [
"base64",
"cosmwasm-crypto",
@@ -824,7 +837,7 @@ dependencies = [
name = "credentials"
version = "0.1.0"
dependencies = [
"bls12_381",
"bls12_381 0.5.0",
"coconut-interface",
"crypto",
"network-defaults",
@@ -1058,9 +1071,9 @@ dependencies = [
[[package]]
name = "curve25519-dalek"
version = "3.2.1"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0"
checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
dependencies = [
"byteorder",
"digest 0.9.0",
@@ -1071,9 +1084,20 @@ dependencies = [
[[package]]
name = "cw-storage-plus"
version = "0.13.1"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e8b7f9a758c030d375520df947323c052704f784561fc28dcaab4f988c50a30"
checksum = "7d7ee1963302b0ac2a9d42fe0faec826209c17452bfd36fbfd9d002a88929261"
dependencies = [
"cosmwasm-std",
"schemars",
"serde",
]
[[package]]
name = "cw-storage-plus"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c087ff98fb0475db4c2b5298a5fd12b2848d2854b39d1115d930ee6da24d1eed"
dependencies = [
"cosmwasm-std",
"schemars",
@@ -1311,17 +1335,16 @@ dependencies = [
[[package]]
name = "ed25519-zebra"
version = "3.0.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69"
checksum = "0a128b76af6dd4b427e34a6fd43dc78dbfe73672ec41ff615a2414c1a0ad0409"
dependencies = [
"curve25519-dalek",
"hex",
"rand_core 0.6.3",
"rand_core 0.5.1",
"serde",
"sha2",
"thiserror",
"zeroize",
]
[[package]]
@@ -1460,7 +1483,7 @@ dependencies = [
[[package]]
name = "explorer-api"
version = "1.0.0-rc.1"
version = "0.1.0"
dependencies = [
"chrono",
"humantime-serde",
@@ -1967,6 +1990,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89"
dependencies = [
"byteorder",
"ff 0.11.0",
"rand_core 0.6.3",
"subtle 2.4.1",
@@ -2892,7 +2916,7 @@ dependencies = [
[[package]]
name = "nym-client"
version = "1.0.0-rc.1"
version = "0.12.1"
dependencies = [
"clap 2.34.0",
"client-core",
@@ -2926,7 +2950,7 @@ dependencies = [
[[package]]
name = "nym-gateway"
version = "1.0.0-rc.1"
version = "0.12.1"
dependencies = [
"anyhow",
"async-trait",
@@ -2972,7 +2996,7 @@ dependencies = [
[[package]]
name = "nym-mixnode"
version = "1.0.0-rc.1"
version = "0.12.1"
dependencies = [
"anyhow",
"bs58",
@@ -3010,7 +3034,7 @@ dependencies = [
[[package]]
name = "nym-network-requester"
version = "1.0.0-rc.1"
version = "0.12.0"
dependencies = [
"clap 2.34.0",
"dirs",
@@ -3031,7 +3055,7 @@ dependencies = [
[[package]]
name = "nym-socks5-client"
version = "1.0.0-rc.1"
version = "0.12.1"
dependencies = [
"clap 2.34.0",
"client-core",
@@ -3066,7 +3090,7 @@ dependencies = [
[[package]]
name = "nym-validator-api"
version = "1.0.0-rc.1"
version = "0.12.0"
dependencies = [
"anyhow",
"attohttpc",
@@ -3108,12 +3132,60 @@ dependencies = [
"version-checker",
]
[[package]]
name = "nym_compact_ecash"
version = "0.1.0"
dependencies = [
"bls12_381 0.6.0",
"bs58",
"criterion",
"digest 0.9.0",
"ff 0.11.0",
"group 0.11.0",
"itertools",
"rand 0.8.5",
"sha2",
"thiserror",
]
[[package]]
name = "nym_offline_divisible_ecash"
version = "0.1.0"
dependencies = [
"bls12_381 0.6.0",
"bs58",
"criterion",
"digest 0.9.0",
"ff 0.11.0",
"group 0.11.0",
"itertools",
"rand 0.8.5",
"sha2",
"thiserror",
]
[[package]]
name = "nym_online_divisible_ecash"
version = "0.1.0"
dependencies = [
"bls12_381 0.5.0",
"bs58",
"criterion",
"digest 0.9.0",
"ff 0.10.1",
"group 0.10.0",
"itertools",
"rand 0.8.5",
"sha2",
"thiserror",
]
[[package]]
name = "nymcoconut"
version = "0.5.0"
dependencies = [
"bincode",
"bls12_381",
"bls12_381 0.5.0",
"bs58",
"criterion",
"digest 0.9.0",
@@ -3341,6 +3413,15 @@ dependencies = [
"group 0.10.0",
]
[[package]]
name = "pairing"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2e415e349a3006dd7d9482cdab1c980a845bed1377777d768cb693a44540b42"
dependencies = [
"group 0.11.0",
]
[[package]]
name = "parity-scale-codec"
version = "2.3.1"
@@ -6052,11 +6133,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vesting-contract"
version = "1.0.0-rc.1"
version = "0.1.0"
dependencies = [
"config",
"cosmwasm-std",
"cw-storage-plus",
"cw-storage-plus 0.12.1",
"mixnet-contract-common",
"schemars",
"serde",
@@ -6070,7 +6151,7 @@ version = "0.1.0"
dependencies = [
"config",
"cosmwasm-std",
"cw-storage-plus",
"cw-storage-plus 0.11.1",
"mixnet-contract-common",
"schemars",
"serde",
@@ -6393,9 +6474,9 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
[[package]]
name = "x25519-dalek"
version = "1.2.0"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2392b6b94a576b4e2bf3c5b2757d63f10ada8020a2e4d08ac849ebcf6ea8e077"
checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f"
dependencies = [
"curve25519-dalek",
"rand_core 0.5.1",
@@ -6410,9 +6491,9 @@ checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71"
[[package]]
name = "zeroize"
version = "1.3.0"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd"
checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619"
dependencies = [
"zeroize_derive",
]
+3
View File
@@ -33,6 +33,9 @@ members = [
"common/network-defaults",
"common/nonexhaustive-delayqueue",
"common/nymcoconut",
"common/nym_offline_compact_ecash",
"common/nym_offline_divisible_ecash",
"common/nym_online_divisible_ecash",
"common/nymsphinx",
"common/nymsphinx/acknowledgements",
"common/nymsphinx/addressing",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "client-core"
version = "1.0.0-rc.1"
version = "0.12.0"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
edition = "2021"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "nym-client"
version = "1.0.0-rc.1"
version = "0.12.1"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
edition = "2021"
rust-version = "1.56"
File diff suppressed because it is too large Load Diff
@@ -18,12 +18,14 @@
"author": "Dave Hrycyszyn",
"license": "Apache-2.0",
"devDependencies": {
"clean-webpack-plugin": "^4.0.0",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.4"
"autoprefixer": "^10.2.6",
"clean-webpack-plugin": "^3.0.0",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"html-webpack-plugin": "^5.5.0"
"core-js": "^3.6.5",
"html-webpack-plugin": "^4.2.0"
}
}
@@ -1,9 +1,9 @@
const autoprefixer = require('autoprefixer');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
mode: 'production',
entry: './src/index.js',
output: {
filename: 'bundle.js',
@@ -18,7 +18,7 @@ module.exports = {
})
],
devServer: {
static: path.join(__dirname, 'dist'),
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 8888
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "nym-socks5-client"
version = "1.0.0-rc.1"
version = "0.12.1"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
edition = "2021"
rust-version = "1.56"
+5
View File
@@ -0,0 +1,5 @@
.DS_Store
/node_modules/
/src/node_modules/@sapper/
yarn-error.log
/__sapper__/
+33
View File
@@ -0,0 +1,33 @@
## Prerequisites
On Ubuntu-ish systems (not tested on Debian but may work):
```
sudo apt update && sudo apt install libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libappindicator3-dev \
patchelf \
librsvg2-dev```
## Getting started
1. Start Sapper([docs](https://sapper.svelte.dev/docs/)) -> `yarn run dev`
2. Start Tauri([docs](https://tauri.studio/en/)) in another terminal -> `yarn tauri dev`
3. Start validator-api locally, or override `validator-urls` in `index.svelte`
## Getting around
+ Frontend -> `tauri-client/`
+ logic -> `tauri-client/src/routes/index.svelte`
+ assets -> `tauri-client/static`
+ Backend -> `tauri-client/src/src-tauri`
## Build standalone app
+ yarn tauri build [--debug]
+38
View File
@@ -0,0 +1,38 @@
{
"name": "TODO",
"description": "TODO",
"version": "0.0.1",
"scripts": {
"dev": "sapper dev",
"build": "sapper build --legacy",
"export": "sapper export --legacy",
"start": "node __sapper__/build"
},
"dependencies": {
"@tauri-apps/api": "^1.0.0-beta.4",
"compression": "^1.7.1",
"polka": "next",
"qrious": "^4.0.2",
"sirv": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-replace": "^2.4.0",
"@rollup/plugin-url": "^5.0.0",
"@tauri-apps/cli": "^1.0.0-rc.5",
"rollup": "^2.3.4",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",
"sapper": "^0.28.0",
"sass": "^1.35.2",
"svelte": "^3.17.3",
"svelte-preprocess": "^4.7.4"
}
}
+140
View File
@@ -0,0 +1,140 @@
import path from "path";
import resolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import commonjs from "@rollup/plugin-commonjs";
import url from "@rollup/plugin-url";
import svelte from "rollup-plugin-svelte";
import babel from "@rollup/plugin-babel";
import { terser } from "rollup-plugin-terser";
import config from "sapper/config/rollup.js";
import pkg from "./package.json";
import sveltePreprocess from "svelte-preprocess";
const mode = process.env.NODE_ENV;
const dev = mode === "development";
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
const onwarn = (warning, onwarn) =>
(warning.code === "MISSING_EXPORT" && /'preload'/.test(warning.message)) ||
(warning.code === "CIRCULAR_DEPENDENCY" &&
/[/\\]@sapper[/\\]/.test(warning.message)) ||
onwarn(warning);
export default {
client: {
input: config.client.input(),
output: config.client.output(),
plugins: [
replace({
preventAssignment: true,
values: {
"process.browser": true,
"process.env.NODE_ENV": JSON.stringify(mode),
},
}),
svelte({
compilerOptions: {
dev,
hydratable: true,
},
preprocess: sveltePreprocess(),
}),
url({
sourceDir: path.resolve(__dirname, "src/node_modules/images"),
publicPath: "/client/",
}),
resolve({
browser: true,
dedupe: ["svelte"],
}),
commonjs(),
legacy &&
babel({
extensions: [".js", ".mjs", ".html", ".svelte"],
babelHelpers: "runtime",
exclude: ["node_modules/@babel/**"],
presets: [
[
"@babel/preset-env",
{
targets: "> 0.25%, not dead",
},
],
],
plugins: [
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-transform-runtime",
{
useESModules: true,
},
],
],
}),
!dev &&
terser({
module: true,
}),
],
preserveEntrySignatures: false,
onwarn,
},
server: {
input: config.server.input(),
output: config.server.output(),
plugins: [
replace({
preventAssignment: true,
values: {
"process.browser": false,
"process.env.NODE_ENV": JSON.stringify(mode),
},
}),
svelte({
compilerOptions: {
dev,
generate: "ssr",
hydratable: true,
},
emitCss: false,
}),
url({
sourceDir: path.resolve(__dirname, "src/node_modules/images"),
publicPath: "/client/",
emitFiles: false, // already emitted by client build
}),
resolve({
dedupe: ["svelte"],
}),
commonjs(),
],
external: Object.keys(pkg.dependencies).concat(
require("module").builtinModules
),
preserveEntrySignatures: "strict",
onwarn,
},
serviceworker: {
input: config.serviceworker.input(),
output: config.serviceworker.output(),
plugins: [
resolve(),
replace({
preventAssignment: true,
values: {
"process.browser": true,
"process.env.NODE_ENV": JSON.stringify(mode),
},
}),
commonjs(),
!dev && terser(),
],
preserveEntrySignatures: false,
onwarn,
},
};
@@ -0,0 +1,304 @@
/**
* Run this script to convert the project to TypeScript. This is only guaranteed to work
* on the unmodified default template; if you have done code changes you are likely need
* to touch up the generated project manually.
*/
// @ts-check
const fs = require('fs');
const path = require('path');
const { argv } = require('process');
const projectRoot = argv[2] || path.join(__dirname, '..');
const isRollup = fs.existsSync(path.join(projectRoot, "rollup.config.js"));
function warn(message) {
console.warn('Warning: ' + message);
}
function replaceInFile(fileName, replacements) {
if (fs.existsSync(fileName)) {
let contents = fs.readFileSync(fileName, 'utf8');
let hadUpdates = false;
replacements.forEach(([from, to]) => {
const newContents = contents.replace(from, to);
const isAlreadyApplied = typeof to !== 'string' || contents.includes(to);
if (newContents !== contents) {
contents = newContents;
hadUpdates = true;
} else if (!isAlreadyApplied) {
warn(`Wanted to update "${from}" in ${fileName}, but did not find it.`);
}
});
if (hadUpdates) {
fs.writeFileSync(fileName, contents);
} else {
console.log(`${fileName} had already been updated.`);
}
} else {
warn(`Wanted to update ${fileName} but the file did not exist.`);
}
}
function createFile(fileName, contents) {
if (fs.existsSync(fileName)) {
warn(`Wanted to create ${fileName}, but it already existed. Leaving existing file.`);
} else {
fs.writeFileSync(fileName, contents);
}
}
function addDepsToPackageJson() {
const pkgJSONPath = path.join(projectRoot, 'package.json');
const packageJSON = JSON.parse(fs.readFileSync(pkgJSONPath, 'utf8'));
packageJSON.devDependencies = Object.assign(packageJSON.devDependencies, {
...(isRollup ? { '@rollup/plugin-typescript': '^6.0.0' } : { 'ts-loader': '^8.0.4' }),
'@tsconfig/svelte': '^1.0.10',
'@types/compression': '^1.7.0',
'@types/node': '^14.11.1',
'@types/polka': '^0.5.1',
'svelte-check': '^1.0.46',
'svelte-preprocess': '^4.3.0',
tslib: '^2.0.1',
typescript: '^4.0.3'
});
// Add script for checking
packageJSON.scripts = Object.assign(packageJSON.scripts, {
validate: 'svelte-check --ignore src/node_modules/@sapper'
});
// Write the package JSON
fs.writeFileSync(pkgJSONPath, JSON.stringify(packageJSON, null, ' '));
}
function changeJsExtensionToTs(dir) {
const elements = fs.readdirSync(dir, { withFileTypes: true });
for (let i = 0; i < elements.length; i++) {
if (elements[i].isDirectory()) {
changeJsExtensionToTs(path.join(dir, elements[i].name));
} else if (elements[i].name.match(/^[^_]((?!json).)*js$/)) {
fs.renameSync(path.join(dir, elements[i].name), path.join(dir, elements[i].name).replace('.js', '.ts'));
}
}
}
function updateSingleSvelteFile({ view, vars, contextModule }) {
replaceInFile(path.join(projectRoot, 'src', `${view}.svelte`), [
[/(?:<script)(( .*?)*?)>/gm, (m, attrs) => `<script${attrs}${!attrs.includes('lang="ts"') ? ' lang="ts"' : ''}>`],
...(vars ? vars.map(({ name, type }) => [`export let ${name};`, `export let ${name}: ${type};`]) : []),
...(contextModule ? contextModule.map(({ js, ts }) => [js, ts]) : [])
]);
}
// Switch the *.svelte file to use TS
function updateSvelteFiles() {
[
{
view: 'components/Nav',
vars: [{ name: 'segment', type: 'string' }]
},
{
view: 'routes/_layout',
vars: [{ name: 'segment', type: 'string' }]
},
{
view: 'routes/_error',
vars: [
{ name: 'status', type: 'number' },
{ name: 'error', type: 'Error' }
]
},
{
view: 'routes/blog/index',
vars: [{ name: 'posts', type: '{ slug: string; title: string, html: any }[]' }],
contextModule: [
{
js: '.then(r => r.json())',
ts: '.then((r: { json: () => any; }) => r.json())'
},
{
js: '.then(posts => {',
ts: '.then((posts: { slug: string; title: string, html: any }[]) => {'
}
]
},
{
view: 'routes/blog/[slug]',
vars: [{ name: 'post', type: '{ slug: string; title: string, html: any }' }]
}
].forEach(updateSingleSvelteFile);
}
function updateRollupConfig() {
// Edit rollup config
replaceInFile(path.join(projectRoot, 'rollup.config.js'), [
// Edit imports
[
/'rollup-plugin-terser';\n(?!import sveltePreprocess)/,
`'rollup-plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
`
],
// Edit inputs
[
/(?<!THIS_IS_UNDEFINED[^\n]*\n\s*)onwarn\(warning\);/,
`(warning.code === 'THIS_IS_UNDEFINED') ||\n\tonwarn(warning);`
],
[/input: config.client.input\(\)(?!\.replace)/, `input: config.client.input().replace(/\\.js$/, '.ts')`],
[
/input: config.server.input\(\)(?!\.replace)/,
`input: { server: config.server.input().server.replace(/\\.js$/, ".ts") }`
],
[
/input: config.serviceworker.input\(\)(?!\.replace)/,
`input: config.serviceworker.input().replace(/\\.js$/, '.ts')`
],
// Add preprocess
[/compilerOptions/g, 'preprocess: sveltePreprocess({ sourceMap: dev }),\n\t\t\t\tcompilerOptions'],
// Add TypeScript
[/commonjs\(\)(?!,\n\s*typescript)/g, 'commonjs(),\n\t\t\ttypescript({ sourceMap: dev })']
]);
}
function updateWebpackConfig() {
// Edit webpack config
replaceInFile(path.join(projectRoot, 'webpack.config.js'), [
// Edit imports
[
/require\('webpack-modules'\);\n(?!const sveltePreprocess)/,
`require('webpack-modules');\nconst sveltePreprocess = require('svelte-preprocess');\n`
],
// Edit extensions
[
/\['\.mjs', '\.js', '\.json', '\.svelte', '\.html'\]/,
`['.mjs', '.js', '.ts', '.json', '.svelte', '.html']`
],
// Edit entries
[
/entry: config\.client\.entry\(\)/,
`entry: { main: config.client.entry().main.replace(/\\.js$/, '.ts') }`
],
[
/entry: config\.server\.entry\(\)/,
`entry: { server: config.server.entry().server.replace(/\\.js$/, '.ts') }`
],
[
/entry: config\.serviceworker\.entry\(\)/,
`entry: { 'service-worker': config.serviceworker.entry()['service-worker'].replace(/\\.js$/, '.ts') }`
],
[
/loader: 'svelte-loader',\n\t\t\t\t\t\toptions: {/g,
'loader: \'svelte-loader\',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tpreprocess: sveltePreprocess({ sourceMap: dev }),'
],
// Add TypeScript rules for client and server
[
/module: {\n\s*rules: \[\n\s*(?!{\n\s*test: \/\\\.ts\$\/)/g,
`module: {\n\t\t\trules: [\n\t\t\t\t{\n\t\t\t\t\ttest: /\\.ts$/,\n\t\t\t\t\tloader: 'ts-loader'\n\t\t\t\t},\n\t\t\t\t`
],
// Add TypeScript rules for serviceworker
[
/output: config\.serviceworker\.output\(\),\n\s*(?!module)/,
`output: config.serviceworker.output(),\n\t\tmodule: {\n\t\t\trules: [\n\t\t\t\t{\n\t\t\t\t\ttest: /\\.ts$/,\n\t\t\t\t\tloader: 'ts-loader'\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t`
],
// Edit outputs
[
/output: config\.serviceworker\.output\(\),\n\s*(?!resolve)/,
`output: config.serviceworker.output(),\n\t\tresolve: { extensions: ['.mjs', '.js', '.ts', '.json'] },\n\t\t`
]
]);
}
function updateServiceWorker() {
replaceInFile(path.join(projectRoot, 'src', 'service-worker.ts'), [
[`shell.concat(files);`, `(shell as string[]).concat(files as string[]);`],
[`self.skipWaiting();`, `((self as any) as ServiceWorkerGlobalScope).skipWaiting();`],
[`self.clients.claim();`, `((self as any) as ServiceWorkerGlobalScope).clients.claim();`],
[`fetchAndCache(request)`, `fetchAndCache(request: Request)`],
[`self.addEventListener('activate', event =>`, `self.addEventListener('activate', (event: ExtendableEvent) =>`],
[`self.addEventListener('install', event =>`, `self.addEventListener('install', (event: ExtendableEvent) =>`],
[`addEventListener('fetch', event =>`, `addEventListener('fetch', (event: FetchEvent) =>`],
]);
}
function createTsConfig() {
const tsconfig = `{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"lib": ["DOM", "ES2017", "WebWorker"]
},
"include": ["src/**/*", "src/node_modules/**/*"],
"exclude": ["node_modules/*", "__sapper__/*", "static/*"]
}`;
createFile(path.join(projectRoot, 'tsconfig.json'), tsconfig);
}
// Adds the extension recommendation
function configureVsCode() {
const dir = path.join(projectRoot, '.vscode');
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
createFile(path.join(projectRoot, '.vscode', 'extensions.json'), `{"recommendations": ["svelte.svelte-vscode"]}`);
}
function deleteThisScript() {
fs.unlinkSync(path.join(__filename));
// Check for Mac's DS_store file, and if it's the only one left remove it
const remainingFiles = fs.readdirSync(path.join(__dirname));
if (remainingFiles.length === 1 && remainingFiles[0] === '.DS_store') {
fs.unlinkSync(path.join(__dirname, '.DS_store'));
}
// Check if the scripts folder is empty
if (fs.readdirSync(path.join(__dirname)).length === 0) {
// Remove the scripts folder
fs.rmdirSync(path.join(__dirname));
}
}
console.log(`Adding TypeScript with ${isRollup ? "Rollup" : "webpack" }...`);
addDepsToPackageJson();
changeJsExtensionToTs(path.join(projectRoot, 'src'));
updateSvelteFiles();
if (isRollup) {
updateRollupConfig();
} else {
updateWebpackConfig();
}
updateServiceWorker();
createTsConfig();
configureVsCode();
// Delete this script, but not during testing
if (!argv[2]) {
deleteThisScript();
}
console.log('Converted to TypeScript.');
if (fs.existsSync(path.join(projectRoot, 'node_modules'))) {
console.log(`
Next:
1. run 'npm install' again to install TypeScript dependencies
2. run 'npm run build' for the @sapper imports in your project to work
`);
}
@@ -0,0 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
build = "src/build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "=1.0.0-rc.2" }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "=1.0.0-rc.2", features = [] }
tokio = "1.4"
url = "2.2"
tauri-codegen = "=1.0.0-rc.1"
tauri-macros = "=1.0.0-rc.1"
core-graphics = "=0.22.2"
coconut-interface = { path = "../../../common/coconut-interface" }
credentials = { path = "../../../common/credentials" }
validator-client = {path = "../../../common/client-libs/validator-client"}
[features]
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

@@ -0,0 +1,13 @@
max_width = 100
hard_tabs = false
tab_spaces = 2
newline_style = "Auto"
use_small_heuristics = "Default"
reorder_imports = true
reorder_modules = true
remove_nested_parens = true
edition = "2018"
merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
+211
View File
@@ -0,0 +1,211 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use std::sync::Arc;
use tokio::sync::RwLock;
use url::Url;
use coconut_interface::{
self, hash_to_scalar, Attribute, Credential, Parameters, Signature, Theta, VerificationKey,
};
use credentials::{obtain_aggregate_signature, obtain_aggregate_verification_key};
struct State {
signatures: Vec<Signature>,
n_attributes: u32,
params: Parameters,
serial_number: Attribute,
binding_number: Attribute,
voucher_value: Attribute,
voucher_info: Attribute,
aggregated_verification_key: Option<VerificationKey>,
}
impl State {
fn init(public_attributes_bytes: Vec<Vec<u8>>, private_attributes_bytes: Vec<Vec<u8>>) -> State {
let n_attributes = (public_attributes_bytes.len() + private_attributes_bytes.len()) as u32;
let params = Parameters::new(n_attributes).unwrap();
let public_attributes = public_attributes_bytes
.iter()
.map(hash_to_scalar)
.collect::<Vec<Attribute>>();
let private_attributes = private_attributes_bytes
.iter()
.map(hash_to_scalar)
.collect::<Vec<Attribute>>();
State {
signatures: Vec::new(),
n_attributes,
params,
serial_number: private_attributes[0],
binding_number: private_attributes[1],
voucher_value: public_attributes[0],
voucher_info: public_attributes[1],
aggregated_verification_key: None,
}
}
}
fn parse_url_validators(raw: &[String]) -> Result<Vec<Url>, String> {
let mut parsed_urls = Vec::with_capacity(raw.len());
for url in raw {
let parsed_url: Url = url
.parse()
.map_err(|err| format!("one of validator urls is malformed - {}", err))?;
parsed_urls.push(parsed_url)
}
Ok(parsed_urls)
}
#[tauri::command]
async fn randomise_credential(
idx: usize,
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<Vec<Signature>, String> {
let mut state = state.write().await;
let signature = state.signatures.remove(idx);
let (new_signature, _) = signature.randomise(&state.params);
state.signatures.insert(idx, new_signature);
Ok(state.signatures.clone())
}
#[tauri::command]
async fn delete_credential(
idx: usize,
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<Vec<Signature>, String> {
let mut state = state.write().await;
state.signatures.remove(idx);
Ok(state.signatures.clone())
}
#[tauri::command]
async fn list_credentials(
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<Vec<Signature>, String> {
let state = state.read().await;
Ok(state.signatures.clone())
}
async fn get_aggregated_verification_key(
validator_urls: Vec<String>,
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<VerificationKey, String> {
if let Some(verification_key) = &state.read().await.aggregated_verification_key {
return Ok(verification_key.clone());
}
let parsed_urls = parse_url_validators(&validator_urls)?;
let key = obtain_aggregate_verification_key(&parsed_urls)
.await
.map_err(|err| format!("failed to obtain aggregate verification key - {:?}", err))?;
state
.write()
.await
.aggregated_verification_key
.replace(key.clone());
Ok(key)
}
async fn prove_credential(
idx: usize,
validator_urls: Vec<String>,
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<Theta, String> {
let verification_key = get_aggregated_verification_key(validator_urls, state.clone()).await?;
let state = state.read().await;
if let Some(signature) = state.signatures.get(idx) {
match coconut_interface::prove_bandwidth_credential(
&state.params,
&verification_key,
signature,
state.serial_number,
state.binding_number,
) {
Ok(theta) => Ok(theta),
Err(e) => Err(format!("{:?}", e)),
}
} else {
Err("Got invalid Signature idx".to_string())
}
}
#[tauri::command]
async fn verify_credential(
idx: usize,
validator_urls: Vec<String>,
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<bool, String> {
// the API needs to be improved but at least it should compile (in theory)
let verification_key =
get_aggregated_verification_key(validator_urls.clone(), state.clone()).await?;
let theta = prove_credential(idx, validator_urls, state.clone()).await?;
let state = state.read().await;
let public_attributes_bytes = vec![
state.voucher_value.to_bytes().to_vec(),
state.voucher_info.to_bytes().to_vec(),
];
let credential = Credential::new(
state.n_attributes,
theta,
public_attributes_bytes,
state
.signatures
.get(idx)
.ok_or("Got invalid signature idx")?,
);
Ok(credential.verify(&verification_key))
}
#[tauri::command]
async fn get_credential(
validator_urls: Vec<String>,
state: tauri::State<'_, Arc<RwLock<State>>>,
) -> Result<Vec<Signature>, String> {
let guard = state.read().await;
let parsed_urls = parse_url_validators(&validator_urls)?;
let public_attributes = vec![guard.voucher_value, guard.voucher_info];
let private_attributes = vec![guard.serial_number, guard.binding_number];
let signature = obtain_aggregate_signature(
&guard.params,
&public_attributes,
&private_attributes,
&parsed_urls,
)
.await
.map_err(|err| format!("failed to obtain aggregate signature - {:?}", err))?;
let mut state = state.write().await;
state.signatures.push(signature);
Ok(state.signatures.clone())
}
fn main() {
let public_attributes = vec![b"public_key".to_vec()];
let private_attributes = vec![b"private_key".to_vec()];
tauri::Builder::default()
.manage(Arc::new(RwLock::new(State::init(
public_attributes,
private_attributes,
))))
.invoke_handler(tauri::generate_handler![
get_credential,
randomise_credential,
delete_credential,
list_credentials,
verify_credential
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
@@ -0,0 +1,65 @@
{
"package": {
"productName": "nym-tauri-client",
"version": "0.1.0"
},
"build": {
"distDir": "../__sapper__/export",
"devPath": "http://localhost:3000",
"beforeDevCommand": "",
"beforeBuildCommand": "yarn run export"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {},
"windows": [
{
"title": "Nym Client",
"width": 800,
"height": 1000,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
}
}
}
+39
View File
@@ -0,0 +1,39 @@
/**
* These declarations tell TypeScript that we allow import of images, e.g.
* ```
<script lang='ts'>
import successkid from 'images/successkid.jpg';
</script>
<img src="{successkid}">
```
*/
declare module "*.gif" {
const value: string;
export default value;
}
declare module "*.jpg" {
const value: string;
export default value;
}
declare module "*.jpeg" {
const value: string;
export default value;
}
declare module "*.png" {
const value: string;
export default value;
}
declare module "*.svg" {
const value: string;
export default value;
}
declare module "*.webp" {
const value: string;
export default value;
}
+5
View File
@@ -0,0 +1,5 @@
import * as sapper from '@sapper/app';
sapper.start({
target: document.querySelector('#sapper')
});
@@ -0,0 +1,3 @@
<nav>
<img src="coconut-120.png" style="width: 120px" alt=""/>
</nav>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,40 @@
<script>
export let status;
export let error;
const dev = process.env.NODE_ENV === 'development';
</script>
<style>
h1, p {
margin: 0 auto;
}
h1 {
font-size: 2.8em;
font-weight: 700;
margin: 0 0 0.5em 0;
}
p {
margin: 1em auto;
}
@media (min-width: 480px) {
h1 {
font-size: 4em;
}
}
</style>
<svelte:head>
<title>{status}</title>
</svelte:head>
<h1>{status}</h1>
<p>{error.message}</p>
{#if dev && error.stack}
<pre>{error.stack}</pre>
{/if}
@@ -0,0 +1,22 @@
<script>
import Nav from '../components/Nav.svelte';
// export let segment;
</script>
<style>
main {
position: relative;
max-width: 56em;
/* background-color: white; */
padding: 2em;
margin: 0 auto;
box-sizing: border-box;
}
</style>
<Nav />
<main>
<slot></slot>
</main>
@@ -0,0 +1,119 @@
<script>
import {invoke} from "@tauri-apps/api/tauri";
import {onMount} from "svelte";
import QRious from "qrious";
const validator_urls = ["http://localhost:8080"];
let signatures = [];
let qrVisible = false;
async function getCredential() {
signatures = await invoke("get_credential", {
validatorUrls: validator_urls,
});
}
async function randomiseCredential(idx) {
signatures = await invoke("randomise_credential", {
idx: idx,
});
}
async function verifyCredential(idx) {
const response = await invoke("verify_credential", {
idx: idx,
validatorUrls: validator_urls,
});
alert(response);
}
async function deleteCredential(idx) {
signatures = await invoke("delete_credential", {
idx: idx,
});
}
async function listCredentials() {
signatures = await invoke("list_credentials");
}
function signatureQR(idx) {
qrVisible = true;
const signature = signatures[idx];
new QRious({
element: document.getElementById("qr"),
value: signature,
foreground: "white",
background: "black",
size: 148,
});
}
onMount(() => {
listCredentials();
});
</script>
<svelte:head>
<title>Coconut</title>
</svelte:head>
<button class="btn btn-success" on:click={getCredential}>Get Credential</button>
<hr />
<table class="table table-dark">
{#each signatures as signature, idx}
<tr>
<td><p>{signature.slice(0, 12)}</p></td>
<td>
<div class="btn-group" role="group" aria-label="Basic example">
<button
class="btn btn-primary"
on:click={() => {
randomiseCredential(idx);
}}>Randomize</button
><button
class="btn btn-danger"
on:click={() => {
deleteCredential(idx);
}}>Delete</button
>
<button
class="btn btn-info"
on:click={() => {
signatureQR(idx);
}}>QR</button
>
<button
class="btn btn-primary"
on:click={() => {
verifyCredential(idx);
}}>Verify</button
>
</div></td
>
</tr>
{/each}
</table>
<div
class="modal"
tabindex="-1"
style={qrVisible ? "display: block" : "display: none"}
>
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
<canvas id="qr"></canvas>
<button
type="button"
class="close"
on:click={() => (qrVisible = false)}
>
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
</div>
</div>
<!-- <div><br /></div> -->
+17
View File
@@ -0,0 +1,17 @@
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
polka() // You can also use Express
.use(
compression({ threshold: 0 }),
sirv('static', { dev }),
sapper.middleware()
)
.listen(PORT, err => {
if (err) console.log('error', err);
});
@@ -0,0 +1,86 @@
import { timestamp, files, shell } from '@sapper/service-worker';
const ASSETS = `cache${timestamp}`;
// `shell` is an array of all the files generated by the bundler,
// `files` is an array of everything in the `static` directory
const to_cache = shell.concat(files);
const staticAssets = new Set(to_cache);
self.addEventListener('install', event => {
event.waitUntil(
caches
.open(ASSETS)
.then(cache => cache.addAll(to_cache))
.then(() => {
self.skipWaiting();
})
);
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(async keys => {
// delete old caches
for (const key of keys) {
if (key !== ASSETS) await caches.delete(key);
}
self.clients.claim();
})
);
});
/**
* Fetch the asset from the network and store it in the cache.
* Fall back to the cache if the user is offline.
*/
async function fetchAndCache(request) {
const cache = await caches.open(`offline${timestamp}`)
try {
const response = await fetch(request);
cache.put(request, response.clone());
return response;
} catch (err) {
const response = await cache.match(request);
if (response) return response;
throw err;
}
}
self.addEventListener('fetch', event => {
if (event.request.method !== 'GET' || event.request.headers.has('range')) return;
const url = new URL(event.request.url);
// don't try to handle e.g. data: URIs
const isHttp = url.protocol.startsWith('http');
const isDevServerRequest = url.hostname === self.location.hostname && url.port !== self.location.port;
const isStaticAsset = url.host === self.location.host && staticAssets.has(url.pathname);
const skipBecauseUncached = event.request.cache === 'only-if-cached' && !isStaticAsset;
if (isHttp && !isDevServerRequest && !skipBecauseUncached) {
event.respondWith(
(async () => {
// always serve static files and bundler-generated assets from cache.
// if your application has other URLs with data that will never change,
// set this variable to true for them and they will only be fetched once.
const cachedAsset = isStaticAsset && await caches.match(event.request);
// for pages, you might want to serve a shell `service-worker-index.html` file,
// which Sapper has generated for you. It's not right for every
// app, but if it's right for yours then uncomment this section
/*
if (!cachedAsset && url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
return caches.match('/service-worker-index.html');
}
*/
return cachedAsset || fetchAndCache(event.request);
})()
);
}
});
+36
View File
@@ -0,0 +1,36 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
%sapper.base%
<link rel="stylesheet" href="stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="stylesheets/bootstrap-grid.min.css">
<link rel="stylesheet" href="stylesheets/bootstrap-reboot.min.css">
<link rel="stylesheet" href="stylesheets/bundle.min.css">
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="apple-touch-icon" href="logo-192.png">
<!-- Sapper creates a <script> tag containing `src/client.js`
and anything else it needs to hydrate the app and
initialise the router -->
%sapper.scripts%
<!-- Sapper generates a <style> tag containing critical CSS
for the current page. CSS for the rest of the app is
lazily loaded when it precaches secondary pages -->
%sapper.styles%
<!-- This contains the contents of the <svelte:head> component, if
the current page has one -->
%sapper.head%
</head>
<body>
<!-- The application will be rendered inside this element,
because `src/client.js` references it -->
<div id="sapper">%sapper.html%</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

+22
View File
@@ -0,0 +1,22 @@
{
"background_color": "#ffffff",
"theme_color": "#333333",
"name": "TODO",
"short_name": "TODO",
"display": "minimal-ui",
"start_url": "/",
"icons": [
{
"src": "logo-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "logo-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
}
]
}
@@ -0,0 +1,12 @@
@import "viewports.css.scss";
@import "colors.css.scss";
@import "fonts.css.scss";
@import "typography.css.scss";
@import "mixins.css.scss";
// Sections
// Section: Mission
#mission-pull-quote {
@include cover-background-image("/images/backgrounds/mission.png")
color: $color-orange;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
@import "viewports.css.scss";
@import "colors.css.scss";
@import "fonts.css.scss";
@import "typography.css.scss";
@import "mixins.css.scss";
// Buttons
input,
.btn {
@include font-mono();
@include text-form();
}
// Buttons: Danger
.btn-outline-danger {
color: $color-red;
border-color: $color-red;
}
.btn-danger {
color: $color-black;
}
.btn-danger:hover {
background-color: $color-black;
border-color: $color-white;
}
// Buttons: Warning
.btn-outline-warning {
color: $color-orange;
}
.btn-outline-warning:hover {
color: $color-white;
}
@@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
@font-face{font-family:'akkurat-mono';src:url("/fonts/akkurat-mono.woff2") format("woff2"),url("/fonts/akkurat-mono.woff") format("woff"),url("/fonts/akkurat-mono.otf") format("opentype");font-weight:normal;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-light.woff2") format("woff2"),url("/fonts/graphik-light.woff") format("woff"),url("/fonts/graphik-light.otf") format("opentype");font-weight:100;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-regular.woff2") format("woff2"),url("/fonts/graphik-regular.woff") format("woff"),url("/fonts/graphik-regular.otf") format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-medium.woff2") format("woff2"),url("/fonts/graphik-medium.woff") format("woff"),url("/fonts/graphik-medium.otf") format("opentype");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-semibold.woff2") format("woff2"),url("/fonts/graphik-semibold.woff") format("woff"),url("/fonts/graphik-semibold.otf") format("opentype");font-weight:900;font-style:normal;font-display:swap}@font-face{font-family:'akkurat-mono';src:url("/fonts/akkurat-mono.woff2") format("woff2"),url("/fonts/akkurat-mono.woff") format("woff"),url("/fonts/akkurat-mono.otf") format("opentype");font-weight:normal;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-light.woff2") format("woff2"),url("/fonts/graphik-light.woff") format("woff"),url("/fonts/graphik-light.otf") format("opentype");font-weight:100;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-regular.woff2") format("woff2"),url("/fonts/graphik-regular.woff") format("woff"),url("/fonts/graphik-regular.otf") format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-medium.woff2") format("woff2"),url("/fonts/graphik-medium.woff") format("woff"),url("/fonts/graphik-medium.otf") format("opentype");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:'graphik';src:url("/fonts/graphik-semibold.woff2") format("woff2"),url("/fonts/graphik-semibold.woff") format("woff"),url("/fonts/graphik-semibold.otf") format("opentype");font-weight:900;font-style:normal;font-display:swap}.font-mono{font-family:"akkurat-mono", "SF Mono", "Inconsolata-g", "Inconsolata-dz", Menlo, Consolas, Monaco, monospace, monospace;text-transform:uppercase;letter-spacing:.2em;font-size:12px}.font-sans-serif{font-family:graphik, system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif}.text-note{font-family:"akkurat-mono", "SF Mono", "Inconsolata-g", "Inconsolata-dz", Menlo, Consolas, Monaco, monospace, monospace;text-transform:uppercase;letter-spacing:.2em;font-size:12px;color:#8C8C8C;font-weight:bold;font-size:11px}::placeholder{color:#646464 !important;opacity:.5 !important}.h1{font-size:40px;line-height:50px}@media (min-width: 720px){.h1{font-size:56px;line-height:70px}}.h2{font-size:40px;line-height:50px}.h3{font-size:18px;line-height:24px;font-weight:600}li.event{font-family:"akkurat-mono", "SF Mono", "Inconsolata-g", "Inconsolata-dz", Menlo, Consolas, Monaco, monospace, monospace;text-transform:uppercase;letter-spacing:.2em}body{background:#000;color:#fff;font-family:graphik, system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;font-size:14px;line-height:22px;quotes:"“" "”"}a,a:hover{color:#fff;text-decoration:none}a:hover{border-bottom:1px solid #fff}.event-link{color:#148EFF}a.more-link,a.more-link:hover,a.more-link:visited{color:#148EFF;text-transform:uppercase;font-family:"akkurat-mono", "SF Mono", "Inconsolata-g", "Inconsolata-dz", Menlo, Consolas, Monaco, monospace, monospace;text-transform:uppercase;letter-spacing:.2em;font-size:12px}a.more-link:hover{border-bottom:none;text-decoration:underline}img{width:100%}.brand,.icon{width:auto}.brand:hover,.icon:hover{border:none}hr{border:1px solid #fff;opacity:0.2}
@@ -0,0 +1,9 @@
$color-white: white;
$color-black: black;
$color-gray: #646464;
$color-gray-dark: #252525;
$color-gray-light: #8C8C8C;
$color-blue: #148EFF;
$color-red: #F44C3B;
$color-orange: #F2A228;
@@ -0,0 +1,49 @@
@font-face {
font-family: 'akkurat-mono';
src: url('/fonts/akkurat-mono.woff2') format('woff2'),
url('/fonts/akkurat-mono.woff') format('woff'),
url('/fonts/akkurat-mono.otf') format('opentype');
font-weight: normal;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'graphik';
src: url('/fonts/graphik-light.woff2') format('woff2'),
url('/fonts/graphik-light.woff') format('woff'),
url('/fonts/graphik-light.otf') format('opentype');
font-weight: 100;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'graphik';
src: url('/fonts/graphik-regular.woff2') format('woff2'),
url('/fonts/graphik-regular.woff') format('woff'),
url('/fonts/graphik-regular.otf') format('opentype');
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'graphik';
src: url('/fonts/graphik-medium.woff2') format('woff2'),
url('/fonts/graphik-medium.woff') format('woff'),
url('/fonts/graphik-medium.otf') format('opentype');
font-weight: 600;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'graphik';
src: url('/fonts/graphik-semibold.woff2') format('woff2'),
url('/fonts/graphik-semibold.woff') format('woff'),
url('/fonts/graphik-semibold.otf') format('opentype');
font-weight: 900;
font-style: normal;
font-display: swap;
}
@@ -0,0 +1,16 @@
@import "viewports.css.scss";
@import "colors.css.scss";
@import "fonts.css.scss";
@import "typography.css.scss";
@import "mixins.css.scss";
footer[role=contentinfo] {
@include font-mono();
background: $color-gray-dark;
}
.copyright { text-align: center; }
@media (min-width: $layout-breakpoint-sm) {
.copyright { text-align: right; }
}

Some files were not shown because too many files have changed in this diff Show More