mirror of
https://github.com/v0l/route96.git
synced 2025-06-14 23:46:34 +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 {
|
||||
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((
|
||||
Status::new(401),
|
||||
"Created timestamp is in the future",
|
||||
"Created timestamp is out of range",
|
||||
));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user