Skip to content

Commit afb3308

Browse files
committed
feat: nip98 timestamp window
closes #12
1 parent f569b94 commit afb3308

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/auth/nip98.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ impl<'r> FromRequest<'r> for Nip98Auth {
3333
if event.kind != Kind::HttpAuth {
3434
return Outcome::Error((Status::new(401), "Wrong event kind"));
3535
}
36-
if event.created_at > Timestamp::now() {
36+
if (event.created_at.as_u64() as i64 -
37+
Timestamp::now().as_u64() as i64).abs() >= 60
38+
{
3739
return Outcome::Error((
3840
Status::new(401),
39-
"Created timestamp is in the future",
41+
"Created timestamp is out of range",
4042
));
4143
}
4244

0 commit comments

Comments
 (0)