tangle


git clone https://radroots.dev/git/tangle.git
Log | Files | Refs | README | LICENSE

commit 7ce1c9252c230aa6b256d1c2833d5b9ee1842672
parent 7fa3790c1a1b3efe8e6b7df643247ab410a5206d
Author: triesap <tyson@radroots.org>
Date:   Sun, 14 Jun 2026 04:37:43 -0700

tests: cover websocket group write auth

- Extend the websocket protocol acceptance flow so group EVENT writes exercise the group write gate.
- Verify an owner-signed group create is rejected on a socket authenticated as a different pubkey.
- Verify the same group create is accepted after owner AUTH on the websocket path.
- Validated with cargo fmt --all -- --check, cargo check --workspace --all-targets, cargo test --workspace, and cargo clippy --workspace --all-targets -- -D warnings.

Diffstat:
Mcrates/tangle_runtime/tests/phase2_acceptance_targets.rs | 19++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/crates/tangle_runtime/tests/phase2_acceptance_targets.rs b/crates/tangle_runtime/tests/phase2_acceptance_targets.rs @@ -29,7 +29,7 @@ use tangle_runtime::{ }; use tangle_test_support::{ FixtureKey, TANGLE_V2_RELAY_SECRET_HEX, TANGLE_V2_RELAY_URL, tangle_v2_auth_event, - tangle_v2_event, + tangle_v2_event, tangle_v2_group_create_event, }; use tokio::{net::TcpListener, time::timeout}; use tokio_tungstenite::tungstenite::{Message as TungsteniteMessage, client::IntoClientRequest}; @@ -144,6 +144,23 @@ async fn websocket_clients_use_nip01_nip42_and_nip45_flows() { "auth-required: auth challenge does not match", ); + let group_create = tangle_v2_group_create_event( + FixtureKey::Owner, + "WebsocketFarm", + auth_created_at.saturating_add(3), + &[], + ) + .expect("group create"); + send_client_value(&mut second, json!(["EVENT", event_to_value(&group_create)])).await; + assert_ok( + read_relay_value(&mut second).await, + &group_create, + false, + "auth-required: group event author must authenticate with AUTH", + ); + send_client_value(&mut first, json!(["EVENT", event_to_value(&group_create)])).await; + assert_ok(read_relay_value(&mut first).await, &group_create, true, ""); + send_client_value(&mut first, json!(["EVENT", event_to_value(&first_event)])).await; assert_ok(read_relay_value(&mut first).await, &first_event, true, ""); send_client_value(&mut first, json!(["EVENT", event_to_value(&first_event)])).await;