#[non_exhaustive]pub enum VerifyRequestError {
Show 19 variants
TokenTooLarge {
len: usize,
max: usize,
},
InvalidScheme,
InvalidBase64,
Event(ParseEventError),
WrongKind {
kind: u16,
},
MalformedTag {
tag: &'static str,
},
MissingUrlTag,
DuplicateUrlTag,
MissingMethodTag,
DuplicateMethodTag,
DuplicatePayloadTag,
UrlMismatch,
MethodMismatch,
MissingPayloadTag,
UnexpectedPayloadTag,
InvalidPayloadTag,
PayloadMismatch,
CreatedTooFarInFuture {
created_at: UnixTime,
now: UnixTime,
},
CreatedTooLongAgo {
created_at: UnixTime,
now: UnixTime,
},
}Expand description
The reasons verify_request can refuse a request, one per check.
No variant carries text from the request, so errors are safe to log.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TokenTooLarge
The header is longer than RequestPolicy::max_token_bytes.
InvalidScheme
The header is not Nostr followed by a space and a token.
InvalidBase64
The token is not standard padded base64.
Event(ParseEventError)
The decoded token is not a valid, correctly signed Nostr event.
WrongKind
The event kind is not HTTP_AUTH_KIND.
MalformedTag
A u, method or payload tag does not have exactly one value.
MissingUrlTag
There is no u tag.
DuplicateUrlTag
There is more than one u tag.
MissingMethodTag
There is no method tag.
DuplicateMethodTag
There is more than one method tag.
DuplicatePayloadTag
There is more than one payload tag.
UrlMismatch
The u tag is not byte-for-byte the expected URL.
MethodMismatch
The method tag is not the expected method.
MissingPayloadTag
The request has a body but the event has no payload tag.
UnexpectedPayloadTag
The request has no body but the event has a payload tag.
InvalidPayloadTag
The payload tag is not 64 lowercase hexadecimal digits.
PayloadMismatch
The payload tag is not the SHA-256 of the body.
CreatedTooFarInFuture
created_at is later than now by more than the allowed skew.
CreatedTooLongAgo
created_at is earlier than now by more than the allowed skew.
Trait Implementations§
Source§impl Clone for VerifyRequestError
impl Clone for VerifyRequestError
impl Copy for VerifyRequestError
Source§impl Debug for VerifyRequestError
impl Debug for VerifyRequestError
Source§impl Display for VerifyRequestError
impl Display for VerifyRequestError
impl Eq for VerifyRequestError
Source§impl Error for VerifyRequestError
impl Error for VerifyRequestError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()