lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

commit c4a406e256ab30d18c8bc790f6cfab6055044627
parent dab69b04c05705240b44e61c75111e8647977be9
Author: triesap <tyson@radroots.org>
Date:   Tue, 20 Oct 2026 07:37:37 +0000

browser: Compose ordinary durable inquiry on the browser host

- Reuse shared workflow and routing with explicit signer and workspace scopes
- Retain accepted local work through observer loss and original-operation resume
- Dispose actual socket, signer and storage callbacks before confirming closure
- Verify real page and worker workflows, APIs and unchanged coverage gates

Diffstat:
MCargo.lock | 23+++++++++++++++++++++++
MCargo.toml | 2++
Mcontracts/api_baselines/radroots.txt | 12++++--------
Mcontracts/api_baselines/radroots_execution.txt | 5+++++
Mcontracts/coverage.toml | 1+
Mcontracts/crates/catalog.v2.toml | 20+++++++++++++++++++-
Mcontracts/crates/generated/package_groups.v1.toml | 10+++++-----
Mcontracts/crates/generated/platform_inventory.v1.toml | 4++--
Mcontracts/crates/generated/release_inventory.v2.toml | 4++--
Mcontracts/releases/publish_policy.toml | 1+
Mcrates/execution/src/session/inquiry.rs | 4++++
Acrates/execution/src/session/inquiry_routes.rs | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcrates/execution/src/session/mod.rs | 11+++++++++++
Mcrates/radroots/src/client.rs | 11+----------
Mcrates/radroots/src/native_inquiry.rs | 72+++++++++++++++++++-----------------------------------------------------
Acrates/radroots_browser/Cargo.toml | 43+++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/README.md | 24++++++++++++++++++++++++
Acrates/radroots_browser/src/client.rs | 329+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/src/clock.rs | 26++++++++++++++++++++++++++
Acrates/radroots_browser/src/inquiry.rs | 204+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/src/lib.rs | 26++++++++++++++++++++++++++
Acrates/radroots_browser/src/tasks.rs | 159+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/src/tasks_tests.rs | 164+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/tests/browser/Cargo.lock | 2727+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/tests/browser/Cargo.toml | 29+++++++++++++++++++++++++++++
Acrates/radroots_browser/tests/browser/run.mjs | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acrates/radroots_browser/tests/browser/src/lib.rs | 420+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcrates/secrets/src/browser/mod.rs | 11++++++++++-
Mcrates/storage_indexeddb/src/browser.rs | 10+++++++++-
Mtools/xtask/src/catalog.rs | 16++++++++++++++++
30 files changed, 4468 insertions(+), 83 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -3081,6 +3081,29 @@ dependencies = [ ] [[package]] +name = "radroots_browser" +version = "0.1.0-alpha" +dependencies = [ + "futures", + "js-sys", + "radroots_domain", + "radroots_execution", + "radroots_nostr", + "radroots_protocol", + "radroots_secrets", + "radroots_signing", + "radroots_storage", + "radroots_storage_indexeddb", + "radroots_transport", + "radroots_transport_nostr", + "radroots_transport_nostr_browser", + "universal-time", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] name = "radroots_core" version = "0.1.0-alpha" dependencies = [ diff --git a/Cargo.toml b/Cargo.toml @@ -48,6 +48,7 @@ members = [ "crates/event_codec_wasm", "crates/identity_bindings", "crates/radroots", + "crates/radroots_browser", "crates/replica_schema_bindings", "crates/replica_store_wasm", "crates/replica_sync_wasm", @@ -140,6 +141,7 @@ radroots_service_sqlite = { path = "crates/service_sqlite", version = "=0.1.0-al radroots_transport_nostr = { package = "radroots_transport_nostr", path = "crates/transport_nostr", version = "=0.1.0-alpha", default-features = false } radroots_transport_nostr_native = { package = "radroots_transport_nostr_native", path = "crates/transport_nostr_native", version = "=0.1.0-alpha", default-features = false } radroots_transport_nostr_browser = { path = "crates/transport_nostr_browser", version = "=0.1.0-alpha", default-features = false } +radroots_browser = { path = "crates/radroots_browser", version = "=0.1.0-alpha", default-features = false } radroots_transport_reticulum = { path = "crates/transport_reticulum", version = "=0.1.0-alpha", default-features = false } radroots_simplex_agent_proto = { path = "crates/simplex_agent_proto", version = "=0.1.0-alpha", default-features = false } radroots_simplex_chat_proto = { path = "crates/simplex_chat_proto", version = "=0.1.0-alpha", default-features = false } diff --git a/contracts/api_baselines/radroots.txt b/contracts/api_baselines/radroots.txt @@ -12,13 +12,12 @@ pub use radroots::OperationId pub use radroots::OperationReceipt pub use radroots::RecoveryRequirement pub use radroots::Result +pub use radroots::StartMode pub use radroots::TargetObservation pub use radroots::WaitTermination pub use radroots::WorkspaceSession pub mod radroots::client -#[non_exhaustive] pub enum radroots::client::StartMode -pub radroots::client::StartMode::LocalOnly -pub radroots::client::StartMode::Online +pub use radroots::client::StartMode pub struct radroots::client::Client impl radroots::client::Client pub async fn radroots::client::Client::attach(&self, radroots_storage::workspace::AttachmentInput, radroots_storage::workspace::AttachmentProof) -> radroots_execution::Result<radroots_execution::workspace::WorkspaceSession> @@ -29,7 +28,7 @@ pub async fn radroots::client::Client::open(radroots::client::NativeConfig) -> r pub fn radroots::client::Client::operations(&self, &radroots_execution::workspace::WorkspaceSession) -> radroots::operations::Operations<'_> pub fn radroots::client::Client::preview() -> Self pub fn radroots::client::Client::signer_session(&self) -> core::option::Option<radroots_execution::session::signer::SignerSession> -pub async fn radroots::client::Client::start(&self, radroots::client::StartMode) -> radroots_execution::Result<radroots::client::SessionStatus> +pub async fn radroots::client::Client::start(&self, radroots_execution::session::StartMode) -> radroots_execution::Result<radroots::client::SessionStatus> pub fn radroots::client::Client::state(&self) -> radroots_execution::session::SessionState pub async fn radroots::client::Client::storage_status(&self) -> radroots_execution::Result<radroots_storage::status::StorageStatus> pub struct radroots::client::CloseReceipt @@ -200,9 +199,6 @@ pub use radroots::transport::Target pub use radroots::transport::TargetPolicy pub use radroots::transport::TargetSet pub use radroots::transport::TransportId -#[non_exhaustive] pub enum radroots::StartMode -pub radroots::StartMode::LocalOnly -pub radroots::StartMode::Online pub struct radroots::Client impl radroots::client::Client pub async fn radroots::client::Client::attach(&self, radroots_storage::workspace::AttachmentInput, radroots_storage::workspace::AttachmentProof) -> radroots_execution::Result<radroots_execution::workspace::WorkspaceSession> @@ -213,7 +209,7 @@ pub async fn radroots::client::Client::open(radroots::client::NativeConfig) -> r pub fn radroots::client::Client::operations(&self, &radroots_execution::workspace::WorkspaceSession) -> radroots::operations::Operations<'_> pub fn radroots::client::Client::preview() -> Self pub fn radroots::client::Client::signer_session(&self) -> core::option::Option<radroots_execution::session::signer::SignerSession> -pub async fn radroots::client::Client::start(&self, radroots::client::StartMode) -> radroots_execution::Result<radroots::client::SessionStatus> +pub async fn radroots::client::Client::start(&self, radroots_execution::session::StartMode) -> radroots_execution::Result<radroots::client::SessionStatus> pub fn radroots::client::Client::state(&self) -> radroots_execution::session::SessionState pub async fn radroots::client::Client::storage_status(&self) -> radroots_execution::Result<radroots_storage::status::StorageStatus> pub struct radroots::CloseReceipt diff --git a/contracts/api_baselines/radroots_execution.txt b/contracts/api_baselines/radroots_execution.txt @@ -18,6 +18,8 @@ pub fn radroots_execution::session::inquiry::InquiryIo::publish(&self, radroots_ pub fn radroots_execution::session::inquiry::InquiryIo::route(&self, radroots_identity::key::PublicKey, core::num::nonzero::NonZeroU64) -> radroots_execution::session::HostFuture<'_, core::result::Result<radroots_protocol::chat::routes::CapturedDmRoute, radroots_storage::command::OperationError>> pub fn radroots_execution::session::inquiry::InquiryIo::seal_time(&self, radroots_domain::context::UnixSeconds) -> core::result::Result<radroots_domain::context::UnixSeconds, radroots_storage::command::OperationError> pub fn radroots_execution::session::inquiry::InquiryIo::targets(&self, &radroots_protocol::chat::routes::CapturedDmRoute) -> core::result::Result<radroots_transport::target::TargetSet, radroots_storage::command::OperationError> +pub fn radroots_execution::session::inquiry::capture_dm_route<'a>(radroots_identity::key::PublicKey, impl core::iter::traits::collect::IntoIterator<Item = &'a str>, &radroots_transport::target::TargetSet) -> core::result::Result<radroots_protocol::chat::routes::CapturedDmRoute, radroots_storage::command::OperationError> +pub fn radroots_execution::session::inquiry::selected_dm_targets(&radroots_protocol::chat::routes::CapturedDmRoute, &radroots_transport::target::TargetSet) -> core::result::Result<radroots_transport::target::TargetSet, radroots_storage::command::OperationError> pub mod radroots_execution::session::tasks pub trait radroots_execution::session::tasks::TaskHost: radroots_execution::session::HostBound pub fn radroots_execution::session::tasks::TaskHost::submit(&self, radroots_execution::session::HostFuture<'static, ()>) -> radroots_execution::Result<()> @@ -27,6 +29,9 @@ pub radroots_execution::session::SessionState::Closing pub radroots_execution::session::SessionState::Ready pub radroots_execution::session::SessionState::Running pub radroots_execution::session::SessionState::Starting +#[non_exhaustive] pub enum radroots_execution::session::StartMode +pub radroots_execution::session::StartMode::LocalOnly +pub radroots_execution::session::StartMode::Online pub struct radroots_execution::session::ClientSession<H: radroots_execution::session::SessionHost> impl<H: radroots_execution::session::SessionHost + 'static> radroots_execution::session::ClientSession<H> pub async fn radroots_execution::session::ClientSession<H>::inquire(&self, alloc::sync::Arc<dyn radroots_storage::command::OperationJournal>, radroots_execution::workspace::CommandContext, radroots_protocol::command::InquireInput) -> radroots_execution::Result<radroots_execution::OperationReceipt<radroots_domain::message::ChatMessage>> diff --git a/contracts/coverage.toml b/contracts/coverage.toml @@ -49,6 +49,7 @@ reason = "branch coverage is not applicable while the crate has no measured bran crates = [ "radroots", "radroots_blossom", + "radroots_browser", "radroots_core", "radroots_core_bindings", "radroots_domain", diff --git a/contracts/crates/catalog.v2.toml b/contracts/crates/catalog.v2.toml @@ -7,7 +7,7 @@ rust_version = "1.99.0" edition = "2024" resolver = "3" public_package_count = 22 -package_count = 56 +package_count = 57 digest_algorithm = "sha256-raw-bytes-v1" source_tree_digest_algorithm = "sha256-git-ls-tree-r-v1" native_introduction_tree_digest_algorithm = "sha256-git-tree-records-z-v1" @@ -1136,6 +1136,24 @@ compatibility = ["rust_api", "features", "package", "product"] replaces = [] [[package]] +name = "radroots_browser" +path = "crates/radroots_browser" +state = "active" +tier = "facade" +visibility = "private_boundary" +publish = false +version = "0.1.0-alpha" +license = "MIT OR Apache-2.0" +platforms = ["wasm32"] +groups = ["coverage_required", "wasm"] +owners = ["sdk"] +permitted_dependency_tiers = ["foundation", "domain", "spi", "adapter", "orchestration"] +provenance_kind = "native" +introduction_tree_sha256 = "3ccf885430e468d77cd0390d3893eac49df5d945445bba307602f546943d9e2b" +compatibility = ["package_private", "rust_api", "behavior"] +replaces = [] + +[[package]] name = "radroots" path = "crates/radroots" state = "active" diff --git a/contracts/crates/generated/package_groups.v1.toml b/contracts/crates/generated/package_groups.v1.toml @@ -1,5 +1,5 @@ schema = "radroots.workspace.package-groups.v1" -catalog_sha256 = "00210ad66c7305d5e57f24e821a0c215e8bd9db25a1382490d6710aca88d3650" +catalog_sha256 = "12fe6f5f020e988da3fa6f37319ffe17bc64d16acb4dce7a5d9d539c06f6b8cb" [[group]] id = "boundaries" @@ -9,8 +9,8 @@ reserved_packages = [] [[group]] id = "coverage_required" -packages = ["radroots", "radroots_blossom", "radroots_core", "radroots_core_bindings", "radroots_domain", "radroots_event", "radroots_event_bindings", "radroots_event_codec", "radroots_event_codec_wasm", "radroots_execution", "radroots_geonames", "radroots_identity", "radroots_identity_bindings", "radroots_mesh", "radroots_mesh_agent_client", "radroots_mesh_agent_proto", "radroots_nostr", "radroots_nostr_connect", "radroots_nostrdb", "radroots_protocol", "radroots_replica_schema", "radroots_replica_schema_bindings", "radroots_replica_store", "radroots_replica_store_wasm", "radroots_replica_sync", "radroots_replica_sync_wasm", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", "radroots_sdk", "radroots_sdk_ffi", "radroots_sdk_sql_wasm_runtime", "radroots_secrets", "radroots_service_host", "radroots_service_sqlite", "radroots_signing", "radroots_sql_core", "radroots_storage", "radroots_storage_indexeddb", "radroots_storage_sqlite", "radroots_sync", "radroots_test_fixtures", "radroots_trade", "radroots_trade_bindings", "radroots_transport", "radroots_transport_nostr", "radroots_transport_nostr_browser", "radroots_transport_nostr_native", "radroots_transport_reticulum", "xtask"] -active_packages = ["radroots", "radroots_blossom", "radroots_core", "radroots_core_bindings", "radroots_domain", "radroots_event", "radroots_event_bindings", "radroots_event_codec", "radroots_event_codec_wasm", "radroots_execution", "radroots_geonames", "radroots_identity", "radroots_identity_bindings", "radroots_mesh", "radroots_mesh_agent_client", "radroots_mesh_agent_proto", "radroots_nostr", "radroots_nostr_connect", "radroots_nostrdb", "radroots_protocol", "radroots_replica_schema", "radroots_replica_schema_bindings", "radroots_replica_store", "radroots_replica_store_wasm", "radroots_replica_sync", "radroots_replica_sync_wasm", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", "radroots_sdk", "radroots_sdk_ffi", "radroots_sdk_sql_wasm_runtime", "radroots_secrets", "radroots_service_host", "radroots_service_sqlite", "radroots_signing", "radroots_sql_core", "radroots_storage", "radroots_storage_indexeddb", "radroots_storage_sqlite", "radroots_sync", "radroots_test_fixtures", "radroots_trade", "radroots_trade_bindings", "radroots_transport", "radroots_transport_nostr", "radroots_transport_nostr_browser", "radroots_transport_nostr_native", "radroots_transport_reticulum", "xtask"] +packages = ["radroots", "radroots_blossom", "radroots_browser", "radroots_core", "radroots_core_bindings", "radroots_domain", "radroots_event", "radroots_event_bindings", "radroots_event_codec", "radroots_event_codec_wasm", "radroots_execution", "radroots_geonames", "radroots_identity", "radroots_identity_bindings", "radroots_mesh", "radroots_mesh_agent_client", "radroots_mesh_agent_proto", "radroots_nostr", "radroots_nostr_connect", "radroots_nostrdb", "radroots_protocol", "radroots_replica_schema", "radroots_replica_schema_bindings", "radroots_replica_store", "radroots_replica_store_wasm", "radroots_replica_sync", "radroots_replica_sync_wasm", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", "radroots_sdk", "radroots_sdk_ffi", "radroots_sdk_sql_wasm_runtime", "radroots_secrets", "radroots_service_host", "radroots_service_sqlite", "radroots_signing", "radroots_sql_core", "radroots_storage", "radroots_storage_indexeddb", "radroots_storage_sqlite", "radroots_sync", "radroots_test_fixtures", "radroots_trade", "radroots_trade_bindings", "radroots_transport", "radroots_transport_nostr", "radroots_transport_nostr_browser", "radroots_transport_nostr_native", "radroots_transport_reticulum", "xtask"] +active_packages = ["radroots", "radroots_blossom", "radroots_browser", "radroots_core", "radroots_core_bindings", "radroots_domain", "radroots_event", "radroots_event_bindings", "radroots_event_codec", "radroots_event_codec_wasm", "radroots_execution", "radroots_geonames", "radroots_identity", "radroots_identity_bindings", "radroots_mesh", "radroots_mesh_agent_client", "radroots_mesh_agent_proto", "radroots_nostr", "radroots_nostr_connect", "radroots_nostrdb", "radroots_protocol", "radroots_replica_schema", "radroots_replica_schema_bindings", "radroots_replica_store", "radroots_replica_store_wasm", "radroots_replica_sync", "radroots_replica_sync_wasm", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", "radroots_sdk", "radroots_sdk_ffi", "radroots_sdk_sql_wasm_runtime", "radroots_secrets", "radroots_service_host", "radroots_service_sqlite", "radroots_signing", "radroots_sql_core", "radroots_storage", "radroots_storage_indexeddb", "radroots_storage_sqlite", "radroots_sync", "radroots_test_fixtures", "radroots_trade", "radroots_trade_bindings", "radroots_transport", "radroots_transport_nostr", "radroots_transport_nostr_browser", "radroots_transport_nostr_native", "radroots_transport_reticulum", "xtask"] reserved_packages = [] [[group]] @@ -45,6 +45,6 @@ reserved_packages = [] [[group]] id = "wasm" -packages = ["radroots_event_codec_wasm", "radroots_replica_store_wasm", "radroots_replica_sync_wasm", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_transport_nostr_browser"] -active_packages = ["radroots_event_codec_wasm", "radroots_replica_store_wasm", "radroots_replica_sync_wasm", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_transport_nostr_browser"] +packages = ["radroots_browser", "radroots_event_codec_wasm", "radroots_replica_store_wasm", "radroots_replica_sync_wasm", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_transport_nostr_browser"] +active_packages = ["radroots_browser", "radroots_event_codec_wasm", "radroots_replica_store_wasm", "radroots_replica_sync_wasm", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_transport_nostr_browser"] reserved_packages = [] diff --git a/contracts/crates/generated/platform_inventory.v1.toml b/contracts/crates/generated/platform_inventory.v1.toml @@ -1,5 +1,5 @@ schema = "radroots.workspace.platform-inventory.v1" -catalog_sha256 = "00210ad66c7305d5e57f24e821a0c215e8bd9db25a1382490d6710aca88d3650" +catalog_sha256 = "12fe6f5f020e988da3fa6f37319ffe17bc64d16acb4dce7a5d9d539c06f6b8cb" [[platform]] id = "any" @@ -11,4 +11,4 @@ packages = ["radroots_core_bindings", "radroots_event_bindings", "radroots_geona [[platform]] id = "wasm32" -packages = ["radroots_event_codec_wasm", "radroots_replica_store_wasm", "radroots_replica_sync_wasm", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_transport_nostr", "radroots_transport_nostr_browser"] +packages = ["radroots_browser", "radroots_event_codec_wasm", "radroots_replica_store_wasm", "radroots_replica_sync_wasm", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_transport_nostr", "radroots_transport_nostr_browser"] diff --git a/contracts/crates/generated/release_inventory.v2.toml b/contracts/crates/generated/release_inventory.v2.toml @@ -1,7 +1,7 @@ schema = "radroots.workspace.release-inventory.v2" -catalog_sha256 = "00210ad66c7305d5e57f24e821a0c215e8bd9db25a1382490d6710aca88d3650" +catalog_sha256 = "12fe6f5f020e988da3fa6f37319ffe17bc64d16acb4dce7a5d9d539c06f6b8cb" architecture = "radroots.crates.release.v2" version = "0.1.0-alpha" public_packages = ["radroots", "radroots_blossom", "radroots_core", "radroots_domain", "radroots_event", "radroots_event_codec", "radroots_execution", "radroots_geonames", "radroots_identity", "radroots_nostr", "radroots_nostr_connect", "radroots_protocol", "radroots_sdk", "radroots_secrets", "radroots_signing", "radroots_storage", "radroots_storage_sqlite", "radroots_sync", "radroots_trade", "radroots_transport", "radroots_transport_nostr", "radroots_transport_nostr_native"] -private_packages = ["radroots_core_bindings", "radroots_event_bindings", "radroots_event_codec_wasm", "radroots_identity_bindings", "radroots_mesh", "radroots_mesh_agent_client", "radroots_mesh_agent_proto", "radroots_nostrdb", "radroots_replica_schema", "radroots_replica_schema_bindings", "radroots_replica_store", "radroots_replica_store_wasm", "radroots_replica_sync", "radroots_replica_sync_wasm", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", "radroots_sdk_ffi", "radroots_sdk_sql_wasm_runtime", "radroots_service_host", "radroots_service_sqlite", "radroots_simplex_agent_proto", "radroots_simplex_app_store", "radroots_simplex_chat_proto", "radroots_simplex_smp_crypto", "radroots_simplex_smp_proto", "radroots_simplex_smp_transport", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_test_fixtures", "radroots_trade_bindings", "radroots_transport_nostr_browser", "radroots_transport_reticulum", "xtask"] +private_packages = ["radroots_browser", "radroots_core_bindings", "radroots_event_bindings", "radroots_event_codec_wasm", "radroots_identity_bindings", "radroots_mesh", "radroots_mesh_agent_client", "radroots_mesh_agent_proto", "radroots_nostrdb", "radroots_replica_schema", "radroots_replica_schema_bindings", "radroots_replica_store", "radroots_replica_store_wasm", "radroots_replica_sync", "radroots_replica_sync_wasm", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", "radroots_sdk_ffi", "radroots_sdk_sql_wasm_runtime", "radroots_service_host", "radroots_service_sqlite", "radroots_simplex_agent_proto", "radroots_simplex_app_store", "radroots_simplex_chat_proto", "radroots_simplex_smp_crypto", "radroots_simplex_smp_proto", "radroots_simplex_smp_transport", "radroots_sql_core", "radroots_storage_indexeddb", "radroots_test_fixtures", "radroots_trade_bindings", "radroots_transport_nostr_browser", "radroots_transport_reticulum", "xtask"] reserved_packages = [] diff --git a/contracts/releases/publish_policy.toml b/contracts/releases/publish_policy.toml @@ -58,6 +58,7 @@ external_packages = [] [workspace_classification] private = [ + "radroots_browser", "radroots_runtime_distribution", "radroots_runtime_manager", "radroots_runtime_paths", diff --git a/crates/execution/src/session/inquiry.rs b/crates/execution/src/session/inquiry.rs @@ -1,4 +1,8 @@ //! Owned ordinary inquiry execution over explicit host IO and protected storage. +#[path = "inquiry_routes.rs"] +mod routes; +pub use routes::{capture_dm_route, selected_dm_targets}; + use super::{HostBound, HostFuture, Shared, SignerSession}; use alloc::{string::String, vec::Vec}; use core::num::NonZeroU64; diff --git a/crates/execution/src/session/inquiry_routes.rs b/crates/execution/src/session/inquiry_routes.rs @@ -0,0 +1,72 @@ +//! Shared authenticated route selection; hosts supply only their explicit policy. +use alloc::{borrow::ToOwned, vec::Vec}; +use radroots_domain::PublicKey; +use radroots_protocol::chat::CapturedDmRoute; +use radroots_storage::command::{OperationError, SignedDmRelaySource}; +use radroots_transport::TargetSet; + +/// Selects the NIP-01 replaceable head from at most two independently verified +/// kind-10050 sources. Retains its original signed bytes and only advertised +/// endpoints allowed by the explicit write policy. Absence grants no fallback. +pub fn capture_dm_route<'a>( + recipient: PublicKey, + raw_sources: impl IntoIterator<Item = &'a str>, + write: &TargetSet, +) -> Result<CapturedDmRoute, OperationError> { + let mut head: Option<SignedDmRelaySource> = None; + for (index, raw) in raw_sources.into_iter().enumerate() { + if index >= 2 { + return Err(OperationError::InvalidEvidence); + } + let source = SignedDmRelaySource::verify(raw)?; + if source.participant() != recipient { + return Err(OperationError::InvalidEvidence); + } + if head.as_ref().is_none_or(|old| { + source.created_at() > old.created_at() + || (source.created_at() == old.created_at() && source.event_id() < old.event_id()) + }) { + head = Some(source); + } + } + let head = head.ok_or(OperationError::MissingHistory)?; + let mut selected = Vec::new(); + for uri in head.relay_uris() { + if write + .targets() + .iter() + .any(|target| target.matches_nostr_relay(uri).unwrap_or(false)) + && !selected.iter().any(|old| old == uri) + { + selected.push(uri.to_owned()); + } + } + CapturedDmRoute::from_observed_descriptor( + recipient, + head.event_id(), + head.raw_json(), + &selected, + ) + .map_err(|_| OperationError::UnverifiedApproval) +} + +/// Reauthenticates the original captured route against current explicit write +/// policy. Canonically equal targets are dispatched once; no new route is added. +pub fn selected_dm_targets( + route: &CapturedDmRoute, + write: &TargetSet, +) -> Result<TargetSet, OperationError> { + SignedDmRelaySource::verify(route.raw_json())?.validate_capture(route)?; + let mut selected = Vec::new(); + for uri in route.selected_relays() { + let target = write + .targets() + .iter() + .find(|target| target.matches_nostr_relay(uri).unwrap_or(false)) + .ok_or(OperationError::UnverifiedApproval)?; + if !selected.iter().any(|old| old == target) { + selected.push(target.clone()); + } + } + TargetSet::new(selected).map_err(|_| OperationError::UnverifiedApproval) +} diff --git a/crates/execution/src/session/mod.rs b/crates/execution/src/session/mod.rs @@ -35,6 +35,17 @@ use std::sync::{Mutex, MutexGuard}; use crate::{Error, Reason, Result}; use host::Shared; +/// Explicit task admission for a local resource session. No network is selected. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[non_exhaustive] +pub enum StartMode { + /// Enables local resource work without opening sockets or replaying writes. + LocalOnly, + /// Permits explicit commands to use the configured transport. Startup + /// itself performs no query, publication or automatic outbox replay. + Online, +} + /// Session resource state, independent of durable operation state. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum SessionState { diff --git a/crates/radroots/src/client.rs b/crates/radroots/src/client.rs @@ -31,16 +31,7 @@ const MISSING_WORKSPACE: Error = match Error::new( Err(_) => panic!("invalid constant pre-admission workspace error"), }; -/// Explicit task admission for a local resource session. No network is selected. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[non_exhaustive] -pub enum StartMode { - /// Enables local resource work without opening sockets or replaying writes. - LocalOnly, - /// Permits explicit commands to use the configured transport. Startup - /// itself performs no query, publication or automatic outbox replay. - Online, -} +pub use radroots_execution::session::StartMode; /// A passive resource-start observation, independent of business authority. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct SessionStatus { diff --git a/crates/radroots/src/native_inquiry.rs b/crates/radroots/src/native_inquiry.rs @@ -1,15 +1,16 @@ use core::num::NonZeroU64; use radroots_domain::{PublicKey, UnixSeconds}; -use radroots_execution::session::{HostFuture, inquiry::InquiryIo}; +use radroots_execution::session::{ + HostFuture, + inquiry::{InquiryIo, capture_dm_route, selected_dm_targets}, +}; use radroots_nostr::signing::{ OsNonceSource, gift_wrap::{randomized_past_time, wrap_retained_seal}, }; use radroots_protocol::chat::CapturedDmRoute; use radroots_signing::provider::NonceSource; -use radroots_storage::command::{ - EnvelopeCandidate, OperationError, PublicationWork, SignedDmRelaySource, -}; +use radroots_storage::command::{EnvelopeCandidate, OperationError, PublicationWork}; use radroots_transport::{ EventSink, EventSource, TargetSet, policy::{SatisfactionClass, SatisfactionPolicy}, @@ -79,41 +80,7 @@ impl NativeInquiry { recipient: PublicKey, raw_sources: impl IntoIterator<Item = &'a str>, ) -> Result<CapturedDmRoute, OperationError> { - let mut head: Option<SignedDmRelaySource> = None; - for raw in raw_sources { - let source = SignedDmRelaySource::verify(raw)?; - if source.participant() != recipient { - return Err(OperationError::InvalidEvidence); - } - // NIP-01 replaceable head: latest time, then lowest event ID. - if head.as_ref().is_none_or(|old| { - source.created_at() > old.created_at() - || (source.created_at() == old.created_at() - && source.event_id() < old.event_id()) - }) { - head = Some(source); - } - } - let head = head.ok_or(OperationError::MissingHistory)?; - let mut selected = Vec::new(); - for uri in head.relay_uris() { - if self - .write - .targets() - .iter() - .any(|target| target.matches_nostr_relay(uri).unwrap_or(false)) - && !selected.iter().any(|old| old == uri) - { - selected.push(uri.to_owned()); - } - } - CapturedDmRoute::from_observed_descriptor( - recipient, - head.event_id(), - head.raw_json(), - &selected, - ) - .map_err(|_| OperationError::UnverifiedApproval) + capture_dm_route(recipient, raw_sources, &self.write) } } impl InquiryIo for NativeInquiry { @@ -167,20 +134,7 @@ impl InquiryIo for NativeInquiry { }) } fn targets(&self, route: &CapturedDmRoute) -> Result<TargetSet, OperationError> { - SignedDmRelaySource::verify(route.raw_json())?.validate_capture(route)?; - let mut selected = Vec::new(); - for uri in route.selected_relays() { - let target = self - .write - .targets() - .iter() - .find(|target| target.matches_nostr_relay(uri).unwrap_or(false)) - .ok_or(OperationError::UnverifiedApproval)?; - if !selected.iter().any(|old| old == target) { - selected.push(target.clone()); - } - } - TargetSet::new(selected).map_err(|_| OperationError::UnverifiedApproval) + selected_dm_targets(route, &self.write) } fn publication_policy(&self) -> SatisfactionPolicy { self.policy.clone() @@ -335,6 +289,10 @@ mod tests { Err(OperationError::MissingHistory) )); assert!(matches!( + io.capture_route(key(), [older.as_str(), newer.as_str(), newer.as_str()]), + Err(OperationError::InvalidEvidence) + )); + assert!(matches!( io.capture_route(key(), [source(2, 100, "foreign", &[URI]).as_str()]), Err(OperationError::InvalidEvidence) )); @@ -356,6 +314,14 @@ mod tests { assert_eq!(route.raw_json(), raw); assert_eq!(route.selected_relays().len(), 2); assert_eq!(io.targets(&route).unwrap().len(), 1); + let changed = radroots_transport::TargetSet::new(vec![ + radroots_transport::Target::nostr_relay("wss://changed.example").unwrap(), + ]) + .unwrap(); + assert!(matches!( + radroots_execution::session::inquiry::selected_dm_targets(&route, &changed), + Err(OperationError::UnverifiedApproval) + )); let refused = source(1, 100, "no approved target", &["wss://other.example"]); assert!(matches!( io.capture_route(key(), [refused.as_str()]), diff --git a/crates/radroots_browser/Cargo.toml b/crates/radroots_browser/Cargo.toml @@ -0,0 +1,43 @@ +[package] +name = "radroots_browser" +publish = false +version = "0.1.0-alpha" +edition.workspace = true +rust-version.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +description = "Origin-thread Radroots client over shared execution and protected IndexedDB" +readme = "README.md" + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +default = [] +artifact_clock = ["dep:universal-time"] + +[dependencies] +futures = { workspace = true } +radroots_domain = { workspace = true, features = ["std"] } +radroots_execution = { workspace = true, features = ["workspace_session"] } +radroots_signing = { workspace = true, features = ["chat", "std"] } +radroots_storage = { workspace = true, features = ["protected_outbox"] } +radroots_transport = { workspace = true } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +radroots_storage_indexeddb = { workspace = true, features = ["workspace"] } +radroots_transport_nostr_browser = { workspace = true } +radroots_transport_nostr = { workspace = true } +radroots_nostr = { workspace = true, features = ["signing", "nip17"] } +radroots_protocol = { workspace = true, features = ["chat"] } +radroots_secrets = { workspace = true, features = ["browser"] } +js-sys = { workspace = true } +wasm-bindgen = { workspace = true } +wasm-bindgen-futures = { workspace = true } +web-sys = { workspace = true, features = ["Crypto"] } +universal-time = { version = "=0.3.1", optional = true } + +[lints] +workspace = true diff --git a/crates/radroots_browser/README.md b/crates/radroots_browser/README.md @@ -0,0 +1,24 @@ +# radroots_browser + +Origin-thread client composition over the shared Radroots execution owner, +authenticated protected IndexedDB workspace and shared Nostr session. Participant +signing and workspace attachment remain explicit. Opening existing state never +creates missing keys, grants or records. Startup performs no automatic query, +publication or outbox replay. Preview memory does not qualify protected work. + +Accepted commands belong to a bounded local Rust task owner independently of +their observation futures. Close permanently stops admission, drains original +obtained evidence, disconnects the shared session, disposes original socket and +signer callbacks and closes protected storage last. Cancelled close must resume. +Tab termination cannot guarantee asynchronous completion. Browser WebSocket +limitations remain those documented by the concrete transport adapter. + +The final WASM artifact must select one real clock provider for the pinned Nostr +session. Enable `artifact_clock` at that artifact root to use `performance.now` +and `Date.now`; do not combine it with another provider selection. Importing the +module and constructing configuration perform no I/O. Native targets compile +only host-independent task mechanics, not a browser client or fallback store. + +This private implementation is not yet a packed browser distribution. Generated +JavaScript calls, scoped worker signer bridges and clean artifact installation +require their own executable qualification. diff --git a/crates/radroots_browser/src/client.rs b/crates/radroots_browser/src/client.rs @@ -0,0 +1,329 @@ +//! Concrete browser resources with the shared command and shutdown owner. +use crate::{ + CommandContext, InquireInput, OperationId, OperationReceipt, Result, SessionState, StartMode, + WorkspaceSession, +}; +use crate::{ + inquiry::{BrowserInquiry, unix_seconds}, + tasks::OwnedTasks, +}; +use radroots_domain::{ChatMessage, CommandDigest, UnixSeconds}; +use radroots_execution::{ + Code, Error, OperationContext, RetryClass, + session::{ClientSession, HostFuture, SessionHost, SignerSession, inquiry::InquiryRuntime}, +}; +use radroots_secrets::{SecretId, SecretRef, browser::BrowserProvider, provider::AccessPolicy}; +use radroots_signing::provider::SignerHandle; +use radroots_storage::{ + command::OperationError, + workspace::{AttachmentInput, AttachmentProof, WorkspaceClock, WorkspaceError}, +}; +use radroots_storage_indexeddb::workspace::BrowserWorkspace; +use std::{cell::Cell, num::NonZeroU16, rc::Rc}; + +fn storage_failure() -> Error { + Error::new( + Code::StorageFailure, + OperationContext::proposed(None), + RetryClass::Never, + None, + ) + .unwrap_or_else(|_| unreachable!("valid constant storage error")) +} +fn operation(error: OperationError) -> Error { + Error::operation(error, OperationContext::proposed(None)) +} + +/// Exact existing protected namespace and independently retained authority. +/// Constructing configuration opens no database and observes no participant. +pub struct BrowserConfig { + namespace: SecretId, + reference: SecretRef, + fingerprint: [u8; 32], + input: AttachmentInput, + proof: AttachmentProof, + policy: AccessPolicy, + inquiry: Option<Rc<BrowserInquiry>>, +} +impl BrowserConfig { + /// Selects an existing key and workspace only. Missing/damaged state is an + /// error; it never triggers automatic enrollment or replacement key creation. + pub fn existing( + namespace: SecretId, + reference: SecretRef, + fingerprint: [u8; 32], + input: AttachmentInput, + proof: AttachmentProof, + policy: AccessPolicy, + ) -> Self { + Self { + namespace, + reference, + fingerprint, + input, + proof, + policy, + inquiry: None, + } + } + /// Adds explicit destinations and a relay acceptance criterion. No I/O. + pub fn with_nostr( + mut self, + config: radroots_transport_nostr::Config, + policy: radroots_transport::policy::SatisfactionPolicy, + ) -> Result<Self> { + self.inquiry = Some(Rc::new( + BrowserInquiry::new(config, policy).map_err(operation)?, + )); + Ok(self) + } +} +struct WallClock; +impl WorkspaceClock for WallClock { + fn now(&self) -> std::result::Result<UnixSeconds, WorkspaceError> { + unix_seconds().map_err(|_| WorkspaceError::Unavailable) + } +} +struct Resources { + workspace: Rc<BrowserWorkspace>, + provider: Rc<BrowserProvider>, + tasks: Rc<OwnedTasks>, + inquiry: Option<Rc<InquiryRuntime>>, + io: Option<Rc<BrowserInquiry>>, + storage_closed: Rc<Cell<bool>>, +} +impl SessionHost for Resources { + fn start(&self) -> HostFuture<'_, Result<()>> { + Box::pin(async move { self.tasks.start(wasm_bindgen_futures::spawn_local) }) + } + fn quiesce(&self) -> HostFuture<'_, Result<()>> { + Box::pin(async move { self.tasks.quiesce() }) + } + fn drain(&self) -> HostFuture<'_, Result<()>> { + Box::pin(async move { + self.tasks.drain().await?; + if let Some(inquiry) = &self.inquiry { + inquiry.drain().await.map_err(operation)?; + } + Ok(()) + }) + } + fn disconnect(&self) -> HostFuture<'_, Result<()>> { + Box::pin(async move { + if let Some(io) = &self.io { + io.disconnect().await; + } + Ok(()) + }) + } + fn dispose_callbacks(&self) -> HostFuture<'_, Result<()>> { + Box::pin(async move { + if let Some(io) = &self.io { + io.dispose().await.map_err(operation)?; + } + Ok(()) + }) + } + fn close_storage(&self) -> HostFuture<'_, Result<()>> { + Box::pin(async move { + self.tasks.close().await?; + self.workspace + .close() + .await + .map_err(|_| storage_failure())?; + self.provider.close().await.map_err(|_| storage_failure())?; + self.storage_closed.set(true); + Ok(()) + }) + } +} +/// Confirmation that this client's actual protected resources completed close. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub struct CloseReceipt { + storage_closed: bool, +} +impl CloseReceipt { + /// Actual workspace/provider close completed after owned work and callbacks. + pub const fn storage_closed(self) -> bool { + self.storage_closed + } +} +/// Cloneable origin-thread ownership of one actual browser resource session. +/// Clones share lifecycle, journal, signer scope and permanent close admission. +#[derive(Clone)] +pub struct Client { + session: ClientSession<Resources>, + workspace: Rc<BrowserWorkspace>, + io: Option<Rc<BrowserInquiry>>, + storage_closed: Rc<Cell<bool>>, +} +impl Client { + /// Authenticates and opens the real existing IndexedDB key/workspace. It + /// neither attaches a signer/scope nor starts network work or replays writes. + pub async fn open(config: BrowserConfig) -> Result<Self> { + let provider = Rc::new( + BrowserProvider::open( + config.namespace, + SecretRef::new( + config.reference.id().clone(), + config.reference.backend(), + config.reference.key_version(), + ), + config.fingerprint, + ) + .await + .map_err(|_| storage_failure())?, + ); + let workspace = match BrowserWorkspace::open_existing( + config.input, + config.proof, + provider.clone(), + config.reference, + config.policy, + Rc::new(WallClock), + ) + .await + { + Ok(workspace) => Rc::new(workspace), + Err(error) => { + provider.close().await.map_err(|_| storage_failure())?; + return Err(operation(OperationError::Workspace(error))); + } + }; + let tasks = Rc::new(OwnedTasks::default()); + let inquiry = config + .inquiry + .as_ref() + .map(|io| Rc::new(InquiryRuntime::new(io.clone()))); + let storage_closed = Rc::new(Cell::new(false)); + let host = Resources { + workspace: workspace.clone(), + provider, + tasks: tasks.clone(), + inquiry: inquiry.clone(), + io: config.inquiry.clone(), + storage_closed: storage_closed.clone(), + }; + const MAX: NonZeroU16 = match NonZeroU16::new(32) { + Some(value) => value, + None => panic!("nonzero constant"), + }; + let session = ClientSession::new_with_task_host(host, MAX, tasks); + let session = match inquiry { + Some(inquiry) => session.with_inquiry_runtime(inquiry), + None => session, + }; + Ok(Self { + session, + workspace, + io: config.inquiry, + storage_closed, + }) + } + /// Passive lifecycle observation; no backend probe or authority acquisition. + pub fn state(&self) -> SessionState { + self.session.state() + } + /// Explicitly observes and retains one participant signer/callback scope. + pub async fn attach_signer(&self, handle: SignerHandle) -> Result<SignerSession> { + self.session.attach_signer(handle).await + } + /// Retains access to a failed/cancelled first signer observation for close. + pub fn signer_session(&self) -> Option<SignerSession> { + self.session.signer_session() + } + /// Authenticates a client-owned workspace scope separately from key opening. + pub async fn attach( + &self, + input: AttachmentInput, + proof: AttachmentProof, + ) -> Result<WorkspaceSession> { + self.session + .attach_workspace(self.workspace.clone(), input, proof) + .await + } + /// Starts bounded Rust tasks. Online permits only subsequent explicit calls; + /// startup performs no query, publication or implicit resume. + pub async fn start(&self, mode: StartMode) -> Result<SessionState> { + if let Some(io) = &self.io { + io.select(mode == StartMode::Online).map_err(operation)?; + } else if mode == StartMode::Online { + return Err(operation(OperationError::Unauthorized)); + } + self.session.start().await?; + Ok(self.state()) + } + /// Borrows the ordinary shared inquiry entry point without performing I/O. + pub const fn inbox(&self) -> Inbox<'_> { + Inbox { client: self } + } + /// Selects an explicitly authenticated scope for retained operation reads. + pub fn operations(&self, scope: &WorkspaceSession) -> Operations<'_> { + Operations { + client: self, + scope: scope.clone(), + } + } + /// Permanently stops admission and resumes original ordered closure after + /// cancellation. A receipt requires actual storage close, never Drop. + pub async fn close(&self) -> Result<CloseReceipt> { + self.session.close().await?; + if !self.storage_closed.get() { + return Err(storage_failure()); + } + Ok(CloseReceipt { + storage_closed: true, + }) + } +} +/// Private inquiry access through the actual protected browser journal. +pub struct Inbox<'a> { + client: &'a Client, +} +impl Inbox<'_> { + /// Runs the shared durable inquiry. Losing observation does not cancel an + /// accepted command, issued artifact or committed browser transaction. + pub async fn inquire( + &self, + context: CommandContext, + input: InquireInput, + ) -> Result<OperationReceipt<ChatMessage>> { + self.client + .session + .inquire(self.client.workspace.clone(), context, input) + .await + } +} +/// Authenticated original-operation reads and explicit delivery resumption. +pub struct Operations<'a> { + client: &'a Client, + scope: WorkspaceSession, +} +impl Operations<'_> { + /// Reads original retained progress; absence proves no safe nonissuance. + pub async fn get(&self, id: OperationId) -> Result<Option<OperationReceipt<ChatMessage>>> { + self.get_matching(id, None).await + } + /// Requires the original command digest in addition to operation identity. + pub async fn get_matching( + &self, + id: OperationId, + expected: Option<CommandDigest>, + ) -> Result<Option<OperationReceipt<ChatMessage>>> { + self.client + .session + .operation(self.client.workspace.clone(), &self.scope, id, expected) + .await + } + /// Resumes only original retained work; it never reissues a signing claim. + pub async fn resume( + &self, + id: OperationId, + expected: Option<CommandDigest>, + ) -> Result<OperationReceipt<ChatMessage>> { + self.client + .session + .resume_inquiry(self.client.workspace.clone(), &self.scope, id, expected) + .await + } +} diff --git a/crates/radroots_browser/src/clock.rs b/crates/radroots_browser/src/clock.rs @@ -0,0 +1,26 @@ +//! The pinned SDK requires exactly one clock selection in the final WASM +//! artifact. This feature is selected only by the final artifact root. Use real +//! browser clocks in both pages and workers; never substitute a test timestamp. + +use std::time::Duration; +use universal_time::{Instant, MonotonicClock, SystemTime, WallClock}; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = performance, js_name = now)] + fn monotonic_ms() -> f64; +} + +struct BrowserClock; +impl WallClock for BrowserClock { + fn system_time(&self) -> SystemTime { + SystemTime::from_unix_duration(Duration::from_secs_f64(js_sys::Date::now() / 1_000.0)) + } +} +impl MonotonicClock for BrowserClock { + fn instant(&self) -> Instant { + Instant::from_ticks(Duration::from_secs_f64(monotonic_ms() / 1_000.0)) + } +} +universal_time::define_time_provider!(BrowserClock); diff --git a/crates/radroots_browser/src/inquiry.rs b/crates/radroots_browser/src/inquiry.rs @@ -0,0 +1,204 @@ +use core::num::NonZeroU64; +use radroots_domain::{PublicKey, UnixSeconds}; +use radroots_execution::session::{ + HostFuture, + inquiry::{InquiryIo, capture_dm_route, selected_dm_targets}, +}; +use radroots_nostr::signing::gift_wrap::{randomized_past_time, wrap_retained_seal}; +use radroots_protocol::chat::CapturedDmRoute; +use radroots_signing::provider::{NonceSource, ProviderError}; +use radroots_storage::command::{EnvelopeCandidate, OperationError, PublicationWork}; +use radroots_transport::{ + EventSink, EventSource, TargetSet, + policy::{SatisfactionClass, SatisfactionPolicy}, + source::{FetchBounds, FetchRequest, FetchSelector}, +}; +use radroots_transport_nostr::{Config, NostrTransport}; +use radroots_transport_nostr_browser::BrowserConnector; +use std::{ + sync::Arc, + sync::atomic::{AtomicU8, Ordering}, +}; +use wasm_bindgen::JsCast; + +pub(crate) struct BrowserInquiry { + transport: NostrTransport, + connector: Arc<BrowserConnector>, + read: TargetSet, + write: TargetSet, + policy: SatisfactionPolicy, + mode: AtomicU8, +} +impl BrowserInquiry { + pub(crate) fn new(config: Config, policy: SatisfactionPolicy) -> Result<Self, OperationError> { + let read = TargetSet::new( + config + .read_relays() + .map(|relay| relay.to_target()) + .collect::<Result<_, _>>() + .map_err(|_| OperationError::InvalidCommand)?, + ) + .map_err(|_| OperationError::InvalidCommand)?; + let write = TargetSet::new( + config + .write_relays() + .map(|relay| relay.to_target()) + .collect::<Result<_, _>>() + .map_err(|_| OperationError::InvalidCommand)?, + ) + .map_err(|_| OperationError::InvalidCommand)?; + if policy.class() != SatisfactionClass::Accepted { + return Err(OperationError::InvalidCommand); + } + policy + .validate_for(&write) + .map_err(|_| OperationError::InvalidCommand)?; + let connector = Arc::new(BrowserConnector::default()); + Ok(Self { + transport: NostrTransport::new(config, connector.clone()), + connector, + read, + write, + policy, + mode: AtomicU8::new(0), + }) + } + pub(crate) fn select(&self, online: bool) -> Result<(), OperationError> { + let mode = if online { 2 } else { 1 }; + match self + .mode + .compare_exchange(0, mode, Ordering::AcqRel, Ordering::Acquire) + { + Ok(_) => Ok(()), + Err(current) if current == mode => Ok(()), + Err(_) => Err(OperationError::Unauthorized), + } + } + pub(crate) async fn disconnect(&self) { + self.transport.shutdown().await; + } + pub(crate) async fn dispose(&self) -> Result<(), OperationError> { + self.connector + .close() + .await + .map_err(|_| OperationError::RecoveryRequired) + } + fn capture_route<'a>( + &self, + recipient: PublicKey, + raw_sources: impl IntoIterator<Item = &'a str>, + ) -> Result<CapturedDmRoute, OperationError> { + capture_dm_route(recipient, raw_sources, &self.write) + } +} +impl InquiryIo for BrowserInquiry { + fn enabled(&self) -> bool { + self.mode.load(Ordering::Acquire) == 2 + } + fn now(&self) -> Result<UnixSeconds, OperationError> { + unix_seconds() + } + fn seal_time(&self, now: UnixSeconds) -> Result<UnixSeconds, OperationError> { + let time = randomized_past_time( + NonZeroU64::new(now.get()).ok_or(OperationError::RecoveryRequired)?, + &BrowserNonceSource, + ) + .map_err(|_| OperationError::RecoveryRequired)?; + UnixSeconds::new(time.get()).map_err(|_| OperationError::RecoveryRequired) + } + fn route( + &self, + recipient: PublicKey, + deadline: NonZeroU64, + ) -> HostFuture<'_, Result<CapturedDmRoute, OperationError>> { + Box::pin(async move { + if !self.enabled() { + return Err(OperationError::Unauthorized); + } + let selector = FetchSelector::all() + .with_kinds(vec![10050]) + .and_then(|selector| selector.with_authors(vec![recipient])) + .map_err(|_| OperationError::InvalidCommand)?; + let bounds = + FetchBounds::new(2, deadline.get()).map_err(|_| OperationError::InvalidCommand)?; + let request = FetchRequest::new(self.delivery_id()?, self.read.clone(), bounds) + .map_err(|_| OperationError::InvalidCommand)? + .with_selector(selector); + let page = self + .transport + .fetch(request) + .await + .map_err(|_| OperationError::MissingHistory)?; + self.capture_route( + recipient, + page.events() + .iter() + .map(|observed| observed.event().raw_json()), + ) + }) + } + fn targets(&self, route: &CapturedDmRoute) -> Result<TargetSet, OperationError> { + selected_dm_targets(route, &self.write) + } + fn publication_policy(&self) -> SatisfactionPolicy { + self.policy.clone() + } + fn envelope( + &self, + work: PublicationWork, + raw_seal: &str, + ) -> Result<EnvelopeCandidate, OperationError> { + let now = NonZeroU64::new(self.now()?.get()).ok_or(OperationError::RecoveryRequired)?; + let recipient = work.evidence().recipient(); + let wrapped = wrap_retained_seal(raw_seal, recipient, now, &BrowserNonceSource) + .map_err(|_| OperationError::InvalidEvidence)?; + wrapped.with_wrapping_key(|key| { + EnvelopeCandidate::from_obtained(work, wrapped.signed_json(), key) + }) + } + fn delivery_id(&self) -> Result<String, OperationError> { + let bytes = BrowserNonceSource + .next_nonce() + .map_err(|_| OperationError::RecoveryRequired)?; + let mut output = String::with_capacity(64); + const HEX: &[u8; 16] = b"0123456789abcdef"; + for byte in bytes { + output.push(HEX[usize::from(byte >> 4)] as char); + output.push(HEX[usize::from(byte & 15)] as char); + } + Ok(output) + } + fn publish( + &self, + request: radroots_transport::sink::DeliveryRequest, + selected: TargetSet, + ) -> HostFuture<'_, Result<radroots_transport::DeliveryReceipt, radroots_transport::SinkFailure>> + { + self.transport.deliver_selected(request, selected) + } +} + +pub(crate) fn unix_seconds() -> Result<UnixSeconds, OperationError> { + let millis = js_sys::Date::now(); + if !millis.is_finite() || millis < 1000.0 { + return Err(OperationError::RecoveryRequired); + } + UnixSeconds::new((millis / 1000.0) as u64).map_err(|_| OperationError::RecoveryRequired) +} + +/// Explicit origin-thread WebCrypto CSPRNG. Construction is inert; failed +/// entropy acquisition never returns a partial nonce or falls back to a clock. +pub struct BrowserNonceSource; +impl NonceSource for BrowserNonceSource { + fn next_nonce(&self) -> Result<[u8; 32], ProviderError> { + let crypto = js_sys::Reflect::get(&js_sys::global(), &"crypto".into()) + .map_err(|_| ProviderError::CapabilityUnavailable)? + .dyn_into::<web_sys::Crypto>() + .map_err(|_| ProviderError::CapabilityUnavailable)?; + let mut nonce = [0; 32]; + crypto + .get_random_values_with_u8_array(&mut nonce) + .map_err(|_| ProviderError::CapabilityUnavailable)?; + Ok(nonce) + } +} diff --git a/crates/radroots_browser/src/lib.rs b/crates/radroots_browser/src/lib.rs @@ -0,0 +1,26 @@ +#![doc = include_str!("../README.md")] +#![forbid(unsafe_code)] +#![cfg_attr(coverage_nightly, feature(coverage_attribute))] + +#[cfg(any(target_arch = "wasm32", test))] +mod tasks; + +#[cfg(target_arch = "wasm32")] +mod client; +#[cfg(all(target_arch = "wasm32", feature = "artifact_clock"))] +mod clock; +#[cfg(target_arch = "wasm32")] +mod inquiry; + +#[cfg(target_arch = "wasm32")] +pub use client::{BrowserConfig, Client, CloseReceipt, Inbox, Operations}; +#[cfg(target_arch = "wasm32")] +pub use inquiry::BrowserNonceSource; +pub use radroots_domain::{CommandDigest, OperationId}; +pub use radroots_execution::{ + OperationReceipt, + inbox::InquireInput, + session::{SessionState, StartMode}, + workspace::{CommandContext, WorkspaceSession}, +}; +pub type Result<T> = radroots_execution::Result<T>; diff --git a/crates/radroots_browser/src/tasks.rs b/crates/radroots_browser/src/tasks.rs @@ -0,0 +1,159 @@ +//! One bounded mechanical task owner; command semantics stay in execution. +use futures::{future::poll_fn, task::AtomicWaker}; +use radroots_execution::{ + Code, Error, OperationContext, RetryClass, + session::{HostFuture, tasks::TaskHost}, +}; +use radroots_signing::host::Shared; +use std::{collections::VecDeque, sync::Mutex, task::Poll}; + +const CAPACITY: usize = 32; +fn unavailable() -> Error { + Error::new( + Code::CapabilityUnavailable, + OperationContext::proposed(None), + RetryClass::Never, + None, + ) + .unwrap_or_else(|_| unreachable!("valid constant task error")) +} +#[derive(Default)] +struct State { + started: bool, + // Every stop/close path sets this irreversible admission flag first. + quiesced: bool, + stopping: bool, + closed: bool, + active: bool, + queue: VecDeque<HostFuture<'static, ()>>, +} +#[derive(Default)] +struct Inner { + state: Mutex<State>, + actor: AtomicWaker, + drained: AtomicWaker, + closed: AtomicWaker, +} +#[derive(Default)] +pub(crate) struct OwnedTasks { + inner: Shared<Inner>, +} +impl OwnedTasks { + pub(crate) fn start(&self, spawn: impl FnOnce(HostFuture<'static, ()>)) -> crate::Result<()> { + { + let mut state = self.inner.state.lock().map_err(|_| unavailable())?; + if state.quiesced { + return Err(unavailable()); + } + if state.started { + return Ok(()); + } + state.started = true; + } + let inner = self.inner.clone(); + spawn(Box::pin(async move { + loop { + let next: crate::Result<Option<HostFuture<'static, ()>>> = poll_fn(|cx| { + inner.actor.register(cx.waker()); + let mut state = inner.state.lock().map_err(|_| unavailable())?; + if let Some(task) = state.queue.pop_front() { + state.active = true; + Poll::Ready(Ok(Some(task))) + } else if state.stopping { + state.closed = true; + Poll::Ready(Ok(None)) + } else { + Poll::Pending + } + }) + .await; + match next { + Ok(Some(task)) => { + task.await; + let Ok(mut state) = inner.state.lock() else { + break; + }; + state.active = false; + drop(state); + inner.drained.wake(); + } + Ok(None) | Err(_) => break, + } + } + inner.closed.wake(); + inner.drained.wake(); + })); + Ok(()) + } + pub(crate) fn quiesce(&self) -> crate::Result<()> { + self.inner.state.lock().map_err(|_| unavailable())?.quiesced = true; + Ok(()) + } + pub(crate) async fn drain(&self) -> crate::Result<()> { + poll_fn(|cx| { + self.inner.drained.register(cx.waker()); + let idle = { + let state = self.inner.state.lock().map_err(|_| unavailable())?; + !state.active && state.queue.is_empty() + }; + if idle { + self.inner.drained.take(); + Poll::Ready(Ok(())) + } else { + Poll::Pending + } + }) + .await + } + pub(crate) async fn close(&self) -> crate::Result<()> { + { + let mut state = self.inner.state.lock().map_err(|_| unavailable())?; + state.quiesced = true; + state.stopping = true; + if !state.started { + state.closed = true; + } + } + self.inner.actor.wake(); + poll_fn(|cx| { + self.inner.closed.register(cx.waker()); + let closed = self.inner.state.lock().map_err(|_| unavailable())?.closed; + if closed { + self.inner.closed.take(); + Poll::Ready(Ok(())) + } else { + Poll::Pending + } + }) + .await + } +} +impl TaskHost for OwnedTasks { + fn submit(&self, task: HostFuture<'static, ()>) -> crate::Result<()> { + { + let mut state = self.inner.state.lock().map_err(|_| unavailable())?; + if !state.started + || state.quiesced + || state.queue.len() + usize::from(state.active) >= CAPACITY + { + return Err(unavailable()); + } + state.queue.push_back(task); + } + self.inner.actor.wake(); + Ok(()) + } +} +impl Drop for OwnedTasks { + fn drop(&mut self) { + if let Ok(mut state) = self.inner.state.lock() { + state.quiesced = true; + state.stopping = true; + } + self.inner.actor.wake(); + } +} + +#[cfg(test)] +#[path = "tasks_tests.rs"] +mod tests; diff --git a/crates/radroots_browser/src/tasks_tests.rs b/crates/radroots_browser/src/tasks_tests.rs @@ -0,0 +1,164 @@ +use super::*; +use futures::{ + FutureExt, + channel::oneshot, + executor::{LocalPool, block_on}, + task::LocalSpawnExt, +}; +use std::sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, +}; + +fn started(pool: &LocalPool) -> Shared<OwnedTasks> { + let tasks = Shared::new(OwnedTasks::default()); + let spawn = pool.spawner(); + tasks + .start(|task| spawn.spawn_local(task).unwrap()) + .unwrap(); + tasks +} +#[test] +fn startup_quiesce_and_empty_close_are_permanent_and_unpolled_close_is_inert() { + let mut pool = LocalPool::new(); + let tasks = Shared::new(OwnedTasks::default()); + assert!(tasks.submit(Box::pin(async {})).is_err()); + drop(tasks.close()); + let spawn = pool.spawner(); + tasks + .start(|task| spawn.spawn_local(task).unwrap()) + .unwrap(); + tasks.start(|_| panic!("second owner")).unwrap(); + tasks.quiesce().unwrap(); + assert!(tasks.submit(Box::pin(async {})).is_err()); + pool.run_until(tasks.close()).unwrap(); + block_on(tasks.close()).unwrap(); + assert!(tasks.start(|_| panic!("restart")).is_err()); + let unopened = OwnedTasks::default(); + block_on(unopened.close()).unwrap(); + assert!(unopened.start(|_| panic!("closed before start")).is_err()); +} +#[test] +fn bounded_original_jobs_survive_cancelled_drain_and_close_observers() { + let mut pool = LocalPool::new(); + let tasks = started(&pool); + let (release, blocked) = oneshot::channel::<()>(); + tasks + .submit(Box::pin(async move { + blocked.await.unwrap(); + })) + .unwrap(); + pool.run_until_stalled(); + let count = Arc::new(AtomicUsize::new(0)); + for _ in 1..CAPACITY { + let count = count.clone(); + tasks + .submit(Box::pin(async move { + count.fetch_add(1, Ordering::SeqCst); + })) + .unwrap(); + } + assert!( + tasks + .submit(Box::pin(async { panic!("refused task polled") })) + .is_err() + ); + let mut drain = Box::pin(tasks.drain()); + assert!(drain.as_mut().now_or_never().is_none()); + drop(drain); + let mut close = Box::pin(tasks.close()); + assert!(close.as_mut().now_or_never().is_none()); + drop(close); + assert!( + tasks + .submit(Box::pin(async { panic!("closed admission") })) + .is_err() + ); + release.send(()).unwrap(); + pool.run_until(tasks.close()).unwrap(); + assert_eq!(count.load(Ordering::SeqCst), CAPACITY - 1); + block_on(tasks.drain()).unwrap(); +} +#[test] +fn an_idle_owner_wakes_and_drain_waits_for_queued_then_running_original_work() { + let mut pool = LocalPool::new(); + let tasks = started(&pool); + pool.run_until_stalled(); + let count = Arc::new(AtomicUsize::new(0)); + let completed = count.clone(); + let (release, blocked) = oneshot::channel::<()>(); + tasks + .submit(Box::pin(async move { + blocked.await.unwrap(); + completed.fetch_add(1, Ordering::SeqCst); + })) + .unwrap(); + let mut drain = Box::pin(tasks.drain()); + assert!(drain.as_mut().now_or_never().is_none()); + assert_eq!(count.load(Ordering::SeqCst), 0); + pool.run_until_stalled(); + assert!(drain.as_mut().now_or_never().is_none()); + release.send(()).unwrap(); + pool.run_until(drain).unwrap(); + assert_eq!(count.load(Ordering::SeqCst), 1); + let completed = count.clone(); + tasks + .submit(Box::pin(async move { + completed.fetch_add(1, Ordering::SeqCst); + })) + .unwrap(); + pool.run_until_stalled(); + pool.run_until(tasks.close()).unwrap(); + assert_eq!(count.load(Ordering::SeqCst), 2); +} +#[test] +fn losing_last_host_observer_still_drains_accepted_work_and_drops_outside_lock() { + struct ReentrantDrop(Shared<OwnedTasks>, Arc<AtomicUsize>); + impl Drop for ReentrantDrop { + fn drop(&mut self) { + self.0.quiesce().unwrap(); + self.1.fetch_add(1, Ordering::SeqCst); + } + } + let mut pool = LocalPool::new(); + let tasks = started(&pool); + let count = Arc::new(AtomicUsize::new(0)); + let probe = ReentrantDrop(tasks.clone(), count.clone()); + tasks.quiesce().unwrap(); + assert!( + tasks + .submit(Box::pin(async move { + let _probe = probe; + })) + .is_err() + ); + assert_eq!(count.load(Ordering::SeqCst), 1); + pool.run_until(tasks.close()).unwrap(); + let tasks = started(&pool); + let count2 = count.clone(); + tasks + .submit(Box::pin(async move { + count2.fetch_add(1, Ordering::SeqCst); + })) + .unwrap(); + drop(tasks); + pool.run(); + assert_eq!(count.load(Ordering::SeqCst), 2); +} +#[test] +fn poisoned_bookkeeping_never_reports_successful_completion() { + let tasks = OwnedTasks::default(); + let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let _guard = tasks.inner.state.lock().unwrap(); + panic!("intentional poison"); + })); + assert!(tasks.start(|_| panic!("poisoned start")).is_err()); + assert!( + tasks + .submit(Box::pin(async { panic!("poisoned admission") })) + .is_err() + ); + assert!(tasks.quiesce().is_err()); + assert!(block_on(tasks.drain()).is_err()); + assert!(block_on(tasks.close()).is_err()); +} diff --git a/crates/radroots_browser/tests/browser/Cargo.lock b/crates/radroots_browser/tests/browser/Cargo.lock @@ -0,0 +1,2727 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-utility" +version = "0.3.2" +source = "git+https://github.com/yukibtc/async-utility?rev=b323ae0c1c1424b78bf8bb8832b95e86771f1dee#b323ae0c1c1424b78bf8bb8832b95e86771f1dee" +dependencies = [ + "futures-util", + "gloo-timers", + "tokio", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-wsocket" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c713e1f14c7b82e32ea159af1c6e2f070cfadbdf23fb2512acce9af0a26f1a2" +dependencies = [ + "futures", + "futures-util", + "js-sys", + "tokio", + "tokio-happy-eyeballs", + "tokio-rustls", + "tokio-socks", + "tokio-tungstenite", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bech32" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" + +[[package]] +name = "bech32" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbd3e1070bbdf4cd88a75264e18e8a26f7cb5c6949eadf0ceb85fb159cf08f8" + +[[package]] +name = "bip39" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" +dependencies = [ + "bitcoin_hashes 0.14.1", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin-consensus-encoding" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9daa31138eb443d5751b207f3f64154e2bb09cd59960562ccc7a7112be38147f" +dependencies = [ + "bitcoin-internals 0.7.0", +] + +[[package]] +name = "bitcoin-internals" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5" + +[[package]] +name = "bitcoin-internals" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8bea3a9f0cfece4564e37cb49a38cc245ca5184719e50d7d0dda3268722c4e2" + +[[package]] +name = "bitcoin-io" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dee39a0ee5b4095224a0cfc6bf4cc1baf0f9624b96b367e53b66d974e51d953" + +[[package]] +name = "bitcoin_hashes" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b" +dependencies = [ + "bitcoin-io", + "hex-conservative 0.2.2", + "serde", +] + +[[package]] +name = "bitcoin_hashes" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e" +dependencies = [ + "bitcoin-consensus-encoding", + "bitcoin-internals 0.6.0", + "hex-conservative 1.3.0", + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.2.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + +[[package]] +name = "defmt" +version = "0.3.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4deef977660e373c458df605a913d4ab121db0ccd18d1ad6976dff7d37cddb53" +dependencies = [ + "defmt 1.2.0", +] + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.2", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.18", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "ff", + "generic-array", + "group", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "faster-hex" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04839bdf9d8c10f66806fad16b852fc72aab80873aebc3cb69d85b4fa41543ed" +dependencies = [ + "autocfg", + "defmt 0.3.101", + "heapless", + "serde", +] + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasip2", + "wasip3", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-conservative" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex-conservative" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271e0d19bcb473b6675739a2b536076b24a082316cb5199ad918edce10c599e8" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "io-uring" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9080b15e63775b9a2ac7dca720f7050a8b955e092ea0f6020a4a80f69998cdc0" +dependencies = [ + "bitflags 2.11.0", + "cfg-if", + "libc", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff-tzdb" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142bd39932ad231f10513df9ab62661fead8719872150b7ad02a2df79f4e141e" + +[[package]] +name = "js-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "elliptic-curve", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5" + +[[package]] +name = "mediatype" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120fa187be19d9962f0926633453784691731018a2bf936ddb4e29101b79c4a7" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "negentropy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d66662cb5ca384d4991509755ed5a42dd8e31c4282bf881938e506fc3146ec" + +[[package]] +name = "nostr" +version = "0.44.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d3d987ea7078dc36947cde532637c472a229426702e4331dd7667325378bd9" +dependencies = [ + "aes", + "base64", + "bech32 0.11.1", + "bip39", + "bitcoin_hashes 0.14.1", + "cbc", + "chacha20", + "chacha20poly1305", + "getrandom 0.2.17", + "hex", + "instant", + "scrypt", + "secp256k1 0.29.1", + "serde", + "serde_json", + "unicode-normalization", + "url", + "url-fork", +] + +[[package]] +name = "nostr" +version = "0.45.5" +source = "git+https://github.com/nostrdevkit/nostr.git?rev=de3031aa99986eb29b3f34580355f9a099e4c927#de3031aa99986eb29b3f34580355f9a099e4c927" +dependencies = [ + "base64", + "bech32 0.12.0", + "bip39", + "bitcoin_hashes 1.2.0", + "cbc", + "chacha20", + "chacha20poly1305", + "faster-hex", + "opaquerr", + "rand 0.10.1", + "secp256k1 0.30.0", + "serde", + "serde_json", + "unicode-normalization", + "universal-time", + "url", + "zeroize", +] + +[[package]] +name = "nostr-database" +version = "0.45.2" +source = "git+https://github.com/nostrdevkit/nostr.git?rev=de3031aa99986eb29b3f34580355f9a099e4c927#de3031aa99986eb29b3f34580355f9a099e4c927" +dependencies = [ + "nostr 0.45.5", + "opaquerr", +] + +[[package]] +name = "nostr-gossip" +version = "0.45.1" +source = "git+https://github.com/nostrdevkit/nostr.git?rev=de3031aa99986eb29b3f34580355f9a099e4c927#de3031aa99986eb29b3f34580355f9a099e4c927" +dependencies = [ + "nostr 0.45.5", + "opaquerr", +] + +[[package]] +name = "nostr-sdk" +version = "0.45.4" +source = "git+https://github.com/nostrdevkit/nostr.git?rev=de3031aa99986eb29b3f34580355f9a099e4c927#de3031aa99986eb29b3f34580355f9a099e4c927" +dependencies = [ + "async-utility", + "async-wsocket", + "faster-hex", + "futures", + "lru", + "negentropy", + "nostr 0.45.5", + "nostr-database", + "nostr-gossip", + "opaquerr", + "rand 0.10.1", + "tokio", + "tokio-stream", + "tracing", + "universal-time", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "opaquerr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f933a4265d5cdad61d19bbdfc972ea5726d56cd8d3d57b8f2d3c365dd42bee9" + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "radroots_blossom" +version = "0.1.0-alpha" +dependencies = [ + "mediatype", + "serde", + "sha2", + "unicode-general-category", + "url", +] + +[[package]] +name = "radroots_browser" +version = "0.1.0-alpha" +dependencies = [ + "futures", + "js-sys", + "radroots_domain", + "radroots_execution", + "radroots_nostr", + "radroots_protocol", + "radroots_secrets", + "radroots_signing", + "radroots_storage", + "radroots_storage_indexeddb", + "radroots_transport", + "radroots_transport_nostr", + "radroots_transport_nostr_browser", + "universal-time", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "radroots_core" +version = "0.1.0-alpha" +dependencies = [ + "rust_decimal", + "serde", +] + +[[package]] +name = "radroots_domain" +version = "0.1.0-alpha" +dependencies = [ + "radroots_identity", + "serde", + "zeroize", +] + +[[package]] +name = "radroots_event" +version = "0.1.0-alpha" +dependencies = [ + "hex", + "jiff-tzdb", + "radroots_blossom", + "radroots_core", + "radroots_identity", + "radroots_protocol", + "serde", + "serde_json", + "sha2", + "unicode-general-category", + "url", +] + +[[package]] +name = "radroots_event_codec" +version = "0.1.0-alpha" +dependencies = [ + "hex", + "radroots_blossom", + "radroots_core", + "radroots_event", + "radroots_identity", + "radroots_protocol", + "secp256k1 0.29.1", + "serde", + "serde_json", + "sha2", +] + +[[package]] +name = "radroots_execution" +version = "0.1.0-alpha" +dependencies = [ + "futures", + "radroots_domain", + "radroots_protocol", + "radroots_signing", + "radroots_storage", + "radroots_transport", +] + +[[package]] +name = "radroots_identity" +version = "0.1.0-alpha" +dependencies = [ + "k256", + "serde", + "thiserror 2.0.18", +] + +[[package]] +name = "radroots_nostr" +version = "0.1.0-alpha" +dependencies = [ + "base64", + "nostr 0.44.7", + "radroots_event", + "radroots_event_codec", + "radroots_identity", + "radroots_protocol", + "radroots_signing", + "serde", + "serde_json", + "thiserror 2.0.18", + "zeroize", +] + +[[package]] +name = "radroots_ordinary_browser_fixture" +version = "0.0.0" +dependencies = [ + "futures", + "js-sys", + "nostr 0.44.7", + "radroots_browser", + "radroots_domain", + "radroots_execution", + "radroots_nostr", + "radroots_secrets", + "radroots_signing", + "radroots_storage", + "radroots_storage_indexeddb", + "radroots_transport", + "radroots_transport_nostr", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "radroots_protocol" +version = "0.1.0-alpha" +dependencies = [ + "radroots_domain", + "radroots_identity", + "serde", + "serde_json", + "sha2", + "zeroize", +] + +[[package]] +name = "radroots_secrets" +version = "0.1.0-alpha" +dependencies = [ + "chacha20poly1305", + "futures", + "js-sys", + "sha2", + "subtle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "zeroize", +] + +[[package]] +name = "radroots_signing" +version = "0.1.0-alpha" +dependencies = [ + "hex", + "radroots_domain", + "radroots_event", + "radroots_event_codec", + "radroots_identity", + "radroots_protocol", + "sha2", + "zeroize", +] + +[[package]] +name = "radroots_storage" +version = "0.1.0-alpha" +dependencies = [ + "radroots_domain", + "radroots_event", + "radroots_event_codec", + "radroots_protocol", + "radroots_trade", + "radroots_transport", + "serde", + "serde_json", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "radroots_storage_indexeddb" +version = "0.1.0-alpha" +dependencies = [ + "futures", + "js-sys", + "nostr 0.44.7", + "radroots_domain", + "radroots_secrets", + "radroots_storage", + "radroots_transport", + "serde", + "serde_json", + "sha2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "zeroize", +] + +[[package]] +name = "radroots_trade" +version = "0.1.0-alpha" +dependencies = [ + "radroots_core", + "radroots_event", + "radroots_identity", + "serde", +] + +[[package]] +name = "radroots_transport" +version = "0.1.0-alpha" +dependencies = [ + "radroots_event", + "radroots_identity", + "radroots_protocol", + "serde", + "sha2", +] + +[[package]] +name = "radroots_transport_nostr" +version = "0.1.0-alpha" +dependencies = [ + "async-utility", + "async-wsocket", + "futures", + "getrandom 0.4.2", + "nostr-sdk", + "radroots_event_codec", + "radroots_nostr", + "radroots_protocol", + "radroots_transport", + "serde_json", + "sha2", + "tokio", + "url", + "wasm-bindgen-futures", + "web-time", +] + +[[package]] +name = "radroots_transport_nostr_browser" +version = "0.1.0-alpha" +dependencies = [ + "async-utility", + "futures", + "js-sys", + "radroots_transport", + "radroots_transport_nostr", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "getrandom 0.4.2", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rust_decimal" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f703d19852dbf87cbc513643fa81428361eb6940f1ac14fd58155d295a3eb0" +dependencies = [ + "arrayvec", + "num-traits", + "serde", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "password-hash", + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" +dependencies = [ + "rand 0.8.5", + "secp256k1-sys", + "serde", +] + +[[package]] +name = "secp256k1" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" +dependencies = [ + "bitcoin_hashes 0.14.1", + "rand 0.8.5", + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" +dependencies = [ + "cc", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a207d6d6a2b7fc470b80443726053f18a2481b7e1eee970597051596567987a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "pin-project-lite", + "slab", + "socket2", + "tokio-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "tokio-happy-eyeballs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8564c32dfb6f4257f8bc6edfc178a34af97520e0b7b9815500c55eb3d092f29f" +dependencies = [ + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-socks" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615" +dependencies = [ + "either", + "futures-util", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857" +dependencies = [ + "futures-util", + "log", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots 0.26.11", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.2", + "rustls", + "rustls-pki-types", + "sha1", + "thiserror 2.0.18", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "universal-time" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47a939edecc3c5a7b83c02e5f6b3c31d2bc69eabcc9a87ab12c6d37ee6dbc856" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna 1.1.0", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "url-fork" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fa3323c39b8e786154d3000b70ae9af0e9bd746c9791456da0d4a1f68ad89d6" +dependencies = [ + "form_urlencoded", + "idna 0.5.0", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.6", +] + +[[package]] +name = "webpki-roots" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[patch.unused]] +name = "radroots_geonames" +version = "0.1.0-alpha" + +[[patch.unused]] +name = "radroots_nostr_connect" +version = "0.1.0-alpha" + +[[patch.unused]] +name = "radroots_storage_sqlite" +version = "0.1.0-alpha" + +[[patch.unused]] +name = "radroots_sync" +version = "0.1.0-alpha" diff --git a/crates/radroots_browser/tests/browser/Cargo.toml b/crates/radroots_browser/tests/browser/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "radroots_ordinary_browser_fixture" +version = "0.0.0" +publish = false +edition = "2024" +rust-version = "1.99.0" + +[workspace] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +radroots_browser = { path = "../..", features = ["artifact_clock"] } +radroots_domain = { path = "../../../domain", default-features = false, features = ["std"] } +radroots_execution = { path = "../../../execution", default-features = false, features = ["workspace_session"] } +radroots_nostr = { path = "../../../nostr", default-features = false, features = ["signing", "nip17"] } +radroots_secrets = { path = "../../../secrets", default-features = false, features = ["browser"] } +radroots_signing = { path = "../../../signing", default-features = false, features = ["chat", "std"] } +radroots_storage = { path = "../../../storage", default-features = false, features = ["protected_outbox"] } +radroots_storage_indexeddb = { path = "../../../storage_indexeddb", features = ["workspace"] } +radroots_transport = { path = "../../../transport", default-features = false, features = ["std"] } +radroots_transport_nostr = { path = "../../../transport_nostr", default-features = false } +nostr = { version = "=0.44.7", default-features = false, features = ["std", "nip44", "nip59"] } +serde_json = "=1.0.149" +futures = "=0.3.32" +js-sys = "=0.3.91" +wasm-bindgen = "=0.2.114" +wasm-bindgen-futures = "=0.4.64" diff --git a/crates/radroots_browser/tests/browser/run.mjs b/crates/radroots_browser/tests/browser/run.mjs @@ -0,0 +1,111 @@ +import assert from 'node:assert/strict'; +import {createRequire} from 'node:module'; +import {createServer} from 'node:http'; +import {readFile} from 'node:fs/promises'; +import {resolve} from 'node:path'; + +const [tools,packageDir,engine='chromium']=process.argv.slice(2); +assert(tools&&packageDir&&['chromium','firefox','webkit'].includes(engine)); +const require=createRequire(resolve(tools,'package.json')); +const playwright=require('playwright'); +const {wsServer:WebSocketServer}=require(resolve(tools,'node_modules/playwright-core/lib/utilsBundle.js')); +const wss=new WebSocketServer({noServer:true}),sockets=new Set(),sources=new Map(),observed=[],upgrades=[]; +process.on('uncaughtExceptionMonitor',()=>console.error(JSON.stringify({engine,upgrades,observed}))); +const observer=` +const ActualWebSocket=globalThis.WebSocket,actualOpen=IDBFactory.prototype.open; +const observedSockets=[],databases=[]; +globalThis.WebSocket=class extends ActualWebSocket {constructor(...args){super(...args);observedSockets.push(this);}}; +globalThis.browserSocketCount=()=>observedSockets.length; +IDBFactory.prototype.open=function(...args){ + const request=actualOpen.apply(this,args); + request.addEventListener('success',()=>databases.push(request.result),{once:true}); + return request; +}; +globalThis.assertStorageCallbacksClosed=()=>{ + for(const db of databases)if(db.onversionchange||db.onclose)throw Error('explicit close retained database callback'); +}; +async function verifyCleanup(){ + await new Promise(resolve=>setTimeout(resolve,80)); + for(const socket of observedSockets){ + if(socket.onopen||socket.onmessage||socket.onerror||socket.onclose)throw Error('retained original socket callback'); + if(socket.readyState!==ActualWebSocket.CLOSED)throw Error('original socket remains open'); + } + assertStorageCallbacksClosed(); + return {sockets:observedSockets.length,databases:databases.length}; +}`; +const execute=` +const {default:init,advertisements,verify_client,verify_publications}=await import('./fixture.js');await init(); +const route='/'+context,endpoint=base.replace('http:','ws:')+route; +const response=await fetch(base+'/advertisements'+route,{method:'POST',body:advertisements(endpoint)}); +if(!response.ok)throw Error('fixture advertisement setup'); +const result=JSON.parse(await verify_client(endpoint,'ordinary_browser_'+context)); +const events=await fetch(base+'/events'+route).then(response=>response.text()); +await verify_publications(events,JSON.stringify(result.messages)); +result.disposed=await verifyCleanup();return result;`; +const worker=`${observer} +self.onmessage=async event=>{try{const base=event.data,context='worker';self.postMessage(await(async()=>{${execute}})());} +catch(error){self.postMessage({error:String(error)});}};`; +const server=createServer(async(req,res)=>{ + try{ + if(req.url==='/'){res.setHeader('content-type','text/html');res.end('<!doctype html><title>Ordinary Radroots browser client</title>');return;} + if(req.url==='/worker.js'){res.setHeader('content-type','text/javascript');res.end(worker);return;} + if(req.url==='/advertisements/main'||req.url==='/advertisements/worker'){ + assert.equal(req.method,'POST');let body='';for await(const chunk of req){body+=chunk;assert(Buffer.byteLength(body)<=64*1024);} + const raw=JSON.parse(body);assert.equal(raw.length,2);const values=raw.map(value=>JSON.parse(value)); + for(const value of values)assert.equal(value.kind,10050); + sources.set(req.url.replace('/advertisements',''),values);res.end('ok');return; + } + if(req.url==='/events/main'||req.url==='/events/worker'){ + const route=req.url.replace('/events','');res.setHeader('content-type','application/json'); + res.end(JSON.stringify(observed.filter(item=>item.route===route&&item.message[0]==='EVENT').map(item=>item.rawEvent)));return; + } + const name=new Map([['/fixture.js','fixture.js'],['/fixture_bg.wasm','fixture_bg.wasm']]).get(req.url); + if(!name){res.statusCode=404;res.end();return;} + res.setHeader('content-type',name.endsWith('.wasm')?'application/wasm':'text/javascript');res.end(await readFile(resolve(packageDir,name))); + }catch(error){res.statusCode=500;res.end('fixture setup failed');console.error(error);} +}); +server.on('connection',socket=>{sockets.add(socket);socket.on('close',()=>sockets.delete(socket));}); +server.on('upgrade',(req,socket,head)=>{ + assert(sources.has(req.url));upgrades.push(req.url); + wss.handleUpgrade(req,socket,head,ws=>{ + ws.on('error',()=>{}); + ws.on('message',(data,binary)=>{ + assert(!binary);const raw=data.toString(),message=JSON.parse(raw); + observed.push({route:req.url,message,rawEvent:message[0]==='EVENT'?raw.slice('["EVENT",'.length,-1):undefined}); + if(message[0]==='REQ'){ + assert.equal(message[2].kinds[0],10050);assert.equal(message[2].authors.length,1); + for(const value of sources.get(req.url))if(value.pubkey===message[2].authors[0])ws.send(JSON.stringify(['EVENT',message[1],value])); + ws.send(JSON.stringify(['EOSE',message[1]])); + }else if(message[0]==='EVENT'){ + assert.equal(message[1].kind,1059);ws.send(JSON.stringify(['OK',message[1].id,true,''])); + }else assert.equal(message[0],'CLOSE'); + }); + }); +}); +await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve)); +const base=`http://127.0.0.1:${server.address().port}`;let browser; +const watchdog=setTimeout(()=>{void browser?.close();},120000);watchdog.unref(); +try{ + const automation=engine==='firefox'?'webdriver_bidi':'playwright_default'; + const options=engine==='firefox'?{headless:true,channel:'moz-firefox-nightly',executablePath:playwright.firefox.executablePath()}:{headless:true}; + browser=await playwright[engine].launch(options);let page=await browser.newPage();const errors=[]; + page.on('pageerror',error=>errors.push(error.message));await page.goto(base);await page.addScriptTag({content:observer}); + const main=await page.evaluate(new Function('base',`return(async()=>{const context='main';${execute}})();`),base); + console.error(JSON.stringify({phase:'main_completed',engine,result:main})); + await page.close();page=await browser.newPage();page.on('pageerror',error=>errors.push(error.message));await page.goto(base); + const dedicated=await page.evaluate(base=>new Promise((resolve,reject)=>{ + const worker=new Worker('./worker.js',{type:'module'}); + worker.onerror=event=>{worker.terminate();reject(Error(event.message));}; + worker.onmessage=event=>{worker.terminate();event.data.error?reject(Error(event.data.error)):resolve(event.data);};worker.postMessage(base); + }),base); + assert.equal(main.passed.length,7);assert.deepEqual(main.passed,dedicated.passed);assert.deepEqual(errors,[]); + for(const context of ['main','worker']){ + const publications=observed.filter(item=>item.route==='/'+context&&item.message[0]==='EVENT'); + assert.equal(publications.length,4);assert.equal(new Set(publications.map(item=>item.message[1].id)).size,4); + assert.equal(upgrades.filter(route=>route==='/'+context).length,2); + } + console.log(JSON.stringify({engine,automation,version:browser.version(),main,dedicated,pageErrors:errors,upgrades,observed})); +}finally{ + clearTimeout(watchdog);await browser?.close();for(const client of wss.clients)client.terminate();for(const socket of sockets)socket.destroy(); + await new Promise(resolve=>wss.close(resolve));await new Promise(resolve=>server.close(resolve)); +} diff --git a/crates/radroots_browser/tests/browser/src/lib.rs b/crates/radroots_browser/tests/browser/src/lib.rs @@ -0,0 +1,420 @@ +#![forbid(unsafe_code)] +use futures::FutureExt; +use nostr::JsonUtil; +use radroots_browser::{ + BrowserConfig, BrowserNonceSource, Client, InquireInput, SessionState, StartMode, + WorkspaceSession, +}; +use radroots_domain::{OperationId, PublicKey, ThreadId, UnixSeconds}; +use radroots_nostr::{key::parse_secret_key, signing::LocalSigner}; +use radroots_secrets::{ + SecretId, SecretRef, + browser::BrowserProvider, + id::{BackendKind, KeyVersion}, + provider::{AccessPolicy, HardwarePolicy, ResidencyPolicy, UserPresencePolicy}, +}; +use radroots_signing::{ + provider::{NonceSource, ProviderError, SignerCallbacks, SignerHandle}, + signer::BoxFuture, +}; +use radroots_storage::workspace::{ + AttachmentInput, AttachmentProof, WorkspaceClock, WorkspaceError, +}; +use radroots_storage_indexeddb::workspace::{BrowserWorkspace, LocalOutboxConfig}; +use radroots_transport::policy::{SatisfactionClass, SatisfactionPolicy, TargetPolicy}; +use radroots_transport_nostr::{ + Config, RelayAccess, RelayEndpoint, RelayProfile, RelayProfileKind, RelayUrlPolicy, +}; +use std::{cell::Cell, rc::Rc}; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = globalThis, js_name = browserSocketCount)] + fn socket_count() -> u32; + #[wasm_bindgen(catch, js_namespace = globalThis, js_name = assertStorageCallbacksClosed)] + fn storage_callbacks_closed() -> Result<(), JsValue>; +} +fn require(value: bool, message: &str) -> Result<(), JsValue> { + if value { Ok(()) } else { Err(message.into()) } +} +fn fail(error: impl std::fmt::Debug) -> JsValue { + JsValue::from_str(&format!("fixture: {error:?}")) +} +fn now() -> u64 { + (js_sys::Date::now() / 1000.0) as u64 +} +fn proof_copy(proof: &AttachmentProof) -> AttachmentProof { + proof.with_secret(|secret| AttachmentProof::from_protected_input(secret).unwrap()) +} +fn reference_copy(reference: &SecretRef) -> SecretRef { + SecretRef::new( + reference.id().clone(), + reference.backend(), + reference.key_version(), + ) +} +fn key(last: u8) -> nostr::Keys { + let mut bytes = [0; 32]; + bytes[31] = last; + nostr::Keys::new(nostr::SecretKey::from_slice(&bytes).unwrap()) +} +fn participant(last: u8) -> PublicKey { + PublicKey::from_bytes(key(last).public_key().to_bytes()).unwrap() +} +fn access() -> AccessPolicy { + AccessPolicy::new( + ResidencyPolicy::Any, + UserPresencePolicy::NotRequired, + HardwarePolicy::Any, + ) +} +struct Clock; +impl WorkspaceClock for Clock { + fn now(&self) -> Result<UnixSeconds, WorkspaceError> { + UnixSeconds::new(now()).map_err(|_| WorkspaceError::Unavailable) + } +} +struct Callbacks { + quiesced: Cell<u32>, + closed: Cell<u32>, +} +impl SignerCallbacks for Callbacks { + fn quiesce(&self) -> BoxFuture<'_, Result<(), ProviderError>> { + Box::pin(async move { + self.quiesced.set(self.quiesced.get() + 1); + Ok(()) + }) + } + fn close(&self) -> BoxFuture<'_, Result<(), ProviderError>> { + Box::pin(async move { + self.closed.set(self.closed.get() + 1); + Ok(()) + }) + } +} +fn signer_clock() -> Result<u64, radroots_signing::Error> { + Ok(js_sys::Date::now() as u64) +} +async fn signer(client: &Client) -> Result<Rc<Callbacks>, JsValue> { + let signer = LocalSigner::with_clock( + parse_secret_key("0000000000000000000000000000000000000000000000000000000000000001") + .unwrap(), + signer_clock, + ) + .unwrap() + .with_nonce_source(Rc::new(BrowserNonceSource)); + let callbacks = Rc::new(Callbacks { + quiesced: Cell::new(0), + closed: Cell::new(0), + }); + client + .attach_signer(SignerHandle::new(Rc::new(signer), callbacks.clone())) + .await + .map_err(fail)?; + Ok(callbacks) +} +struct Existing { + namespace: SecretId, + reference: SecretRef, + fingerprint: [u8; 32], + input: AttachmentInput, + proof: AttachmentProof, +} +impl Existing { + async fn create(label: &str) -> Result<Self, JsValue> { + let namespace = SecretId::parse(label).unwrap(); + let reference = SecretRef::new( + SecretId::parse("ordinary_browser_workspace").unwrap(), + BackendKind::External, + KeyVersion::new(1).unwrap(), + ); + let provider = Rc::new( + BrowserProvider::create(namespace.clone(), reference_copy(&reference)) + .await + .map_err(fail)?, + ); + let fingerprint = provider.fingerprint(); + let (workspace, input, proof) = BrowserWorkspace::initialize_local_outbox( + LocalOutboxConfig::new( + participant(1), + participant(3), + "isolated-browser-fixture", + UnixSeconds::new(now() + 600).unwrap(), + ) + .unwrap(), + provider.clone(), + reference_copy(&reference), + access(), + Rc::new(Clock), + ) + .await + .map_err(fail)?; + workspace.close().await.map_err(fail)?; + provider.close().await.map_err(fail)?; + Ok(Self { + namespace, + reference, + fingerprint, + input, + proof, + }) + } + fn config(&self, base: &str) -> BrowserConfig { + let transport = Config::from_profile( + RelayProfile::explicit( + RelayProfileKind::Simulator, + [ + RelayEndpoint::new(base, RelayUrlPolicy::Local, RelayAccess::ReadWrite) + .unwrap(), + ], + ) + .unwrap(), + ) + .with_timeouts(2000, 2000, 2000) + .unwrap(); + BrowserConfig::existing( + self.namespace.clone(), + reference_copy(&self.reference), + self.fingerprint, + self.input.clone(), + proof_copy(&self.proof), + access(), + ) + .with_nostr( + transport, + SatisfactionPolicy::new(SatisfactionClass::Accepted, TargetPolicy::all()), + ) + .unwrap() + } + async fn open(&self, base: &str) -> Result<(Client, WorkspaceSession), JsValue> { + let client = Client::open(self.config(base)).await.map_err(fail)?; + require( + client.state() == SessionState::Ready, + "open must remain ready", + )?; + let wrong = AttachmentProof::from_protected_input(&[99; 32]).unwrap(); + require( + client.attach(self.input.clone(), wrong).await.is_err(), + "key ownership cannot replace attachment proof", + )?; + let scope = client + .attach(self.input.clone(), proof_copy(&self.proof)) + .await + .map_err(fail)?; + Ok((client, scope)) + } +} +fn id() -> OperationId { + OperationId::from_bytes(BrowserNonceSource.next_nonce().unwrap()) +} +fn inquire() -> InquireInput { + InquireInput::new( + ThreadId::from_bytes([33; 32]), + participant(2), + None, + "ordinary browser inquiry", + ) + .unwrap() +} +fn context( + scope: &WorkspaceSession, + operation: OperationId, + deadline: u64, +) -> radroots_browser::CommandContext { + scope + .command_context(operation, None, None, UnixSeconds::new(deadline).unwrap()) + .unwrap() +} + +#[wasm_bindgen] +pub fn advertisements(base: String) -> String { + let values: Vec<_> = (1..=2) + .map(|last| { + nostr::EventBuilder::new(nostr::Kind::Custom(10050), "") + .tags([nostr::Tag::parse(["relay", base.as_str()]).unwrap()]) + .custom_created_at(nostr::Timestamp::from_secs(now() - 1)) + .sign_with_keys(&key(last)) + .unwrap() + .as_json() + }) + .collect(); + serde_json::to_string(&values).unwrap() +} +#[wasm_bindgen] +pub async fn verify_client(base: String, label: String) -> Result<String, JsValue> { + let mut passed = Vec::new(); + let existing = Existing::create(&label).await?; + // Build the alternate selection without exposing a key or mutating storage. + let mut wrong_pin = existing.fingerprint; + wrong_pin[0] ^= 1; + let wrong = BrowserConfig::existing( + existing.namespace.clone(), + reference_copy(&existing.reference), + wrong_pin, + existing.input.clone(), + proof_copy(&existing.proof), + access(), + ); + require( + Client::open(wrong).await.is_err(), + "wrong provider identity must refuse", + )?; + let (client, scope) = existing.open(&base).await?; + let callbacks = signer(&client).await?; + client.start(StartMode::Online).await.map_err(fail)?; + require( + socket_count() == 0, + "open, attach and start cannot perform network work", + )?; + passed.push("real existing IndexedDB and explicit authority, inert startup"); + let operation = id(); + let deadline = now() + 120; + let receipt = client + .inbox() + .inquire(context(&scope, operation, deadline), inquire()) + .await + .map_err(fail)?; + require( + receipt.durable() && receipt.business_result().is_some(), + "real inquiry must install business result", + )?; + let original = receipt.operation_checkpoint(); + let message = receipt.business_result().unwrap().id().to_string(); + let replay = client + .inbox() + .inquire(context(&scope, operation, deadline), inquire()) + .await + .map_err(fail)?; + require( + replay.operation_checkpoint() == original, + "replay must retain original checkpoint", + )?; + passed.push("shared T0 T1 real signing S T2 and self/peer relay acceptance"); + passed.push("same original command does not replace issuance or publication"); + require( + client.close().await.map_err(fail)?.storage_closed(), + "actual close receipt", + )?; + storage_callbacks_closed()?; + require( + callbacks.closed.get() == 1 && callbacks.quiesced.get() == 1, + "original signer callbacks close once", + )?; + require( + client.close().await.map_err(fail)?.storage_closed(), + "repeated close", + )?; + require( + client.operations(&scope).get(operation).await.is_err(), + "closed resource admission remains closed", + )?; + let sockets = socket_count(); + let (local, scope) = existing.open(&base).await?; + local.start(StartMode::LocalOnly).await.map_err(fail)?; + let retained = local + .operations(&scope) + .get(operation) + .await + .map_err(fail)? + .ok_or_else(|| JsValue::from_str("missing original operation"))?; + require( + retained.operation_checkpoint() == original, + "actual reopen retains original checkpoint", + )?; + require( + socket_count() == sockets, + "reopen/read/local start cannot open a socket", + )?; + passed.push("actual protected close/reopen retains original completed operation"); + let lost = id(); + let inbox = local.inbox(); + let mut observer = Box::pin(inbox.inquire(context(&scope, lost, deadline), inquire())); + require( + observer.as_mut().now_or_never().is_none(), + "owned command starts pending", + )?; + drop(observer); + local.close().await.map_err(fail)?; + let (resumed, scope) = existing.open(&base).await?; + let callbacks = signer(&resumed).await?; + resumed.start(StartMode::Online).await.map_err(fail)?; + let pending = resumed + .operations(&scope) + .get(lost) + .await + .map_err(fail)? + .ok_or_else(|| JsValue::from_str("observer loss erased original T0"))?; + require( + pending.durable() && pending.business_result().is_none(), + "local observer loss retains T0 without invented signing", + )?; + passed.push("lost observer and close drain preserve actual durable T0"); + let completed = resumed + .operations(&scope) + .resume(lost, None) + .await + .map_err(fail)?; + require( + completed.durable() && completed.business_result().is_some(), + "explicit resume must finish original inquiry", + )?; + let resumed_message = completed.business_result().unwrap().id().to_string(); + resumed.close().await.map_err(fail)?; + storage_callbacks_closed()?; + require(callbacks.closed.get() == 1, "resumed signer scope disposed")?; + passed.push("explicit original-operation resume signs and delivers after reopen"); + passed.push("ordered repeated close and permanent admission"); + Ok(serde_json::json!({"passed":passed,"messages":[message,resumed_message]}).to_string()) +} +#[wasm_bindgen] +pub async fn verify_publications(raw_events: String, expected: String) -> Result<(), JsValue> { + let events: Vec<String> = serde_json::from_str(&raw_events).map_err(fail)?; + let expected: Vec<String> = serde_json::from_str(&expected).map_err(fail)?; + require( + events.len() == 4 && expected.len() == 2, + "original self/peer envelope counts", + )?; + let mut seen = Vec::new(); + for raw in events { + let event = nostr::Event::from_json(&raw).map_err(fail)?; + event.verify().map_err(fail)?; + let recipient = event + .tags + .iter() + .find(|tag| tag.as_slice()[0] == "p") + .ok_or_else(|| JsValue::from_str("missing envelope recipient"))? + .as_slice()[1] + .clone(); + let n = if recipient == key(1).public_key().to_hex() { + 1 + } else { + 2 + }; + require( + recipient == key(n).public_key().to_hex(), + "unapproved envelope recipient", + )?; + let message = nostr::nips::nip59::extract_rumor(&key(n), &event) + .await + .map_err(fail)?; + require( + message.sender == key(1).public_key() + && message.rumor.content == "ordinary browser inquiry", + "independent nested authentication and original text", + )?; + let id = message + .rumor + .id + .ok_or_else(|| JsValue::from_str("missing rumor ID"))? + .to_hex(); + require(expected.contains(&id), "exact installed business result")?; + seen.push((id, n)); + } + seen.sort(); + seen.dedup(); + require( + seen.len() == 4, + "each original rumor has independent self and peer delivery", + ) +} diff --git a/crates/secrets/src/browser/mod.rs b/crates/secrets/src/browser/mod.rs @@ -106,6 +106,12 @@ struct State { version_change: RefCell<Option<Callback>>, } impl State { + fn detach_callbacks(&self) { + self.db.set_onversionchange(None); + self.db.set_onclose(None); + let retired = { self.version_change.borrow_mut().take() }; + drop(retired); + } fn wake(&self) { self.waiters.borrow_mut().retain(|weak| { if let Some(signal) = weak.upgrade() { @@ -345,11 +351,13 @@ impl BrowserProvider { pub fn fingerprint(&self) -> [u8; 32] { self.state.fingerprint } - /// Stops admission, drains accepted jobs and closes the actual connection. + /// Stops admission, drains accepted jobs, closes the actual connection and + /// detaches its callbacks even while closed provider handles remain alive. /// Cancellation of this observation does not cancel accepted jobs. pub async fn close(&self) -> Result<(), BrowserError> { self.state.stop(); if self.state.jobs.get() == 0 { + self.state.detach_callbacks(); return Ok(()); } let signal = Rc::new(RefCell::new(None)); @@ -370,6 +378,7 @@ impl BrowserProvider { } }) .await; + self.state.detach_callbacks(); Ok(()) } fn check(&self, reference: &SecretRef) -> Result<(), Error> { diff --git a/crates/storage_indexeddb/src/browser.rs b/crates/storage_indexeddb/src/browser.rs @@ -127,6 +127,11 @@ struct State { version_change: RefCell<Option<EventCallback>>, } impl State { + fn detach_callbacks(&self) { + self.db.set_onversionchange(None); + let retired = { self.version_change.borrow_mut().take() }; + drop(retired); + } fn stop(&self) { self.closing.set(true); if self.count.get() == 0 { @@ -259,10 +264,12 @@ impl Database { observe.await.unwrap_or(Err(Error::CommitUnknown)) } /// Stops admission immediately when polled, drains every accepted job and - /// closes the connection. A cancelled observer can explicitly resume close. + /// closes the connection and detaches callbacks even while closed handles + /// remain alive. A cancelled observer can explicitly resume close. pub async fn close(&self) -> Result<(), Error> { self.state.stop(); if self.state.count.get() == 0 { + self.state.detach_callbacks(); return Ok(()); } let signal = Rc::new(RefCell::new(None)); @@ -282,6 +289,7 @@ impl Database { Poll::Pending }) .await; + self.state.detach_callbacks(); Ok(()) } } diff --git a/tools/xtask/src/catalog.rs b/tools/xtask/src/catalog.rs @@ -360,6 +360,8 @@ fn validate_catalog(catalog: &Catalog) -> Result<(), String> { validate_identifier(&package.tier, "package tier")?; let expected_path = match package.name.as_str() { "radroots" => "crates/radroots".to_owned(), + // shared_sdk_refactor.v1.json fixes the browser artifact-root path. + "radroots_browser" => "crates/radroots_browser".to_owned(), "xtask" => "tools/xtask".to_owned(), name => format!( "crates/{}", @@ -1569,6 +1571,20 @@ mod tests { } #[test] + fn browser_artifact_keeps_its_approved_directory_instead_of_prefix_stripping() { + let mut catalog = checked_in_catalog(); + validate_catalog(&catalog).expect("approved catalog"); + let browser = catalog + .package + .iter_mut() + .find(|package| package.name == "radroots_browser") + .expect("browser artifact"); + assert_eq!(browser.path, "crates/radroots_browser"); + browser.path = "crates/browser".to_owned(); + assert!(validate_catalog(&catalog).is_err()); + } + + #[test] fn only_approved_shared_native_packages_can_be_public() { for name in [ "radroots_domain",