pub struct SiwxProof {Show 15 fields
pub address: CompactString,
pub signature: CompactString,
pub domain: CompactString,
pub uri: CompactString,
pub version: CompactString,
pub nonce: CompactString,
pub issued_at: CompactString,
pub expiration_time: Option<CompactString>,
pub not_before: Option<CompactString>,
pub statement: Option<CompactString>,
pub request_id: Option<CompactString>,
pub resources: Vec<CompactString>,
pub chain_id: CompactString,
pub signature_type: CompactString,
pub signature_scheme: Option<CompactString>,
}server and siwx only.Expand description
Client proof carried on SIGN-IN-WITH-X (base64 JSON).
Fields§
§address: CompactStringWallet address that signed the message.
signature: CompactStringCryptographic signature (hex for EVM, Base58 for Solana).
domain: CompactStringCAIP-122 domain.
uri: CompactStringResource URI.
version: CompactStringCAIP-122 version (always "1").
nonce: CompactStringChallenge nonce (32 hex).
issued_at: CompactStringISO 8601 issuedAt as sent by the client (signing-string form).
expiration_time: Option<CompactString>Optional ISO 8601 expiry, original string.
not_before: Option<CompactString>Optional ISO 8601 not-before, original string.
statement: Option<CompactString>Optional CAIP-122 statement.
request_id: Option<CompactString>Optional request id.
resources: Vec<CompactString>Optional resource URIs.
chain_id: CompactStringCAIP-2 chain identifier.
signature_type: CompactStringSignature algorithm (eip191 / ed25519).
signature_scheme: Option<CompactString>Spec signatureScheme hint, if the client sent one.
Implementations§
Source§impl SiwxProof
impl SiwxProof
Sourcepub fn parse_header(value: &str) -> Result<SiwxProof, SiwxProofError>
pub fn parse_header(value: &str) -> Result<SiwxProof, SiwxProofError>
Decodes a SIGN-IN-WITH-X header value.
§Errors
SiwxProofError when the header is not base64 JSON with the
required string fields, or version is not "1".
Sourcepub fn bind_origin(
&self,
origin: &SiwxOrigin,
path: &str,
) -> Result<(), SiwxError>
pub fn bind_origin( &self, origin: &SiwxOrigin, path: &str, ) -> Result<(), SiwxError>
Checks domain / uri against the configured origin. Never uses Host.
§Errors
Sourcepub fn validate_at(
&self,
origin: &SiwxOrigin,
path: &str,
now: OffsetDateTime,
) -> Result<(), SiwxError>
pub fn validate_at( &self, origin: &SiwxOrigin, path: &str, now: OffsetDateTime, ) -> Result<(), SiwxError>
Origin, URI, and temporal checks. now is injectable for tests.
§Errors
Spec invalid_siwx_* field codes.
Sourcepub fn signing_message(&self) -> Result<String, SiwxError>
pub fn signing_message(&self) -> Result<String, SiwxError>
Canonical CAIP-122 signing string for this proof’s fields.
Renders via EvmVerifier::format_message /
Ed25519Verifier::format_message. Timestamp fields are passed
through *_raw so the original RFC 3339 bytes are hashed.
§Errors
SiwxError::ChainId, SiwxError::UnsupportedChain, or a field
error when the proof cannot be turned into a SiwxMessage.
Sourcepub async fn verify_at(
&self,
origin: &SiwxOrigin,
path: &str,
now: OffsetDateTime,
evm: &EvmVerifier,
) -> Result<(), SiwxError>
pub async fn verify_at( &self, origin: &SiwxOrigin, path: &str, now: OffsetDateTime, evm: &EvmVerifier, ) -> Result<(), SiwxError>
Sourcepub fn encode_header(&self) -> Result<String, SiwxProofError>
pub fn encode_header(&self) -> Result<String, SiwxProofError>
Encodes this proof as a SIGN-IN-WITH-X header value (base64 JSON).
§Errors
SiwxProofError::InvalidJson when the proof cannot be serialized.
Trait Implementations§
impl Eq for SiwxProof
impl StructuralPartialEq for SiwxProof
Auto Trait Implementations§
impl Freeze for SiwxProof
impl RefUnwindSafe for SiwxProof
impl Send for SiwxProof
impl Sync for SiwxProof
impl Unpin for SiwxProof
impl UnsafeUnpin for SiwxProof
impl UnwindSafe for SiwxProof
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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