#[non_exhaustive]pub struct SignOptions {
pub context: Option<Vec<String>>,
pub created: Option<DateTime<Utc>>,
pub cryptosuite: Option<CryptoSuite>,
pub proof_purpose: Option<String>,
}Expand description
Options for signing a Data Integrity proof.
Construct via SignOptions::new (or SignOptions::default) then
chain with_* methods. All fields default to None / empty; the
library fills in spec-compliant defaults (current time for created,
"assertionMethod" for proof_purpose, the signer’s declared
cryptosuite) where they are not overridden here.
SignOptions is #[non_exhaustive] from the outside: construct it
only via the provided methods, not struct-literal syntax.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.context: Option<Vec<String>>JSON-LD @context values to place on the proof. If None, the
document’s own @context is used (for RDFC canonicalization) or no
context is emitted (for JCS).
created: Option<DateTime<Utc>>Proof creation timestamp. If None, Utc::now() is used.
cryptosuite: Option<CryptoSuite>Overrides the signer’s declared cryptosuite. If None, the
library uses signer.cryptosuite().
proof_purpose: Option<String>Value of proofPurpose. Defaults to "assertionMethod".
Implementations§
Source§impl SignOptions
impl SignOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs an empty SignOptions. Equivalent to
SignOptions::default.
Sourcepub fn with_context(self, context: Vec<String>) -> Self
pub fn with_context(self, context: Vec<String>) -> Self
Sets the @context value placed on the emitted proof.
Sourcepub fn with_created(self, created: DateTime<Utc>) -> Self
pub fn with_created(self, created: DateTime<Utc>) -> Self
Sets the created timestamp. Takes a typed DateTime<Utc>; the
library serialises it to ISO-8601 (seconds precision, Z-suffix)
at the serde boundary.
Sourcepub fn with_cryptosuite(self, suite: CryptoSuite) -> Self
pub fn with_cryptosuite(self, suite: CryptoSuite) -> Self
Overrides the cryptosuite that would otherwise be chosen by the
signer’s default (crate::signer::Signer::cryptosuite).
Sourcepub fn with_proof_purpose(self, purpose: impl Into<String>) -> Self
pub fn with_proof_purpose(self, purpose: impl Into<String>) -> Self
Overrides proofPurpose. The default is "assertionMethod".
Trait Implementations§
Source§impl Clone for SignOptions
impl Clone for SignOptions
Source§fn clone(&self) -> SignOptions
fn clone(&self) -> SignOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more