Skip to content

Commit e41ed12

Browse files
committed
refactor(visibility): route is_owner through the shared did_matches matcher (#153)
1 parent ca579c6 commit e41ed12

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

crates/gitlawb-node/src/api/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ mod did_tests {
114114
assert!(!did_matches("did:key:zABC", "did:key:zXYZ"));
115115
assert!(!did_matches("zABC", "zXYZ"));
116116
}
117+
118+
#[test]
119+
fn empty_did_matches() {
120+
assert!(did_matches("", ""));
121+
assert!(did_matches("", "did:key:"));
122+
}
117123
}
118124

119125
/// Drift guard (plan 002 §Gate-type table, Step 5). Every in-scope mutation

crates/gitlawb-node/src/visibility.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -445,24 +445,12 @@ mod tests {
445445
fn cross_method_did_denied_with_bare_owner() {
446446
let rules = [rule("/", VisibilityMode::A, &[])];
447447
assert_eq!(
448-
visibility_check(
449-
&rules,
450-
false,
451-
"z6MkFoo",
452-
Some("did:gitlawb:z6MkFoo"),
453-
"/"
454-
),
448+
visibility_check(&rules, false, "z6MkFoo", Some("did:gitlawb:z6MkFoo"), "/"),
455449
Decision::Deny,
456450
"cross-method DID must not match a bare did:key owner"
457451
);
458452
assert_eq!(
459-
visibility_check(
460-
&rules,
461-
false,
462-
"z6MkFoo",
463-
Some("did:web:z6MkFoo"),
464-
"/"
465-
),
453+
visibility_check(&rules, false, "z6MkFoo", Some("did:web:z6MkFoo"), "/"),
466454
Decision::Deny,
467455
"did:web must not match a bare did:key owner"
468456
);

0 commit comments

Comments
 (0)