pub struct DelegationSigner { /* private fields */ }Expand description
Signer that mints JWS tokens.
Implementations§
Source§impl DelegationSigner
impl DelegationSigner
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a fresh Ed25519 signing key.
§Examples
use agentguard_core::DelegationSigner;
let signer = DelegationSigner::generate();
let _public_key = signer.public_key_b64();Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Construct from raw 32-byte Ed25519 secret bytes.
§Errors
Returns Error::InvalidToken if bytes is not exactly 32 bytes.
pub fn public_key_b64(&self) -> String
pub fn verifying_key(&self) -> VerifyingKey
pub fn key_id(&self) -> &str
pub fn set_key_id(&mut self, id: impl Into<String>)
Sourcepub fn mint(
&self,
iss: impl Into<String>,
sub: impl Into<String>,
aud: impl Into<String>,
allowed_actions: Vec<String>,
resource_patterns: Vec<String>,
cfg: DelegationConfig,
) -> Result<DelegationToken>
pub fn mint( &self, iss: impl Into<String>, sub: impl Into<String>, aud: impl Into<String>, allowed_actions: Vec<String>, resource_patterns: Vec<String>, cfg: DelegationConfig, ) -> Result<DelegationToken>
Mint a delegation token with the given configuration.
Sourcepub fn mint_with<F>(
&self,
iss: impl Into<String>,
sub: impl Into<String>,
aud: impl Into<String>,
allowed_actions: Vec<String>,
resource_patterns: Vec<String>,
cfg: DelegationConfig,
mutate: F,
) -> Result<DelegationToken>where
F: FnOnce(&mut DelegationClaims),
pub fn mint_with<F>(
&self,
iss: impl Into<String>,
sub: impl Into<String>,
aud: impl Into<String>,
allowed_actions: Vec<String>,
resource_patterns: Vec<String>,
cfg: DelegationConfig,
mutate: F,
) -> Result<DelegationToken>where
F: FnOnce(&mut DelegationClaims),
Mint a delegation token with a callback to mutate the claims before signing.
Sourcepub fn mint_attenuated(
&self,
parent: &VerifiedDelegation,
spec: DelegationSpec,
) -> Result<DelegationToken>
pub fn mint_attenuated( &self, parent: &VerifiedDelegation, spec: DelegationSpec, ) -> Result<DelegationToken>
Mint a child grant that cannot outlive or broaden the supplied, cryptographically verified parent grant.
Actions must be present in the parent grant. Literal child resources
must match a parent resource pattern; child patterns containing *
are accepted only when identical to a parent pattern. If the parent
has constraints, the child must preserve all of them and may add
stricter conjunctive constraints.
Sourcepub fn sign_jws(&self, claims: &DelegationClaims) -> Result<DelegationToken>
pub fn sign_jws(&self, claims: &DelegationClaims) -> Result<DelegationToken>
Sign a JWS with the given claims.
Trait Implementations§
Source§impl Clone for DelegationSigner
impl Clone for DelegationSigner
Source§fn clone(&self) -> DelegationSigner
fn clone(&self) -> DelegationSigner
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DelegationSigner
impl RefUnwindSafe for DelegationSigner
impl Send for DelegationSigner
impl Sync for DelegationSigner
impl Unpin for DelegationSigner
impl UnwindSafe for DelegationSigner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more