pub struct Operation<'a> {
pub context: Context<'a>,
pub procedure: &'a str,
pub commitment: &'a str,
pub created_at: i64,
pub expires_at: i64,
pub nonce: &'a str,
}Expand description
Fields authenticated by a v2 request signature. All string fields are bounded and newline-free, making the newline-separated encoding unambiguous.
Fields§
§context: Context<'a>Intended service and repository.
procedure: &'a strFull Connect procedure, or the documented full procedure for REST.
commitment: &'a strCanonical content commitment text: body:<64 lowercase hex>,
pack:<64 lowercase hex>:<decimal length> or
part:<64 hex ticket>:<decimal index>:<64 hex subtree>:<decimal length>
(see ContentCommitment).
created_at: i64Inclusive start time in epoch milliseconds.
expires_at: i64Inclusive expiry time in epoch milliseconds.
nonce: &'a str32 random bytes, encoded as 64 lowercase hexadecimal characters.
Implementations§
Source§impl Operation<'_>
impl Operation<'_>
Sourcepub fn canonical(&self) -> Result<String, AuthError>
pub fn canonical(&self) -> Result<String, AuthError>
Encode all authenticated fields in the v2 canonical order.
§Errors
Rejects malformed fields, invalid validity intervals and unknown content commitment forms before signing or verification.
Sourcepub fn digest(&self) -> Result<Hash, AuthError>
pub fn digest(&self) -> Result<Hash, AuthError>
Digest signed with plain Ed25519 (without commit-signing domains).
§Errors
Same validation errors as Self::canonical.
Sourcepub fn verify(
&self,
expected: Context<'_>,
now: i64,
public_key: &[u8; 32],
signature: &[u8; 64],
) -> Result<(), AuthError>
pub fn verify( &self, expected: Context<'_>, now: i64, public_key: &[u8; 32], signature: &[u8; 64], ) -> Result<(), AuthError>
Validate destination, time and Ed25519 signature. Persistence/effect adapters must reserve the nonce after this returns, before any effects.
§Errors
Rejects destination mismatch, stale/future requests and invalid signatures.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Operation<'a>
impl<'a> RefUnwindSafe for Operation<'a>
impl<'a> Send for Operation<'a>
impl<'a> Sync for Operation<'a>
impl<'a> Unpin for Operation<'a>
impl<'a> UnsafeUnpin for Operation<'a>
impl<'a> UnwindSafe for Operation<'a>
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
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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> ⓘ
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> ⓘ
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