pub struct SignOpts {
pub domain: String,
pub selector: String,
pub signed_headers: Vec<String>,
pub canon_header: Canon,
pub canon_body: Canon,
pub identity: Option<String>,
pub timestamp: Option<u64>,
pub expiration: Option<u64>,
pub body_length: Option<u64>,
}Expand description
Options for sign.
Fields§
§domain: Stringd= — signing domain.
selector: Strings= — selector (publishes the public key at
<selector>._domainkey.<domain>).
signed_headers: Vec<String>h= — header NAMES to sign, in order. Case-insensitive
lookup against the message. Headers that don’t exist on the
message are skipped (RFC 6376 §3.5).
canon_header: Canonc= header canonicalization.
canon_body: Canonc= body canonicalization.
identity: Option<String>i= — optional identity (AUID).
timestamp: Option<u64>t= — optional signature timestamp. Caller supplies because
this crate avoids the std::time::SystemTime dep on the
signing path (lets tests pin time).
expiration: Option<u64>x= — optional expiration timestamp.
body_length: Option<u64>l= — optional body-length limit. Most signers leave this
unset; a few sign just the first N bytes to tolerate
trailing additions.
Implementations§
Source§impl SignOpts
impl SignOpts
Sourcepub fn new(domain: impl Into<String>, selector: impl Into<String>) -> Self
pub fn new(domain: impl Into<String>, selector: impl Into<String>) -> Self
Sensible defaults: relaxed/relaxed canon, no expiry, no AUID,
no body-length limit. Caller still must set domain,
selector, and signed_headers.
Sourcepub fn add_signed_header(self, name: impl Into<String>) -> Self
pub fn add_signed_header(self, name: impl Into<String>) -> Self
Add a single header name to the h= list.
Sourcepub fn signed_headers<I: IntoIterator<Item = S>, S: Into<String>>(
self,
headers: I,
) -> Self
pub fn signed_headers<I: IntoIterator<Item = S>, S: Into<String>>( self, headers: I, ) -> Self
Replace the h= list with the provided one.
Sourcepub fn expiration(self, x: u64) -> Self
pub fn expiration(self, x: u64) -> Self
Set x=.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SignOpts
impl RefUnwindSafe for SignOpts
impl Send for SignOpts
impl Sync for SignOpts
impl Unpin for SignOpts
impl UnsafeUnpin for SignOpts
impl UnwindSafe for SignOpts
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
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> 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