Skip to main content

encode_agent_scope

Function encode_agent_scope 

Source
pub fn encode_agent_scope(agent_prefix: &str, scope: &AgentScope) -> String
Expand description

Encode an agent-scope seal value: agentscope:{prefix}:{expires_or_0}:{caps_csv}.

Args:

  • agent_prefix: The agent’s KEL prefix the scope applies to.
  • scope: The granted capabilities + optional expiry.

Usage:

use auths_keri::{AgentScope, Capability, encode_agent_scope};
let s = AgentScope {
    capabilities: vec![Capability::sign_commit()],
    expires_at: Some(99),
};
assert_eq!(encode_agent_scope("Eabc", &s), "agentscope:Eabc:99:sign_commit");