Phase B: identifier+key on the wire, JCS envelope signing (FRX/0.5), registry binding
This commit is contained in:
+21
-11
@@ -78,11 +78,12 @@ async fn responses_for(
|
||||
http: &reqwest::Client,
|
||||
relay_url: &str,
|
||||
asker: &Keypair,
|
||||
identifier: &str,
|
||||
text: &str,
|
||||
timeout_ms: u64,
|
||||
) -> Vec<Value> {
|
||||
register(http, relay_url, asker).await;
|
||||
let envelope = query_envelope(asker, text, 5);
|
||||
let envelope = query_envelope(asker, identifier, text, 5);
|
||||
assert!(
|
||||
publish(http, relay_url, &envelope)
|
||||
.await
|
||||
@@ -133,16 +134,24 @@ async fn registry_gates_membership_and_revocation_propagates() {
|
||||
.await;
|
||||
let http = client();
|
||||
|
||||
let accepted = responses_for(&http, &relay_url, &alice, "rust", 700).await;
|
||||
let accepted = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 700).await;
|
||||
assert_eq!(accepted.len(), 1, "listed member got no response");
|
||||
|
||||
let stranger = Keypair::generate();
|
||||
let denied = responses_for(&http, &relay_url, &stranger, "rust", 400).await;
|
||||
let denied = responses_for(
|
||||
&http,
|
||||
&relay_url,
|
||||
&stranger,
|
||||
&stranger.public_hex(),
|
||||
"rust",
|
||||
400,
|
||||
)
|
||||
.await;
|
||||
assert!(denied.is_empty(), "unlisted key was answered");
|
||||
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
registry::save_registry(®istry_path, &ma_registry(&ma, Vec::new(), 2)).unwrap();
|
||||
let revoked = responses_for(&http, &relay_url, &alice, "rust", 500).await;
|
||||
let revoked = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 500).await;
|
||||
assert!(revoked.is_empty(), "revoked member still answered");
|
||||
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
@@ -155,7 +164,8 @@ async fn registry_gates_membership_and_revocation_propagates() {
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
let rolled_back = responses_for(&http, &relay_url, &alice, "rust", 500).await;
|
||||
let rolled_back =
|
||||
responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 500).await;
|
||||
assert!(
|
||||
rolled_back.is_empty(),
|
||||
"registry rollback re-admitted a revoked member"
|
||||
@@ -188,7 +198,7 @@ async fn forged_or_wrong_key_snapshot_closes_the_registry() {
|
||||
)
|
||||
.await;
|
||||
let http = client();
|
||||
let denied = responses_for(&http, &relay_url, &alice, "rust", 400).await;
|
||||
let denied = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 400).await;
|
||||
assert!(
|
||||
denied.is_empty(),
|
||||
"snapshot signed by wrong key was trusted"
|
||||
@@ -226,7 +236,7 @@ async fn expired_key_is_not_authorized() {
|
||||
)
|
||||
.await;
|
||||
let http = client();
|
||||
let denied = responses_for(&http, &relay_url, &alice, "rust", 400).await;
|
||||
let denied = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 400).await;
|
||||
assert!(denied.is_empty(), "expired key was answered");
|
||||
}
|
||||
|
||||
@@ -243,7 +253,7 @@ async fn fail_static_uses_last_validated_snapshot() {
|
||||
);
|
||||
|
||||
let cached_dir = root.path().join("bob-cached");
|
||||
let mut config = config_with_registry(
|
||||
let config = config_with_registry(
|
||||
&cached_dir,
|
||||
"bob",
|
||||
&relay_url,
|
||||
@@ -264,7 +274,7 @@ async fn fail_static_uses_last_validated_snapshot() {
|
||||
let _bob = Node::start(config.clone()).await.unwrap();
|
||||
|
||||
let http = client();
|
||||
let accepted = responses_for(&http, &relay_url, &alice, "rust", 700).await;
|
||||
let accepted = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 700).await;
|
||||
assert_eq!(
|
||||
accepted.len(),
|
||||
1,
|
||||
@@ -287,7 +297,7 @@ async fn fail_static_uses_last_validated_snapshot() {
|
||||
.unwrap();
|
||||
}
|
||||
let _bob2 = Node::start(fresh).await.unwrap();
|
||||
let denied = responses_for(&http, &relay_url, &alice, "rust", 400).await;
|
||||
let denied = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 400).await;
|
||||
assert!(
|
||||
denied.is_empty(),
|
||||
"unreachable registry without cache must close, not open"
|
||||
@@ -337,7 +347,7 @@ async fn registry_can_be_served_over_http() {
|
||||
|
||||
let _bob = bob_with_docs(root.path(), &relay_url, ®istry_url, &ma.public_hex()).await;
|
||||
let http = client();
|
||||
let accepted = responses_for(&http, &relay_url, &alice, "rust", 900).await;
|
||||
let accepted = responses_for(&http, &relay_url, &alice, "alice.frx.example", "rust", 900).await;
|
||||
assert_eq!(
|
||||
accepted.len(),
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user