is_auth_gate_ref (auth_interaction/gate_ref.rs)

ironclaw · crates/product/ironclaw_assistant/src/auth_interaction/gate_ref.rs · rust · Apache-2.0
auth, tag:embed-classified

Checks if a string matches auth gate reference patterns, used for gate validation.

// Source: https://github.com/nearai/ironclaw | License: Apache-2.0 | Copyright 2026 NEAR AI
// Provided via justclaw.it.com; keep this notice with the code.
const AUTH_GATE_REF: &str = "gate:auth";
const AUTH_GATE_PREFIX: &str = "gate:auth-";
const HOOK_AUTH_GATE_PREFIX: &str = "gate:hook-auth-";

pub fn is_auth_gate_ref(gate_ref_str: &str) -> bool {
    gate_ref_str == AUTH_GATE_REF
        || gate_ref_str.starts_with(AUTH_GATE_PREFIX)
        || gate_ref_str.starts_with(HOOK_AUTH_GATE_PREFIX)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn is_auth_gate_ref_matches_only_auth_gate_shapes() {
        assert!(is_auth_gate_ref("gate:auth"));
        assert!(is_auth_gate_ref("gate:auth-oauth"));
        assert!(is_auth_gate_ref("gate:hook-auth-oauth"));
        assert!(!is_a

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key