Cotton code
16 lines · 792 B · RustRaw
//! The two questions a HANDLER asks of a credential.//!//! Split from the token store (`cotton_server::mcp::tokens`, which re-exports//! both of these) because the store is the server's: it mints, lists, revokes//! and reads `cotton_mcp_tokens`, and it is reached from routes. What a//! handler needs is smaller and has no database in it — does this connection//! carry the scope this tool declared, and what is the hash of a token this//! call just minted.//!//! Declared ONCE, here, so the server's answer to "is this token allowed to//! write" and the dispatcher's are the same function rather than two./// Does this connection carry the scope a tool declared?pub fn has_scope(scopes: &[String], required: &str) -> bool {    scopes.iter().any(|scope| scope == required)}