Cleanups and licensing fix

This commit is contained in:
Christien Rioux 2025-09-03 10:27:23 -04:00
parent 6a79e13024
commit 34c82ec128
41 changed files with 14725 additions and 12558 deletions

View file

@ -37,6 +37,7 @@
- Added SequenceOrdering enum to represent ordering mode for protocols rather than a bool - Added SequenceOrdering enum to represent ordering mode for protocols rather than a bool
- `RecordKey`s are now validated on both server side and client side of DHT RPC operations, closes [#299](https://gitlab.com/veilid/veilid/-/issues/299) - `RecordKey`s are now validated on both server side and client side of DHT RPC operations, closes [#299](https://gitlab.com/veilid/veilid/-/issues/299)
- Revert punishment for FailedToVerifySenderPeerInfo, with a better peer info filter, fixes [#470](https://gitlab.com/veilid/veilid/-/issues/470) - Revert punishment for FailedToVerifySenderPeerInfo, with a better peer info filter, fixes [#470](https://gitlab.com/veilid/veilid/-/issues/470)
- Update keyring-manager to eliminate licensing issue
- veilid-python: - veilid-python:
- Correction of type hints - Correction of type hints

362
Cargo.lock generated
View file

@ -212,9 +212,9 @@ checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
[[package]] [[package]]
name = "arboard" name = "arboard"
version = "3.6.0" version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55f533f8e0af236ffe5eb979b99381df3258853f00ba2e44b6e1955292c75227" checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf"
dependencies = [ dependencies = [
"clipboard-win", "clipboard-win",
"log", "log",
@ -223,6 +223,7 @@ dependencies = [
"objc2-foundation", "objc2-foundation",
"parking_lot 0.12.4", "parking_lot 0.12.4",
"percent-encoding", "percent-encoding",
"windows-sys 0.60.2",
"x11rb", "x11rb",
] ]
@ -291,9 +292,9 @@ dependencies = [
[[package]] [[package]]
name = "async-executor" name = "async-executor"
version = "1.13.2" version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa" checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8"
dependencies = [ dependencies = [
"async-task", "async-task",
"concurrent-queue", "concurrent-queue",
@ -746,9 +747,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.9.2" version = "2.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29" checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
[[package]] [[package]]
name = "bitmaps" name = "bitmaps"
@ -883,28 +884,29 @@ dependencies = [
[[package]] [[package]]
name = "capnp" name = "capnp"
version = "0.21.4" version = "0.21.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "def25bdbbc2758b363d79129c7f277520e3347e8b647c404d4823591f837c4ad" checksum = "f62fcad97587224e2a1bd12ec1c7c0e95b93cefd285763a174cf1b34048c6437"
dependencies = [ dependencies = [
"embedded-io 0.6.1", "embedded-io 0.6.1",
] ]
[[package]] [[package]]
name = "capnpc" name = "capnpc"
version = "0.21.2" version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d93a18ec8176d4a87f1852b6a560b4196729365c01ba3cad03b73a376a23c56e" checksum = "6da96dcb0a0e0c526daf42bac55e1550f18ad973df9ef9ba75204f332c80ad16"
dependencies = [ dependencies = [
"capnp", "capnp",
] ]
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.33" version = "1.2.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee0f8803222ba5a7e2777dd72ca451868909b1ac410621b676adf07280e9b5f" checksum = "590f9024a68a8c40351881787f1934dc11afd69090f5edb6831464694d836ea3"
dependencies = [ dependencies = [
"find-msvc-tools",
"shlex", "shlex",
] ]
@ -1028,9 +1030,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.45" version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -1038,9 +1040,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.44" version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -1051,9 +1053,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.45" version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6" checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -1091,7 +1093,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
dependencies = [ dependencies = [
"thiserror 2.0.15", "thiserror 2.0.16",
] ]
[[package]] [[package]]
@ -1161,13 +1163,13 @@ dependencies = [
[[package]] [[package]]
name = "config" name = "config"
version = "0.15.14" version = "0.15.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4092bf3922a966e2bd74640b80f36c73eaa7251a4fd0fbcda1f8a4de401352" checksum = "0faa974509d38b33ff89282db9c3295707ccf031727c0de9772038ec526852ba"
dependencies = [ dependencies = [
"pathdiff", "pathdiff",
"serde", "serde",
"winnow 0.7.12", "winnow 0.7.13",
"yaml-rust2 0.10.3", "yaml-rust2 0.10.3",
] ]
@ -1263,6 +1265,16 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "core-foundation"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]] [[package]]
name = "core-foundation-sys" name = "core-foundation-sys"
version = "0.8.7" version = "0.8.7"
@ -1314,7 +1326,7 @@ version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"crossterm_winapi", "crossterm_winapi",
"libc", "libc",
"mio 0.8.11", "mio 0.8.11",
@ -1330,7 +1342,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"crossterm_winapi", "crossterm_winapi",
"derive_more", "derive_more",
"document-features", "document-features",
@ -1527,12 +1539,12 @@ dependencies = [
[[package]] [[package]]
name = "darling" name = "darling"
version = "0.21.2" version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08440b3dd222c3d0433e63e097463969485f112baff337dfdaca043a0d760570" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"
dependencies = [ dependencies = [
"darling_core 0.21.2", "darling_core 0.21.3",
"darling_macro 0.21.2", "darling_macro 0.21.3",
] ]
[[package]] [[package]]
@ -1565,9 +1577,9 @@ dependencies = [
[[package]] [[package]]
name = "darling_core" name = "darling_core"
version = "0.21.2" version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25b7912bc28a04ab1b7715a68ea03aaa15662b43a1a4b2c480531fd19f8bf7e" checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4"
dependencies = [ dependencies = [
"fnv", "fnv",
"ident_case", "ident_case",
@ -1600,11 +1612,11 @@ dependencies = [
[[package]] [[package]]
name = "darling_macro" name = "darling_macro"
version = "0.21.2" version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce154b9bea7fb0c8e8326e62d00354000c36e79770ff21b8c84e3aa267d9d531" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
dependencies = [ dependencies = [
"darling_core 0.21.2", "darling_core 0.21.3",
"quote", "quote",
"syn 2.0.106", "syn 2.0.106",
] ]
@ -1640,9 +1652,9 @@ dependencies = [
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.4.0" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc"
dependencies = [ dependencies = [
"powerfmt", "powerfmt",
"serde", "serde",
@ -1727,7 +1739,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"objc2", "objc2",
] ]
@ -1871,9 +1883,9 @@ dependencies = [
[[package]] [[package]]
name = "enumset" name = "enumset"
version = "1.1.9" version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f50acec76c668b4621fe3694e5ddee53c8fae2a03410026f50947d195eb44dc1" checksum = "25b07a8dfbbbfc0064c0a6bdf9edcf966de6b1c33ce344bdeca3b41615452634"
dependencies = [ dependencies = [
"enumset_derive", "enumset_derive",
"serde", "serde",
@ -1881,11 +1893,11 @@ dependencies = [
[[package]] [[package]]
name = "enumset_derive" name = "enumset_derive"
version = "0.13.1" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588eaef9dbc5d72c5fa4edf162527e67dab5d14ba61519ef7c8e233d5bdc092c" checksum = "f43e744e4ea338060faee68ed933e46e722fb7f3617e722a5772d7e856d8b3ce"
dependencies = [ dependencies = [
"darling 0.21.2", "darling 0.21.3",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.106", "syn 2.0.106",
@ -2020,16 +2032,22 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.25" version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed"
dependencies = [ dependencies = [
"cfg-if 1.0.3", "cfg-if 1.0.3",
"libc", "libc",
"libredox", "libredox",
"windows-sys 0.59.0", "windows-sys 0.60.2",
] ]
[[package]]
name = "find-msvc-tools"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e178e4fba8a2726903f6ba98a6d221e76f9c12c650d5dc0e6afdc50677b49650"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.1.2" version = "1.1.2"
@ -2099,9 +2117,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.2.1" version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
] ]
@ -2273,12 +2291,12 @@ dependencies = [
[[package]] [[package]]
name = "gethostname" name = "gethostname"
version = "0.4.3" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" checksum = "fc257fdb4038301ce4b9cd1b3b51704509692bb3ff716a410cbd07925d9dae55"
dependencies = [ dependencies = [
"libc", "rustix 1.0.8",
"windows-targets 0.48.5", "windows-targets 0.52.6",
] ]
[[package]] [[package]]
@ -2303,7 +2321,7 @@ dependencies = [
"cfg-if 1.0.3", "cfg-if 1.0.3",
"libc", "libc",
"r-efi", "r-efi",
"wasi 0.14.2+wasi-0.2.4", "wasi 0.14.3+wasi-0.2.4",
] ]
[[package]] [[package]]
@ -2398,7 +2416,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-util", "futures-util",
"http 0.2.12", "http 0.2.12",
"indexmap 2.10.0", "indexmap 2.11.0",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@ -2865,9 +2883,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "idna" name = "idna"
version = "1.0.3" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [ dependencies = [
"idna_adapter", "idna_adapter",
"smallvec", "smallvec",
@ -2942,9 +2960,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.10.0" version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.5", "hashbrown 0.15.5",
@ -2982,11 +3000,11 @@ dependencies = [
[[package]] [[package]]
name = "io-uring" name = "io-uring"
version = "0.7.9" version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"libc", "libc",
] ]
@ -3091,14 +3109,12 @@ checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd"
[[package]] [[package]]
name = "keyring-manager" name = "keyring-manager"
version = "0.5.1" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aed4aad1a5c0ae5cfd990fd8cb7e1e31d1742e04c964a62b6928962838c766d" checksum = "7118537d59e34bd487248fb745ec6c21625d216a4722712c8fc581f6ec6bd68e"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"core-foundation",
"core-foundation-sys",
"directories", "directories",
"fs4", "fs4",
"jni", "jni",
@ -3107,11 +3123,11 @@ dependencies = [
"ndk", "ndk",
"ndk-glue", "ndk-glue",
"secret-service", "secret-service",
"security-framework", "security-framework 2.11.1",
"security-framework-sys", "security-framework 3.3.0",
"serde", "serde",
"serde_cbor", "serde_cbor",
"snailquote", "unicode_categories",
"winapi", "winapi",
] ]
@ -3216,7 +3232,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"libc", "libc",
"redox_syscall 0.5.17", "redox_syscall 0.5.17",
] ]
@ -3331,11 +3347,11 @@ checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
[[package]] [[package]]
name = "matchers" name = "matchers"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
dependencies = [ dependencies = [
"regex-automata 0.1.10", "regex-automata",
] ]
[[package]] [[package]]
@ -3447,7 +3463,7 @@ dependencies = [
"openssl-probe", "openssl-probe",
"openssl-sys", "openssl-sys",
"schannel", "schannel",
"security-framework", "security-framework 2.11.1",
"security-framework-sys", "security-framework-sys",
"tempfile", "tempfile",
] ]
@ -3578,7 +3594,7 @@ dependencies = [
"log", "log",
"netlink-packet-core", "netlink-packet-core",
"netlink-sys", "netlink-sys",
"thiserror 2.0.15", "thiserror 2.0.16",
] ]
[[package]] [[package]]
@ -3625,7 +3641,7 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"libc", "libc",
] ]
@ -3636,7 +3652,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"cfg_aliases", "cfg_aliases",
"libc", "libc",
@ -3648,7 +3664,7 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"cfg_aliases", "cfg_aliases",
"libc", "libc",
@ -3684,12 +3700,11 @@ dependencies = [
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.50.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
dependencies = [ dependencies = [
"overload", "windows-sys 0.52.0",
"winapi",
] ]
[[package]] [[package]]
@ -3816,7 +3831,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6f29f568bec459b0ddff777cec4fe3fd8666d82d5a40ebd0ff7e66134f89bcc" checksum = "e6f29f568bec459b0ddff777cec4fe3fd8666d82d5a40ebd0ff7e66134f89bcc"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"objc2", "objc2",
"objc2-core-graphics", "objc2-core-graphics",
"objc2-foundation", "objc2-foundation",
@ -3828,7 +3843,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"dispatch2", "dispatch2",
"objc2", "objc2",
] ]
@ -3839,7 +3854,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "989c6c68c13021b5c2d6b71456ebb0f9dc78d752e86a98da7c716f4f9470f5a4" checksum = "989c6c68c13021b5c2d6b71456ebb0f9dc78d752e86a98da7c716f4f9470f5a4"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"dispatch2", "dispatch2",
"objc2", "objc2",
"objc2-core-foundation", "objc2-core-foundation",
@ -3858,7 +3873,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c" checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"objc2", "objc2",
"objc2-core-foundation", "objc2-core-foundation",
] ]
@ -3869,7 +3884,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7282e9ac92529fa3457ce90ebb15f4ecbc383e8338060960760fa2cf75420c3c" checksum = "7282e9ac92529fa3457ce90ebb15f4ecbc383e8338060960760fa2cf75420c3c"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"objc2", "objc2",
"objc2-core-foundation", "objc2-core-foundation",
] ]
@ -3907,7 +3922,7 @@ version = "0.10.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"foreign-types", "foreign-types",
"libc", "libc",
@ -4148,12 +4163,6 @@ dependencies = [
"log", "log",
] ]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "owning_ref" name = "owning_ref"
version = "0.4.1" version = "0.4.1"
@ -4268,9 +4277,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.3.1" version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]] [[package]]
name = "pharos" name = "pharos"
@ -4432,9 +4441,9 @@ dependencies = [
[[package]] [[package]]
name = "potential_utf" name = "potential_utf"
version = "0.1.2" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
dependencies = [ dependencies = [
"zerovec", "zerovec",
] ]
@ -4652,7 +4661,7 @@ version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
] ]
[[package]] [[package]]
@ -4688,47 +4697,32 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.11.1" version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-automata 0.4.9", "regex-automata",
"regex-syntax 0.8.5", "regex-syntax",
] ]
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.1.10" version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
dependencies = [
"regex-syntax 0.6.29",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-syntax 0.8.5", "regex-syntax",
] ]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.29" version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
@ -4836,7 +4830,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"fallible-iterator", "fallible-iterator",
"fallible-streaming-iterator", "fallible-streaming-iterator",
"hashlink", "hashlink",
@ -4885,7 +4879,7 @@ version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.4.15", "linux-raw-sys 0.4.15",
@ -4898,7 +4892,7 @@ version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.9.4", "linux-raw-sys 0.9.4",
@ -4953,7 +4947,7 @@ dependencies = [
"futures-util", "futures-util",
"pin-project 1.1.10", "pin-project 1.1.10",
"thingbuf", "thingbuf",
"thiserror 2.0.15", "thiserror 2.0.16",
"unicode-segmentation", "unicode-segmentation",
] ]
@ -5091,8 +5085,21 @@ version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"core-foundation", "core-foundation 0.9.4",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80fb1d92c5028aa318b4b8bd7302a5bfcf48be96a37fc6fc790f806b0004ee0c"
dependencies = [
"bitflags 2.9.4",
"core-foundation 0.10.1",
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
"security-framework-sys", "security-framework-sys",
@ -5262,7 +5269,7 @@ dependencies = [
"chrono", "chrono",
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.10.0", "indexmap 2.11.0",
"schemars 0.9.0", "schemars 0.9.0",
"schemars 1.0.4", "schemars 1.0.4",
"serde", "serde",
@ -5290,7 +5297,7 @@ version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [ dependencies = [
"indexmap 2.10.0", "indexmap 2.11.0",
"itoa", "itoa",
"ryu", "ryu",
"serde", "serde",
@ -5303,7 +5310,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f" checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f"
dependencies = [ dependencies = [
"indexmap 2.10.0", "indexmap 2.11.0",
"itoa", "itoa",
"ryu", "ryu",
"serde", "serde",
@ -5491,16 +5498,6 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "snailquote"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec62a949bda7f15800481a711909f946e1204f2460f89210eaf7f57730f88f86"
dependencies = [
"thiserror 1.0.69",
"unicode_categories",
]
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.10" version = "0.4.10"
@ -5658,7 +5655,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"core-foundation", "core-foundation 0.9.4",
"system-configuration-sys", "system-configuration-sys",
] ]
@ -5734,11 +5731,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.15" version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850" checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
dependencies = [ dependencies = [
"thiserror-impl 2.0.15", "thiserror-impl 2.0.16",
] ]
[[package]] [[package]]
@ -5754,9 +5751,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.15" version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0" checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -5784,12 +5781,11 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.41" version = "0.3.43"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" checksum = "83bde6f1ec10e72d583d91623c939f623002284ef622b87de38cfd546cbf2031"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa",
"libc", "libc",
"num-conv", "num-conv",
"num_threads", "num_threads",
@ -5801,15 +5797,15 @@ dependencies = [
[[package]] [[package]]
name = "time-core" name = "time-core"
version = "0.1.4" version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.22" version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
dependencies = [ dependencies = [
"num-conv", "num-conv",
"time-core", "time-core",
@ -5953,7 +5949,7 @@ version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [ dependencies = [
"indexmap 2.10.0", "indexmap 2.11.0",
"toml_datetime", "toml_datetime",
"winnow 0.5.40", "winnow 0.5.40",
] ]
@ -5964,12 +5960,12 @@ version = "0.22.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [ dependencies = [
"indexmap 2.10.0", "indexmap 2.11.0",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_write", "toml_write",
"winnow 0.7.12", "winnow 0.7.13",
] ]
[[package]] [[package]]
@ -6232,14 +6228,14 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.19" version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
dependencies = [ dependencies = [
"matchers", "matchers",
"nu-ansi-term", "nu-ansi-term",
"once_cell", "once_cell",
"regex", "regex-automata",
"sharded-slab", "sharded-slab",
"smallvec", "smallvec",
"thread_local", "thread_local",
@ -6406,13 +6402,14 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.4" version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
"percent-encoding", "percent-encoding",
"serde",
] ]
[[package]] [[package]]
@ -6511,8 +6508,8 @@ dependencies = [
"async-tungstenite 0.23.0", "async-tungstenite 0.23.0",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"chrono", "chrono",
"clap 4.5.45", "clap 4.5.47",
"config 0.15.14", "config 0.15.15",
"console", "console",
"crossbeam-channel", "crossbeam-channel",
"cursive", "cursive",
@ -6664,7 +6661,7 @@ name = "veilid-core-examples-private-route"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-stdin", "async-stdin",
"clap 4.5.45", "clap 4.5.47",
"ctrlc", "ctrlc",
"data-encoding", "data-encoding",
"tokio", "tokio",
@ -6753,7 +6750,7 @@ dependencies = [
"backtrace", "backtrace",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"chrono", "chrono",
"clap 4.5.45", "clap 4.5.47",
"color-eyre", "color-eyre",
"config 0.14.1", "config 0.14.1",
"console-subscriber", "console-subscriber",
@ -6813,7 +6810,7 @@ dependencies = [
"backtrace", "backtrace",
"cfg-if 1.0.3", "cfg-if 1.0.3",
"chrono", "chrono",
"clap 4.5.45", "clap 4.5.47",
"console_error_panic_hook", "console_error_panic_hook",
"ctrlc", "ctrlc",
"eyre", "eyre",
@ -6954,11 +6951,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.14.2+wasi-0.2.4" version = "0.14.3+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95"
dependencies = [ dependencies = [
"wit-bindgen-rt", "wit-bindgen",
] ]
[[package]] [[package]]
@ -7308,7 +7305,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "193cae8e647981c35bc947fdd57ba7928b1fa0d4a79305f6dd2dc55221ac35ac" checksum = "193cae8e647981c35bc947fdd57ba7928b1fa0d4a79305f6dd2dc55221ac35ac"
dependencies = [ dependencies = [
"bitflags 2.9.2", "bitflags 2.9.4",
"widestring", "widestring",
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
@ -7621,9 +7618,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.7.12" version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -7639,13 +7636,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "wit-bindgen-rt" name = "wit-bindgen"
version = "0.39.0" version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814"
dependencies = [
"bitflags 2.9.2",
]
[[package]] [[package]]
name = "writeable" name = "writeable"
@ -7661,7 +7655,7 @@ checksum = "ed39ff9f8b2eda91bf6390f9f49eee93d655489e15708e3bb638c1c4f07cecb4"
dependencies = [ dependencies = [
"async-tungstenite 0.28.2", "async-tungstenite 0.28.2",
"async_io_stream", "async_io_stream",
"bitflags 2.9.2", "bitflags 2.9.4",
"futures-core", "futures-core",
"futures-io", "futures-io",
"futures-sink", "futures-sink",
@ -7685,7 +7679,7 @@ dependencies = [
"pharos", "pharos",
"rustc_version", "rustc_version",
"send_wrapper 0.6.0", "send_wrapper 0.6.0",
"thiserror 2.0.15", "thiserror 2.0.16",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
@ -7693,20 +7687,20 @@ dependencies = [
[[package]] [[package]]
name = "x11rb" name = "x11rb"
version = "0.13.1" version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
dependencies = [ dependencies = [
"gethostname", "gethostname",
"rustix 0.38.44", "rustix 1.0.8",
"x11rb-protocol", "x11rb-protocol",
] ]
[[package]] [[package]]
name = "x11rb-protocol" name = "x11rb-protocol"
version = "0.13.1" version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
[[package]] [[package]]
name = "x25519-dalek" name = "x25519-dalek"

View file

@ -24,6 +24,7 @@ cursive = { git = "https://gitlab.com/veilid/cursive.git" }
cursive_core = { git = "https://gitlab.com/veilid/cursive.git" } cursive_core = { git = "https://gitlab.com/veilid/cursive.git" }
# For local development # For local development
# keyring-manager = { path = "../keyring-manager" }
# keyvaluedb = { path = "../keyvaluedb/keyvaluedb" } # keyvaluedb = { path = "../keyvaluedb/keyvaluedb" }
# keyvaluedb-memorydb = { path = "../keyvaluedb/keyvaluedb-memorydb" } # keyvaluedb-memorydb = { path = "../keyvaluedb/keyvaluedb-memorydb" }
# keyvaluedb-sqlite = { path = "../keyvaluedb/keyvaluedb-sqlite" } # keyvaluedb-sqlite = { path = "../keyvaluedb/keyvaluedb-sqlite" }

View file

@ -199,7 +199,7 @@ futures-util = { version = "0.3.31", default-features = false, features = [
] } ] }
# Data structures # Data structures
keyring-manager = "0.5.1" keyring-manager = "0.6.0"
keyvaluedb-sqlite = "0.1.3" keyvaluedb-sqlite = "0.1.3"
# Network # Network

View file

@ -141,6 +141,14 @@ pub trait CryptoSystem {
} }
Ok(()) Ok(())
} }
fn check_keypair(&self, keypair: &KeyPair) -> VeilidAPIResult<()> {
if keypair.kind() != self.kind() {
apibail_generic!("incorrect keypair kind");
}
self.check_public_key(&keypair.key())?;
self.check_secret_key(&keypair.secret())?;
Ok(())
}
fn validate_keypair(&self, key: &PublicKey, secret: &SecretKey) -> VeilidAPIResult<bool>; fn validate_keypair(&self, key: &PublicKey, secret: &SecretKey) -> VeilidAPIResult<bool>;
fn validate_hash(&self, data: &[u8], hash: &HashDigest) -> VeilidAPIResult<bool>; fn validate_hash(&self, data: &[u8], hash: &HashDigest) -> VeilidAPIResult<bool>;

View file

@ -240,6 +240,45 @@ impl Crypto {
self.get_async(best_crypto_kind()).unwrap() self.get_async(best_crypto_kind()).unwrap()
} }
// Convenience validators
pub fn check_shared_secret(&self, secret: &SharedSecret) -> VeilidAPIResult<()> {
let Some(vcrypto) = self.get(secret.kind()) else {
apibail_generic!("unsupported crypto kind");
};
vcrypto.check_shared_secret(secret)
}
pub fn check_hash_digest(&self, hash: &HashDigest) -> VeilidAPIResult<()> {
let Some(vcrypto) = self.get(hash.kind()) else {
apibail_generic!("unsupported crypto kind");
};
vcrypto.check_hash_digest(hash)
}
pub fn check_public_key(&self, key: &PublicKey) -> VeilidAPIResult<()> {
let Some(vcrypto) = self.get(key.kind()) else {
apibail_generic!("unsupported crypto kind");
};
vcrypto.check_public_key(key)
}
pub fn check_secret_key(&self, key: &SecretKey) -> VeilidAPIResult<()> {
let Some(vcrypto) = self.get(key.kind()) else {
apibail_generic!("unsupported crypto kind");
};
vcrypto.check_secret_key(key)
}
pub fn check_signature(&self, signature: &Signature) -> VeilidAPIResult<()> {
let Some(vcrypto) = self.get(signature.kind()) else {
apibail_generic!("unsupported crypto kind");
};
vcrypto.check_signature(signature)
}
pub fn check_keypair(&self, key_pair: &KeyPair) -> VeilidAPIResult<()> {
let Some(vcrypto) = self.get(key_pair.kind()) else {
apibail_generic!("unsupported crypto kind");
};
vcrypto.check_keypair(key_pair)
}
/// BareSignature set verification /// BareSignature set verification
/// Returns Some() the set of signature cryptokinds that validate and are supported /// Returns Some() the set of signature cryptokinds that validate and are supported
/// Returns None if any cryptokinds are supported and do not validate /// Returns None if any cryptokinds are supported and do not validate

View file

@ -373,6 +373,28 @@ impl RoutingTable {
false false
} }
// Convenience validators
pub fn check_route_id(&self, route_id: &RouteId) -> VeilidAPIResult<()> {
let crypto = self.crypto();
let Some(vcrypto) = crypto.get(route_id.kind()) else {
apibail_generic!("unsupported crypto kind");
};
if route_id.ref_value().len() != vcrypto.hash_digest_length() {
apibail_generic!("invalid route id length");
}
Ok(())
}
pub fn check_node_id(&self, node_id: &NodeId) -> VeilidAPIResult<()> {
let crypto = self.crypto();
let Some(_) = crypto.get(node_id.kind()) else {
apibail_generic!("unsupported crypto kind");
};
if node_id.ref_value().len() != HASH_COORDINATE_LENGTH {
apibail_generic!("invalid node id length");
}
Ok(())
}
/// Produce node id from public key /// Produce node id from public key
pub fn generate_node_id(&self, public_key: &PublicKey) -> VeilidAPIResult<NodeId> { pub fn generate_node_id(&self, public_key: &PublicKey) -> VeilidAPIResult<NodeId> {
if public_key.ref_value().len() == HASH_COORDINATE_LENGTH { if public_key.ref_value().len() == HASH_COORDINATE_LENGTH {

View file

@ -559,6 +559,33 @@ impl StorageManager {
) )
} }
/// Validate a record key
pub(crate) fn check_record_key(&self, record_key: &RecordKey) -> VeilidAPIResult<()> {
let crypto = self.crypto();
let Some(vcrypto) = crypto.get(record_key.kind()) else {
apibail_generic!("unsupported record key kind");
};
if record_key.value().key().len() != HASH_COORDINATE_LENGTH {
apibail_generic!(format!(
"invalid record key length: {} != {}",
record_key.value().key().len(),
HASH_COORDINATE_LENGTH
));
}
if let Some(encryption_key) = record_key.value().encryption_key() {
if encryption_key.len() != vcrypto.shared_secret_length() {
apibail_generic!(format!(
"invalid encryption key length: {} != {}",
encryption_key.len(),
vcrypto.shared_secret_length()
));
}
}
Ok(())
}
/// Create a local record from scratch with a new owner key, open it, and return the opened descriptor /// Create a local record from scratch with a new owner key, open it, and return the opened descriptor
pub async fn create_record( pub async fn create_record(
&self, &self,
@ -660,8 +687,7 @@ impl StorageManager {
// If we got nothing back, the key wasn't found // If we got nothing back, the key wasn't found
if result.inspect_result.opt_descriptor().is_none() { if result.inspect_result.opt_descriptor().is_none() {
// No result // No result
let opaque_record_key = record_key.opaque(); apibail_key_not_found!(record_key.opaque());
apibail_key_not_found!(opaque_record_key);
}; };
// Check again to see if we have a local record already or not // Check again to see if we have a local record already or not
@ -1195,10 +1221,10 @@ impl StorageManager {
// Obtain the inner state lock // Obtain the inner state lock
let mut inner = self.inner.lock().await; let mut inner = self.inner.lock().await;
let opaque_record_key = record_key.opaque();
// Get the safety selection and the writer we opened this record // Get the safety selection and the writer we opened this record
let (safety_selection, opt_watcher) = { let (safety_selection, opt_watcher) = {
let opaque_record_key = record_key.opaque();
let Some(opened_record) = inner.opened_records.get(&opaque_record_key) else { let Some(opened_record) = inner.opened_records.get(&opaque_record_key) else {
// Record must be opened already to change watch // Record must be opened already to change watch
apibail_generic!("record not open"); apibail_generic!("record not open");
@ -1218,7 +1244,6 @@ impl StorageManager {
// Get the schema so we can truncate the watch to the number of subkeys // Get the schema so we can truncate the watch to the number of subkeys
let schema = if let Some(lrs) = inner.local_record_store.as_ref() { let schema = if let Some(lrs) = inner.local_record_store.as_ref() {
let opaque_record_key = record_key.opaque();
let Some(schema) = lrs.peek_record(&opaque_record_key, |r| r.schema()) else { let Some(schema) = lrs.peek_record(&opaque_record_key, |r| r.schema()) else {
apibail_generic!("no local record found"); apibail_generic!("no local record found");
}; };
@ -1804,7 +1829,6 @@ impl StorageManager {
} }
// Write open record // Write open record
let opaque_record_key = record_key.opaque();
inner inner
.opened_records .opened_records
.entry(opaque_record_key) .entry(opaque_record_key)

View file

@ -227,6 +227,9 @@ impl VeilidAPI {
#[instrument(target = "veilid_api", level = "debug", skip(self), fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", skip(self), fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub fn generate_member_id(&self, writer_key: &PublicKey) -> VeilidAPIResult<MemberId> { pub fn generate_member_id(&self, writer_key: &PublicKey) -> VeilidAPIResult<MemberId> {
veilid_log!(self debug "VeilidAPI::generate_member_id(writer_key: {:?}", writer_key); veilid_log!(self debug "VeilidAPI::generate_member_id(writer_key: {:?}", writer_key);
self.crypto()?.check_public_key(writer_key)?;
let storage_manager = self.core_context()?.storage_manager(); let storage_manager = self.core_context()?.storage_manager();
storage_manager.generate_member_id(writer_key) storage_manager.generate_member_id(writer_key)
} }
@ -340,7 +343,10 @@ impl VeilidAPI {
pub fn release_private_route(&self, route_id: RouteId) -> VeilidAPIResult<()> { pub fn release_private_route(&self, route_id: RouteId) -> VeilidAPIResult<()> {
veilid_log!(self debug veilid_log!(self debug
"VeilidAPI::release_private_route(route_id: {:?})", route_id); "VeilidAPI::release_private_route(route_id: {:?})", route_id);
let routing_table = self.core_context()?.routing_table(); let routing_table = self.core_context()?.routing_table();
routing_table.check_route_id(&route_id)?;
let rss = routing_table.route_spec_store(); let rss = routing_table.route_spec_store();
if !rss.release_route(route_id.clone()) { if !rss.release_route(route_id.clone()) {
apibail_invalid_argument!("release_private_route", "key", route_id); apibail_invalid_argument!("release_private_route", "key", route_id);

View file

@ -108,7 +108,7 @@ impl RoutingContext {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::with_safety(self: {:?}, safety_selection: {:?})", self, safety_selection); "RoutingContext::with_safety(self: {:?}, safety_selection: {:?})", self, safety_selection);
if let SafetySelection::Unsafe(_) = safety_selection { if let SafetySelection::Unsafe(_) = &safety_selection {
#[cfg(not(feature = "footgun"))] #[cfg(not(feature = "footgun"))]
{ {
return Err(VeilidAPIError::generic( return Err(VeilidAPIError::generic(
@ -117,6 +117,15 @@ impl RoutingContext {
} }
} }
if let SafetySelection::Safe(safe) = &safety_selection {
if let Some(preferred_route) = &safe.preferred_route {
self.api
.core_context()?
.routing_table()
.check_route_id(preferred_route)?;
}
}
Ok(Self { Ok(Self {
api: self.api.clone(), api: self.api.clone(),
unlocked_inner: Arc::new(RoutingContextUnlockedInner { safety_selection }), unlocked_inner: Arc::new(RoutingContextUnlockedInner { safety_selection }),
@ -179,6 +188,24 @@ impl RoutingContext {
.map_err(VeilidAPIError::invalid_target) .map_err(VeilidAPIError::invalid_target)
} }
fn check_target(&self, target: &Target) -> VeilidAPIResult<()> {
match target {
Target::NodeId(node_id) => {
self.api
.core_context()?
.routing_table()
.check_node_id(node_id)?;
}
Target::RouteId(route_id) => {
self.api
.core_context()?
.routing_table()
.check_route_id(route_id)?;
}
}
Ok(())
}
#[instrument(target = "veilid_api", level = "debug", skip(message), fields(__VEILID_LOG_KEY = self.log_key(), message_len = message.len()), ret, err)] #[instrument(target = "veilid_api", level = "debug", skip(message), fields(__VEILID_LOG_KEY = self.log_key(), message_len = message.len()), ret, err)]
async fn internal_app_call( async fn internal_app_call(
&self, &self,
@ -189,6 +216,8 @@ impl RoutingContext {
"RoutingContext::app_call(self: {:?}, target: {:?}, message_len: {:?})", self, target, message.len()); "RoutingContext::app_call(self: {:?}, target: {:?}, message_len: {:?})", self, target, message.len());
veilid_log!(self trace "message: {:?}", message); veilid_log!(self trace "message: {:?}", message);
self.check_target(&target)?;
let rpc_processor = self.api.core_context()?.rpc_processor(); let rpc_processor = self.api.core_context()?.rpc_processor();
// Get destination // Get destination
@ -252,6 +281,8 @@ impl RoutingContext {
"RoutingContext::app_message(self: {:?}, target: {:?}, message_len: {})", self, target, message.len()); "RoutingContext::app_message(self: {:?}, target: {:?}, message_len: {})", self, target, message.len());
veilid_log!(self trace "message: {:?}", message); veilid_log!(self trace "message: {:?}", message);
self.check_target(&target)?;
let rpc_processor = self.api.core_context()?.rpc_processor(); let rpc_processor = self.api.core_context()?.rpc_processor();
// Get destination // Get destination
@ -317,6 +348,11 @@ impl RoutingContext {
"RoutingContext::get_dht_record_key(self: {:?} schema: {:?}, owner_key: {:?}, encryption_key: {:?}", self, schema, owner_key, encryption_key); "RoutingContext::get_dht_record_key(self: {:?} schema: {:?}, owner_key: {:?}, encryption_key: {:?}", self, schema, owner_key, encryption_key);
schema.validate()?; schema.validate()?;
self.api.crypto()?.check_public_key(&owner_key)?;
if let Some(encryption_key) = encryption_key.as_ref() {
self.api.crypto()?.check_shared_secret(encryption_key)?;
}
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
storage_manager.get_record_key(schema, &owner_key, encryption_key) storage_manager.get_record_key(schema, &owner_key, encryption_key)
} }
@ -339,9 +375,11 @@ impl RoutingContext {
) -> VeilidAPIResult<DHTRecordDescriptor> { ) -> VeilidAPIResult<DHTRecordDescriptor> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::create_dht_record(self: {:?}, schema: {:?}, owner: {:?}, kind: {:?})", self, schema, owner, kind); "RoutingContext::create_dht_record(self: {:?}, schema: {:?}, owner: {:?}, kind: {:?})", self, schema, owner, kind);
schema.validate()?;
Crypto::validate_crypto_kind(kind)?; Crypto::validate_crypto_kind(kind)?;
schema.validate()?;
if let Some(owner) = &owner {
self.api.crypto()?.check_keypair(owner)?;
}
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.create_record( Box::pin(storage_manager.create_record(
@ -367,18 +405,24 @@ impl RoutingContext {
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn open_dht_record( pub async fn open_dht_record(
&self, &self,
key: RecordKey, record_key: RecordKey,
default_writer: Option<KeyPair>, default_writer: Option<KeyPair>,
) -> VeilidAPIResult<DHTRecordDescriptor> { ) -> VeilidAPIResult<DHTRecordDescriptor> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::open_dht_record(self: {:?}, key: {:?}, default_writer: {:?})", self, key, default_writer); "RoutingContext::open_dht_record(self: {:?}, key: {:?}, default_writer: {:?})", self, record_key, default_writer);
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
if let Some(default_writer) = &default_writer {
self.api.crypto()?.check_keypair(default_writer)?;
}
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
storage_manager storage_manager
.open_record( .open_record(
key, record_key,
default_writer, default_writer,
self.unlocked_inner.safety_selection.clone(), self.unlocked_inner.safety_selection.clone(),
) )
@ -389,14 +433,17 @@ impl RoutingContext {
/// ///
/// Closing a record allows you to re-open it with a different routing context. /// Closing a record allows you to re-open it with a different routing context.
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn close_dht_record(&self, key: RecordKey) -> VeilidAPIResult<()> { pub async fn close_dht_record(&self, record_key: RecordKey) -> VeilidAPIResult<()> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::close_dht_record(self: {:?}, key: {:?})", self, key); "RoutingContext::close_dht_record(self: {:?}, key: {:?})", self, record_key);
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.close_record(key)).await Box::pin(storage_manager.close_record(record_key)).await
} }
/// Deletes a DHT record at a specific key. /// Deletes a DHT record at a specific key.
@ -405,14 +452,17 @@ impl RoutingContext {
/// Deleting a record does not delete it from the network, but will remove the storage of the record /// Deleting a record does not delete it from the network, but will remove the storage of the record
/// locally, and will prevent its value from being refreshed on the network by this node. /// locally, and will prevent its value from being refreshed on the network by this node.
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn delete_dht_record(&self, key: RecordKey) -> VeilidAPIResult<()> { pub async fn delete_dht_record(&self, record_key: RecordKey) -> VeilidAPIResult<()> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::delete_dht_record(self: {:?}, key: {:?})", self, key); "RoutingContext::delete_dht_record(self: {:?}, key: {:?})", self, record_key);
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.delete_record(key)).await Box::pin(storage_manager.delete_record(record_key)).await
} }
/// Gets the latest value of a subkey. /// Gets the latest value of a subkey.
@ -424,17 +474,20 @@ impl RoutingContext {
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn get_dht_value( pub async fn get_dht_value(
&self, &self,
key: RecordKey, record_key: RecordKey,
subkey: ValueSubkey, subkey: ValueSubkey,
force_refresh: bool, force_refresh: bool,
) -> VeilidAPIResult<Option<ValueData>> { ) -> VeilidAPIResult<Option<ValueData>> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::get_dht_value(self: {:?}, key: {:?}, subkey: {:?}, force_refresh: {:?})", self, key, subkey, force_refresh); "RoutingContext::get_dht_value(self: {:?}, key: {:?}, subkey: {:?}, force_refresh: {:?})", self, record_key, subkey, force_refresh);
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.get_value(key, subkey, force_refresh)).await Box::pin(storage_manager.get_value(record_key, subkey, force_refresh)).await
} }
/// Pushes a changed subkey value to the network. /// Pushes a changed subkey value to the network.
@ -447,18 +500,21 @@ impl RoutingContext {
#[instrument(target = "veilid_api", level = "debug", skip(data), fields(__VEILID_LOG_KEY = self.log_key(), data = print_data(&data, Some(64))), ret, err)] #[instrument(target = "veilid_api", level = "debug", skip(data), fields(__VEILID_LOG_KEY = self.log_key(), data = print_data(&data, Some(64))), ret, err)]
pub async fn set_dht_value( pub async fn set_dht_value(
&self, &self,
key: RecordKey, record_key: RecordKey,
subkey: ValueSubkey, subkey: ValueSubkey,
data: Vec<u8>, data: Vec<u8>,
options: Option<SetDHTValueOptions>, options: Option<SetDHTValueOptions>,
) -> VeilidAPIResult<Option<ValueData>> { ) -> VeilidAPIResult<Option<ValueData>> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::set_dht_value(self: {:?}, key: {:?}, subkey: {:?}, data: len={}, options: {:?})", self, key, subkey, data.len(), options); "RoutingContext::set_dht_value(self: {:?}, key: {:?}, subkey: {:?}, data: len={}, options: {:?})", self, record_key, subkey, data.len(), options);
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.set_value(key, subkey, data, options)).await Box::pin(storage_manager.set_value(record_key, subkey, data, options)).await
} }
/// Add or update a watch to a DHT value that informs the user via an VeilidUpdate::ValueChange callback when the record has subkeys change. /// Add or update a watch to a DHT value that informs the user via an VeilidUpdate::ValueChange callback when the record has subkeys change.
@ -489,21 +545,24 @@ impl RoutingContext {
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn watch_dht_values( pub async fn watch_dht_values(
&self, &self,
key: RecordKey, record_key: RecordKey,
subkeys: Option<ValueSubkeyRangeSet>, subkeys: Option<ValueSubkeyRangeSet>,
expiration: Option<Timestamp>, expiration: Option<Timestamp>,
count: Option<u32>, count: Option<u32>,
) -> VeilidAPIResult<bool> { ) -> VeilidAPIResult<bool> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::watch_dht_values(self: {:?}, key: {:?}, subkeys: {:?}, expiration: {:?}, count: {:?})", self, key, subkeys, expiration, count); "RoutingContext::watch_dht_values(self: {:?}, key: {:?}, subkeys: {:?}, expiration: {:?}, count: {:?})", self, record_key, subkeys, expiration, count);
let subkeys = subkeys.unwrap_or_default(); let subkeys = subkeys.unwrap_or_default();
let expiration = expiration.unwrap_or_default(); let expiration = expiration.unwrap_or_default();
let count = count.unwrap_or(u32::MAX); let count = count.unwrap_or(u32::MAX);
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.watch_values(key, subkeys, expiration, count)).await Box::pin(storage_manager.watch_values(record_key, subkeys, expiration, count)).await
} }
/// Cancels a watch early. /// Cancels a watch early.
@ -521,17 +580,20 @@ impl RoutingContext {
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn cancel_dht_watch( pub async fn cancel_dht_watch(
&self, &self,
key: RecordKey, record_key: RecordKey,
subkeys: Option<ValueSubkeyRangeSet>, subkeys: Option<ValueSubkeyRangeSet>,
) -> VeilidAPIResult<bool> { ) -> VeilidAPIResult<bool> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::cancel_dht_watch(self: {:?}, key: {:?}, subkeys: {:?}", self, key, subkeys); "RoutingContext::cancel_dht_watch(self: {:?}, key: {:?}, subkeys: {:?}", self, record_key, subkeys);
let subkeys = subkeys.unwrap_or_default(); let subkeys = subkeys.unwrap_or_default();
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.cancel_watch_values(key, subkeys)).await Box::pin(storage_manager.cancel_watch_values(record_key, subkeys)).await
} }
/// Inspects a DHT record for subkey state. /// Inspects a DHT record for subkey state.
@ -577,18 +639,21 @@ impl RoutingContext {
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)] #[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
pub async fn inspect_dht_record( pub async fn inspect_dht_record(
&self, &self,
key: RecordKey, record_key: RecordKey,
subkeys: Option<ValueSubkeyRangeSet>, subkeys: Option<ValueSubkeyRangeSet>,
scope: DHTReportScope, scope: DHTReportScope,
) -> VeilidAPIResult<DHTRecordReport> { ) -> VeilidAPIResult<DHTRecordReport> {
veilid_log!(self debug veilid_log!(self debug
"RoutingContext::inspect_dht_record(self: {:?}, key: {:?}, subkeys: {:?}, scope: {:?})", self, key, subkeys, scope); "RoutingContext::inspect_dht_record(self: {:?}, key: {:?}, subkeys: {:?}, scope: {:?})", self, record_key, subkeys, scope);
let subkeys = subkeys.unwrap_or_default(); let subkeys = subkeys.unwrap_or_default();
Crypto::validate_crypto_kind(key.kind())?; self.api
.core_context()?
.storage_manager()
.check_record_key(&record_key)?;
let storage_manager = self.api.core_context()?.storage_manager(); let storage_manager = self.api.core_context()?.storage_manager();
Box::pin(storage_manager.inspect_record(key, subkeys, scope)).await Box::pin(storage_manager.inspect_record(record_key, subkeys, scope)).await
} }
/////////////////////////////////// ///////////////////////////////////

View file

@ -19,7 +19,7 @@ pluginManagement {
plugins { plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.8.0" apply false id "com.android.application" version "8.8.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.25" apply false id "org.jetbrains.kotlin.android" version "2.1.0" apply false
} }
include ":app" include ":app"

View file

@ -52,13 +52,13 @@ void main() {
group('Routing Contexts', () { group('Routing Contexts', () {
test('routing contexts', testRoutingContexts); test('routing contexts', testRoutingContexts);
test('app message loopback', test('app message loopback',
() async => testAppMessageLoopback(fixture.updateStream)); () => testAppMessageLoopback(fixture.updateStream));
test('app call loopback', test('app call loopback',
() async => testAppCallLoopback(fixture.updateStream)); () => testAppCallLoopback(fixture.updateStream));
test('app message loopback big packets', test('app message loopback big packets',
() async => testAppMessageLoopbackBigPackets(fixture.updateStream)); () => testAppMessageLoopbackBigPackets(fixture.updateStream));
test('app call loopback big packets', test('app call loopback big packets',
() async => testAppCallLoopbackBigPackets(fixture.updateStream)); () => testAppCallLoopbackBigPackets(fixture.updateStream));
}); });
group('Veilid DHT', () { group('Veilid DHT', () {

View file

@ -25,7 +25,7 @@ Future<void> testHashAndVerifyPassword() async {
for (final kind in Veilid.instance.validCryptoKinds()) { for (final kind in Veilid.instance.validCryptoKinds()) {
final cs = await Veilid.instance.getCryptoSystem(kind); final cs = await Veilid.instance.getCryptoSystem(kind);
final nonce = await cs.randomNonce(); final nonce = await cs.randomNonce();
final salt = nonce.decode(); final salt = nonce.toBytes();
// Password match // Password match
final phash = await cs.hashPassword(utf8.encode('abc123'), salt); final phash = await cs.hashPassword(utf8.encode('abc123'), salt);

View file

@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '12.0' # platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View file

@ -30,12 +30,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/veilid/ios" :path: ".symlinks/plugins/veilid/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
system_info_plus: 555ce7047fbbf29154726db942ae785c29211740 system_info_plus: 555ce7047fbbf29154726db942ae785c29211740
veilid: 3ce560a4f2b568a77a9fd5e23090f2fa97581019 veilid: 3ce560a4f2b568a77a9fd5e23090f2fa97581019
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 PODFILE CHECKSUM: 0dbd5a87e0ace00c9610d2037ac22083a01f861d
COCOAPODS: 1.16.2 COCOAPODS: 1.16.2

View file

@ -26,6 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
@ -43,6 +44,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View file

@ -3,10 +3,24 @@ import 'package:flutter/services.dart';
/// TextField History Controller /// TextField History Controller
class HistoryTextEditingController { class HistoryTextEditingController {
////////////////////////////////////////////////////////////////////////////
late void Function(void Function()) setState;
final TextEditingController _controller;
late final FocusNode _historyFocusNode;
final List<String> _history = [];
var _historyPosition = 0;
var _historyCurrentEdit = '';
HistoryTextEditingController( HistoryTextEditingController(
{required this.setState, TextEditingController? controller}) {required this.setState, TextEditingController? controller})
: _controller = controller ?? TextEditingController() { : _controller = controller ?? TextEditingController() {
_historyFocusNode = FocusNode(onKeyEvent: (_node, event) { _historyFocusNode = FocusNode(onKeyEvent: (node, event) {
if (event.runtimeType == KeyDownEvent && if (event.runtimeType == KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.arrowUp) { event.logicalKey == LogicalKeyboardKey.arrowUp) {
if (_historyPosition > 0) { if (_historyPosition > 0) {
@ -55,15 +69,6 @@ class HistoryTextEditingController {
} }
FocusNode get focusNode => _historyFocusNode; FocusNode get focusNode => _historyFocusNode;
TextEditingController get controller => _controller; TextEditingController get controller => _controller;
////////////////////////////////////////////////////////////////////////////
late void Function(void Function()) setState;
final TextEditingController _controller;
late final FocusNode _historyFocusNode;
final List<String> _history = [];
int _historyPosition = 0;
String _historyCurrentEdit = '';
} }

View file

@ -1,4 +1,3 @@
// ignore_for_file: prefer_single_quotes
import 'dart:io' show Platform; import 'dart:io' show Platform;
import 'package:ansicolor/ansicolor.dart'; import 'package:ansicolor/ansicolor.dart';
@ -7,7 +6,7 @@ import 'package:loggy/loggy.dart';
import 'package:veilid/veilid.dart'; import 'package:veilid/veilid.dart';
// Loggy tools // Loggy tools
const LogLevel traceLevel = LogLevel('Trace', 1); const traceLevel = LogLevel('Trace', 1);
VeilidConfigLogLevel convertToVeilidConfigLogLevel(LogLevel? level) { VeilidConfigLogLevel convertToVeilidConfigLogLevel(LogLevel? level) {
if (level == null) { if (level == null) {
@ -66,7 +65,7 @@ String wrapWithLogColor(LogLevel? level, String text) {
void setRootLogLevel(LogLevel? level) { void setRootLogLevel(LogLevel? level) {
Loggy('').level = getLogOptions(level); Loggy('').level = getLogOptions(level);
Veilid.instance.changeLogLevel("all", convertToVeilidConfigLogLevel(level)); Veilid.instance.changeLogLevel('all', convertToVeilidConfigLogLevel(level));
} }
extension PrettyPrintLogRecord on LogRecord { extension PrettyPrintLogRecord on LogRecord {
@ -78,10 +77,10 @@ extension PrettyPrintLogRecord on LogRecord {
} }
class CallbackPrinter extends LoggyPrinter { class CallbackPrinter extends LoggyPrinter {
CallbackPrinter() : super();
void Function(LogRecord)? callback; void Function(LogRecord)? callback;
CallbackPrinter() : super();
@override @override
void onLog(LogRecord record) { void onLog(LogRecord record) {
final out = record.pretty().replaceAll('\uFFFD', ''); final out = record.pretty().replaceAll('\uFFFD', '');
@ -95,13 +94,14 @@ class CallbackPrinter extends LoggyPrinter {
callback?.call(record); callback?.call(record);
} }
// Keep this as a function
// ignore: use_setters_to_change_properties // ignore: use_setters_to_change_properties
void setCallback(void Function(LogRecord)? cb) { void setCallback(void Function(LogRecord)? cb) {
callback = cb; callback = cb;
} }
} }
CallbackPrinter globalTerminalPrinter = CallbackPrinter(); var globalTerminalPrinter = CallbackPrinter();
extension TraceLoggy on Loggy { extension TraceLoggy on Loggy {
void trace(dynamic message, [Object? error, StackTrace? stackTrace]) => void trace(dynamic message, [Object? error, StackTrace? stackTrace]) =>

View file

@ -25,8 +25,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/veilid/macos :path: Flutter/ephemeral/.symlinks/plugins/veilid/macos
SPEC CHECKSUMS: SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
macos_window_utils: 3bca8603c2a1cf2257351dfe6bbccc9accf739fd macos_window_utils: 23f54331a0fd51eea9e0ed347253bf48fd379d1d
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
veilid: 319e2e78836d7b3d08203596d0b4a0e244b68d29 veilid: 319e2e78836d7b3d08203596d0b4a0e244b68d29

View file

@ -1,6 +1,30 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f
url: "https://pub.dev"
source: hosted
version: "85.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: f4ad0fea5f102201015c9aae9d93bc02f75dd9491529a8c21f88d17a8523d44c
url: "https://pub.dev"
source: hosted
version: "7.6.0"
analyzer_plugin:
dependency: transitive
description:
name: analyzer_plugin
sha256: a5ab7590c27b779f3d4de67f31c4109dbe13dd7339f86461a6f2a8ab2594d8ce
url: "https://pub.dev"
source: hosted
version: "0.13.4"
ansicolor: ansicolor:
dependency: "direct main" dependency: "direct main"
description: description:
@ -9,14 +33,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
args:
dependency: transitive
description:
name: args
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
url: "https://pub.dev"
source: hosted
version: "2.7.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.12.0" version: "2.13.0"
async_tools: async_tools:
dependency: transitive dependency: transitive
description: description:
@ -57,6 +89,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
ci:
dependency: transitive
description:
name: ci
sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
url: "https://pub.dev"
source: hosted
version: "0.4.2"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -81,6 +137,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
crypto:
dependency: transitive
description:
name: crypto
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
url: "https://pub.dev"
source: hosted
version: "3.0.6"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -89,6 +153,46 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.8" version: "1.0.8"
custom_lint:
dependency: transitive
description:
name: custom_lint
sha256: "78085fbe842de7c5bef92de811ca81536968dbcbbcdac5c316711add2d15e796"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
custom_lint_builder:
dependency: transitive
description:
name: custom_lint_builder
sha256: cc5532d5733d4eccfccaaec6070a1926e9f21e613d93ad0927fad020b95c9e52
url: "https://pub.dev"
source: hosted
version: "0.8.0"
custom_lint_core:
dependency: transitive
description:
name: custom_lint_core
sha256: cc4684d22ca05bf0a4a51127e19a8aea576b42079ed2bc9e956f11aaebe35dd1
url: "https://pub.dev"
source: hosted
version: "0.8.0"
custom_lint_visitor:
dependency: transitive
description:
name: custom_lint_visitor
sha256: "4a86a0d8415a91fbb8298d6ef03e9034dc8e323a599ddc4120a0e36c433983a2"
url: "https://pub.dev"
source: hosted
version: "1.0.0+7.7.0"
dart_style:
dependency: transitive
description:
name: dart_style
sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
equatable: equatable:
dependency: transitive dependency: transitive
description: description:
@ -101,10 +205,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.2" version: "1.3.3"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -161,15 +265,23 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: freezed_annotation name: freezed_annotation
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "3.1.0"
fuchsia_remote_debug_protocol: fuchsia_remote_debug_protocol:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
glob:
dependency: transitive
description:
name: glob
sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de
url: "https://pub.dev"
source: hosted
version: "2.1.3"
globbing: globbing:
dependency: transitive dependency: transitive
description: description:
@ -178,6 +290,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
hotreloader:
dependency: transitive
description:
name: hotreloader
sha256: bc167a1163807b03bada490bfe2df25b0d744df359227880220a5cbd04e5734b
url: "https://pub.dev"
source: hosted
version: "4.3.0"
integration_test: integration_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -195,34 +315,42 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.0.8" version: "11.0.1"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.9" version: "3.0.10"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
lint_hard: lint_hard:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: lint_hard name: lint_hard
sha256: ffe7058cb49e021d244d67e650a63380445b56643c2849c6929e938246b99058 sha256: "805771ca5131c1e798ec7e94eb557dc61d6dc1220246855196776f4ac7299446"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.0" version: "6.2.1"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.3.0"
loggy: loggy:
dependency: "direct main" dependency: "direct main"
description: description:
@ -235,10 +363,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: macos_window_utils name: macos_window_utils
sha256: "3534f2af024f2f24112ca28789a44e6750083f8c0065414546c6593ee48a5009" sha256: d4df3501fd32ac0d2d7590cb6a8e4758337d061c8fa0db816fdd636be63a8438
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.6.1" version: "1.9.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -263,6 +391,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.16.0" version: "1.16.0"
package_config:
dependency: transitive
description:
name: package_config
sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
url: "https://pub.dev"
source: hosted
version: "2.2.0"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:
@ -283,18 +419,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
sha256: "0ca7359dad67fd7063cb2892ab0c0737b2daafd807cf1acecd62374c8fae6c12" sha256: "993381400e94d18469750e5b9dcb8206f15bc09f9da86b9e44a9b0092a0066db"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.16" version: "2.2.18"
path_provider_foundation: path_provider_foundation:
dependency: transitive dependency: transitive
description: description:
name: path_provider_foundation name: path_provider_foundation
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.1" version: "2.4.2"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -339,10 +475,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: process name: process
sha256: "107d8be718f120bbba9dcd1e95e3bd325b1b4a4f07db64154635ba03f2567a0d" sha256: c6248e4526673988586e8c00bb22a49210c258dc91df5227d5da9748ecf79744
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.0.3" version: "5.0.5"
pub_semver:
dependency: transitive
description:
name: pub_semver
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082"
url: "https://pub.dev"
source: hosted
version: "1.5.0"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
@ -351,6 +503,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.2" version: "3.2.2"
rxdart:
dependency: transitive
description:
name: rxdart
sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962"
url: "https://pub.dev"
source: hosted
version: "0.28.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -364,6 +524,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.1" version: "1.10.1"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -380,6 +548,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
stream_transform:
dependency: transitive
description:
name: stream_transform
sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871
url: "https://pub.dev"
source: hosted
version: "2.1.1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -424,10 +600,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.4" version: "0.7.6"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -436,14 +612,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
uuid:
dependency: transitive
description:
name: uuid
sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
url: "https://pub.dev"
source: hosted
version: "4.5.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.2.0"
veilid: veilid:
dependency: "direct main" dependency: "direct main"
description: description:
@ -462,18 +646,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.3.1" version: "15.0.2"
watcher:
dependency: transitive
description:
name: watcher
sha256: "5bf046f41320ac97a469d506261797f35254fa61c641741ef32dacda98b7d39c"
url: "https://pub.dev"
source: hosted
version: "1.1.3"
webdriver: webdriver:
dependency: transitive dependency: transitive
description: description:
name: webdriver name: webdriver
sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8" sha256: "2f3a14ca026957870cfd9c635b83507e0e51d8091568e90129fbf805aba7cade"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.4" version: "3.1.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -490,6 +682,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
url: "https://pub.dev"
source: hosted
version: "3.1.3"
zmodem: zmodem:
dependency: transitive dependency: transitive
description: description:
@ -499,5 +699,5 @@ packages:
source: hosted source: hosted
version: "0.0.6" version: "0.0.6"
sdks: sdks:
dart: ">=3.7.0 <4.0.0" dart: ">=3.8.0 <4.0.0"
flutter: ">=3.27.0" flutter: ">=3.29.0"

View file

@ -44,7 +44,7 @@ dev_dependencies:
sdk: flutter sdk: flutter
integration_test: integration_test:
sdk: flutter sdk: flutter
lint_hard: ^6.0.0 lint_hard: ^6.2.1
veilid_test: veilid_test:
path: ../packages/veilid_test path: ../packages/veilid_test

View file

@ -70,9 +70,10 @@ sealed class DHTSchema with _$DHTSchema {
const factory DHTSchema.dflt({required int oCnt}) = DHTSchemaDFLT; const factory DHTSchema.dflt({required int oCnt}) = DHTSchemaDFLT;
@FreezedUnionValue('SMPL') @FreezedUnionValue('SMPL')
const factory DHTSchema.smpl( const factory DHTSchema.smpl({
{required int oCnt, required int oCnt,
required List<DHTSchemaMember> members}) = DHTSchemaSMPL; required List<DHTSchemaMember> members,
}) = DHTSchemaSMPL;
factory DHTSchema.fromJson(dynamic json) => factory DHTSchema.fromJson(dynamic json) =>
_$DHTSchemaFromJson(json as Map<String, dynamic>); _$DHTSchemaFromJson(json as Map<String, dynamic>);
@ -84,12 +85,21 @@ const defaultDHTSchema = DHTSchema.dflt(oCnt: 1);
sealed class DHTSchemaMember with _$DHTSchemaMember { sealed class DHTSchemaMember with _$DHTSchemaMember {
@Assert('mCnt > 0 && mCnt <= 65535', 'value out of range') @Assert('mCnt > 0 && mCnt <= 65535', 'value out of range')
const factory DHTSchemaMember({ const factory DHTSchemaMember({
required MemberId mKey, required BareMemberId mKey,
required int mCnt, required int mCnt,
}) = _DHTSchemaMember; }) = _DHTSchemaMember;
factory DHTSchemaMember.fromJson(dynamic json) => factory DHTSchemaMember.fromJson(dynamic json) =>
_$DHTSchemaMemberFromJson(json as Map<String, dynamic>); _$DHTSchemaMemberFromJson(json as Map<String, dynamic>);
static Future<DHTSchemaMember> fromPublicKey(
Veilid veilid,
PublicKey publicKey,
int mCnt,
) async => DHTSchemaMember(
mKey: (await veilid.generateMemberId(publicKey)).value,
mCnt: mCnt,
);
} }
////////////////////////////////////// //////////////////////////////////////
@ -135,7 +145,10 @@ extension DHTRecordDescriptorExt on DHTRecordDescriptor {
@freezed @freezed
sealed class ValueData with _$ValueData { sealed class ValueData with _$ValueData {
@Assert('seq >= 0', 'seq out of range') static const maxLen = 32768;
@Assert('seq >= 0 && seq <= 4294967295', 'seq out of range')
@Assert('data.length <= ValueData.maxLen', 'data too large')
const factory ValueData({ const factory ValueData({
required int seq, required int seq,
@Uint8ListJsonConverter.jsIsArray() required Uint8List data, @Uint8ListJsonConverter.jsIsArray() required Uint8List data,
@ -180,7 +193,8 @@ abstract class SafetySelection {
final json = jsond as Map<String, dynamic>; final json = jsond as Map<String, dynamic>;
if (json.containsKey('Unsafe')) { if (json.containsKey('Unsafe')) {
return SafetySelectionUnsafe( return SafetySelectionUnsafe(
sequencing: Sequencing.fromJson(json['Unsafe'])); sequencing: Sequencing.fromJson(json['Unsafe']),
);
} else if (json.containsKey('Safe')) { } else if (json.containsKey('Safe')) {
return SafetySelectionSafe(safetySpec: SafetySpec.fromJson(json['Safe'])); return SafetySelectionSafe(safetySpec: SafetySpec.fromJson(json['Safe']));
} else { } else {
@ -192,13 +206,14 @@ abstract class SafetySelection {
@immutable @immutable
class SafetySelectionUnsafe extends Equatable implements SafetySelection { class SafetySelectionUnsafe extends Equatable implements SafetySelection {
//
const SafetySelectionUnsafe({
required this.sequencing,
});
final Sequencing sequencing; final Sequencing sequencing;
//
const SafetySelectionUnsafe({required this.sequencing});
@override @override
List<Object> get props => [sequencing]; List<Object> get props => [sequencing];
@override @override
bool? get stringify => null; bool? get stringify => null;
@ -208,13 +223,14 @@ class SafetySelectionUnsafe extends Equatable implements SafetySelection {
@immutable @immutable
class SafetySelectionSafe extends Equatable implements SafetySelection { class SafetySelectionSafe extends Equatable implements SafetySelection {
//
const SafetySelectionSafe({
required this.safetySpec,
});
final SafetySpec safetySpec; final SafetySpec safetySpec;
//
const SafetySelectionSafe({required this.safetySpec});
@override @override
List<Object> get props => [safetySpec]; List<Object> get props => [safetySpec];
@override @override
bool? get stringify => null; bool? get stringify => null;
@ -256,13 +272,14 @@ abstract class Target {
@immutable @immutable
class TargetNodeId extends Equatable implements Target { class TargetNodeId extends Equatable implements Target {
//
const TargetNodeId({
required this.nodeId,
});
final NodeId nodeId; final NodeId nodeId;
//
const TargetNodeId({required this.nodeId});
@override @override
List<Object> get props => [nodeId]; List<Object> get props => [nodeId];
@override @override
bool? get stringify => null; bool? get stringify => null;
@ -272,13 +289,14 @@ class TargetNodeId extends Equatable implements Target {
@immutable @immutable
class TargetRouteId extends Equatable implements Target { class TargetRouteId extends Equatable implements Target {
//
const TargetRouteId({
required this.routeId,
});
final RouteId routeId; final RouteId routeId;
//
const TargetRouteId({required this.routeId});
@override @override
List<Object> get props => [routeId]; List<Object> get props => [routeId];
@override @override
bool? get stringify => null; bool? get stringify => null;
@ -290,10 +308,10 @@ class TargetRouteId extends Equatable implements Target {
/// RouteBlob /// RouteBlob
@freezed @freezed
sealed class RouteBlob with _$RouteBlob { sealed class RouteBlob with _$RouteBlob {
const factory RouteBlob( const factory RouteBlob({
{required RouteId routeId, required RouteId routeId,
@Uint8ListJsonConverter.jsIsArray() required Uint8List blob}) = @Uint8ListJsonConverter.jsIsArray() required Uint8List blob,
_RouteBlob; }) = _RouteBlob;
factory RouteBlob.fromJson(dynamic json) => factory RouteBlob.fromJson(dynamic json) =>
_$RouteBlobFromJson(json as Map<String, dynamic>); _$RouteBlobFromJson(json as Map<String, dynamic>);
} }
@ -328,19 +346,17 @@ enum DHTReportScope {
@freezed @freezed
sealed class SetDHTValueOptions with _$SetDHTValueOptions { sealed class SetDHTValueOptions with _$SetDHTValueOptions {
const factory SetDHTValueOptions({ const factory SetDHTValueOptions({KeyPair? writer, bool? allowOffline}) =
KeyPair? writer, _SetDHTValueOptions;
bool? allowOffline,
}) = _SetDHTValueOptions;
factory SetDHTValueOptions.fromJson(dynamic json) => factory SetDHTValueOptions.fromJson(dynamic json) =>
_$SetDHTValueOptionsFromJson(json as Map<String, dynamic>); _$SetDHTValueOptionsFromJson(json as Map<String, dynamic>);
@override @override
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
'writer': writer, 'writer': writer,
'allow_offline': allowOffline, 'allow_offline': allowOffline,
}; };
} }
////////////////////////////////////// //////////////////////////////////////
@ -351,10 +367,14 @@ abstract class VeilidRoutingContext {
// Modifiers // Modifiers
VeilidRoutingContext withDefaultSafety({bool closeSelf = false}); VeilidRoutingContext withDefaultSafety({bool closeSelf = false});
VeilidRoutingContext withSafety(SafetySelection safetySelection, VeilidRoutingContext withSafety(
{bool closeSelf = false}); SafetySelection safetySelection, {
VeilidRoutingContext withSequencing(Sequencing sequencing, bool closeSelf = false,
{bool closeSelf = false}); });
VeilidRoutingContext withSequencing(
Sequencing sequencing, {
bool closeSelf = false,
});
Future<SafetySelection> safety(); Future<SafetySelection> safety();
// App call/message // App call/message
@ -362,21 +382,40 @@ abstract class VeilidRoutingContext {
Future<void> appMessage(Target target, Uint8List message); Future<void> appMessage(Target target, Uint8List message);
// DHT Operations // DHT Operations
Future<DHTRecordDescriptor> createDHTRecord(CryptoKind kind, DHTSchema schema, Future<DHTRecordDescriptor> createDHTRecord(
{KeyPair? owner}); CryptoKind kind,
DHTSchema schema, {
KeyPair? owner,
});
Future<DHTRecordDescriptor> openDHTRecord(RecordKey key, {KeyPair? writer}); Future<DHTRecordDescriptor> openDHTRecord(RecordKey key, {KeyPair? writer});
Future<void> closeDHTRecord(RecordKey key); Future<void> closeDHTRecord(RecordKey key);
Future<void> deleteDHTRecord(RecordKey key); Future<void> deleteDHTRecord(RecordKey key);
Future<RecordKey> getDHTRecordKey( Future<RecordKey> getDHTRecordKey(
DHTSchema schema, PublicKey owner, SharedSecret? encryptionKey); DHTSchema schema,
Future<ValueData?> getDHTValue(RecordKey key, int subkey, PublicKey owner,
{bool forceRefresh = false}); SharedSecret? encryptionKey,
Future<ValueData?> setDHTValue(RecordKey key, int subkey, Uint8List data, );
{SetDHTValueOptions? options}); Future<ValueData?> getDHTValue(
Future<bool> watchDHTValues(RecordKey key, RecordKey key,
{List<ValueSubkeyRange>? subkeys, Timestamp? expiration, int? count}); int subkey, {
bool forceRefresh = false,
});
Future<ValueData?> setDHTValue(
RecordKey key,
int subkey,
Uint8List data, {
SetDHTValueOptions? options,
});
Future<bool> watchDHTValues(
RecordKey key, {
List<ValueSubkeyRange>? subkeys,
Timestamp? expiration,
int? count,
});
Future<bool> cancelDHTWatch(RecordKey key, {List<ValueSubkeyRange>? subkeys}); Future<bool> cancelDHTWatch(RecordKey key, {List<ValueSubkeyRange>? subkeys});
Future<DHTRecordReport> inspectDHTRecord(RecordKey key, Future<DHTRecordReport> inspectDHTRecord(
{List<ValueSubkeyRange>? subkeys, RecordKey key, {
DHTReportScope scope = DHTReportScope.local}); List<ValueSubkeyRange>? subkeys,
DHTReportScope scope = DHTReportScope.local,
});
} }

File diff suppressed because it is too large Load diff

View file

@ -13,10 +13,7 @@ DHTSchemaDFLT _$DHTSchemaDFLTFromJson(Map<String, dynamic> json) =>
); );
Map<String, dynamic> _$DHTSchemaDFLTToJson(DHTSchemaDFLT instance) => Map<String, dynamic> _$DHTSchemaDFLTToJson(DHTSchemaDFLT instance) =>
<String, dynamic>{ <String, dynamic>{'o_cnt': instance.oCnt, 'kind': instance.$type};
'o_cnt': instance.oCnt,
'kind': instance.$type,
};
DHTSchemaSMPL _$DHTSchemaSMPLFromJson(Map<String, dynamic> json) => DHTSchemaSMPL _$DHTSchemaSMPLFromJson(Map<String, dynamic> json) =>
DHTSchemaSMPL( DHTSchemaSMPL(
@ -36,15 +33,12 @@ Map<String, dynamic> _$DHTSchemaSMPLToJson(DHTSchemaSMPL instance) =>
_DHTSchemaMember _$DHTSchemaMemberFromJson(Map<String, dynamic> json) => _DHTSchemaMember _$DHTSchemaMemberFromJson(Map<String, dynamic> json) =>
_DHTSchemaMember( _DHTSchemaMember(
mKey: Typed<BareMemberId>.fromJson(json['m_key']), mKey: BareMemberId.fromJson(json['m_key']),
mCnt: (json['m_cnt'] as num).toInt(), mCnt: (json['m_cnt'] as num).toInt(),
); );
Map<String, dynamic> _$DHTSchemaMemberToJson(_DHTSchemaMember instance) => Map<String, dynamic> _$DHTSchemaMemberToJson(_DHTSchemaMember instance) =>
<String, dynamic>{ <String, dynamic>{'m_key': instance.mKey.toJson(), 'm_cnt': instance.mCnt};
'm_key': instance.mKey.toJson(),
'm_cnt': instance.mCnt,
};
_DHTRecordDescriptor _$DHTRecordDescriptorFromJson(Map<String, dynamic> json) => _DHTRecordDescriptor _$DHTRecordDescriptorFromJson(Map<String, dynamic> json) =>
_DHTRecordDescriptor( _DHTRecordDescriptor(
@ -57,19 +51,19 @@ _DHTRecordDescriptor _$DHTRecordDescriptorFromJson(Map<String, dynamic> json) =>
); );
Map<String, dynamic> _$DHTRecordDescriptorToJson( Map<String, dynamic> _$DHTRecordDescriptorToJson(
_DHTRecordDescriptor instance) => _DHTRecordDescriptor instance,
<String, dynamic>{ ) => <String, dynamic>{
'key': instance.key.toJson(), 'key': instance.key.toJson(),
'owner': instance.owner.toJson(), 'owner': instance.owner.toJson(),
'schema': instance.schema.toJson(), 'schema': instance.schema.toJson(),
'owner_secret': instance.ownerSecret?.toJson(), 'owner_secret': instance.ownerSecret?.toJson(),
}; };
_ValueData _$ValueDataFromJson(Map<String, dynamic> json) => _ValueData( _ValueData _$ValueDataFromJson(Map<String, dynamic> json) => _ValueData(
seq: (json['seq'] as num).toInt(), seq: (json['seq'] as num).toInt(),
data: const Uint8ListJsonConverter.jsIsArray().fromJson(json['data']), data: const Uint8ListJsonConverter.jsIsArray().fromJson(json['data']),
writer: Typed<BarePublicKey>.fromJson(json['writer']), writer: Typed<BarePublicKey>.fromJson(json['writer']),
); );
Map<String, dynamic> _$ValueDataToJson(_ValueData instance) => Map<String, dynamic> _$ValueDataToJson(_ValueData instance) =>
<String, dynamic>{ <String, dynamic>{
@ -79,13 +73,13 @@ Map<String, dynamic> _$ValueDataToJson(_ValueData instance) =>
}; };
_SafetySpec _$SafetySpecFromJson(Map<String, dynamic> json) => _SafetySpec( _SafetySpec _$SafetySpecFromJson(Map<String, dynamic> json) => _SafetySpec(
hopCount: (json['hop_count'] as num).toInt(), hopCount: (json['hop_count'] as num).toInt(),
stability: Stability.fromJson(json['stability']), stability: Stability.fromJson(json['stability']),
sequencing: Sequencing.fromJson(json['sequencing']), sequencing: Sequencing.fromJson(json['sequencing']),
preferredRoute: json['preferred_route'] == null preferredRoute: json['preferred_route'] == null
? null ? null
: Typed<BareRouteId>.fromJson(json['preferred_route']), : Typed<BareRouteId>.fromJson(json['preferred_route']),
); );
Map<String, dynamic> _$SafetySpecToJson(_SafetySpec instance) => Map<String, dynamic> _$SafetySpecToJson(_SafetySpec instance) =>
<String, dynamic>{ <String, dynamic>{
@ -96,9 +90,9 @@ Map<String, dynamic> _$SafetySpecToJson(_SafetySpec instance) =>
}; };
_RouteBlob _$RouteBlobFromJson(Map<String, dynamic> json) => _RouteBlob( _RouteBlob _$RouteBlobFromJson(Map<String, dynamic> json) => _RouteBlob(
routeId: Typed<BareRouteId>.fromJson(json['route_id']), routeId: Typed<BareRouteId>.fromJson(json['route_id']),
blob: const Uint8ListJsonConverter.jsIsArray().fromJson(json['blob']), blob: const Uint8ListJsonConverter.jsIsArray().fromJson(json['blob']),
); );
Map<String, dynamic> _$RouteBlobToJson(_RouteBlob instance) => Map<String, dynamic> _$RouteBlobToJson(_RouteBlob instance) =>
<String, dynamic>{ <String, dynamic>{
@ -122,14 +116,14 @@ _DHTRecordReport _$DHTRecordReportFromJson(Map<String, dynamic> json) =>
.toList(), .toList(),
); );
Map<String, dynamic> _$DHTRecordReportToJson(_DHTRecordReport instance) => Map<String, dynamic> _$DHTRecordReportToJson(
<String, dynamic>{ _DHTRecordReport instance,
'subkeys': instance.subkeys.map((e) => e.toJson()).toList(), ) => <String, dynamic>{
'offline_subkeys': 'subkeys': instance.subkeys.map((e) => e.toJson()).toList(),
instance.offlineSubkeys.map((e) => e.toJson()).toList(), 'offline_subkeys': instance.offlineSubkeys.map((e) => e.toJson()).toList(),
'local_seqs': instance.localSeqs, 'local_seqs': instance.localSeqs,
'network_seqs': instance.networkSeqs, 'network_seqs': instance.networkSeqs,
}; };
_SetDHTValueOptions _$SetDHTValueOptionsFromJson(Map<String, dynamic> json) => _SetDHTValueOptions _$SetDHTValueOptionsFromJson(Map<String, dynamic> json) =>
_SetDHTValueOptions( _SetDHTValueOptions(

View file

@ -5,6 +5,10 @@ import 'package:freezed_annotation/freezed_annotation.dart';
@immutable @immutable
class ValueSubkeyRange extends Equatable { class ValueSubkeyRange extends Equatable {
final int low;
final int high;
const ValueSubkeyRange({ const ValueSubkeyRange({
required this.low, required this.low,
required this.high, required this.high,
@ -12,14 +16,18 @@ class ValueSubkeyRange extends Equatable {
factory ValueSubkeyRange.single(int val) => factory ValueSubkeyRange.single(int val) =>
ValueSubkeyRange(low: val, high: val); ValueSubkeyRange(low: val, high: val);
factory ValueSubkeyRange.make(int low, int high) => factory ValueSubkeyRange.make(int low, int high) =>
ValueSubkeyRange(low: low, high: high); ValueSubkeyRange(low: low, high: high);
factory ValueSubkeyRange.fromIntPair((int, int) pair) => factory ValueSubkeyRange.fromIntPair((int, int) pair) =>
ValueSubkeyRange(low: pair.$1, high: pair.$2); ValueSubkeyRange(low: pair.$1, high: pair.$2);
factory ValueSubkeyRange.fromIntList(List<int> intlist) { factory ValueSubkeyRange.fromIntList(List<int> intlist) {
assert(intlist.length == 2, 'range must be a two item list'); assert(intlist.length == 2, 'range must be a two item list');
return ValueSubkeyRange(low: intlist[0], high: intlist[1]); return ValueSubkeyRange(low: intlist[0], high: intlist[1]);
} }
factory ValueSubkeyRange.fromJson(dynamic json) => factory ValueSubkeyRange.fromJson(dynamic json) =>
ValueSubkeyRange.fromIntList((json as List<dynamic>).cast<int>()); ValueSubkeyRange.fromIntList((json as List<dynamic>).cast<int>());
@ -27,9 +35,6 @@ class ValueSubkeyRange extends Equatable {
@override @override
List<Object> get props => [low, high]; List<Object> get props => [low, high];
final int low;
final int high;
} }
extension ValueSubkeyRangeExt on ValueSubkeyRange { extension ValueSubkeyRangeExt on ValueSubkeyRange {

View file

@ -43,10 +43,14 @@ List<T>? Function(dynamic) optJsonListConstructor<T>(
@immutable @immutable
class VeilidVersion extends Equatable { class VeilidVersion extends Equatable {
const VeilidVersion(this.major, this.minor, this.patch);
final int major; final int major;
final int minor; final int minor;
final int patch; final int patch;
const VeilidVersion(this.major, this.minor, this.patch);
@override @override
List<Object> get props => [major, minor, patch]; List<Object> get props => [major, minor, patch];
} }
@ -55,15 +59,21 @@ class VeilidVersion extends Equatable {
/// Timestamp /// Timestamp
@immutable @immutable
class Timestamp extends Equatable implements Comparable<Timestamp> { class Timestamp extends Equatable implements Comparable<Timestamp> {
final BigInt value;
const Timestamp({required this.value}); const Timestamp({required this.value});
factory Timestamp.zero() => Timestamp(value: BigInt.zero); factory Timestamp.zero() => Timestamp(value: BigInt.zero);
factory Timestamp.fromInt64(Int64 i64) => Timestamp( factory Timestamp.fromInt64(Int64 i64) => Timestamp(
value: (BigInt.from((i64 >> 32).toUnsigned(32).toInt()) << 32) | value: (BigInt.from((i64 >> 32).toUnsigned(32).toInt()) << 32) |
BigInt.from(i64.toUnsigned(32).toInt())); BigInt.from(i64.toUnsigned(32).toInt()));
factory Timestamp.fromString(String s) => Timestamp(value: BigInt.parse(s)); factory Timestamp.fromString(String s) => Timestamp(value: BigInt.parse(s));
factory Timestamp.fromJson(dynamic json) => factory Timestamp.fromJson(dynamic json) =>
Timestamp.fromString(json as String); Timestamp.fromString(json as String);
final BigInt value;
@override @override
List<Object> get props => [value]; List<Object> get props => [value];
@ -71,13 +81,18 @@ class Timestamp extends Equatable implements Comparable<Timestamp> {
int compareTo(Timestamp other) => value.compareTo(other.value); int compareTo(Timestamp other) => value.compareTo(other.value);
bool operator <(Timestamp other) => compareTo(other) < 0; bool operator <(Timestamp other) => compareTo(other) < 0;
bool operator <=(Timestamp other) => compareTo(other) <= 0; bool operator <=(Timestamp other) => compareTo(other) <= 0;
bool operator >(Timestamp other) => compareTo(other) > 0; bool operator >(Timestamp other) => compareTo(other) > 0;
bool operator >=(Timestamp other) => compareTo(other) >= 0; bool operator >=(Timestamp other) => compareTo(other) >= 0;
@override @override
String toString() => value.toString(); String toString() => value.toString();
String toJson() => toString(); String toJson() => toString();
Int64 toInt64() => Int64.fromInts( Int64 toInt64() => Int64.fromInts(
(value >> 32).toUnsigned(32).toInt(), value.toUnsigned(32).toInt()); (value >> 32).toUnsigned(32).toInt(), value.toUnsigned(32).toInt());
@ -91,20 +106,27 @@ class Timestamp extends Equatable implements Comparable<Timestamp> {
@immutable @immutable
class TimestampDuration extends Equatable class TimestampDuration extends Equatable
implements Comparable<TimestampDuration> { implements Comparable<TimestampDuration> {
final BigInt value;
const TimestampDuration({required this.value}); const TimestampDuration({required this.value});
factory TimestampDuration.fromInt64(Int64 i64) => TimestampDuration( factory TimestampDuration.fromInt64(Int64 i64) => TimestampDuration(
value: (BigInt.from((i64 >> 32).toUnsigned(32).toInt()) << 32) | value: (BigInt.from((i64 >> 32).toUnsigned(32).toInt()) << 32) |
BigInt.from(i64.toUnsigned(32).toInt())); BigInt.from(i64.toUnsigned(32).toInt()));
factory TimestampDuration.fromMillis(int millis) => factory TimestampDuration.fromMillis(int millis) =>
TimestampDuration(value: BigInt.from(millis) * BigInt.from(1000)); TimestampDuration(value: BigInt.from(millis) * BigInt.from(1000));
factory TimestampDuration.fromDuration(Duration d) => TimestampDuration( factory TimestampDuration.fromDuration(Duration d) => TimestampDuration(
value: BigInt.from(d.inSeconds) * BigInt.from(1000000) + value: BigInt.from(d.inSeconds) * BigInt.from(1000000) +
BigInt.from(d.inMicroseconds % 1000000)); BigInt.from(d.inMicroseconds % 1000000));
factory TimestampDuration.fromString(String s) => factory TimestampDuration.fromString(String s) =>
TimestampDuration(value: BigInt.parse(s)); TimestampDuration(value: BigInt.parse(s));
factory TimestampDuration.fromJson(dynamic json) => factory TimestampDuration.fromJson(dynamic json) =>
TimestampDuration.fromString(json as String); TimestampDuration.fromString(json as String);
final BigInt value;
@override @override
List<Object> get props => [value]; List<Object> get props => [value];
@ -112,8 +134,11 @@ class TimestampDuration extends Equatable
int compareTo(TimestampDuration other) => value.compareTo(other.value); int compareTo(TimestampDuration other) => value.compareTo(other.value);
bool operator <(TimestampDuration other) => compareTo(other) < 0; bool operator <(TimestampDuration other) => compareTo(other) < 0;
bool operator <=(TimestampDuration other) => compareTo(other) <= 0; bool operator <=(TimestampDuration other) => compareTo(other) <= 0;
bool operator >(TimestampDuration other) => compareTo(other) > 0; bool operator >(TimestampDuration other) => compareTo(other) > 0;
bool operator >=(TimestampDuration other) => compareTo(other) >= 0; bool operator >=(TimestampDuration other) => compareTo(other) >= 0;
@override @override
@ -153,11 +178,14 @@ class TimestampDuration extends Equatable
} }
String toJson() => value.toString(); String toJson() => value.toString();
Int64 toInt64() => Int64.fromInts( Int64 toInt64() => Int64.fromInts(
(value >> 32).toUnsigned(32).toInt(), value.toUnsigned(32).toInt()); (value >> 32).toUnsigned(32).toInt(), value.toUnsigned(32).toInt());
double toMillis() => value / BigInt.from(1000); double toMillis() => value / BigInt.from(1000);
double toSecs() => value / BigInt.from(1000000); double toSecs() => value / BigInt.from(1000000);
BigInt toMicros() => value; BigInt toMicros() => value;
} }

View file

@ -108,9 +108,11 @@ class VeilidAPIExceptionTimeout implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionTryAgain implements VeilidAPIException { class VeilidAPIExceptionTryAgain implements VeilidAPIException {
final String message;
// //
const VeilidAPIExceptionTryAgain(this.message); const VeilidAPIExceptionTryAgain(this.message);
final String message;
@override @override
String toString() => 'VeilidAPIException: TryAgain (message: $message)'; String toString() => 'VeilidAPIException: TryAgain (message: $message)';
@ -129,9 +131,10 @@ class VeilidAPIExceptionShutdown implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionInvalidTarget implements VeilidAPIException { class VeilidAPIExceptionInvalidTarget implements VeilidAPIException {
final String message;
// //
const VeilidAPIExceptionInvalidTarget(this.message); const VeilidAPIExceptionInvalidTarget(this.message);
final String message;
@override @override
String toString() => 'VeilidAPIException: InvalidTarget (message: $message)'; String toString() => 'VeilidAPIException: InvalidTarget (message: $message)';
@ -142,9 +145,11 @@ class VeilidAPIExceptionInvalidTarget implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionNoConnection implements VeilidAPIException { class VeilidAPIExceptionNoConnection implements VeilidAPIException {
final String message;
// //
const VeilidAPIExceptionNoConnection(this.message); const VeilidAPIExceptionNoConnection(this.message);
final String message;
@override @override
String toString() => 'VeilidAPIException: NoConnection (message: $message)'; String toString() => 'VeilidAPIException: NoConnection (message: $message)';
@ -154,9 +159,11 @@ class VeilidAPIExceptionNoConnection implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionKeyNotFound implements VeilidAPIException { class VeilidAPIExceptionKeyNotFound implements VeilidAPIException {
final String key;
// //
const VeilidAPIExceptionKeyNotFound(this.key); const VeilidAPIExceptionKeyNotFound(this.key);
final String key;
@override @override
String toString() => 'VeilidAPIException: KeyNotFound (key: $key)'; String toString() => 'VeilidAPIException: KeyNotFound (key: $key)';
@ -166,9 +173,10 @@ class VeilidAPIExceptionKeyNotFound implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionInternal implements VeilidAPIException { class VeilidAPIExceptionInternal implements VeilidAPIException {
final String message;
// //
const VeilidAPIExceptionInternal(this.message); const VeilidAPIExceptionInternal(this.message);
final String message;
@override @override
String toString() => 'VeilidAPIException: Internal ($message)'; String toString() => 'VeilidAPIException: Internal ($message)';
@ -179,9 +187,10 @@ class VeilidAPIExceptionInternal implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionUnimplemented implements VeilidAPIException { class VeilidAPIExceptionUnimplemented implements VeilidAPIException {
final String message;
// //
const VeilidAPIExceptionUnimplemented(this.message); const VeilidAPIExceptionUnimplemented(this.message);
final String message;
@override @override
String toString() => 'VeilidAPIException: Unimplemented ($message)'; String toString() => 'VeilidAPIException: Unimplemented ($message)';
@ -192,10 +201,12 @@ class VeilidAPIExceptionUnimplemented implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionParseError implements VeilidAPIException { class VeilidAPIExceptionParseError implements VeilidAPIException {
final String message;
final String value;
// //
const VeilidAPIExceptionParseError(this.message, this.value); const VeilidAPIExceptionParseError(this.message, this.value);
final String message;
final String value;
@override @override
String toString() => String toString() =>
@ -207,12 +218,15 @@ class VeilidAPIExceptionParseError implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionInvalidArgument implements VeilidAPIException { class VeilidAPIExceptionInvalidArgument implements VeilidAPIException {
final String context;
final String argument;
final String value;
// //
const VeilidAPIExceptionInvalidArgument( const VeilidAPIExceptionInvalidArgument(
this.context, this.argument, this.value); this.context, this.argument, this.value);
final String context;
final String argument;
final String value;
@override @override
String toString() => 'VeilidAPIException: InvalidArgument' String toString() => 'VeilidAPIException: InvalidArgument'
@ -224,10 +238,12 @@ class VeilidAPIExceptionInvalidArgument implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionMissingArgument implements VeilidAPIException { class VeilidAPIExceptionMissingArgument implements VeilidAPIException {
final String context;
final String argument;
// //
const VeilidAPIExceptionMissingArgument(this.context, this.argument); const VeilidAPIExceptionMissingArgument(this.context, this.argument);
final String context;
final String argument;
@override @override
String toString() => String toString() =>
@ -239,9 +255,10 @@ class VeilidAPIExceptionMissingArgument implements VeilidAPIException {
@immutable @immutable
class VeilidAPIExceptionGeneric implements VeilidAPIException { class VeilidAPIExceptionGeneric implements VeilidAPIException {
final String message;
// //
const VeilidAPIExceptionGeneric(this.message); const VeilidAPIExceptionGeneric(this.message);
final String message;
@override @override
String toString() => 'VeilidAPIException: Generic (message: $message)'; String toString() => 'VeilidAPIException: Generic (message: $message)';

File diff suppressed because it is too large Load diff

View file

@ -7,164 +7,161 @@ part of 'veilid_config.dart';
// ************************************************************************** // **************************************************************************
_VeilidFFIConfigLoggingTerminal _$VeilidFFIConfigLoggingTerminalFromJson( _VeilidFFIConfigLoggingTerminal _$VeilidFFIConfigLoggingTerminalFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidFFIConfigLoggingTerminal( ) => _VeilidFFIConfigLoggingTerminal(
enabled: json['enabled'] as bool, enabled: json['enabled'] as bool,
level: VeilidConfigLogLevel.fromJson(json['level']), level: VeilidConfigLogLevel.fromJson(json['level']),
ignoreLogTargets: (json['ignore_log_targets'] as List<dynamic>?) ignoreLogTargets:
?.map((e) => e as String) (json['ignore_log_targets'] as List<dynamic>?)
.toList() ?? ?.map((e) => e as String)
const [], .toList() ??
); const [],
);
Map<String, dynamic> _$VeilidFFIConfigLoggingTerminalToJson( Map<String, dynamic> _$VeilidFFIConfigLoggingTerminalToJson(
_VeilidFFIConfigLoggingTerminal instance) => _VeilidFFIConfigLoggingTerminal instance,
<String, dynamic>{ ) => <String, dynamic>{
'enabled': instance.enabled, 'enabled': instance.enabled,
'level': instance.level.toJson(), 'level': instance.level.toJson(),
'ignore_log_targets': instance.ignoreLogTargets, 'ignore_log_targets': instance.ignoreLogTargets,
}; };
_VeilidFFIConfigLoggingOtlp _$VeilidFFIConfigLoggingOtlpFromJson( _VeilidFFIConfigLoggingOtlp _$VeilidFFIConfigLoggingOtlpFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidFFIConfigLoggingOtlp( ) => _VeilidFFIConfigLoggingOtlp(
enabled: json['enabled'] as bool, enabled: json['enabled'] as bool,
level: VeilidConfigLogLevel.fromJson(json['level']), level: VeilidConfigLogLevel.fromJson(json['level']),
grpcEndpoint: json['grpc_endpoint'] as String, grpcEndpoint: json['grpc_endpoint'] as String,
serviceName: json['service_name'] as String, serviceName: json['service_name'] as String,
ignoreLogTargets: (json['ignore_log_targets'] as List<dynamic>?) ignoreLogTargets:
?.map((e) => e as String) (json['ignore_log_targets'] as List<dynamic>?)
.toList() ?? ?.map((e) => e as String)
const [], .toList() ??
); const [],
);
Map<String, dynamic> _$VeilidFFIConfigLoggingOtlpToJson( Map<String, dynamic> _$VeilidFFIConfigLoggingOtlpToJson(
_VeilidFFIConfigLoggingOtlp instance) => _VeilidFFIConfigLoggingOtlp instance,
<String, dynamic>{ ) => <String, dynamic>{
'enabled': instance.enabled, 'enabled': instance.enabled,
'level': instance.level.toJson(), 'level': instance.level.toJson(),
'grpc_endpoint': instance.grpcEndpoint, 'grpc_endpoint': instance.grpcEndpoint,
'service_name': instance.serviceName, 'service_name': instance.serviceName,
'ignore_log_targets': instance.ignoreLogTargets, 'ignore_log_targets': instance.ignoreLogTargets,
}; };
_VeilidFFIConfigLoggingApi _$VeilidFFIConfigLoggingApiFromJson( _VeilidFFIConfigLoggingApi _$VeilidFFIConfigLoggingApiFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidFFIConfigLoggingApi( ) => _VeilidFFIConfigLoggingApi(
enabled: json['enabled'] as bool, enabled: json['enabled'] as bool,
level: VeilidConfigLogLevel.fromJson(json['level']), level: VeilidConfigLogLevel.fromJson(json['level']),
ignoreLogTargets: (json['ignore_log_targets'] as List<dynamic>?) ignoreLogTargets:
?.map((e) => e as String) (json['ignore_log_targets'] as List<dynamic>?)
.toList() ?? ?.map((e) => e as String)
const [], .toList() ??
); const [],
);
Map<String, dynamic> _$VeilidFFIConfigLoggingApiToJson( Map<String, dynamic> _$VeilidFFIConfigLoggingApiToJson(
_VeilidFFIConfigLoggingApi instance) => _VeilidFFIConfigLoggingApi instance,
<String, dynamic>{ ) => <String, dynamic>{
'enabled': instance.enabled, 'enabled': instance.enabled,
'level': instance.level.toJson(), 'level': instance.level.toJson(),
'ignore_log_targets': instance.ignoreLogTargets, 'ignore_log_targets': instance.ignoreLogTargets,
}; };
_VeilidFFIConfigLoggingFlame _$VeilidFFIConfigLoggingFlameFromJson( _VeilidFFIConfigLoggingFlame _$VeilidFFIConfigLoggingFlameFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidFFIConfigLoggingFlame( ) => _VeilidFFIConfigLoggingFlame(
enabled: json['enabled'] as bool, enabled: json['enabled'] as bool,
path: json['path'] as String, path: json['path'] as String,
); );
Map<String, dynamic> _$VeilidFFIConfigLoggingFlameToJson( Map<String, dynamic> _$VeilidFFIConfigLoggingFlameToJson(
_VeilidFFIConfigLoggingFlame instance) => _VeilidFFIConfigLoggingFlame instance,
<String, dynamic>{ ) => <String, dynamic>{'enabled': instance.enabled, 'path': instance.path};
'enabled': instance.enabled,
'path': instance.path,
};
_VeilidFFIConfigLogging _$VeilidFFIConfigLoggingFromJson( _VeilidFFIConfigLogging _$VeilidFFIConfigLoggingFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidFFIConfigLogging( ) => _VeilidFFIConfigLogging(
terminal: VeilidFFIConfigLoggingTerminal.fromJson(json['terminal']), terminal: VeilidFFIConfigLoggingTerminal.fromJson(json['terminal']),
otlp: VeilidFFIConfigLoggingOtlp.fromJson(json['otlp']), otlp: VeilidFFIConfigLoggingOtlp.fromJson(json['otlp']),
api: VeilidFFIConfigLoggingApi.fromJson(json['api']), api: VeilidFFIConfigLoggingApi.fromJson(json['api']),
flame: VeilidFFIConfigLoggingFlame.fromJson(json['flame']), flame: VeilidFFIConfigLoggingFlame.fromJson(json['flame']),
); );
Map<String, dynamic> _$VeilidFFIConfigLoggingToJson( Map<String, dynamic> _$VeilidFFIConfigLoggingToJson(
_VeilidFFIConfigLogging instance) => _VeilidFFIConfigLogging instance,
<String, dynamic>{ ) => <String, dynamic>{
'terminal': instance.terminal.toJson(), 'terminal': instance.terminal.toJson(),
'otlp': instance.otlp.toJson(), 'otlp': instance.otlp.toJson(),
'api': instance.api.toJson(), 'api': instance.api.toJson(),
'flame': instance.flame.toJson(), 'flame': instance.flame.toJson(),
}; };
_VeilidFFIConfig _$VeilidFFIConfigFromJson(Map<String, dynamic> json) => _VeilidFFIConfig _$VeilidFFIConfigFromJson(Map<String, dynamic> json) =>
_VeilidFFIConfig( _VeilidFFIConfig(logging: VeilidFFIConfigLogging.fromJson(json['logging']));
logging: VeilidFFIConfigLogging.fromJson(json['logging']),
);
Map<String, dynamic> _$VeilidFFIConfigToJson(_VeilidFFIConfig instance) => Map<String, dynamic> _$VeilidFFIConfigToJson(_VeilidFFIConfig instance) =>
<String, dynamic>{ <String, dynamic>{'logging': instance.logging.toJson()};
'logging': instance.logging.toJson(),
};
_VeilidWASMConfigLoggingPerformance _VeilidWASMConfigLoggingPerformance
_$VeilidWASMConfigLoggingPerformanceFromJson(Map<String, dynamic> json) => _$VeilidWASMConfigLoggingPerformanceFromJson(Map<String, dynamic> json) =>
_VeilidWASMConfigLoggingPerformance( _VeilidWASMConfigLoggingPerformance(
enabled: json['enabled'] as bool,
level: VeilidConfigLogLevel.fromJson(json['level']),
logsInTimings: json['logs_in_timings'] as bool,
logsInConsole: json['logs_in_console'] as bool,
ignoreLogTargets: (json['ignore_log_targets'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
const [],
);
Map<String, dynamic> _$VeilidWASMConfigLoggingPerformanceToJson(
_VeilidWASMConfigLoggingPerformance instance) =>
<String, dynamic>{
'enabled': instance.enabled,
'level': instance.level.toJson(),
'logs_in_timings': instance.logsInTimings,
'logs_in_console': instance.logsInConsole,
'ignore_log_targets': instance.ignoreLogTargets,
};
_VeilidWASMConfigLoggingApi _$VeilidWASMConfigLoggingApiFromJson(
Map<String, dynamic> json) =>
_VeilidWASMConfigLoggingApi(
enabled: json['enabled'] as bool, enabled: json['enabled'] as bool,
level: VeilidConfigLogLevel.fromJson(json['level']), level: VeilidConfigLogLevel.fromJson(json['level']),
ignoreLogTargets: (json['ignore_log_targets'] as List<dynamic>?) logsInTimings: json['logs_in_timings'] as bool,
logsInConsole: json['logs_in_console'] as bool,
ignoreLogTargets:
(json['ignore_log_targets'] as List<dynamic>?)
?.map((e) => e as String) ?.map((e) => e as String)
.toList() ?? .toList() ??
const [], const [],
); );
Map<String, dynamic> _$VeilidWASMConfigLoggingPerformanceToJson(
_VeilidWASMConfigLoggingPerformance instance,
) => <String, dynamic>{
'enabled': instance.enabled,
'level': instance.level.toJson(),
'logs_in_timings': instance.logsInTimings,
'logs_in_console': instance.logsInConsole,
'ignore_log_targets': instance.ignoreLogTargets,
};
_VeilidWASMConfigLoggingApi _$VeilidWASMConfigLoggingApiFromJson(
Map<String, dynamic> json,
) => _VeilidWASMConfigLoggingApi(
enabled: json['enabled'] as bool,
level: VeilidConfigLogLevel.fromJson(json['level']),
ignoreLogTargets:
(json['ignore_log_targets'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
const [],
);
Map<String, dynamic> _$VeilidWASMConfigLoggingApiToJson( Map<String, dynamic> _$VeilidWASMConfigLoggingApiToJson(
_VeilidWASMConfigLoggingApi instance) => _VeilidWASMConfigLoggingApi instance,
<String, dynamic>{ ) => <String, dynamic>{
'enabled': instance.enabled, 'enabled': instance.enabled,
'level': instance.level.toJson(), 'level': instance.level.toJson(),
'ignore_log_targets': instance.ignoreLogTargets, 'ignore_log_targets': instance.ignoreLogTargets,
}; };
_VeilidWASMConfigLogging _$VeilidWASMConfigLoggingFromJson( _VeilidWASMConfigLogging _$VeilidWASMConfigLoggingFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidWASMConfigLogging( ) => _VeilidWASMConfigLogging(
performance: performance: VeilidWASMConfigLoggingPerformance.fromJson(json['performance']),
VeilidWASMConfigLoggingPerformance.fromJson(json['performance']), api: VeilidWASMConfigLoggingApi.fromJson(json['api']),
api: VeilidWASMConfigLoggingApi.fromJson(json['api']), );
);
Map<String, dynamic> _$VeilidWASMConfigLoggingToJson( Map<String, dynamic> _$VeilidWASMConfigLoggingToJson(
_VeilidWASMConfigLogging instance) => _VeilidWASMConfigLogging instance,
<String, dynamic>{ ) => <String, dynamic>{
'performance': instance.performance.toJson(), 'performance': instance.performance.toJson(),
'api': instance.api.toJson(), 'api': instance.api.toJson(),
}; };
_VeilidWASMConfig _$VeilidWASMConfigFromJson(Map<String, dynamic> json) => _VeilidWASMConfig _$VeilidWASMConfigFromJson(Map<String, dynamic> json) =>
_VeilidWASMConfig( _VeilidWASMConfig(
@ -172,9 +169,7 @@ _VeilidWASMConfig _$VeilidWASMConfigFromJson(Map<String, dynamic> json) =>
); );
Map<String, dynamic> _$VeilidWASMConfigToJson(_VeilidWASMConfig instance) => Map<String, dynamic> _$VeilidWASMConfigToJson(_VeilidWASMConfig instance) =>
<String, dynamic>{ <String, dynamic>{'logging': instance.logging.toJson()};
'logging': instance.logging.toJson(),
};
_VeilidConfigHTTPS _$VeilidConfigHTTPSFromJson(Map<String, dynamic> json) => _VeilidConfigHTTPS _$VeilidConfigHTTPSFromJson(Map<String, dynamic> json) =>
_VeilidConfigHTTPS( _VeilidConfigHTTPS(
@ -209,18 +204,18 @@ Map<String, dynamic> _$VeilidConfigHTTPToJson(_VeilidConfigHTTP instance) =>
}; };
_VeilidConfigApplication _$VeilidConfigApplicationFromJson( _VeilidConfigApplication _$VeilidConfigApplicationFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigApplication( ) => _VeilidConfigApplication(
https: VeilidConfigHTTPS.fromJson(json['https']), https: VeilidConfigHTTPS.fromJson(json['https']),
http: VeilidConfigHTTP.fromJson(json['http']), http: VeilidConfigHTTP.fromJson(json['http']),
); );
Map<String, dynamic> _$VeilidConfigApplicationToJson( Map<String, dynamic> _$VeilidConfigApplicationToJson(
_VeilidConfigApplication instance) => _VeilidConfigApplication instance,
<String, dynamic>{ ) => <String, dynamic>{
'https': instance.https.toJson(), 'https': instance.https.toJson(),
'http': instance.http.toJson(), 'http': instance.http.toJson(),
}; };
_VeilidConfigUDP _$VeilidConfigUDPFromJson(Map<String, dynamic> json) => _VeilidConfigUDP _$VeilidConfigUDPFromJson(Map<String, dynamic> json) =>
_VeilidConfigUDP( _VeilidConfigUDP(
@ -297,22 +292,22 @@ Map<String, dynamic> _$VeilidConfigWSSToJson(_VeilidConfigWSS instance) =>
}; };
_VeilidConfigProtocol _$VeilidConfigProtocolFromJson( _VeilidConfigProtocol _$VeilidConfigProtocolFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigProtocol( ) => _VeilidConfigProtocol(
udp: VeilidConfigUDP.fromJson(json['udp']), udp: VeilidConfigUDP.fromJson(json['udp']),
tcp: VeilidConfigTCP.fromJson(json['tcp']), tcp: VeilidConfigTCP.fromJson(json['tcp']),
ws: VeilidConfigWS.fromJson(json['ws']), ws: VeilidConfigWS.fromJson(json['ws']),
wss: VeilidConfigWSS.fromJson(json['wss']), wss: VeilidConfigWSS.fromJson(json['wss']),
); );
Map<String, dynamic> _$VeilidConfigProtocolToJson( Map<String, dynamic> _$VeilidConfigProtocolToJson(
_VeilidConfigProtocol instance) => _VeilidConfigProtocol instance,
<String, dynamic>{ ) => <String, dynamic>{
'udp': instance.udp.toJson(), 'udp': instance.udp.toJson(),
'tcp': instance.tcp.toJson(), 'tcp': instance.tcp.toJson(),
'ws': instance.ws.toJson(), 'ws': instance.ws.toJson(),
'wss': instance.wss.toJson(), 'wss': instance.wss.toJson(),
}; };
_VeilidConfigPrivacy _$VeilidConfigPrivacyFromJson(Map<String, dynamic> json) => _VeilidConfigPrivacy _$VeilidConfigPrivacyFromJson(Map<String, dynamic> json) =>
_VeilidConfigPrivacy( _VeilidConfigPrivacy(
@ -320,17 +315,15 @@ _VeilidConfigPrivacy _$VeilidConfigPrivacyFromJson(Map<String, dynamic> json) =>
); );
Map<String, dynamic> _$VeilidConfigPrivacyToJson( Map<String, dynamic> _$VeilidConfigPrivacyToJson(
_VeilidConfigPrivacy instance) => _VeilidConfigPrivacy instance,
<String, dynamic>{ ) => <String, dynamic>{'require_inbound_relay': instance.requireInboundRelay};
'require_inbound_relay': instance.requireInboundRelay,
};
_VeilidConfigTLS _$VeilidConfigTLSFromJson(Map<String, dynamic> json) => _VeilidConfigTLS _$VeilidConfigTLSFromJson(Map<String, dynamic> json) =>
_VeilidConfigTLS( _VeilidConfigTLS(
certificatePath: json['certificate_path'] as String, certificatePath: json['certificate_path'] as String,
privateKeyPath: json['private_key_path'] as String, privateKeyPath: json['private_key_path'] as String,
connectionInitialTimeoutMs: connectionInitialTimeoutMs: (json['connection_initial_timeout_ms'] as num)
(json['connection_initial_timeout_ms'] as num).toInt(), .toInt(),
); );
Map<String, dynamic> _$VeilidConfigTLSToJson(_VeilidConfigTLS instance) => Map<String, dynamic> _$VeilidConfigTLSToJson(_VeilidConfigTLS instance) =>
@ -363,40 +356,39 @@ _VeilidConfigDHT _$VeilidConfigDHTFromJson(Map<String, dynamic> json) =>
remoteMaxRecords: (json['remote_max_records'] as num).toInt(), remoteMaxRecords: (json['remote_max_records'] as num).toInt(),
remoteMaxSubkeyCacheMemoryMb: remoteMaxSubkeyCacheMemoryMb:
(json['remote_max_subkey_cache_memory_mb'] as num).toInt(), (json['remote_max_subkey_cache_memory_mb'] as num).toInt(),
remoteMaxStorageSpaceMb: remoteMaxStorageSpaceMb: (json['remote_max_storage_space_mb'] as num)
(json['remote_max_storage_space_mb'] as num).toInt(), .toInt(),
publicWatchLimit: (json['public_watch_limit'] as num).toInt(), publicWatchLimit: (json['public_watch_limit'] as num).toInt(),
memberWatchLimit: (json['member_watch_limit'] as num).toInt(), memberWatchLimit: (json['member_watch_limit'] as num).toInt(),
maxWatchExpirationMs: (json['max_watch_expiration_ms'] as num).toInt(), maxWatchExpirationMs: (json['max_watch_expiration_ms'] as num).toInt(),
); );
Map<String, dynamic> _$VeilidConfigDHTToJson(_VeilidConfigDHT instance) => Map<String, dynamic> _$VeilidConfigDHTToJson(
<String, dynamic>{ _VeilidConfigDHT instance,
'resolve_node_timeout_ms': instance.resolveNodeTimeoutMs, ) => <String, dynamic>{
'resolve_node_count': instance.resolveNodeCount, 'resolve_node_timeout_ms': instance.resolveNodeTimeoutMs,
'resolve_node_fanout': instance.resolveNodeFanout, 'resolve_node_count': instance.resolveNodeCount,
'max_find_node_count': instance.maxFindNodeCount, 'resolve_node_fanout': instance.resolveNodeFanout,
'get_value_timeout_ms': instance.getValueTimeoutMs, 'max_find_node_count': instance.maxFindNodeCount,
'get_value_count': instance.getValueCount, 'get_value_timeout_ms': instance.getValueTimeoutMs,
'get_value_fanout': instance.getValueFanout, 'get_value_count': instance.getValueCount,
'set_value_timeout_ms': instance.setValueTimeoutMs, 'get_value_fanout': instance.getValueFanout,
'set_value_count': instance.setValueCount, 'set_value_timeout_ms': instance.setValueTimeoutMs,
'set_value_fanout': instance.setValueFanout, 'set_value_count': instance.setValueCount,
'min_peer_count': instance.minPeerCount, 'set_value_fanout': instance.setValueFanout,
'min_peer_refresh_time_ms': instance.minPeerRefreshTimeMs, 'min_peer_count': instance.minPeerCount,
'validate_dial_info_receipt_time_ms': 'min_peer_refresh_time_ms': instance.minPeerRefreshTimeMs,
instance.validateDialInfoReceiptTimeMs, 'validate_dial_info_receipt_time_ms': instance.validateDialInfoReceiptTimeMs,
'local_subkey_cache_size': instance.localSubkeyCacheSize, 'local_subkey_cache_size': instance.localSubkeyCacheSize,
'local_max_subkey_cache_memory_mb': instance.localMaxSubkeyCacheMemoryMb, 'local_max_subkey_cache_memory_mb': instance.localMaxSubkeyCacheMemoryMb,
'remote_subkey_cache_size': instance.remoteSubkeyCacheSize, 'remote_subkey_cache_size': instance.remoteSubkeyCacheSize,
'remote_max_records': instance.remoteMaxRecords, 'remote_max_records': instance.remoteMaxRecords,
'remote_max_subkey_cache_memory_mb': 'remote_max_subkey_cache_memory_mb': instance.remoteMaxSubkeyCacheMemoryMb,
instance.remoteMaxSubkeyCacheMemoryMb, 'remote_max_storage_space_mb': instance.remoteMaxStorageSpaceMb,
'remote_max_storage_space_mb': instance.remoteMaxStorageSpaceMb, 'public_watch_limit': instance.publicWatchLimit,
'public_watch_limit': instance.publicWatchLimit, 'member_watch_limit': instance.memberWatchLimit,
'member_watch_limit': instance.memberWatchLimit, 'max_watch_expiration_ms': instance.maxWatchExpirationMs,
'max_watch_expiration_ms': instance.maxWatchExpirationMs, };
};
_VeilidConfigRPC _$VeilidConfigRPCFromJson(Map<String, dynamic> json) => _VeilidConfigRPC _$VeilidConfigRPCFromJson(Map<String, dynamic> json) =>
_VeilidConfigRPC( _VeilidConfigRPC(
@ -421,44 +413,45 @@ Map<String, dynamic> _$VeilidConfigRPCToJson(_VeilidConfigRPC instance) =>
}; };
_VeilidConfigRoutingTable _$VeilidConfigRoutingTableFromJson( _VeilidConfigRoutingTable _$VeilidConfigRoutingTableFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigRoutingTable( ) => _VeilidConfigRoutingTable(
publicKeys: (json['public_keys'] as List<dynamic>) publicKeys: (json['public_keys'] as List<dynamic>)
.map(Typed<BarePublicKey>.fromJson) .map(Typed<BarePublicKey>.fromJson)
.toList(), .toList(),
secretKeys: (json['secret_keys'] as List<dynamic>) secretKeys: (json['secret_keys'] as List<dynamic>)
.map(Typed<BareSecretKey>.fromJson) .map(Typed<BareSecretKey>.fromJson)
.toList(), .toList(),
bootstrap: bootstrap: (json['bootstrap'] as List<dynamic>)
(json['bootstrap'] as List<dynamic>).map((e) => e as String).toList(), .map((e) => e as String)
bootstrapKeys: (json['bootstrap_keys'] as List<dynamic>) .toList(),
.map(Typed<BarePublicKey>.fromJson) bootstrapKeys: (json['bootstrap_keys'] as List<dynamic>)
.toList(), .map(Typed<BarePublicKey>.fromJson)
limitOverAttached: (json['limit_over_attached'] as num).toInt(), .toList(),
limitFullyAttached: (json['limit_fully_attached'] as num).toInt(), limitOverAttached: (json['limit_over_attached'] as num).toInt(),
limitAttachedStrong: (json['limit_attached_strong'] as num).toInt(), limitFullyAttached: (json['limit_fully_attached'] as num).toInt(),
limitAttachedGood: (json['limit_attached_good'] as num).toInt(), limitAttachedStrong: (json['limit_attached_strong'] as num).toInt(),
limitAttachedWeak: (json['limit_attached_weak'] as num).toInt(), limitAttachedGood: (json['limit_attached_good'] as num).toInt(),
); limitAttachedWeak: (json['limit_attached_weak'] as num).toInt(),
);
Map<String, dynamic> _$VeilidConfigRoutingTableToJson( Map<String, dynamic> _$VeilidConfigRoutingTableToJson(
_VeilidConfigRoutingTable instance) => _VeilidConfigRoutingTable instance,
<String, dynamic>{ ) => <String, dynamic>{
'public_keys': instance.publicKeys.map((e) => e.toJson()).toList(), 'public_keys': instance.publicKeys.map((e) => e.toJson()).toList(),
'secret_keys': instance.secretKeys.map((e) => e.toJson()).toList(), 'secret_keys': instance.secretKeys.map((e) => e.toJson()).toList(),
'bootstrap': instance.bootstrap, 'bootstrap': instance.bootstrap,
'bootstrap_keys': instance.bootstrapKeys.map((e) => e.toJson()).toList(), 'bootstrap_keys': instance.bootstrapKeys.map((e) => e.toJson()).toList(),
'limit_over_attached': instance.limitOverAttached, 'limit_over_attached': instance.limitOverAttached,
'limit_fully_attached': instance.limitFullyAttached, 'limit_fully_attached': instance.limitFullyAttached,
'limit_attached_strong': instance.limitAttachedStrong, 'limit_attached_strong': instance.limitAttachedStrong,
'limit_attached_good': instance.limitAttachedGood, 'limit_attached_good': instance.limitAttachedGood,
'limit_attached_weak': instance.limitAttachedWeak, 'limit_attached_weak': instance.limitAttachedWeak,
}; };
_VeilidConfigNetwork _$VeilidConfigNetworkFromJson(Map<String, dynamic> json) => _VeilidConfigNetwork _$VeilidConfigNetworkFromJson(Map<String, dynamic> json) =>
_VeilidConfigNetwork( _VeilidConfigNetwork(
connectionInitialTimeoutMs: connectionInitialTimeoutMs: (json['connection_initial_timeout_ms'] as num)
(json['connection_initial_timeout_ms'] as num).toInt(), .toInt(),
connectionInactivityTimeoutMs: connectionInactivityTimeoutMs:
(json['connection_inactivity_timeout_ms'] as num).toInt(), (json['connection_inactivity_timeout_ms'] as num).toInt(),
maxConnectionsPerIp4: (json['max_connections_per_ip4'] as num).toInt(), maxConnectionsPerIp4: (json['max_connections_per_ip4'] as num).toInt(),
@ -468,12 +461,12 @@ _VeilidConfigNetwork _$VeilidConfigNetworkFromJson(Map<String, dynamic> json) =>
(json['max_connections_per_ip6_prefix_size'] as num).toInt(), (json['max_connections_per_ip6_prefix_size'] as num).toInt(),
maxConnectionFrequencyPerMin: maxConnectionFrequencyPerMin:
(json['max_connection_frequency_per_min'] as num).toInt(), (json['max_connection_frequency_per_min'] as num).toInt(),
clientAllowlistTimeoutMs: clientAllowlistTimeoutMs: (json['client_allowlist_timeout_ms'] as num)
(json['client_allowlist_timeout_ms'] as num).toInt(), .toInt(),
reverseConnectionReceiptTimeMs: reverseConnectionReceiptTimeMs:
(json['reverse_connection_receipt_time_ms'] as num).toInt(), (json['reverse_connection_receipt_time_ms'] as num).toInt(),
holePunchReceiptTimeMs: holePunchReceiptTimeMs: (json['hole_punch_receipt_time_ms'] as num)
(json['hole_punch_receipt_time_ms'] as num).toInt(), .toInt(),
routingTable: VeilidConfigRoutingTable.fromJson(json['routing_table']), routingTable: VeilidConfigRoutingTable.fromJson(json['routing_table']),
rpc: VeilidConfigRPC.fromJson(json['rpc']), rpc: VeilidConfigRPC.fromJson(json['rpc']),
dht: VeilidConfigDHT.fromJson(json['dht']), dht: VeilidConfigDHT.fromJson(json['dht']),
@ -488,106 +481,100 @@ _VeilidConfigNetwork _$VeilidConfigNetworkFromJson(Map<String, dynamic> json) =>
); );
Map<String, dynamic> _$VeilidConfigNetworkToJson( Map<String, dynamic> _$VeilidConfigNetworkToJson(
_VeilidConfigNetwork instance) => _VeilidConfigNetwork instance,
<String, dynamic>{ ) => <String, dynamic>{
'connection_initial_timeout_ms': instance.connectionInitialTimeoutMs, 'connection_initial_timeout_ms': instance.connectionInitialTimeoutMs,
'connection_inactivity_timeout_ms': 'connection_inactivity_timeout_ms': instance.connectionInactivityTimeoutMs,
instance.connectionInactivityTimeoutMs, 'max_connections_per_ip4': instance.maxConnectionsPerIp4,
'max_connections_per_ip4': instance.maxConnectionsPerIp4, 'max_connections_per_ip6_prefix': instance.maxConnectionsPerIp6Prefix,
'max_connections_per_ip6_prefix': instance.maxConnectionsPerIp6Prefix, 'max_connections_per_ip6_prefix_size':
'max_connections_per_ip6_prefix_size': instance.maxConnectionsPerIp6PrefixSize,
instance.maxConnectionsPerIp6PrefixSize, 'max_connection_frequency_per_min': instance.maxConnectionFrequencyPerMin,
'max_connection_frequency_per_min': instance.maxConnectionFrequencyPerMin, 'client_allowlist_timeout_ms': instance.clientAllowlistTimeoutMs,
'client_allowlist_timeout_ms': instance.clientAllowlistTimeoutMs, 'reverse_connection_receipt_time_ms': instance.reverseConnectionReceiptTimeMs,
'reverse_connection_receipt_time_ms': 'hole_punch_receipt_time_ms': instance.holePunchReceiptTimeMs,
instance.reverseConnectionReceiptTimeMs, 'routing_table': instance.routingTable.toJson(),
'hole_punch_receipt_time_ms': instance.holePunchReceiptTimeMs, 'rpc': instance.rpc.toJson(),
'routing_table': instance.routingTable.toJson(), 'dht': instance.dht.toJson(),
'rpc': instance.rpc.toJson(), 'upnp': instance.upnp,
'dht': instance.dht.toJson(), 'detect_address_changes': instance.detectAddressChanges,
'upnp': instance.upnp, 'restricted_nat_retries': instance.restrictedNatRetries,
'detect_address_changes': instance.detectAddressChanges, 'tls': instance.tls.toJson(),
'restricted_nat_retries': instance.restrictedNatRetries, 'application': instance.application.toJson(),
'tls': instance.tls.toJson(), 'protocol': instance.protocol.toJson(),
'application': instance.application.toJson(), 'privacy': instance.privacy.toJson(),
'protocol': instance.protocol.toJson(), 'network_key_password': instance.networkKeyPassword,
'privacy': instance.privacy.toJson(), };
'network_key_password': instance.networkKeyPassword,
};
_VeilidConfigTableStore _$VeilidConfigTableStoreFromJson( _VeilidConfigTableStore _$VeilidConfigTableStoreFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigTableStore( ) => _VeilidConfigTableStore(
directory: json['directory'] as String, directory: json['directory'] as String,
delete: json['delete'] as bool, delete: json['delete'] as bool,
); );
Map<String, dynamic> _$VeilidConfigTableStoreToJson( Map<String, dynamic> _$VeilidConfigTableStoreToJson(
_VeilidConfigTableStore instance) => _VeilidConfigTableStore instance,
<String, dynamic>{ ) => <String, dynamic>{
'directory': instance.directory, 'directory': instance.directory,
'delete': instance.delete, 'delete': instance.delete,
}; };
_VeilidConfigBlockStore _$VeilidConfigBlockStoreFromJson( _VeilidConfigBlockStore _$VeilidConfigBlockStoreFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigBlockStore( ) => _VeilidConfigBlockStore(
directory: json['directory'] as String, directory: json['directory'] as String,
delete: json['delete'] as bool, delete: json['delete'] as bool,
); );
Map<String, dynamic> _$VeilidConfigBlockStoreToJson( Map<String, dynamic> _$VeilidConfigBlockStoreToJson(
_VeilidConfigBlockStore instance) => _VeilidConfigBlockStore instance,
<String, dynamic>{ ) => <String, dynamic>{
'directory': instance.directory, 'directory': instance.directory,
'delete': instance.delete, 'delete': instance.delete,
}; };
_VeilidConfigProtectedStore _$VeilidConfigProtectedStoreFromJson( _VeilidConfigProtectedStore _$VeilidConfigProtectedStoreFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigProtectedStore( ) => _VeilidConfigProtectedStore(
allowInsecureFallback: json['allow_insecure_fallback'] as bool, allowInsecureFallback: json['allow_insecure_fallback'] as bool,
alwaysUseInsecureStorage: json['always_use_insecure_storage'] as bool, alwaysUseInsecureStorage: json['always_use_insecure_storage'] as bool,
directory: json['directory'] as String, directory: json['directory'] as String,
delete: json['delete'] as bool, delete: json['delete'] as bool,
deviceEncryptionKeyPassword: deviceEncryptionKeyPassword: json['device_encryption_key_password'] as String,
json['device_encryption_key_password'] as String, newDeviceEncryptionKeyPassword:
newDeviceEncryptionKeyPassword: json['new_device_encryption_key_password'] as String?,
json['new_device_encryption_key_password'] as String?, );
);
Map<String, dynamic> _$VeilidConfigProtectedStoreToJson( Map<String, dynamic> _$VeilidConfigProtectedStoreToJson(
_VeilidConfigProtectedStore instance) => _VeilidConfigProtectedStore instance,
<String, dynamic>{ ) => <String, dynamic>{
'allow_insecure_fallback': instance.allowInsecureFallback, 'allow_insecure_fallback': instance.allowInsecureFallback,
'always_use_insecure_storage': instance.alwaysUseInsecureStorage, 'always_use_insecure_storage': instance.alwaysUseInsecureStorage,
'directory': instance.directory, 'directory': instance.directory,
'delete': instance.delete, 'delete': instance.delete,
'device_encryption_key_password': instance.deviceEncryptionKeyPassword, 'device_encryption_key_password': instance.deviceEncryptionKeyPassword,
'new_device_encryption_key_password': 'new_device_encryption_key_password': instance.newDeviceEncryptionKeyPassword,
instance.newDeviceEncryptionKeyPassword, };
};
_VeilidConfigCapabilities _$VeilidConfigCapabilitiesFromJson( _VeilidConfigCapabilities _$VeilidConfigCapabilitiesFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidConfigCapabilities( ) => _VeilidConfigCapabilities(
disable: disable: (json['disable'] as List<dynamic>).map((e) => e as String).toList(),
(json['disable'] as List<dynamic>).map((e) => e as String).toList(), );
);
Map<String, dynamic> _$VeilidConfigCapabilitiesToJson( Map<String, dynamic> _$VeilidConfigCapabilitiesToJson(
_VeilidConfigCapabilities instance) => _VeilidConfigCapabilities instance,
<String, dynamic>{ ) => <String, dynamic>{'disable': instance.disable};
'disable': instance.disable,
};
_VeilidConfig _$VeilidConfigFromJson(Map<String, dynamic> json) => _VeilidConfig _$VeilidConfigFromJson(Map<String, dynamic> json) =>
_VeilidConfig( _VeilidConfig(
programName: json['program_name'] as String, programName: json['program_name'] as String,
namespace: json['namespace'] as String, namespace: json['namespace'] as String,
capabilities: VeilidConfigCapabilities.fromJson(json['capabilities']), capabilities: VeilidConfigCapabilities.fromJson(json['capabilities']),
protectedStore: protectedStore: VeilidConfigProtectedStore.fromJson(
VeilidConfigProtectedStore.fromJson(json['protected_store']), json['protected_store'],
),
tableStore: VeilidConfigTableStore.fromJson(json['table_store']), tableStore: VeilidConfigTableStore.fromJson(json['table_store']),
blockStore: VeilidConfigBlockStore.fromJson(json['block_store']), blockStore: VeilidConfigBlockStore.fromJson(json['block_store']),
network: VeilidConfigNetwork.fromJson(json['network']), network: VeilidConfigNetwork.fromJson(json['network']),

View file

@ -14,6 +14,8 @@ import 'veilid.dart';
typedef CryptoKind = int; typedef CryptoKind = int;
const CryptoKind cryptoKindVLD0 = const CryptoKind cryptoKindVLD0 =
$V << 24 | $L << 16 | $D << 8 | $0 << 0; // "VLD0" $V << 24 | $L << 16 | $D << 8 | $0 << 0; // "VLD0"
// const CryptoKind cryptoKindVLD1 =
// $V << 24 | $L << 16 | $D << 8 | $1 << 0; // "VLD1"
const CryptoKind cryptoKindNONE = const CryptoKind cryptoKindNONE =
$N << 24 | $O << 16 | $N << 8 | $E << 0; // "NONE" $N << 24 | $O << 16 | $N << 8 | $E << 0; // "NONE"
@ -35,16 +37,29 @@ CryptoKind cryptoKindFromString(String s) {
if (s.codeUnits.length != 4) { if (s.codeUnits.length != 4) {
throw const FormatException('malformed string'); throw const FormatException('malformed string');
} }
final kind = final kind = ByteData.sublistView(
ByteData.sublistView(Uint8List.fromList(s.codeUnits)).getUint32(0); Uint8List.fromList(s.codeUnits),
).getUint32(0);
return kind; return kind;
} }
////////////////////////////////////// //////////////////////////////////////
/// Types /// Types
abstract interface class TypedCryptoKey<V> {
CryptoKind get kind;
V get value;
}
@immutable @immutable
class Typed<V extends EncodedString> extends Equatable { class Typed<V extends EncodedString> extends Equatable
implements TypedCryptoKey<V> {
@override
final CryptoKind kind;
@override
final V value;
const Typed({required this.kind, required this.value}); const Typed({required this.kind, required this.value});
factory Typed.fromString(String s) { factory Typed.fromString(String s) {
@ -56,24 +71,25 @@ class Typed<V extends EncodedString> extends Equatable {
final value = EncodedString.fromString<V>(parts.sublist(1).join(':')); final value = EncodedString.fromString<V>(parts.sublist(1).join(':'));
return Typed(kind: kind, value: value); return Typed(kind: kind, value: value);
} }
factory Typed.fromBytes(Uint8List b) { factory Typed.fromBytes(Uint8List b) {
final kind = cryptoKindFromBytes(b); final kind = cryptoKindFromBytes(b);
final value = EncodedString.fromBytes<V>(b.sublist(4)); final value = EncodedString.fromBytes<V>(b.sublist(4));
return Typed(kind: kind, value: value); return Typed(kind: kind, value: value);
} }
factory Typed.fromJson(dynamic json) => Typed.fromString(json as String); factory Typed.fromJson(dynamic json) => Typed.fromString(json as String);
final CryptoKind kind;
final V value;
@override @override
List<Object> get props => [kind, value]; List<Object> get props => [kind, value];
@override @override
String toString() => '${cryptoKindToString(kind)}:$value'; String toString() => '${cryptoKindToString(kind)}:$value';
Uint8List decode() { Uint8List toBytes() {
final b = BytesBuilder() final b = BytesBuilder()
..add(cryptoKindToBytes(kind)) ..add(cryptoKindToBytes(kind))
..add(value.decode()); ..add(value.toBytes());
return b.toBytes(); return b.toBytes();
} }
@ -82,6 +98,10 @@ class Typed<V extends EncodedString> extends Equatable {
@immutable @immutable
class BareKeyPair extends Equatable { class BareKeyPair extends Equatable {
final BarePublicKey key;
final BareSecretKey secret;
const BareKeyPair({required this.key, required this.secret}); const BareKeyPair({required this.key, required this.secret});
factory BareKeyPair.fromString(String s) { factory BareKeyPair.fromString(String s) {
@ -93,10 +113,10 @@ class BareKeyPair extends Equatable {
final secret = BareSecretKey.fromString(parts[1]); final secret = BareSecretKey.fromString(parts[1]);
return BareKeyPair(key: key, secret: secret); return BareKeyPair(key: key, secret: secret);
} }
factory BareKeyPair.fromJson(dynamic json) => factory BareKeyPair.fromJson(dynamic json) =>
BareKeyPair.fromString(json as String); BareKeyPair.fromString(json as String);
final BarePublicKey key;
final BareSecretKey secret;
@override @override
List<Object> get props => [key, secret]; List<Object> get props => [key, secret];
@ -107,9 +127,13 @@ class BareKeyPair extends Equatable {
} }
@immutable @immutable
class KeyPair extends Equatable { class KeyPair extends Equatable implements TypedCryptoKey<BareKeyPair> {
final PublicKey key;
final SecretKey secret;
KeyPair({required this.key, required this.secret}) KeyPair({required this.key, required this.secret})
: assert(key.kind == secret.kind, 'keypair parts must have same kind'); : assert(key.kind == secret.kind, 'keypair parts must have same kind');
factory KeyPair.fromString(String s) { factory KeyPair.fromString(String s) {
final parts = s.split(':'); final parts = s.split(':');
@ -117,22 +141,39 @@ class KeyPair extends Equatable {
throw VeilidAPIExceptionInvalidArgument('malformed string', 's', s); throw VeilidAPIExceptionInvalidArgument('malformed string', 's', s);
} }
final kind = cryptoKindFromString(parts[0]); final kind = cryptoKindFromString(parts[0]);
final key = final key = PublicKey(
PublicKey(kind: kind, value: BarePublicKey.fromString(parts[1])); kind: kind,
final secret = value: BarePublicKey.fromString(parts[1]),
SecretKey(kind: kind, value: BareSecretKey.fromString(parts[2])); );
final secret = SecretKey(
kind: kind,
value: BareSecretKey.fromString(parts[2]),
);
return KeyPair(key: key, secret: secret); return KeyPair(key: key, secret: secret);
} }
factory KeyPair.fromJson(dynamic json) => KeyPair.fromString(json as String); factory KeyPair.fromJson(dynamic json) => KeyPair.fromString(json as String);
factory KeyPair.fromBareKeyPair(CryptoKind kind, BareKeyPair keyPair) => factory KeyPair.fromBareKeyPair(CryptoKind kind, BareKeyPair keyPair) =>
KeyPair( KeyPair(
key: PublicKey(kind: kind, value: keyPair.key), key: PublicKey(kind: kind, value: keyPair.key),
secret: SecretKey(kind: kind, value: keyPair.secret)); secret: SecretKey(kind: kind, value: keyPair.secret),
);
factory KeyPair.fromPublicAndBareSecret( factory KeyPair.fromPublicAndBareSecret(
PublicKey key, BareSecretKey secret) => PublicKey key,
KeyPair(key: key, secret: SecretKey(kind: key.kind, value: secret)); BareSecretKey secret,
final PublicKey key; ) => KeyPair(
final SecretKey secret; key: key,
secret: SecretKey(kind: key.kind, value: secret),
);
@override
CryptoKind get kind => key.kind;
@override
BareKeyPair get value => BareKeyPair(key: key.value, secret: secret.value);
@override @override
List<Object> get props => [key, secret]; List<Object> get props => [key, secret];
@ -141,12 +182,17 @@ class KeyPair extends Equatable {
'${cryptoKindToString(key.kind)}:${key.value}:${secret.value}'; '${cryptoKindToString(key.kind)}:${key.value}:${secret.value}';
String toJson() => toString(); String toJson() => toString();
BareKeyPair toBareKeyPair() => BareKeyPair toBareKeyPair() =>
BareKeyPair(key: key.value, secret: secret.value); BareKeyPair(key: key.value, secret: secret.value);
} }
@immutable @immutable
class BareRecordKey extends Equatable { class BareRecordKey extends Equatable {
final BareOpaqueRecordKey key;
final BareSharedSecret? encryptionKey;
const BareRecordKey({required this.key, required this.encryptionKey}); const BareRecordKey({required this.key, required this.encryptionKey});
factory BareRecordKey.fromString(String s) { factory BareRecordKey.fromString(String s) {
@ -162,10 +208,10 @@ class BareRecordKey extends Equatable {
final key = BareOpaqueRecordKey.fromString(parts[0]); final key = BareOpaqueRecordKey.fromString(parts[0]);
return BareRecordKey(key: key, encryptionKey: null); return BareRecordKey(key: key, encryptionKey: null);
} }
factory BareRecordKey.fromJson(dynamic json) => factory BareRecordKey.fromJson(dynamic json) =>
BareRecordKey.fromString(json as String); BareRecordKey.fromString(json as String);
final BareOpaqueRecordKey key;
final BareSharedSecret? encryptionKey;
@override @override
List<Object?> get props => [key, encryptionKey]; List<Object?> get props => [key, encryptionKey];
@ -176,10 +222,16 @@ class BareRecordKey extends Equatable {
} }
@immutable @immutable
class RecordKey extends Equatable { class RecordKey extends Equatable implements TypedCryptoKey<BareRecordKey> {
RecordKey({required this.key, required this.encryptionKey}) final OpaqueRecordKey opaque;
: assert(encryptionKey == null || key.kind == encryptionKey.kind,
'recordkey parts must have same kind'); final SharedSecret? encryptionKey;
RecordKey({required this.opaque, required this.encryptionKey})
: assert(
encryptionKey == null || opaque.kind == encryptionKey.kind,
'recordkey parts must have same kind',
);
factory RecordKey.fromString(String s) { factory RecordKey.fromString(String s) {
final parts = s.split(':'); final parts = s.split(':');
@ -190,41 +242,75 @@ class RecordKey extends Equatable {
} }
final kind = cryptoKindFromString(parts[0]); final kind = cryptoKindFromString(parts[0]);
final key = OpaqueRecordKey( final key = OpaqueRecordKey(
kind: kind, value: BareOpaqueRecordKey.fromString(parts[1])); kind: kind,
value: BareOpaqueRecordKey.fromString(parts[1]),
);
if (parts.length == 3) { if (parts.length == 3) {
final encryptionKey = SharedSecret( final encryptionKey = SharedSecret(
kind: kind, value: BareSharedSecret.fromString(parts[2])); kind: kind,
return RecordKey(key: key, encryptionKey: encryptionKey); value: BareSharedSecret.fromString(parts[2]),
);
return RecordKey(opaque: key, encryptionKey: encryptionKey);
} }
return RecordKey(key: key, encryptionKey: null); return RecordKey(opaque: key, encryptionKey: null);
} }
factory RecordKey.fromJson(dynamic json) => factory RecordKey.fromJson(dynamic json) =>
RecordKey.fromString(json as String); RecordKey.fromString(json as String);
factory RecordKey.fromBareRecordKey( factory RecordKey.fromBareRecordKey(
CryptoKind kind, BareRecordKey bareRecordKey) => CryptoKind kind,
RecordKey( BareRecordKey bareRecordKey,
key: OpaqueRecordKey(kind: kind, value: bareRecordKey.key), ) => RecordKey(
encryptionKey: bareRecordKey.encryptionKey == null opaque: OpaqueRecordKey(kind: kind, value: bareRecordKey.key),
? null encryptionKey: bareRecordKey.encryptionKey == null
: SharedSecret(kind: kind, value: bareRecordKey.encryptionKey!)); ? null
factory RecordKey.fromOpaqueRecordKey( : SharedSecret(kind: kind, value: bareRecordKey.encryptionKey!),
OpaqueRecordKey key, BareSharedSecret? encryptionKey) => );
RecordKey(
key: key, factory RecordKey.fromBytes(Uint8List bytes) {
encryptionKey: encryptionKey == null final keyLength = ByteData.sublistView(bytes).getUint8(0);
? null final keyBytes = bytes.sublist(1, 1 + keyLength);
: SharedSecret(kind: key.kind, value: encryptionKey)); final key = OpaqueRecordKey.fromBytes(keyBytes);
final OpaqueRecordKey key; SharedSecret? encryptionKey;
final SharedSecret? encryptionKey; if (bytes.length > 1 + keyLength) {
final ekBytes = bytes.sublist(1 + keyLength, bytes.length);
encryptionKey = SharedSecret(
kind: key.kind,
value: BareSharedSecret.fromBytes(ekBytes),
);
}
return RecordKey(opaque: key, encryptionKey: encryptionKey);
}
@override @override
List<Object?> get props => [key, encryptionKey]; List<Object?> get props => [opaque, encryptionKey];
@override
CryptoKind get kind => opaque.kind;
@override
BareRecordKey get value =>
BareRecordKey(key: opaque.value, encryptionKey: encryptionKey?.value);
@override @override
String toString() => encryptionKey != null String toString() => encryptionKey != null
? '${cryptoKindToString(key.kind)}:${key.value}:${encryptionKey!.value}' ? '${cryptoKindToString(opaque.kind)}:${opaque.value}:${encryptionKey!.value}'
: '${cryptoKindToString(key.kind)}:${key.value}'; : '${cryptoKindToString(opaque.kind)}:${opaque.value}';
String toJson() => toString(); String toJson() => toString();
Uint8List toBytes() {
final keyBytes = opaque.toBytes();
final b = BytesBuilder()
..addByte(keyBytes.lengthInBytes)
..add(keyBytes);
final ek = encryptionKey;
if (ek != null) {
b.add(ek.value.toBytes());
}
return b.toBytes();
}
} }
typedef PublicKey = Typed<BarePublicKey>; typedef PublicKey = Typed<BarePublicKey>;
@ -257,7 +343,10 @@ abstract class VeilidCryptoSystem {
Future<SharedSecret> randomSharedSecret(); Future<SharedSecret> randomSharedSecret();
Future<SharedSecret> computeDH(PublicKey key, SecretKey secret); Future<SharedSecret> computeDH(PublicKey key, SecretKey secret);
Future<SharedSecret> generateSharedSecret( Future<SharedSecret> generateSharedSecret(
PublicKey key, SecretKey secret, Uint8List domain); PublicKey key,
SecretKey secret,
Uint8List domain,
);
Future<KeyPair> generateKeyPair(); Future<KeyPair> generateKeyPair();
Future<HashDigest> generateHash(Uint8List data); Future<HashDigest> generateHash(Uint8List data);
//Future<HashDigest> generateHashReader(Stream<List<int>> reader); //Future<HashDigest> generateHashReader(Stream<List<int>> reader);
@ -297,26 +386,41 @@ abstract class VeilidCryptoSystem {
// AEAD Encrypt/Decrypt // AEAD Encrypt/Decrypt
Future<Uint8List> decryptAead(Uint8List body, Nonce nonce, Future<Uint8List> decryptAead(
SharedSecret sharedSecret, Uint8List? associatedData); Uint8List body,
Future<Uint8List> encryptAead(Uint8List body, Nonce nonce, Nonce nonce,
SharedSecret sharedSecret, Uint8List? associatedData); SharedSecret sharedSecret,
Uint8List? associatedData,
);
Future<Uint8List> encryptAead(
Uint8List body,
Nonce nonce,
SharedSecret sharedSecret,
Uint8List? associatedData,
);
Future<Uint8List> cryptNoAuth( Future<Uint8List> cryptNoAuth(
Uint8List body, Nonce nonce, SharedSecret sharedSecret); Uint8List body,
Nonce nonce,
SharedSecret sharedSecret,
);
Future<Uint8List> encryptAeadWithNonce( Future<Uint8List> encryptAeadWithNonce(
Uint8List body, SharedSecret secret) async { Uint8List body,
SharedSecret secret,
) async {
// generate nonce // generate nonce
final nonce = await randomNonce(); final nonce = await randomNonce();
// crypt and append nonce // crypt and append nonce
final b = BytesBuilder() final b = BytesBuilder()
..add(await encryptAead(body, nonce, secret, null)) ..add(await encryptAead(body, nonce, secret, null))
..add(nonce.decode()); ..add(nonce.toBytes());
return b.toBytes(); return b.toBytes();
} }
Future<Uint8List> decryptAeadWithNonce( Future<Uint8List> decryptAeadWithNonce(
Uint8List body, SharedSecret secret) async { Uint8List body,
SharedSecret secret,
) async {
final nlen = await nonceLength(); final nlen = await nonceLength();
if (body.length < nlen) { if (body.length < nlen) {
throw const FormatException('not enough data to decrypt'); throw const FormatException('not enough data to decrypt');
@ -328,17 +432,22 @@ abstract class VeilidCryptoSystem {
} }
Future<Uint8List> encryptAeadWithPassword( Future<Uint8List> encryptAeadWithPassword(
Uint8List body, String password) async { Uint8List body,
String password,
) async {
final ekbytes = Uint8List.fromList(utf8.encode(password)); final ekbytes = Uint8List.fromList(utf8.encode(password));
final nonce = await randomNonce(); final nonce = await randomNonce();
final saltBytes = nonce.decode(); final saltBytes = nonce.toBytes();
final sharedSecret = await deriveSharedSecret(ekbytes, saltBytes); final sharedSecret = await deriveSharedSecret(ekbytes, saltBytes);
return Uint8List.fromList( return Uint8List.fromList(
(await encryptAead(body, nonce, sharedSecret, null)) + saltBytes); (await encryptAead(body, nonce, sharedSecret, null)) + saltBytes,
);
} }
Future<Uint8List> decryptAeadWithPassword( Future<Uint8List> decryptAeadWithPassword(
Uint8List body, String password) async { Uint8List body,
String password,
) async {
final nlen = await nonceLength(); final nlen = await nonceLength();
if (body.length < nlen) { if (body.length < nlen) {
throw const FormatException('not enough data to decrypt'); throw const FormatException('not enough data to decrypt');
@ -354,18 +463,22 @@ abstract class VeilidCryptoSystem {
// NoAuth Encrypt/Decrypt // NoAuth Encrypt/Decrypt
Future<Uint8List> encryptNoAuthWithNonce( Future<Uint8List> encryptNoAuthWithNonce(
Uint8List body, SharedSecret secret) async { Uint8List body,
SharedSecret secret,
) async {
// generate nonce // generate nonce
final nonce = await randomNonce(); final nonce = await randomNonce();
// crypt and append nonce // crypt and append nonce
final b = BytesBuilder() final b = BytesBuilder()
..add(await cryptNoAuth(body, nonce, secret)) ..add(await cryptNoAuth(body, nonce, secret))
..add(nonce.decode()); ..add(nonce.toBytes());
return b.toBytes(); return b.toBytes();
} }
Future<Uint8List> decryptNoAuthWithNonce( Future<Uint8List> decryptNoAuthWithNonce(
Uint8List body, SharedSecret secret) async { Uint8List body,
SharedSecret secret,
) async {
final nlen = await nonceLength(); final nlen = await nonceLength();
if (body.length < nlen) { if (body.length < nlen) {
throw const FormatException('not enough data to decrypt'); throw const FormatException('not enough data to decrypt');
@ -377,17 +490,22 @@ abstract class VeilidCryptoSystem {
} }
Future<Uint8List> encryptNoAuthWithPassword( Future<Uint8List> encryptNoAuthWithPassword(
Uint8List body, String password) async { Uint8List body,
String password,
) async {
final ekbytes = Uint8List.fromList(utf8.encode(password)); final ekbytes = Uint8List.fromList(utf8.encode(password));
final nonce = await randomNonce(); final nonce = await randomNonce();
final saltBytes = nonce.decode(); final saltBytes = nonce.toBytes();
final sharedSecret = await deriveSharedSecret(ekbytes, saltBytes); final sharedSecret = await deriveSharedSecret(ekbytes, saltBytes);
return Uint8List.fromList( return Uint8List.fromList(
(await cryptNoAuth(body, nonce, sharedSecret)) + saltBytes); (await cryptNoAuth(body, nonce, sharedSecret)) + saltBytes,
);
} }
Future<Uint8List> decryptNoAuthWithPassword( Future<Uint8List> decryptNoAuthWithPassword(
Uint8List body, String password) async { Uint8List body,
String password,
) async {
final nlen = await nonceLength(); final nlen = await nonceLength();
if (body.length < nlen) { if (body.length < nlen) {
throw const FormatException('not enough data to decrypt'); throw const FormatException('not enough data to decrypt');

View file

@ -25,15 +25,17 @@ Uint8List base64UrlNoPadDecodeDynamic(dynamic source) =>
base64UrlNoPadDecode(source as String); base64UrlNoPadDecode(source as String);
class Uint8ListJsonConverter implements JsonConverter<Uint8List, dynamic> { class Uint8ListJsonConverter implements JsonConverter<Uint8List, dynamic> {
const Uint8ListJsonConverter() : _jsIsArray = false;
const Uint8ListJsonConverter.jsIsArray() : _jsIsArray = true;
final bool _jsIsArray; final bool _jsIsArray;
const Uint8ListJsonConverter() : _jsIsArray = false;
const Uint8ListJsonConverter.jsIsArray() : _jsIsArray = true;
@override @override
Uint8List fromJson(dynamic json) => kIsWeb && _jsIsArray Uint8List fromJson(dynamic json) => kIsWeb && _jsIsArray
? convertUint8ListFromJson(json) ? convertUint8ListFromJson(json)
: base64UrlNoPadDecode(json as String); : base64UrlNoPadDecode(json as String);
@override @override
dynamic toJson(Uint8List data) => kIsWeb && _jsIsArray dynamic toJson(Uint8List data) => kIsWeb && _jsIsArray
? convertUint8ListToJson(data) ? convertUint8ListToJson(data)
@ -42,6 +44,10 @@ class Uint8ListJsonConverter implements JsonConverter<Uint8List, dynamic> {
@immutable @immutable
sealed class EncodedString extends Equatable { sealed class EncodedString extends Equatable {
////////////////////////////////////////////////////////////////////////////
final String contents;
EncodedString._fromBytes(Uint8List bytes) EncodedString._fromBytes(Uint8List bytes)
: contents = base64UrlNoPadEncode(bytes); : contents = base64UrlNoPadEncode(bytes);
@ -49,13 +55,15 @@ sealed class EncodedString extends Equatable {
// Ensure things can be decoded, will throw an exception if it fails // Ensure things can be decoded, will throw an exception if it fails
base64UrlNoPadDecode(contents); base64UrlNoPadDecode(contents);
} }
EncodedString._fromJson(dynamic json) : contents = json as String { EncodedString._fromJson(dynamic json) : contents = json as String {
// Ensure things can be decoded, will throw an exception if it fails // Ensure things can be decoded, will throw an exception if it fails
base64UrlNoPadDecode(contents); base64UrlNoPadDecode(contents);
} }
String toJson() => toString(); String toJson() => toString();
Uint8List decode() => base64UrlNoPadDecode(contents);
Uint8List toBytes() => base64UrlNoPadDecode(contents);
@override @override
String toString() => contents; String toString() => contents;
@ -74,10 +82,10 @@ sealed class EncodedString extends Equatable {
return BareSecretKey.fromBytes(bytes) as T; return BareSecretKey.fromBytes(bytes) as T;
case const (BareHashDigest): case const (BareHashDigest):
return BareHashDigest.fromBytes(bytes) as T; return BareHashDigest.fromBytes(bytes) as T;
case const (BareOpaqueRecordKey):
return BareOpaqueRecordKey.fromBytes(bytes) as T;
case const (BareSharedSecret): case const (BareSharedSecret):
return BareSharedSecret.fromBytes(bytes) as T; return BareSharedSecret.fromBytes(bytes) as T;
case const (BareHashDistance):
return BareHashDistance.fromBytes(bytes) as T;
case const (BareRouteId): case const (BareRouteId):
return BareRouteId.fromBytes(bytes) as T; return BareRouteId.fromBytes(bytes) as T;
case const (BareNodeId): case const (BareNodeId):
@ -101,10 +109,10 @@ sealed class EncodedString extends Equatable {
return BareSecretKey.fromString(s) as T; return BareSecretKey.fromString(s) as T;
case const (BareHashDigest): case const (BareHashDigest):
return BareHashDigest.fromString(s) as T; return BareHashDigest.fromString(s) as T;
case const (BareOpaqueRecordKey):
return BareOpaqueRecordKey.fromString(s) as T;
case const (BareSharedSecret): case const (BareSharedSecret):
return BareSharedSecret.fromString(s) as T; return BareSharedSecret.fromString(s) as T;
case const (BareHashDistance):
return BareHashDistance.fromString(s) as T;
case const (BareRouteId): case const (BareRouteId):
return BareRouteId.fromString(s) as T; return BareRouteId.fromString(s) as T;
case const (BareNodeId): case const (BareNodeId):
@ -128,10 +136,10 @@ sealed class EncodedString extends Equatable {
return BareSecretKey.fromJson(json) as T; return BareSecretKey.fromJson(json) as T;
case const (BareHashDigest): case const (BareHashDigest):
return BareHashDigest.fromJson(json) as T; return BareHashDigest.fromJson(json) as T;
case const (BareOpaqueRecordKey):
return BareOpaqueRecordKey.fromJson(json) as T;
case const (BareSharedSecret): case const (BareSharedSecret):
return BareSharedSecret.fromJson(json) as T; return BareSharedSecret.fromJson(json) as T;
case const (BareHashDistance):
return BareHashDistance.fromJson(json) as T;
case const (BareRouteId): case const (BareRouteId):
return BareRouteId.fromJson(json) as T; return BareRouteId.fromJson(json) as T;
case const (BareNodeId): case const (BareNodeId):
@ -143,9 +151,6 @@ sealed class EncodedString extends Equatable {
} }
} }
////////////////////////////////////////////////////////////////////////////
final String contents;
@override @override
List<Object> get props => [contents]; List<Object> get props => [contents];
} }
@ -180,24 +185,18 @@ class BareHashDigest extends EncodedString {
BareHashDigest.fromJson(super.json) : super._fromJson(); BareHashDigest.fromJson(super.json) : super._fromJson();
} }
class BareSharedSecret extends EncodedString {
BareSharedSecret.fromBytes(super.bytes) : super._fromBytes();
BareSharedSecret.fromString(super.s) : super._fromString();
BareSharedSecret.fromJson(super.json) : super._fromJson();
}
class BareHashDistance extends EncodedString {
BareHashDistance.fromBytes(super.bytes) : super._fromBytes();
BareHashDistance.fromString(super.s) : super._fromString();
BareHashDistance.fromJson(super.json) : super._fromJson();
}
class BareOpaqueRecordKey extends EncodedString { class BareOpaqueRecordKey extends EncodedString {
BareOpaqueRecordKey.fromBytes(super.bytes) : super._fromBytes(); BareOpaqueRecordKey.fromBytes(super.bytes) : super._fromBytes();
BareOpaqueRecordKey.fromString(super.s) : super._fromString(); BareOpaqueRecordKey.fromString(super.s) : super._fromString();
BareOpaqueRecordKey.fromJson(super.json) : super._fromJson(); BareOpaqueRecordKey.fromJson(super.json) : super._fromJson();
} }
class BareSharedSecret extends EncodedString {
BareSharedSecret.fromBytes(super.bytes) : super._fromBytes();
BareSharedSecret.fromString(super.s) : super._fromString();
BareSharedSecret.fromJson(super.json) : super._fromJson();
}
class BareRouteId extends EncodedString { class BareRouteId extends EncodedString {
BareRouteId.fromBytes(super.bytes) : super._fromBytes(); BareRouteId.fromBytes(super.bytes) : super._fromBytes();
BareRouteId.fromString(super.s) : super._fromString(); BareRouteId.fromString(super.s) : super._fromString();

View file

@ -547,10 +547,11 @@ Stream<T> processStreamJson<T>(
} }
class _Ctx { class _Ctx {
_Ctx(int this.id, this.ffi);
int? id; int? id;
final VeilidFFI ffi; final VeilidFFI ffi;
_Ctx(int this.id, this.ffi);
void ensureValid() { void ensureValid() {
if (id == null) { if (id == null) {
throw VeilidAPIExceptionNotInitialized(); throw VeilidAPIExceptionNotInitialized();
@ -567,11 +568,12 @@ class _Ctx {
// FFI implementation of VeilidRoutingContext // FFI implementation of VeilidRoutingContext
class VeilidRoutingContextFFI extends VeilidRoutingContext { class VeilidRoutingContextFFI extends VeilidRoutingContext {
final _Ctx _ctx;
static final Finalizer<_Ctx> _finalizer = Finalizer((ctx) => ctx.close());
VeilidRoutingContextFFI._(this._ctx) { VeilidRoutingContextFFI._(this._ctx) {
_finalizer.attach(this, _ctx, detach: this); _finalizer.attach(this, _ctx, detach: this);
} }
final _Ctx _ctx;
static final Finalizer<_Ctx> _finalizer = Finalizer((ctx) => ctx.close());
@override @override
void close() { void close() {
@ -818,10 +820,12 @@ class VeilidRoutingContextFFI extends VeilidRoutingContext {
} }
class _TDBT { class _TDBT {
_TDBT(int this.id, this.tdbffi, this.ffi);
int? id; int? id;
final VeilidTableDBFFI tdbffi; final VeilidTableDBFFI tdbffi;
final VeilidFFI ffi; final VeilidFFI ffi;
_TDBT(int this.id, this.tdbffi, this.ffi);
void ensureValid() { void ensureValid() {
if (id == null) { if (id == null) {
throw VeilidAPIExceptionNotInitialized(); throw VeilidAPIExceptionNotInitialized();
@ -838,11 +842,12 @@ class _TDBT {
// FFI implementation of VeilidTableDBTransaction // FFI implementation of VeilidTableDBTransaction
class VeilidTableDBTransactionFFI extends VeilidTableDBTransaction { class VeilidTableDBTransactionFFI extends VeilidTableDBTransaction {
final _TDBT _tdbt;
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) => tdbt.close());
VeilidTableDBTransactionFFI._(this._tdbt) { VeilidTableDBTransactionFFI._(this._tdbt) {
_finalizer.attach(this, _tdbt, detach: this); _finalizer.attach(this, _tdbt, detach: this);
} }
final _TDBT _tdbt;
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) => tdbt.close());
@override @override
bool isDone() => _tdbt.id == null; bool isDone() => _tdbt.id == null;
@ -909,9 +914,11 @@ class VeilidTableDBTransactionFFI extends VeilidTableDBTransaction {
} }
class _TDB { class _TDB {
_TDB(int this.id, this.ffi);
int? id; int? id;
final VeilidFFI ffi; final VeilidFFI ffi;
_TDB(int this.id, this.ffi);
void ensureValid() { void ensureValid() {
if (id == null) { if (id == null) {
throw VeilidAPIExceptionNotInitialized(); throw VeilidAPIExceptionNotInitialized();
@ -928,11 +935,12 @@ class _TDB {
// FFI implementation of VeilidTableDB // FFI implementation of VeilidTableDB
class VeilidTableDBFFI extends VeilidTableDB { class VeilidTableDBFFI extends VeilidTableDB {
final _TDB _tdb;
static final Finalizer<_TDB> _finalizer = Finalizer((tdb) => tdb.close());
VeilidTableDBFFI._(this._tdb) { VeilidTableDBFFI._(this._tdb) {
_finalizer.attach(this, _tdb, detach: this); _finalizer.attach(this, _tdb, detach: this);
} }
final _TDB _tdb;
static final Finalizer<_TDB> _finalizer = Finalizer((tdb) => tdb.close());
@override @override
void close() { void close() {
@ -1029,10 +1037,11 @@ class VeilidTableDBFFI extends VeilidTableDB {
// FFI implementation of VeilidCryptoSystem // FFI implementation of VeilidCryptoSystem
class VeilidCryptoSystemFFI extends VeilidCryptoSystem { class VeilidCryptoSystemFFI extends VeilidCryptoSystem {
VeilidCryptoSystemFFI._(this._ffi, this._kind);
final CryptoKind _kind; final CryptoKind _kind;
final VeilidFFI _ffi; final VeilidFFI _ffi;
VeilidCryptoSystemFFI._(this._ffi, this._kind);
@override @override
CryptoKind kind() => _kind; CryptoKind kind() => _kind;
@ -1376,6 +1385,113 @@ class VeilidCryptoSystemFFI extends VeilidCryptoSystem {
// FFI implementation of high level Veilid API // FFI implementation of high level Veilid API
class VeilidFFI extends Veilid { class VeilidFFI extends Veilid {
// veilid_core shared library
final DynamicLibrary _dylib;
// Shared library functions
final _FreeStringDart _freeString;
final _InitializeVeilidCoreDart _initializeVeilidCore;
final _ChangeLogLevelDart _changeLogLevel;
final _ChangeLogIgnoreDart _changeLogIgnore;
final _StartupVeilidCoreDart _startupVeilidCore;
final _GetVeilidStateDart _getVeilidState;
final _IsShutdownDart _isShutdown;
final _AttachDart _attach;
final _DetachDart _detach;
final _ShutdownVeilidCoreDart _shutdownVeilidCore;
final _RoutingContextDart _routingContext;
final _ReleaseRoutingContextDart _releaseRoutingContext;
final _RoutingContextWithDefaultSafetyDart _routingContextWithDefaultSafety;
final _RoutingContextWithSafetyDart _routingContextWithSafety;
final _RoutingContextWithSequencingDart _routingContextWithSequencing;
final _RoutingContextSafetyDart _routingContextSafety;
final _RoutingContextAppCallDart _routingContextAppCall;
final _RoutingContextAppMessageDart _routingContextAppMessage;
final _RoutingContextGetDHTRecordKeyDart _routingContextGetDHTRecordKey;
final _RoutingContextCreateDHTRecordDart _routingContextCreateDHTRecord;
final _RoutingContextOpenDHTRecordDart _routingContextOpenDHTRecord;
final _RoutingContextCloseDHTRecordDart _routingContextCloseDHTRecord;
final _RoutingContextDeleteDHTRecordDart _routingContextDeleteDHTRecord;
final _RoutingContextGetDHTValueDart _routingContextGetDHTValue;
final _RoutingContextSetDHTValueDart _routingContextSetDHTValue;
final _RoutingContextWatchDHTValuesDart _routingContextWatchDHTValues;
final _RoutingContextCancelDHTWatchDart _routingContextCancelDHTWatch;
final _RoutingContextInspectDHTRecordDart _routingContextInspectDHTRecord;
final _GenerateMemberIdDart _generateMemberId;
final _NewPrivateRouteDart _newPrivateRoute;
final _NewCustomPrivateRouteDart _newCustomPrivateRoute;
final _ImportRemotePrivateRouteDart _importRemotePrivateRoute;
final _ReleasePrivateRouteDart _releasePrivateRoute;
final _AppCallReplyDart _appCallReply;
final _OpenTableDbDart _openTableDb;
final _ReleaseTableDbDart _releaseTableDb;
final _DeleteTableDbDart _deleteTableDb;
final _TableDbGetColumnCountDart _tableDbGetColumnCount;
final _TableDbGetKeysDart _tableDbGetKeys;
final _TableDbStoreDart _tableDbStore;
final _TableDbLoadDart _tableDbLoad;
final _TableDbDeleteDart _tableDbDelete;
final _TableDbTransactDart _tableDbTransact;
final _ReleaseTableDbTransactionDart _releaseTableDbTransaction;
final _TableDbTransactionCommitDart _tableDbTransactionCommit;
final _TableDbTransactionRollbackDart _tableDbTransactionRollback;
final _TableDbTransactionStoreDart _tableDbTransactionStore;
final _TableDbTransactionDeleteDart _tableDbTransactionDelete;
final _ValidCryptoKindsDart _validCryptoKinds;
final _VerifySignaturesDart _verifySignatures;
final _GenerateSignaturesDart _generateSignatures;
final _GenerateKeyPairDart _generateKeyPair;
final _CryptoCachedDHDart _cryptoCachedDH;
final _CryptoComputeDHDart _cryptoComputeDH;
final _CryptoGenerateSharedSecretDart _cryptoGenerateSharedSecret;
final _CryptoRandomBytesDart _cryptoRandomBytes;
final _CryptoHashPasswordDart _cryptoHashPassword;
final _CryptoVerifyPasswordDart _cryptoVerifyPassword;
final _CryptoDeriveSharedSecretDart _cryptoDeriveSharedSecret;
final _CryptoSharedSecretLengthDart _cryptoSharedSecretLength;
final _CryptoNonceLengthDart _cryptoNonceLength;
final _CryptoHashDigestLengthDart _cryptoHashDigestLength;
final _CryptoPublicKeyLengthDart _cryptoPublicKeyLength;
final _CryptoSecretKeyLengthDart _cryptoSecretKeyLength;
final _CryptoSignatureLengthDart _cryptoSignatureLength;
final _CryptoDefaultSaltLengthDart _cryptoDefaultSaltLength;
final _CryptoAeadOverheadDart _cryptoAeadOverhead;
final _CryptoCheckSharedSecretDart _cryptoCheckSharedSecret;
final _CryptoCheckNonceDart _cryptoCheckNonce;
final _CryptoCheckHashDigestDart _cryptoCheckHashDigest;
final _CryptoCheckPublicKeyDart _cryptoCheckPublicKey;
final _CryptoCheckSecretKeyDart _cryptoCheckSecretKey;
final _CryptoCheckSignatureDart _cryptoCheckSignature;
final _CryptoRandomNonceDart _cryptoRandomNonce;
final _CryptoRandomSharedSecretDart _cryptoRandomSharedSecret;
final _CryptoGenerateKeyPairDart _cryptoGenerateKeyPair;
final _CryptoGenerateHashDart _cryptoGenerateHash;
final _CryptoValidateKeyPairDart _cryptoValidateKeyPair;
final _CryptoValidateHashDart _cryptoValidateHash;
final _CryptoSignDart _cryptoSign;
final _CryptoVerifyDart _cryptoVerify;
final _CryptoDecryptAeadDart _cryptoDecryptAead;
final _CryptoEncryptAeadDart _cryptoEncryptAead;
final _CryptoCryptNoAuthDart _cryptoCryptNoAuth;
final _NowDart _now;
final _DebugDart _debug;
final _VeilidVersionStringDart _veilidVersionString;
final _VeilidVersionDart _veilidVersion;
final _DefaultVeilidConfigDart _defaultVeilidConfig;
final _VeilidFeaturesDart _veilidFeatures;
VeilidFFI(DynamicLibrary dylib) VeilidFFI(DynamicLibrary dylib)
: _dylib = dylib, : _dylib = dylib,
_freeString = _freeString =
@ -1666,113 +1782,6 @@ class VeilidFFI extends Veilid {
const String.fromEnvironment('VEILID_CRASH_PATH').toNativeUtf8(), const String.fromEnvironment('VEILID_CRASH_PATH').toNativeUtf8(),
); );
} }
// veilid_core shared library
final DynamicLibrary _dylib;
// Shared library functions
final _FreeStringDart _freeString;
final _InitializeVeilidCoreDart _initializeVeilidCore;
final _ChangeLogLevelDart _changeLogLevel;
final _ChangeLogIgnoreDart _changeLogIgnore;
final _StartupVeilidCoreDart _startupVeilidCore;
final _GetVeilidStateDart _getVeilidState;
final _IsShutdownDart _isShutdown;
final _AttachDart _attach;
final _DetachDart _detach;
final _ShutdownVeilidCoreDart _shutdownVeilidCore;
final _RoutingContextDart _routingContext;
final _ReleaseRoutingContextDart _releaseRoutingContext;
final _RoutingContextWithDefaultSafetyDart _routingContextWithDefaultSafety;
final _RoutingContextWithSafetyDart _routingContextWithSafety;
final _RoutingContextWithSequencingDart _routingContextWithSequencing;
final _RoutingContextSafetyDart _routingContextSafety;
final _RoutingContextAppCallDart _routingContextAppCall;
final _RoutingContextAppMessageDart _routingContextAppMessage;
final _RoutingContextGetDHTRecordKeyDart _routingContextGetDHTRecordKey;
final _RoutingContextCreateDHTRecordDart _routingContextCreateDHTRecord;
final _RoutingContextOpenDHTRecordDart _routingContextOpenDHTRecord;
final _RoutingContextCloseDHTRecordDart _routingContextCloseDHTRecord;
final _RoutingContextDeleteDHTRecordDart _routingContextDeleteDHTRecord;
final _RoutingContextGetDHTValueDart _routingContextGetDHTValue;
final _RoutingContextSetDHTValueDart _routingContextSetDHTValue;
final _RoutingContextWatchDHTValuesDart _routingContextWatchDHTValues;
final _RoutingContextCancelDHTWatchDart _routingContextCancelDHTWatch;
final _RoutingContextInspectDHTRecordDart _routingContextInspectDHTRecord;
final _GenerateMemberIdDart _generateMemberId;
final _NewPrivateRouteDart _newPrivateRoute;
final _NewCustomPrivateRouteDart _newCustomPrivateRoute;
final _ImportRemotePrivateRouteDart _importRemotePrivateRoute;
final _ReleasePrivateRouteDart _releasePrivateRoute;
final _AppCallReplyDart _appCallReply;
final _OpenTableDbDart _openTableDb;
final _ReleaseTableDbDart _releaseTableDb;
final _DeleteTableDbDart _deleteTableDb;
final _TableDbGetColumnCountDart _tableDbGetColumnCount;
final _TableDbGetKeysDart _tableDbGetKeys;
final _TableDbStoreDart _tableDbStore;
final _TableDbLoadDart _tableDbLoad;
final _TableDbDeleteDart _tableDbDelete;
final _TableDbTransactDart _tableDbTransact;
final _ReleaseTableDbTransactionDart _releaseTableDbTransaction;
final _TableDbTransactionCommitDart _tableDbTransactionCommit;
final _TableDbTransactionRollbackDart _tableDbTransactionRollback;
final _TableDbTransactionStoreDart _tableDbTransactionStore;
final _TableDbTransactionDeleteDart _tableDbTransactionDelete;
final _ValidCryptoKindsDart _validCryptoKinds;
final _VerifySignaturesDart _verifySignatures;
final _GenerateSignaturesDart _generateSignatures;
final _GenerateKeyPairDart _generateKeyPair;
final _CryptoCachedDHDart _cryptoCachedDH;
final _CryptoComputeDHDart _cryptoComputeDH;
final _CryptoGenerateSharedSecretDart _cryptoGenerateSharedSecret;
final _CryptoRandomBytesDart _cryptoRandomBytes;
final _CryptoHashPasswordDart _cryptoHashPassword;
final _CryptoVerifyPasswordDart _cryptoVerifyPassword;
final _CryptoDeriveSharedSecretDart _cryptoDeriveSharedSecret;
final _CryptoSharedSecretLengthDart _cryptoSharedSecretLength;
final _CryptoNonceLengthDart _cryptoNonceLength;
final _CryptoHashDigestLengthDart _cryptoHashDigestLength;
final _CryptoPublicKeyLengthDart _cryptoPublicKeyLength;
final _CryptoSecretKeyLengthDart _cryptoSecretKeyLength;
final _CryptoSignatureLengthDart _cryptoSignatureLength;
final _CryptoDefaultSaltLengthDart _cryptoDefaultSaltLength;
final _CryptoAeadOverheadDart _cryptoAeadOverhead;
final _CryptoCheckSharedSecretDart _cryptoCheckSharedSecret;
final _CryptoCheckNonceDart _cryptoCheckNonce;
final _CryptoCheckHashDigestDart _cryptoCheckHashDigest;
final _CryptoCheckPublicKeyDart _cryptoCheckPublicKey;
final _CryptoCheckSecretKeyDart _cryptoCheckSecretKey;
final _CryptoCheckSignatureDart _cryptoCheckSignature;
final _CryptoRandomNonceDart _cryptoRandomNonce;
final _CryptoRandomSharedSecretDart _cryptoRandomSharedSecret;
final _CryptoGenerateKeyPairDart _cryptoGenerateKeyPair;
final _CryptoGenerateHashDart _cryptoGenerateHash;
final _CryptoValidateKeyPairDart _cryptoValidateKeyPair;
final _CryptoValidateHashDart _cryptoValidateHash;
final _CryptoSignDart _cryptoSign;
final _CryptoVerifyDart _cryptoVerify;
final _CryptoDecryptAeadDart _cryptoDecryptAead;
final _CryptoEncryptAeadDart _cryptoEncryptAead;
final _CryptoCryptNoAuthDart _cryptoCryptNoAuth;
final _NowDart _now;
final _DebugDart _debug;
final _VeilidVersionStringDart _veilidVersionString;
final _VeilidVersionDart _veilidVersion;
final _DefaultVeilidConfigDart _defaultVeilidConfig;
final _VeilidFeaturesDart _veilidFeatures;
@override @override
void initializeVeilidCore(Map<String, dynamic> platformConfigJson) { void initializeVeilidCore(Map<String, dynamic> platformConfigJson) {
final nativePlatformConfig = jsonEncode(platformConfigJson).toNativeUtf8(); final nativePlatformConfig = jsonEncode(platformConfigJson).toNativeUtf8();

View file

@ -41,9 +41,12 @@ Future<T> _wrapApiPromise<T>(Object p) => js_util
}); });
class _Ctx { class _Ctx {
_Ctx(int id, this.js) : _id = id;
int? _id; int? _id;
final VeilidJS js; final VeilidJS js;
_Ctx(int id, this.js) : _id = id;
int requireId() { int requireId() {
if (_id == null) { if (_id == null) {
throw VeilidAPIExceptionNotInitialized(); throw VeilidAPIExceptionNotInitialized();
@ -61,11 +64,13 @@ class _Ctx {
// JS implementation of VeilidRoutingContext // JS implementation of VeilidRoutingContext
class VeilidRoutingContextJS extends VeilidRoutingContext { class VeilidRoutingContextJS extends VeilidRoutingContext {
final _Ctx _ctx;
static final Finalizer<_Ctx> _finalizer = Finalizer((ctx) => ctx.close());
VeilidRoutingContextJS._(this._ctx) { VeilidRoutingContextJS._(this._ctx) {
_finalizer.attach(this, _ctx, detach: this); _finalizer.attach(this, _ctx, detach: this);
} }
final _Ctx _ctx;
static final Finalizer<_Ctx> _finalizer = Finalizer((ctx) => ctx.close());
@override @override
void close() { void close() {
@ -270,13 +275,14 @@ class VeilidRoutingContextJS extends VeilidRoutingContext {
// JS implementation of VeilidCryptoSystem // JS implementation of VeilidCryptoSystem
class VeilidCryptoSystemJS extends VeilidCryptoSystem { class VeilidCryptoSystemJS extends VeilidCryptoSystem {
VeilidCryptoSystemJS._(this._js, this._kind);
final CryptoKind _kind; final CryptoKind _kind;
// Keep the reference // Keep the reference
// ignore: unused_field // ignore: unused_field
final VeilidJS _js; final VeilidJS _js;
VeilidCryptoSystemJS._(this._js, this._kind);
@override @override
CryptoKind kind() => _kind; CryptoKind kind() => _kind;
@ -293,6 +299,7 @@ class VeilidCryptoSystemJS extends VeilidCryptoSystem {
wasm, wasm,
'crypto_compute_dh', 'crypto_compute_dh',
[_kind, jsonEncode(key), jsonEncode(secret)])))); [_kind, jsonEncode(key), jsonEncode(secret)]))));
@override @override
Future<SharedSecret> generateSharedSecret( Future<SharedSecret> generateSharedSecret(
PublicKey key, SecretKey secret, Uint8List domain) async => PublicKey key, SecretKey secret, Uint8List domain) async =>
@ -481,10 +488,14 @@ class VeilidCryptoSystemJS extends VeilidCryptoSystem {
} }
class _TDBT { class _TDBT {
_TDBT(this.id, this.tdbjs, this.js);
int? id; int? id;
final VeilidTableDBJS tdbjs; final VeilidTableDBJS tdbjs;
final VeilidJS js; final VeilidJS js;
_TDBT(this.id, this.tdbjs, this.js);
void ensureValid() { void ensureValid() {
if (id == null) { if (id == null) {
throw VeilidAPIExceptionNotInitialized(); throw VeilidAPIExceptionNotInitialized();
@ -501,11 +512,13 @@ class _TDBT {
// JS implementation of VeilidTableDBTransaction // JS implementation of VeilidTableDBTransaction
class VeilidTableDBTransactionJS extends VeilidTableDBTransaction { class VeilidTableDBTransactionJS extends VeilidTableDBTransaction {
final _TDBT _tdbt;
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) => tdbt.close());
VeilidTableDBTransactionJS._(this._tdbt) { VeilidTableDBTransactionJS._(this._tdbt) {
_finalizer.attach(this, _tdbt, detach: this); _finalizer.attach(this, _tdbt, detach: this);
} }
final _TDBT _tdbt;
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) => tdbt.close());
@override @override
bool isDone() => _tdbt.id == null; bool isDone() => _tdbt.id == null;
@ -551,11 +564,12 @@ class VeilidTableDBTransactionJS extends VeilidTableDBTransaction {
} }
class _TDB { class _TDB {
_TDB(int id, this.js) : _id = id;
int? _id; int? _id;
final VeilidJS js; final VeilidJS js;
_TDB(int id, this.js) : _id = id;
int requireId() { int requireId() {
if (_id == null) { if (_id == null) {
throw VeilidAPIExceptionNotInitialized(); throw VeilidAPIExceptionNotInitialized();
@ -573,11 +587,13 @@ class _TDB {
// JS implementation of VeilidTableDB // JS implementation of VeilidTableDB
class VeilidTableDBJS extends VeilidTableDB { class VeilidTableDBJS extends VeilidTableDB {
final _TDB _tdb;
static final Finalizer<_TDB> _finalizer = Finalizer((tdb) => tdb.close());
VeilidTableDBJS._(this._tdb) { VeilidTableDBJS._(this._tdb) {
_finalizer.attach(this, _tdb, detach: this); _finalizer.attach(this, _tdb, detach: this);
} }
final _TDB _tdb;
static final Finalizer<_TDB> _finalizer = Finalizer((tdb) => tdb.close());
@override @override
void close() { void close() {

File diff suppressed because it is too large Load diff

View file

@ -51,20 +51,20 @@ _TransferStatsDownUp _$TransferStatsDownUpFromJson(Map<String, dynamic> json) =>
); );
Map<String, dynamic> _$TransferStatsDownUpToJson( Map<String, dynamic> _$TransferStatsDownUpToJson(
_TransferStatsDownUp instance) => _TransferStatsDownUp instance,
<String, dynamic>{ ) => <String, dynamic>{
'down': instance.down.toJson(), 'down': instance.down.toJson(),
'up': instance.up.toJson(), 'up': instance.up.toJson(),
}; };
_StateStats _$StateStatsFromJson(Map<String, dynamic> json) => _StateStats( _StateStats _$StateStatsFromJson(Map<String, dynamic> json) => _StateStats(
span: TimestampDuration.fromJson(json['span']), span: TimestampDuration.fromJson(json['span']),
reliable: TimestampDuration.fromJson(json['reliable']), reliable: TimestampDuration.fromJson(json['reliable']),
unreliable: TimestampDuration.fromJson(json['unreliable']), unreliable: TimestampDuration.fromJson(json['unreliable']),
dead: TimestampDuration.fromJson(json['dead']), dead: TimestampDuration.fromJson(json['dead']),
punished: TimestampDuration.fromJson(json['punished']), punished: TimestampDuration.fromJson(json['punished']),
reason: StateReasonStats.fromJson(json['reason']), reason: StateReasonStats.fromJson(json['reason']),
); );
Map<String, dynamic> _$StateStatsToJson(_StateStats instance) => Map<String, dynamic> _$StateStatsToJson(_StateStats instance) =>
<String, dynamic>{ <String, dynamic>{
@ -79,15 +79,18 @@ Map<String, dynamic> _$StateStatsToJson(_StateStats instance) =>
_StateReasonStats _$StateReasonStatsFromJson(Map<String, dynamic> json) => _StateReasonStats _$StateReasonStatsFromJson(Map<String, dynamic> json) =>
_StateReasonStats( _StateReasonStats(
canNotSend: TimestampDuration.fromJson(json['can_not_send']), canNotSend: TimestampDuration.fromJson(json['can_not_send']),
tooManyLostAnswers: tooManyLostAnswers: TimestampDuration.fromJson(
TimestampDuration.fromJson(json['too_many_lost_answers']), json['too_many_lost_answers'],
),
noPingResponse: TimestampDuration.fromJson(json['no_ping_response']), noPingResponse: TimestampDuration.fromJson(json['no_ping_response']),
failedToSend: TimestampDuration.fromJson(json['failed_to_send']), failedToSend: TimestampDuration.fromJson(json['failed_to_send']),
lostAnswers: TimestampDuration.fromJson(json['lost_answers']), lostAnswers: TimestampDuration.fromJson(json['lost_answers']),
notSeenConsecutively: notSeenConsecutively: TimestampDuration.fromJson(
TimestampDuration.fromJson(json['not_seen_consecutively']), json['not_seen_consecutively'],
inUnreliablePingSpan: ),
TimestampDuration.fromJson(json['in_unreliable_ping_span']), inUnreliablePingSpan: TimestampDuration.fromJson(
json['in_unreliable_ping_span'],
),
); );
Map<String, dynamic> _$StateReasonStatsToJson(_StateReasonStats instance) => Map<String, dynamic> _$StateReasonStatsToJson(_StateReasonStats instance) =>
@ -102,86 +105,84 @@ Map<String, dynamic> _$StateReasonStatsToJson(_StateReasonStats instance) =>
}; };
_AnswerStats _$AnswerStatsFromJson(Map<String, dynamic> json) => _AnswerStats( _AnswerStats _$AnswerStatsFromJson(Map<String, dynamic> json) => _AnswerStats(
span: TimestampDuration.fromJson(json['span']), span: TimestampDuration.fromJson(json['span']),
questions: (json['questions'] as num).toInt(), questions: (json['questions'] as num).toInt(),
answers: (json['answers'] as num).toInt(), answers: (json['answers'] as num).toInt(),
lostAnswers: (json['lost_answers'] as num).toInt(), lostAnswers: (json['lost_answers'] as num).toInt(),
consecutiveAnswersMaximum: consecutiveAnswersMaximum: (json['consecutive_answers_maximum'] as num)
(json['consecutive_answers_maximum'] as num).toInt(), .toInt(),
consecutiveAnswersAverage: consecutiveAnswersAverage: (json['consecutive_answers_average'] as num)
(json['consecutive_answers_average'] as num).toInt(), .toInt(),
consecutiveAnswersMinimum: consecutiveAnswersMinimum: (json['consecutive_answers_minimum'] as num)
(json['consecutive_answers_minimum'] as num).toInt(), .toInt(),
consecutiveLostAnswersMaximum: consecutiveLostAnswersMaximum:
(json['consecutive_lost_answers_maximum'] as num).toInt(), (json['consecutive_lost_answers_maximum'] as num).toInt(),
consecutiveLostAnswersAverage: consecutiveLostAnswersAverage:
(json['consecutive_lost_answers_average'] as num).toInt(), (json['consecutive_lost_answers_average'] as num).toInt(),
consecutiveLostAnswersMinimum: consecutiveLostAnswersMinimum:
(json['consecutive_lost_answers_minimum'] as num).toInt(), (json['consecutive_lost_answers_minimum'] as num).toInt(),
); );
Map<String, dynamic> _$AnswerStatsToJson(_AnswerStats instance) => Map<String, dynamic> _$AnswerStatsToJson(
<String, dynamic>{ _AnswerStats instance,
'span': instance.span.toJson(), ) => <String, dynamic>{
'questions': instance.questions, 'span': instance.span.toJson(),
'answers': instance.answers, 'questions': instance.questions,
'lost_answers': instance.lostAnswers, 'answers': instance.answers,
'consecutive_answers_maximum': instance.consecutiveAnswersMaximum, 'lost_answers': instance.lostAnswers,
'consecutive_answers_average': instance.consecutiveAnswersAverage, 'consecutive_answers_maximum': instance.consecutiveAnswersMaximum,
'consecutive_answers_minimum': instance.consecutiveAnswersMinimum, 'consecutive_answers_average': instance.consecutiveAnswersAverage,
'consecutive_lost_answers_maximum': 'consecutive_answers_minimum': instance.consecutiveAnswersMinimum,
instance.consecutiveLostAnswersMaximum, 'consecutive_lost_answers_maximum': instance.consecutiveLostAnswersMaximum,
'consecutive_lost_answers_average': 'consecutive_lost_answers_average': instance.consecutiveLostAnswersAverage,
instance.consecutiveLostAnswersAverage, 'consecutive_lost_answers_minimum': instance.consecutiveLostAnswersMinimum,
'consecutive_lost_answers_minimum': };
instance.consecutiveLostAnswersMinimum,
};
_RPCStats _$RPCStatsFromJson(Map<String, dynamic> json) => _RPCStats( _RPCStats _$RPCStatsFromJson(Map<String, dynamic> json) => _RPCStats(
messagesSent: (json['messages_sent'] as num).toInt(), messagesSent: (json['messages_sent'] as num).toInt(),
messagesRcvd: (json['messages_rcvd'] as num).toInt(), messagesRcvd: (json['messages_rcvd'] as num).toInt(),
questionsInFlight: (json['questions_in_flight'] as num).toInt(), questionsInFlight: (json['questions_in_flight'] as num).toInt(),
lastQuestionTs: json['last_question_ts'] == null lastQuestionTs: json['last_question_ts'] == null
? null ? null
: Timestamp.fromJson(json['last_question_ts']), : Timestamp.fromJson(json['last_question_ts']),
lastSeenTs: json['last_seen_ts'] == null lastSeenTs: json['last_seen_ts'] == null
? null ? null
: Timestamp.fromJson(json['last_seen_ts']), : Timestamp.fromJson(json['last_seen_ts']),
firstConsecutiveSeenTs: json['first_consecutive_seen_ts'] == null firstConsecutiveSeenTs: json['first_consecutive_seen_ts'] == null
? null ? null
: Timestamp.fromJson(json['first_consecutive_seen_ts']), : Timestamp.fromJson(json['first_consecutive_seen_ts']),
recentLostAnswersUnordered: recentLostAnswersUnordered: (json['recent_lost_answers_unordered'] as num)
(json['recent_lost_answers_unordered'] as num).toInt(), .toInt(),
recentLostAnswersOrdered: recentLostAnswersOrdered: (json['recent_lost_answers_ordered'] as num)
(json['recent_lost_answers_ordered'] as num).toInt(), .toInt(),
failedToSend: (json['failed_to_send'] as num).toInt(), failedToSend: (json['failed_to_send'] as num).toInt(),
answerUnordered: AnswerStats.fromJson(json['answer_unordered']), answerUnordered: AnswerStats.fromJson(json['answer_unordered']),
answerOrdered: AnswerStats.fromJson(json['answer_ordered']), answerOrdered: AnswerStats.fromJson(json['answer_ordered']),
); );
Map<String, dynamic> _$RPCStatsToJson(_RPCStats instance) => <String, dynamic>{ Map<String, dynamic> _$RPCStatsToJson(_RPCStats instance) => <String, dynamic>{
'messages_sent': instance.messagesSent, 'messages_sent': instance.messagesSent,
'messages_rcvd': instance.messagesRcvd, 'messages_rcvd': instance.messagesRcvd,
'questions_in_flight': instance.questionsInFlight, 'questions_in_flight': instance.questionsInFlight,
'last_question_ts': instance.lastQuestionTs?.toJson(), 'last_question_ts': instance.lastQuestionTs?.toJson(),
'last_seen_ts': instance.lastSeenTs?.toJson(), 'last_seen_ts': instance.lastSeenTs?.toJson(),
'first_consecutive_seen_ts': instance.firstConsecutiveSeenTs?.toJson(), 'first_consecutive_seen_ts': instance.firstConsecutiveSeenTs?.toJson(),
'recent_lost_answers_unordered': instance.recentLostAnswersUnordered, 'recent_lost_answers_unordered': instance.recentLostAnswersUnordered,
'recent_lost_answers_ordered': instance.recentLostAnswersOrdered, 'recent_lost_answers_ordered': instance.recentLostAnswersOrdered,
'failed_to_send': instance.failedToSend, 'failed_to_send': instance.failedToSend,
'answer_unordered': instance.answerUnordered.toJson(), 'answer_unordered': instance.answerUnordered.toJson(),
'answer_ordered': instance.answerOrdered.toJson(), 'answer_ordered': instance.answerOrdered.toJson(),
}; };
_PeerStats _$PeerStatsFromJson(Map<String, dynamic> json) => _PeerStats( _PeerStats _$PeerStatsFromJson(Map<String, dynamic> json) => _PeerStats(
timeAdded: Timestamp.fromJson(json['time_added']), timeAdded: Timestamp.fromJson(json['time_added']),
rpcStats: RPCStats.fromJson(json['rpc_stats']), rpcStats: RPCStats.fromJson(json['rpc_stats']),
transfer: TransferStatsDownUp.fromJson(json['transfer']), transfer: TransferStatsDownUp.fromJson(json['transfer']),
state: StateStats.fromJson(json['state']), state: StateStats.fromJson(json['state']),
latency: json['latency'] == null latency: json['latency'] == null
? null ? null
: LatencyStats.fromJson(json['latency']), : LatencyStats.fromJson(json['latency']),
); );
Map<String, dynamic> _$PeerStatsToJson(_PeerStats instance) => Map<String, dynamic> _$PeerStatsToJson(_PeerStats instance) =>
<String, dynamic>{ <String, dynamic>{
@ -209,23 +210,24 @@ Map<String, dynamic> _$PeerTableDataToJson(_PeerTableData instance) =>
}; };
VeilidLog _$VeilidLogFromJson(Map<String, dynamic> json) => VeilidLog( VeilidLog _$VeilidLogFromJson(Map<String, dynamic> json) => VeilidLog(
logLevel: VeilidLogLevel.fromJson(json['log_level']), logLevel: VeilidLogLevel.fromJson(json['log_level']),
message: json['message'] as String, message: json['message'] as String,
backtrace: json['backtrace'] as String?, backtrace: json['backtrace'] as String?,
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidLogToJson(VeilidLog instance) => <String, dynamic>{ Map<String, dynamic> _$VeilidLogToJson(VeilidLog instance) => <String, dynamic>{
'log_level': instance.logLevel.toJson(), 'log_level': instance.logLevel.toJson(),
'message': instance.message, 'message': instance.message,
'backtrace': instance.backtrace, 'backtrace': instance.backtrace,
'kind': instance.$type, 'kind': instance.$type,
}; };
VeilidAppMessage _$VeilidAppMessageFromJson(Map<String, dynamic> json) => VeilidAppMessage _$VeilidAppMessageFromJson(Map<String, dynamic> json) =>
VeilidAppMessage( VeilidAppMessage(
message: message: const Uint8ListJsonConverter.jsIsArray().fromJson(
const Uint8ListJsonConverter.jsIsArray().fromJson(json['message']), json['message'],
),
sender: json['sender'] == null sender: json['sender'] == null
? null ? null
: Typed<BarePublicKey>.fromJson(json['sender']), : Typed<BarePublicKey>.fromJson(json['sender']),
@ -233,19 +235,20 @@ VeilidAppMessage _$VeilidAppMessageFromJson(Map<String, dynamic> json) =>
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidAppMessageToJson(VeilidAppMessage instance) => Map<String, dynamic> _$VeilidAppMessageToJson(
<String, dynamic>{ VeilidAppMessage instance,
'message': ) => <String, dynamic>{
const Uint8ListJsonConverter.jsIsArray().toJson(instance.message), 'message': const Uint8ListJsonConverter.jsIsArray().toJson(instance.message),
'sender': instance.sender?.toJson(), 'sender': instance.sender?.toJson(),
'route_id': instance.routeId, 'route_id': instance.routeId,
'kind': instance.$type, 'kind': instance.$type,
}; };
VeilidAppCall _$VeilidAppCallFromJson(Map<String, dynamic> json) => VeilidAppCall _$VeilidAppCallFromJson(Map<String, dynamic> json) =>
VeilidAppCall( VeilidAppCall(
message: message: const Uint8ListJsonConverter.jsIsArray().fromJson(
const Uint8ListJsonConverter.jsIsArray().fromJson(json['message']), json['message'],
),
callId: json['call_id'] as String, callId: json['call_id'] as String,
sender: json['sender'] == null sender: json['sender'] == null
? null ? null
@ -254,59 +257,60 @@ VeilidAppCall _$VeilidAppCallFromJson(Map<String, dynamic> json) =>
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidAppCallToJson(VeilidAppCall instance) => Map<String, dynamic> _$VeilidAppCallToJson(
<String, dynamic>{ VeilidAppCall instance,
'message': ) => <String, dynamic>{
const Uint8ListJsonConverter.jsIsArray().toJson(instance.message), 'message': const Uint8ListJsonConverter.jsIsArray().toJson(instance.message),
'call_id': instance.callId, 'call_id': instance.callId,
'sender': instance.sender?.toJson(), 'sender': instance.sender?.toJson(),
'route_id': instance.routeId, 'route_id': instance.routeId,
'kind': instance.$type, 'kind': instance.$type,
}; };
VeilidUpdateAttachment _$VeilidUpdateAttachmentFromJson( VeilidUpdateAttachment _$VeilidUpdateAttachmentFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
VeilidUpdateAttachment( ) => VeilidUpdateAttachment(
state: AttachmentState.fromJson(json['state']), state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool, publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool, localNetworkReady: json['local_network_ready'] as bool,
uptime: TimestampDuration.fromJson(json['uptime']), uptime: TimestampDuration.fromJson(json['uptime']),
attachedUptime: json['attached_uptime'] == null attachedUptime: json['attached_uptime'] == null
? null ? null
: TimestampDuration.fromJson(json['attached_uptime']), : TimestampDuration.fromJson(json['attached_uptime']),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidUpdateAttachmentToJson( Map<String, dynamic> _$VeilidUpdateAttachmentToJson(
VeilidUpdateAttachment instance) => VeilidUpdateAttachment instance,
<String, dynamic>{ ) => <String, dynamic>{
'state': instance.state.toJson(), 'state': instance.state.toJson(),
'public_internet_ready': instance.publicInternetReady, 'public_internet_ready': instance.publicInternetReady,
'local_network_ready': instance.localNetworkReady, 'local_network_ready': instance.localNetworkReady,
'uptime': instance.uptime.toJson(), 'uptime': instance.uptime.toJson(),
'attached_uptime': instance.attachedUptime?.toJson(), 'attached_uptime': instance.attachedUptime?.toJson(),
'kind': instance.$type, 'kind': instance.$type,
}; };
VeilidUpdateNetwork _$VeilidUpdateNetworkFromJson(Map<String, dynamic> json) => VeilidUpdateNetwork _$VeilidUpdateNetworkFromJson(Map<String, dynamic> json) =>
VeilidUpdateNetwork( VeilidUpdateNetwork(
started: json['started'] as bool, started: json['started'] as bool,
bpsDown: BigInt.parse(json['bps_down'] as String), bpsDown: BigInt.parse(json['bps_down'] as String),
bpsUp: BigInt.parse(json['bps_up'] as String), bpsUp: BigInt.parse(json['bps_up'] as String),
peers: peers: (json['peers'] as List<dynamic>)
(json['peers'] as List<dynamic>).map(PeerTableData.fromJson).toList(), .map(PeerTableData.fromJson)
.toList(),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidUpdateNetworkToJson( Map<String, dynamic> _$VeilidUpdateNetworkToJson(
VeilidUpdateNetwork instance) => VeilidUpdateNetwork instance,
<String, dynamic>{ ) => <String, dynamic>{
'started': instance.started, 'started': instance.started,
'bps_down': instance.bpsDown.toString(), 'bps_down': instance.bpsDown.toString(),
'bps_up': instance.bpsUp.toString(), 'bps_up': instance.bpsUp.toString(),
'peers': instance.peers.map((e) => e.toJson()).toList(), 'peers': instance.peers.map((e) => e.toJson()).toList(),
'kind': instance.$type, 'kind': instance.$type,
}; };
VeilidUpdateConfig _$VeilidUpdateConfigFromJson(Map<String, dynamic> json) => VeilidUpdateConfig _$VeilidUpdateConfigFromJson(Map<String, dynamic> json) =>
VeilidUpdateConfig( VeilidUpdateConfig(
@ -321,76 +325,77 @@ Map<String, dynamic> _$VeilidUpdateConfigToJson(VeilidUpdateConfig instance) =>
}; };
VeilidUpdateRouteChange _$VeilidUpdateRouteChangeFromJson( VeilidUpdateRouteChange _$VeilidUpdateRouteChangeFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
VeilidUpdateRouteChange( ) => VeilidUpdateRouteChange(
deadRoutes: (json['dead_routes'] as List<dynamic>) deadRoutes: (json['dead_routes'] as List<dynamic>)
.map((e) => e as String) .map((e) => e as String)
.toList(), .toList(),
deadRemoteRoutes: (json['dead_remote_routes'] as List<dynamic>) deadRemoteRoutes: (json['dead_remote_routes'] as List<dynamic>)
.map((e) => e as String) .map((e) => e as String)
.toList(), .toList(),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidUpdateRouteChangeToJson( Map<String, dynamic> _$VeilidUpdateRouteChangeToJson(
VeilidUpdateRouteChange instance) => VeilidUpdateRouteChange instance,
<String, dynamic>{ ) => <String, dynamic>{
'dead_routes': instance.deadRoutes, 'dead_routes': instance.deadRoutes,
'dead_remote_routes': instance.deadRemoteRoutes, 'dead_remote_routes': instance.deadRemoteRoutes,
'kind': instance.$type, 'kind': instance.$type,
}; };
VeilidUpdateValueChange _$VeilidUpdateValueChangeFromJson( VeilidUpdateValueChange _$VeilidUpdateValueChangeFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
VeilidUpdateValueChange( ) => VeilidUpdateValueChange(
key: RecordKey.fromJson(json['key']), key: RecordKey.fromJson(json['key']),
subkeys: (json['subkeys'] as List<dynamic>) subkeys: (json['subkeys'] as List<dynamic>)
.map(ValueSubkeyRange.fromJson) .map(ValueSubkeyRange.fromJson)
.toList(), .toList(),
count: (json['count'] as num).toInt(), count: (json['count'] as num).toInt(),
value: json['value'] == null ? null : ValueData.fromJson(json['value']), value: json['value'] == null ? null : ValueData.fromJson(json['value']),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$VeilidUpdateValueChangeToJson( Map<String, dynamic> _$VeilidUpdateValueChangeToJson(
VeilidUpdateValueChange instance) => VeilidUpdateValueChange instance,
<String, dynamic>{ ) => <String, dynamic>{
'key': instance.key.toJson(), 'key': instance.key.toJson(),
'subkeys': instance.subkeys.map((e) => e.toJson()).toList(), 'subkeys': instance.subkeys.map((e) => e.toJson()).toList(),
'count': instance.count, 'count': instance.count,
'value': instance.value?.toJson(), 'value': instance.value?.toJson(),
'kind': instance.$type, 'kind': instance.$type,
}; };
_VeilidStateAttachment _$VeilidStateAttachmentFromJson( _VeilidStateAttachment _$VeilidStateAttachmentFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json,
_VeilidStateAttachment( ) => _VeilidStateAttachment(
state: AttachmentState.fromJson(json['state']), state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool, publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool, localNetworkReady: json['local_network_ready'] as bool,
uptime: TimestampDuration.fromJson(json['uptime']), uptime: TimestampDuration.fromJson(json['uptime']),
attachedUptime: json['attached_uptime'] == null attachedUptime: json['attached_uptime'] == null
? null ? null
: TimestampDuration.fromJson(json['attached_uptime']), : TimestampDuration.fromJson(json['attached_uptime']),
); );
Map<String, dynamic> _$VeilidStateAttachmentToJson( Map<String, dynamic> _$VeilidStateAttachmentToJson(
_VeilidStateAttachment instance) => _VeilidStateAttachment instance,
<String, dynamic>{ ) => <String, dynamic>{
'state': instance.state.toJson(), 'state': instance.state.toJson(),
'public_internet_ready': instance.publicInternetReady, 'public_internet_ready': instance.publicInternetReady,
'local_network_ready': instance.localNetworkReady, 'local_network_ready': instance.localNetworkReady,
'uptime': instance.uptime.toJson(), 'uptime': instance.uptime.toJson(),
'attached_uptime': instance.attachedUptime?.toJson(), 'attached_uptime': instance.attachedUptime?.toJson(),
}; };
_VeilidStateNetwork _$VeilidStateNetworkFromJson(Map<String, dynamic> json) => _VeilidStateNetwork _$VeilidStateNetworkFromJson(Map<String, dynamic> json) =>
_VeilidStateNetwork( _VeilidStateNetwork(
started: json['started'] as bool, started: json['started'] as bool,
bpsDown: BigInt.parse(json['bps_down'] as String), bpsDown: BigInt.parse(json['bps_down'] as String),
bpsUp: BigInt.parse(json['bps_up'] as String), bpsUp: BigInt.parse(json['bps_up'] as String),
peers: peers: (json['peers'] as List<dynamic>)
(json['peers'] as List<dynamic>).map(PeerTableData.fromJson).toList(), .map(PeerTableData.fromJson)
.toList(),
); );
Map<String, dynamic> _$VeilidStateNetworkToJson(_VeilidStateNetwork instance) => Map<String, dynamic> _$VeilidStateNetworkToJson(_VeilidStateNetwork instance) =>
@ -402,20 +407,16 @@ Map<String, dynamic> _$VeilidStateNetworkToJson(_VeilidStateNetwork instance) =>
}; };
_VeilidStateConfig _$VeilidStateConfigFromJson(Map<String, dynamic> json) => _VeilidStateConfig _$VeilidStateConfigFromJson(Map<String, dynamic> json) =>
_VeilidStateConfig( _VeilidStateConfig(config: VeilidConfig.fromJson(json['config']));
config: VeilidConfig.fromJson(json['config']),
);
Map<String, dynamic> _$VeilidStateConfigToJson(_VeilidStateConfig instance) => Map<String, dynamic> _$VeilidStateConfigToJson(_VeilidStateConfig instance) =>
<String, dynamic>{ <String, dynamic>{'config': instance.config.toJson()};
'config': instance.config.toJson(),
};
_VeilidState _$VeilidStateFromJson(Map<String, dynamic> json) => _VeilidState( _VeilidState _$VeilidStateFromJson(Map<String, dynamic> json) => _VeilidState(
attachment: VeilidStateAttachment.fromJson(json['attachment']), attachment: VeilidStateAttachment.fromJson(json['attachment']),
network: VeilidStateNetwork.fromJson(json['network']), network: VeilidStateNetwork.fromJson(json['network']),
config: VeilidStateConfig.fromJson(json['config']), config: VeilidStateConfig.fromJson(json['config']),
); );
Map<String, dynamic> _$VeilidStateToJson(_VeilidState instance) => Map<String, dynamic> _$VeilidStateToJson(_VeilidState instance) =>
<String, dynamic>{ <String, dynamic>{

View file

@ -12,7 +12,7 @@ abstract class VeilidTableDBTransaction {
Future<void> delete(int col, Uint8List key); Future<void> delete(int col, Uint8List key);
Future<void> storeJson(int col, Uint8List key, Object? object, Future<void> storeJson(int col, Uint8List key, Object? object,
{Object? Function(Object? nonEncodable)? toEncodable}) async => {Object? Function(Object? nonEncodable)? toEncodable}) =>
store(col, key, store(col, key,
utf8.encoder.convert(jsonEncode(object, toEncodable: toEncodable))); utf8.encoder.convert(jsonEncode(object, toEncodable: toEncodable)));

View file

@ -1,9 +1,7 @@
import 'package:veilid/veilid.dart'; import 'package:veilid/veilid.dart';
class ProcessorConnectionState { class ProcessorConnectionState {
ProcessorConnectionState(); var attachment = VeilidStateAttachment(
VeilidStateAttachment attachment = VeilidStateAttachment(
localNetworkReady: false, localNetworkReady: false,
publicInternetReady: false, publicInternetReady: false,
state: AttachmentState.detached, state: AttachmentState.detached,
@ -11,9 +9,12 @@ class ProcessorConnectionState {
value: BigInt.zero, value: BigInt.zero,
), ),
attachedUptime: null); attachedUptime: null);
VeilidStateNetwork network = VeilidStateNetwork(
var network = VeilidStateNetwork(
bpsDown: BigInt.zero, bpsUp: BigInt.zero, started: false, peers: []); bpsDown: BigInt.zero, bpsUp: BigInt.zero, started: false, peers: []);
ProcessorConnectionState();
bool get isAttached => !(attachment.state == AttachmentState.detached || bool get isAttached => !(attachment.state == AttachmentState.detached ||
attachment.state == AttachmentState.detaching || attachment.state == AttachmentState.detaching ||
attachment.state == AttachmentState.attaching); attachment.state == AttachmentState.attaching);

View file

@ -9,14 +9,16 @@ abstract class TickerFixtureTickable {
} }
class TickerFixture { class TickerFixture {
TickerFixture({required this.updateProcessorFixture});
static final _fixtureMutex = Mutex(); static final _fixtureMutex = Mutex();
UpdateProcessorFixture updateProcessorFixture; UpdateProcessorFixture updateProcessorFixture;
Timer? _tickTimer; Timer? _tickTimer;
final List<TickerFixtureTickable> _tickables = []; final List<TickerFixtureTickable> _tickables = [];
TickerFixture({required this.updateProcessorFixture});
Future<void> setUp() async { Future<void> setUp() async {
await _fixtureMutex.acquire(); await _fixtureMutex.acquire();
_tickTimer = Timer.periodic(const Duration(seconds: 1), (timer) { _tickTimer = Timer.periodic(const Duration(seconds: 1), (timer) {

View file

@ -7,13 +7,13 @@ import 'processor_connection_state.dart';
import 'veilid_fixture.dart'; import 'veilid_fixture.dart';
class UpdateProcessorFixture { class UpdateProcessorFixture {
UpdateProcessorFixture({required this.veilidFixture});
static final _fixtureMutex = Mutex(); static final _fixtureMutex = Mutex();
VeilidFixture veilidFixture; VeilidFixture veilidFixture;
ProcessorConnectionState processorConnectionState = final processorConnectionState = ProcessorConnectionState();
ProcessorConnectionState();
UpdateProcessorFixture({required this.veilidFixture});
Future<void> setUp() async { Future<void> setUp() async {
await _fixtureMutex.acquire(); await _fixtureMutex.acquire();

View file

@ -17,15 +17,18 @@ abstract class VeilidFixture {
} }
class DefaultVeilidFixture implements VeilidFixture { class DefaultVeilidFixture implements VeilidFixture {
DefaultVeilidFixture({required this.programName});
StreamSubscription<VeilidUpdate>? _veilidUpdateSubscription; StreamSubscription<VeilidUpdate>? _veilidUpdateSubscription;
Stream<VeilidUpdate>? _veilidUpdateStream; Stream<VeilidUpdate>? _veilidUpdateStream;
late final StreamController<VeilidUpdate> _updateStreamController; late final StreamController<VeilidUpdate> _updateStreamController;
static final _fixtureMutex = Mutex(); static final _fixtureMutex = Mutex();
final String programName; final String programName;
DefaultVeilidFixture({required this.programName});
@override @override
Future<void> setUp() async { Future<void> setUp() async {
await _fixtureMutex.acquire(); await _fixtureMutex.acquire();

View file

@ -7,7 +7,7 @@ homepage: https://veilid.com
publish_to: "none" # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.8.0 <4.0.0'
flutter: '>=3.19.1' flutter: '>=3.19.1'
dependencies: dependencies:
@ -20,7 +20,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter_web_plugins: flutter_web_plugins:
sdk: flutter sdk: flutter
freezed_annotation: ^3.0.0 freezed_annotation: ^3.1.0
json_annotation: ^4.9.0 json_annotation: ^4.9.0
path: ^1.9.0 path: ^1.9.0
path_provider: ^2.1.3 path_provider: ^2.1.3
@ -31,9 +31,9 @@ dev_dependencies:
build_runner: ^2.4.10 build_runner: ^2.4.10
flutter_test: flutter_test:
sdk: flutter sdk: flutter
freezed: ^3.0.4 freezed: ^3.2.0
json_serializable: ^6.8.0 json_serializable: ^6.8.0
lint_hard: ^6.0.0 lint_hard: ^6.2.1
test: ^1.25.15 test: ^1.25.15
# The following section is specific to Flutter. # The following section is specific to Flutter.