pub struct McpServerRequestStateCodec { /* private fields */ }Expand description
StateKnot-owned wrapper around integrity-protected MCP requestState.
Tokens are authenticated, not encrypted. Bind them to
McpServerToolContext::request_state_binding and apply a TTL. Single-use
redemption remains application-owned durable state.
Implementations§
Source§impl McpServerRequestStateCodec
impl McpServerRequestStateCodec
Sourcepub fn new(
key: impl Into<Vec<u8>>,
) -> Result<Self, McpServerRequestStateCodecBuildError>
pub fn new( key: impl Into<Vec<u8>>, ) -> Result<Self, McpServerRequestStateCodecBuildError>
Builds a codec from at least 32 bytes of high-entropy key material.
Sourcepub fn with_keyring<K, V>(
active_key_id: impl Into<String>,
keys: impl IntoIterator<Item = (K, V)>,
) -> Result<Self, McpServerRequestStateCodecBuildError>
pub fn with_keyring<K, V>( active_key_id: impl Into<String>, keys: impl IntoIterator<Item = (K, V)>, ) -> Result<Self, McpServerRequestStateCodecBuildError>
Builds a rotating keyring that emits the active rs2 key id.
Sourcepub fn seal_json(
&self,
value: &Value,
associated_data: &[u8],
ttl: Duration,
) -> Result<String, McpServerRequestStateError>
pub fn seal_json( &self, value: &Value, associated_data: &[u8], ttl: Duration, ) -> Result<String, McpServerRequestStateError>
Seals bounded JSON with caller binding and mandatory positive TTL.
Sourcepub fn open_json(
&self,
sealed: &str,
associated_data: &[u8],
) -> Result<Value, McpServerRequestStateError>
pub fn open_json( &self, sealed: &str, associated_data: &[u8], ) -> Result<Value, McpServerRequestStateError>
Opens bounded JSON with the exact same caller binding.
All malformed, expired, unknown-key, and integrity failures collapse to
McpServerRequestStateError::InvalidState to avoid an oracle.
Trait Implementations§
Source§impl Clone for McpServerRequestStateCodec
impl Clone for McpServerRequestStateCodec
Auto Trait Implementations§
impl Forget for McpServerRequestStateCodec
impl Freeze for McpServerRequestStateCodec
impl Move for McpServerRequestStateCodec
impl RefUnwindSafe for McpServerRequestStateCodec
impl Send for McpServerRequestStateCodec
impl Sync for McpServerRequestStateCodec
impl Unpin for McpServerRequestStateCodec
impl UnsafeUnpin for McpServerRequestStateCodec
impl UnwindSafe for McpServerRequestStateCodec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request