mirror of
https://github.com/v0l/route96.git
synced 2025-06-15 16:03:00 +00:00
feat: nip98 timestamp window
closes https://github.com/v0l/route96/issues/12
This commit is contained in:
@ -33,10 +33,12 @@ impl<'r> FromRequest<'r> for Nip98Auth {
|
|||||||
if event.kind != Kind::HttpAuth {
|
if event.kind != Kind::HttpAuth {
|
||||||
return Outcome::Error((Status::new(401), "Wrong event kind"));
|
return Outcome::Error((Status::new(401), "Wrong event kind"));
|
||||||
}
|
}
|
||||||
if event.created_at > Timestamp::now() {
|
if (event.created_at.as_u64() as i64 -
|
||||||
|
Timestamp::now().as_u64() as i64).abs() >= 60
|
||||||
|
{
|
||||||
return Outcome::Error((
|
return Outcome::Error((
|
||||||
Status::new(401),
|
Status::new(401),
|
||||||
"Created timestamp is in the future",
|
"Created timestamp is out of range",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user