Skip to main content

grants_anyone

Function grants_anyone 

pub fn grants_anyone(allowed: &[String]) -> bool
Expand description

Whether a resolved peer list can admit anybody at all.

“Is this list empty” and “has anybody been authorized” are different questions, because the list also carries a !name deny for every ignore entry. Code that gates pairing or explains an unauthorized sender wants this one.

A grant only counts when a deny does not already shadow it, so ["alice", "!alice"] and ["*", "!*"] both answer false: they are syntactic grants that admit nobody, and reporting them as authorization leaves the operator with no accepted sender and no pairing route back. Only the channel’s own matcher can decide the general case, so this answers conservatively with the normalized comparison a deny is matched by anyway — erring toward “nobody is authorized” is what keeps recovery pairing available, and the sender that then arrives is still judged by is_identity_allowed_by.