Merge v1 branch into v2

pull/468/head
FabianLars 2 years ago
commit 7fb4401ec8
No known key found for this signature in database
GPG Key ID: 3B12BC1DEBF61125

@ -1,5 +0,0 @@
---
"stronghold-js": minor
---
Added `Stronghold.load` and removed its constructor.

395
Cargo.lock generated

@ -96,6 +96,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
"getrandom 0.2.9",
"once_cell",
"version_check",
]
@ -269,7 +270,7 @@ dependencies = [
"objc-foundation",
"objc_id",
"once_cell",
"parking_lot 0.12.1",
"parking_lot",
"thiserror",
"winapi",
"x11rb",
@ -455,9 +456,9 @@ dependencies = [
[[package]]
name = "atoi"
version = "1.0.0"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e"
checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
dependencies = [
"num-traits",
]
@ -557,6 +558,9 @@ name = "bitflags"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84"
dependencies = [
"serde",
]
[[package]]
name = "blake2"
@ -960,9 +964,9 @@ dependencies = [
[[package]]
name = "const-oid"
version = "0.7.1"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3"
checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc"
[[package]]
name = "constant_time_eq"
@ -1085,16 +1089,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crypto-bigint"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21"
dependencies = [
"generic-array",
"subtle",
]
[[package]]
name = "crypto-common"
version = "0.1.6"
@ -1217,13 +1211,13 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "der"
version = "0.5.1"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c"
checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946"
dependencies = [
"const-oid",
"crypto-bigint",
"pem-rfc7468",
"zeroize",
]
[[package]]
@ -1276,6 +1270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer 0.10.4",
"const-oid",
"crypto-common",
"subtle",
]
@ -1373,6 +1368,9 @@ name = "either"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
dependencies = [
"serde",
]
[[package]]
name = "embed-resource"
@ -1433,6 +1431,12 @@ dependencies = [
"regex",
]
[[package]]
name = "equivalent"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
[[package]]
name = "errno"
version = "0.3.1"
@ -1464,6 +1468,17 @@ dependencies = [
"str-buf",
]
[[package]]
name = "etcetera"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943"
dependencies = [
"cfg-if",
"home",
"windows-sys 0.48.0",
]
[[package]]
name = "event-listener"
version = "2.5.3"
@ -1635,13 +1650,13 @@ dependencies = [
[[package]]
name = "futures-intrusive"
version = "0.4.2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5"
checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
dependencies = [
"futures-core",
"lock_api",
"parking_lot 0.11.2",
"parking_lot",
]
[[package]]
@ -2079,7 +2094,7 @@ dependencies = [
"futures-sink",
"futures-util",
"http",
"indexmap",
"indexmap 1.9.3",
"slab",
"tokio",
"tokio-util",
@ -2104,6 +2119,12 @@ dependencies = [
"ahash 0.8.3",
]
[[package]]
name = "hashbrown"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]]
name = "hashlink"
version = "0.8.2"
@ -2179,6 +2200,15 @@ dependencies = [
"digest 0.10.7",
]
[[package]]
name = "home"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "html5ever"
version = "0.25.2"
@ -2265,9 +2295,9 @@ checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7"
dependencies = [
"http",
"hyper",
"rustls 0.21.1",
"rustls",
"tokio",
"tokio-rustls 0.24.0",
"tokio-rustls",
]
[[package]]
@ -2385,6 +2415,16 @@ dependencies = [
"serde",
]
[[package]]
name = "indexmap"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"equivalent",
"hashbrown 0.14.0",
]
[[package]]
name = "infer"
version = "0.9.0"
@ -2480,9 +2520,9 @@ dependencies = [
[[package]]
name = "iota-crypto"
version = "0.20.1"
version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7eb2df6763689b6e2b95787941eb9a58b29d16d17c2055392f550b3daf40bdce"
checksum = "4d22b9d6f6b7601c3fcff97cdf6298cbfdd6fb44812b4e6f82a016152be1c891"
dependencies = [
"autocfg",
]
@ -2754,9 +2794,9 @@ dependencies = [
[[package]]
name = "libsqlite3-sys"
version = "0.24.2"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14"
checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326"
dependencies = [
"cc",
"pkg-config",
@ -3146,17 +3186,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "num-bigint"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-bigint-dig"
version = "0.8.2"
@ -3441,17 +3470,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e"
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.6",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
@ -3459,21 +3477,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.7",
]
[[package]]
name = "parking_lot_core"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall 0.2.16",
"smallvec",
"winapi",
"parking_lot_core",
]
[[package]]
@ -3512,9 +3516,9 @@ dependencies = [
[[package]]
name = "pem-rfc7468"
version = "0.3.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30"
checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
dependencies = [
"base64ct",
]
@ -3657,24 +3661,23 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkcs1"
version = "0.3.3"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320"
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
dependencies = [
"der",
"pkcs8",
"zeroize",
"spki",
]
[[package]]
name = "pkcs8"
version = "0.8.0"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
dependencies = [
"der",
"spki",
"zeroize",
]
[[package]]
@ -3690,7 +3693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590"
dependencies = [
"base64 0.21.2",
"indexmap",
"indexmap 1.9.3",
"line-wrap",
"quick-xml 0.28.2",
"serde",
@ -4040,14 +4043,14 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
"rustls 0.21.1",
"rustls",
"rustls-pemfile",
"serde",
"serde_json",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
"tokio-rustls 0.24.0",
"tokio-rustls",
"tokio-util",
"tower-service",
"url",
@ -4101,11 +4104,12 @@ dependencies = [
[[package]]
name = "rsa"
version = "0.6.1"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b"
checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8"
dependencies = [
"byteorder",
"const-oid",
"digest 0.10.7",
"num-bigint-dig",
"num-integer",
@ -4114,7 +4118,8 @@ dependencies = [
"pkcs1",
"pkcs8",
"rand_core 0.6.4",
"smallvec",
"signature",
"spki",
"subtle",
"zeroize",
]
@ -4160,18 +4165,6 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "rustls"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f"
dependencies = [
"log",
"ring",
"sct",
"webpki",
]
[[package]]
name = "rustls"
version = "0.21.1"
@ -4397,7 +4390,7 @@ dependencies = [
"base64 0.21.2",
"chrono",
"hex",
"indexmap",
"indexmap 1.9.3",
"serde",
"serde_json",
"serde_with_macros",
@ -4502,6 +4495,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "signature"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500"
dependencies = [
"digest 0.10.7",
"rand_core 0.6.4",
]
[[package]]
name = "simd-adler32"
version = "0.3.5"
@ -4590,9 +4593,9 @@ dependencies = [
[[package]]
name = "spki"
version = "0.5.4"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a"
dependencies = [
"base64ct",
"der",
@ -4611,104 +4614,204 @@ dependencies = [
[[package]]
name = "sqlx"
version = "0.6.3"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188"
checksum = "91ef53c86d2066e04f0ac6b1364f16d13d82388e2d07f11a5c71782345555761"
dependencies = [
"sqlx-core",
"sqlx-macros",
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
]
[[package]]
name = "sqlx-core"
version = "0.6.3"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029"
checksum = "8a22fd81e9c1ad53c562edb869ff042b215d4eadefefc4784bacfbfd19835945"
dependencies = [
"ahash 0.7.6",
"ahash 0.8.3",
"atoi",
"base64 0.13.1",
"bitflags 1.3.2",
"byteorder",
"bytes 1.4.0",
"crc",
"crossbeam-queue",
"digest 0.10.7",
"dirs",
"dotenvy",
"either",
"event-listener",
"flume",
"futures-channel",
"futures-core",
"futures-executor",
"futures-intrusive",
"futures-io",
"futures-util",
"generic-array",
"hashlink",
"hex",
"hkdf",
"hmac",
"indexmap",
"itoa 1.0.6",
"libc",
"libsqlite3-sys",
"indexmap 2.0.0",
"log",
"md-5",
"memchr",
"num-bigint",
"once_cell",
"paste",
"percent-encoding",
"rand 0.8.5",
"rsa",
"rustls 0.20.8",
"rustls",
"rustls-pemfile",
"serde",
"serde_json",
"sha1",
"sha2 0.10.6",
"smallvec",
"sqlformat",
"sqlx-rt",
"stringprep",
"thiserror",
"time 0.3.21",
"tokio",
"tokio-stream",
"tracing",
"url",
"webpki-roots 0.22.6",
"whoami",
"webpki-roots 0.23.0",
]
[[package]]
name = "sqlx-macros"
version = "0.6.3"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00bb7c096a202b8164c175614cbfb79fe0e1e0a3d50e0374526183ef2974e4a2"
dependencies = [
"proc-macro2",
"quote",
"sqlx-core",
"sqlx-macros-core",
"syn 1.0.109",
]
[[package]]
name = "sqlx-macros-core"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9"
checksum = "37d644623ab9699014e5b3cb61a040d16caa50fd477008f63f1399ae35498a58"
dependencies = [
"dotenvy",
"either",
"heck 0.4.1",
"hex",
"once_cell",
"proc-macro2",
"quote",
"serde",
"serde_json",
"sha2 0.10.6",
"sqlx-core",
"sqlx-rt",
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
"syn 1.0.109",
"tempfile",
"tokio",
"url",
]
[[package]]
name = "sqlx-rt"
version = "0.6.3"
name = "sqlx-mysql"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024"
checksum = "8264c59b28b6858796acfcedc660aa4c9075cc6e4ec8eb03cdca2a3e725726db"
dependencies = [
"atoi",
"base64 0.21.2",
"bitflags 2.3.1",
"byteorder",
"bytes 1.4.0",
"crc",
"digest 0.10.7",
"dotenvy",
"either",
"futures-channel",
"futures-core",
"futures-io",
"futures-util",
"generic-array",
"hex",
"hkdf",
"hmac",
"itoa 1.0.6",
"log",
"md-5",
"memchr",
"once_cell",
"tokio",
"tokio-rustls 0.23.4",
"percent-encoding",
"rand 0.8.5",
"rsa",
"serde",
"sha1",
"sha2 0.10.6",
"smallvec",
"sqlx-core",
"stringprep",
"thiserror",
"time 0.3.21",
"tracing",
"whoami",
]
[[package]]
name = "sqlx-postgres"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cab6147b81ca9213a7578f1b4c9d24c449a53953cd2222a7b5d7cd29a5c3139"
dependencies = [
"atoi",
"base64 0.21.2",
"bitflags 2.3.1",
"byteorder",
"crc",
"dotenvy",
"etcetera",
"futures-channel",
"futures-core",
"futures-io",
"futures-util",
"hex",
"hkdf",
"hmac",
"home",
"itoa 1.0.6",
"log",
"md-5",
"memchr",
"once_cell",
"rand 0.8.5",
"serde",
"serde_json",
"sha1",
"sha2 0.10.6",
"smallvec",
"sqlx-core",
"stringprep",
"thiserror",
"time 0.3.21",
"tracing",
"whoami",
]
[[package]]
name = "sqlx-sqlite"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59fba60afa64718104b71eec6984f8779d4caffff3b30cde91a75843c7efc126"
dependencies = [
"atoi",
"flume",
"futures-channel",
"futures-core",
"futures-executor",
"futures-intrusive",
"futures-util",
"libsqlite3-sys",
"log",
"percent-encoding",
"serde",
"sqlx-core",
"time 0.3.21",
"tracing",
"url",
]
[[package]]
@ -4746,7 +4849,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b"
dependencies = [
"new_debug_unreachable",
"once_cell",
"parking_lot 0.12.1",
"parking_lot",
"phf_shared 0.10.0",
"precomputed-hash",
"serde",
@ -4957,7 +5060,7 @@ dependencies = [
"ndk-sys",
"objc",
"once_cell",
"parking_lot 0.12.1",
"parking_lot",
"png",
"raw-window-handle",
"scopeguard",
@ -5390,7 +5493,7 @@ name = "tauri-plugin-stronghold"
version = "2.0.0-alpha.0"
dependencies = [
"hex",
"iota-crypto 0.20.1",
"iota-crypto 0.21.2",
"iota_stronghold",
"log",
"rand 0.8.5",
@ -5755,24 +5858,13 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
dependencies = [
"rustls 0.20.8",
"tokio",
"webpki",
]
[[package]]
name = "tokio-rustls"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5"
dependencies = [
"rustls 0.21.1",
"rustls",
"tokio",
]
@ -5809,10 +5901,10 @@ dependencies = [
"futures-util",
"log",
"native-tls",
"rustls 0.21.1",
"rustls",
"tokio",
"tokio-native-tls",
"tokio-rustls 0.24.0",
"tokio-rustls",
"tungstenite",
"webpki-roots 0.23.0",
]
@ -5858,7 +5950,7 @@ version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739"
dependencies = [
"indexmap",
"indexmap 1.9.3",
"serde",
"serde_spanned",
"toml_datetime",
@ -5878,6 +5970,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [
"cfg-if",
"log",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@ -5962,7 +6055,7 @@ dependencies = [
"log",
"native-tls",
"rand 0.8.5",
"rustls 0.21.1",
"rustls",
"sha1",
"thiserror",
"url",
@ -6427,10 +6520,6 @@ name = "whoami"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c70234412ca409cc04e864e89523cb0fc37f5e1344ebed5a3ebf4192b6b9f68"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "win7-notifications"

@ -18,15 +18,18 @@
"covector": "^0.9.0",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-config-standard-with-typescript": "^36.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-security": "^1.7.1",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"rollup": "^3.25.1",
"typescript": "^5.1.3"
},
"resolutions": {
"semver": ">=7.5.2"
},
"engines": {
"pnpm": ">=7.33.0"
}

@ -25,7 +25,7 @@ export class Authenticator {
challenge: string,
application: string,
registerData: string,
clientData: string
clientData: string,
): Promise<string> {
return await window.__TAURI_INVOKE__(
"plugin:authenticator|verify_registration",
@ -41,7 +41,7 @@ export class Authenticator {
async sign(
challenge: string,
application: string,
keyHandle: string
keyHandle: string,
): Promise<string> {
return await window.__TAURI_INVOKE__("plugin:authenticator|sign", {
timeout: 10000,
@ -57,7 +57,7 @@ export class Authenticator {
signData: string,
clientData: string,
keyHandle: string,
pubkey: string
pubkey: string,
): Promise<number> {
return await window.__TAURI_INVOKE__(
"plugin:authenticator|verify_signature",

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -52,7 +52,7 @@ enum LogLevel {
async function log(
level: LogLevel,
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
const traces = new Error().stack?.split("\n").map((line) => line.split("@"));
@ -95,7 +95,7 @@ async function log(
*/
export async function error(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Error, message, options);
}
@ -117,7 +117,7 @@ export async function error(
*/
export async function warn(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Warn, message, options);
}
@ -139,7 +139,7 @@ export async function warn(
*/
export async function info(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Info, message, options);
}
@ -161,7 +161,7 @@ export async function info(
*/
export async function debug(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Debug, message, options);
}
@ -183,7 +183,7 @@ export async function debug(
*/
export async function trace(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Trace, message, options);
}
@ -202,7 +202,7 @@ export async function attachConsole(): Promise<UnlistenFn> {
// TODO: Investigate security/detect-unsafe-regex
// eslint-disable-next-line no-control-regex, security/detect-unsafe-regex
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
""
"",
);
switch (payload.level) {

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -5,6 +5,11 @@
- [`ebb2eb2`](https://github.com/tauri-apps/plugins-workspace/commit/ebb2eb2fe2ebfbb70530d16a983d396aa5829aa1)([#274](https://github.com/tauri-apps/plugins-workspace/pull/274)) Recursively unescape saved patterns before allowing/forbidding them. This effectively prevents `.persisted-scope` files from blowing up, which caused Out-Of-Memory issues, while automatically fixing existing broken files seamlessly.
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
## \[0.1.2]
- Fix usage of directory patterns by removing glob asterisks at the end before allowing/forbidding them. This was causing them to be escaped, and so undesirable paths were allowed/forbidden while polluting the `.persisted_scope` file.
- [9174b80](https://github.com/tauri-apps/plugins-workspace/commit/9174b808dc37154999c119fcc3f31258a9c5a3fb) \[persisted scope] fix: handle recursive directory correctly ([#455](https://github.com/tauri-apps/plugins-workspace/pull/455)) on 2023-06-29
## \[0.1.1]
- The MSRV was raised to 1.64!

@ -15,7 +15,7 @@ use aho_corasick::AhoCorasick;
use serde::{Deserialize, Serialize};
use tauri::{
plugin::{Builder, TauriPlugin},
AppHandle, Manager, Runtime,
AppHandle, FsScope, FsScopeEvent, Manager, Runtime,
};
use tauri_plugin_fs::{FsExt, ScopeEvent as FsScopeEvent};
@ -52,6 +52,14 @@ enum Error {
Bincode(#[from] Box<bincode::ErrorKind>),
}
#[derive(Debug, Default, Deserialize, Serialize, Eq, PartialEq, Hash)]
enum TargetType {
#[default]
File,
Directory,
RecursiveDirectory,
}
#[derive(Debug, Default, Deserialize, Serialize)]
struct Scope {
allowed_paths: Vec<String>,
@ -68,6 +76,66 @@ fn fix_pattern(ac: &AhoCorasick, s: &str) -> String {
s
}
const RESURSIVE_DIRECTORY_SUFFIX: &str = "**";
const DIRECTORY_SUFFIX: &str = "*";
fn detect_scope_type(scope_state_path: &str) -> TargetType {
if scope_state_path.ends_with(RESURSIVE_DIRECTORY_SUFFIX) {
TargetType::RecursiveDirectory
} else if scope_state_path.ends_with(DIRECTORY_SUFFIX) {
TargetType::Directory
} else {
TargetType::File
}
}
fn fix_directory(path_str: &str) -> &Path {
let mut path = Path::new(path_str);
if path.ends_with(DIRECTORY_SUFFIX) || path.ends_with(RESURSIVE_DIRECTORY_SUFFIX) {
path = match path.parent() {
Some(value) => value,
None => return path,
};
}
path
}
fn allow_path(scope: &FsScope, path: &str) {
let target_type = detect_scope_type(path);
match target_type {
TargetType::File => {
let _ = scope.allow_file(path);
}
TargetType::Directory => {
// We remove the '*' at the end of it, else it will be escaped by the pattern.
let _ = scope.allow_directory(fix_directory(path), false);
}
TargetType::RecursiveDirectory => {
// We remove the '**' at the end of it, else it will be escaped by the pattern.
let _ = scope.allow_directory(fix_directory(path), true);
}
}
}
fn forbid_path(scope: &FsScope, path: &str) {
let target_type = detect_scope_type(path);
match target_type {
TargetType::File => {
let _ = scope.forbid_file(path);
}
TargetType::Directory => {
let _ = scope.forbid_directory(fix_directory(path), false);
}
TargetType::RecursiveDirectory => {
let _ = scope.forbid_directory(fix_directory(path), true);
}
}
}
fn save_scopes<R: Runtime>(app: &AppHandle<R>, app_dir: &Path, scope_state_path: &Path) {
if let Some(fs_scope) = app.try_fs_scope() {
let scope = Scope {
@ -118,21 +186,18 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
.map_err(Error::from)
.and_then(|scope| bincode::deserialize(&scope).map_err(Into::into))
.unwrap_or_default();
for allowed in &scope.allowed_paths {
let allowed = fix_pattern(&ac, allowed);
if let Some(s) = fs_scope {
let _ = s.allow_file(&allowed);
}
let _ = core_scopes.allow_file(&allowed);
allow_path(&fs_scope, &allowed);
#[cfg(feature = "protocol-asset")]
allow_path(&asset_protocol_scope, &allowed);
}
for forbidden in &scope.forbidden_patterns {
let forbidden = fix_pattern(&ac, forbidden);
if let Some(s) = fs_scope {
let _ = s.forbid_file(&forbidden);
}
let _ = core_scopes.forbid_file(&forbidden);
forbid_path(&fs_scope, &forbidden);
#[cfg(feature = "protocol-asset")]
forbid_path(&asset_protocol_scope, &forbidden);
}
// Manually save the fixed scopes to disk once.

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -5,7 +5,8 @@ description = "Interface with SQL databases."
authors = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
rust-version = { workspace = true }
#rust-version = { workspace = true }
rust-version = "1.65"
[package.metadata.docs.rs]
features = [ "sqlite" ]
@ -17,7 +18,7 @@ tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }
futures-core = "0.3"
sqlx = { version = "0.6", features = [ "runtime-tokio-rustls", "json", "time" ] }
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "json", "time" ] }
time = "0.3"
tokio = { version = "1", features = [ "sync" ] }

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -184,7 +184,7 @@ export class Store {
*/
async onKeyChange<T>(
key: string,
cb: (value: T | null) => void
cb: (value: T | null) => void,
): Promise<UnlistenFn> {
return await listen<ChangePayload<T>>("store://change", (event) => {
if (event.payload.path === this.path && event.payload.key === key) {
@ -201,7 +201,7 @@ export class Store {
* @since 2.0.0
*/
async onChange<T>(
cb: (key: string, value: T | null) => void
cb: (key: string, value: T | null) => void,
): Promise<UnlistenFn> {
return await listen<ChangePayload<T>>("store://change", (event) => {
if (event.payload.path === this.path) {

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -14,7 +14,7 @@ tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }
iota_stronghold = "1"
iota-crypto = "0.20"
iota-crypto = "0.21"
hex = "0.4"
zeroize = { version = "1", features = [ "zeroize_derive" ] }

@ -317,14 +317,14 @@ export class Store {
this.client = client;
}
async get(key: StoreKey): Promise<Uint8Array> {
async get(key: StoreKey): Promise<Uint8Array | null> {
return await window
.__TAURI_INVOKE__<number[]>("plugin:stronghold|get_store_record", {
snapshotPath: this.path,
client: this.client,
key: toBytesDto(key),
})
.then((v) => Uint8Array.from(v));
.then((v) => (v != null ? Uint8Array.from(v) : null));
}
async insert(
@ -409,7 +409,7 @@ export class Vault extends ProcedureExecutor {
snapshotPath: this.path,
client: this.client,
vault: this.name,
location,
recordPath: location.payload.record,
});
}
}

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -15,7 +15,7 @@ async function upload(
url: string,
filePath: string,
progressHandler?: ProgressHandler,
headers?: Map<string, string>
headers?: Map<string, string>,
): Promise<void> {
const ids = new Uint32Array(1);
window.crypto.getRandomValues(ids);
@ -43,7 +43,7 @@ async function download(
url: string,
filePath: string,
progressHandler?: ProgressHandler,
headers?: Map<string, string>
headers?: Map<string, string>,
): Promise<void> {
const ids = new Uint32Array(1);
window.crypto.getRandomValues(ids);

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -60,7 +60,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { WebSocket } from "@tauri-apps/plugin-websocket";
import WebSocket from "tauri-plugin-websocket-api";
const ws = await WebSocket.connect("wss://example.com");

@ -11,14 +11,14 @@
"tauri": "tauri"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.15.5",
"@tauri-apps/cli": "2.0.0-alpha.10",
"svelte": "^3.58.0",
"svelte-check": "^3.2.0",
"tslib": "^2.5.0",
"typescript": "^5.0.4",
"vite": "^4.3.9"
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.22.0",
"@tauri-apps/cli": "^1.4.0",
"svelte": "^4.0.4",
"svelte-check": "^3.4.4",
"tslib": "^2.6.0",
"typescript": "^5.1.6",
"vite": "^4.4.0"
},
"dependencies": {
"@tauri-apps/plugin-websocket": "link:../../"

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

@ -66,7 +66,7 @@ export default class WebSocket {
m = { type: "Binary", data: message };
} else {
throw new Error(
"invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array"
"invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array",
);
}
return await window.__TAURI_INVOKE__("plugin:websocket|send", {

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

File diff suppressed because it is too large Load Diff

@ -27,6 +27,8 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
<!-- Add the branch for installations using git! -->
```sh
pnpm add @tauri-apps/plugin-{{plugin-name}}
# or

@ -5,7 +5,7 @@ import { createConfig } from "../rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});

Loading…
Cancel
Save