From 2d7398e9d10ad6e6ebb994fa56666269109bcb8c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 10 Sep 2023 17:11:13 -0500 Subject: [PATCH] nip98: fix pow check --- src/utils/nip98.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/nip98.ts b/src/utils/nip98.ts index 0445fbd..facc9af 100644 --- a/src/utils/nip98.ts +++ b/src/utils/nip98.ts @@ -36,7 +36,7 @@ function validateAuthEvent(req: Request, event: Event, opts: ParseAuthRequestOpt .refine((event) => eventAge(event) < maxAge, 'Event expired') .refine((event) => tagValue(event, 'method') === req.method, 'Event method does not match HTTP request method') .refine((event) => tagValue(event, 'u') === req.url, 'Event URL does not match request URL') - .refine((event) => pow > 0 && nip13.getPow(event.id) >= pow, 'Insufficient proof of work') + .refine((event) => pow ? nip13.getPow(event.id) >= pow : true, 'Insufficient proof of work') .refine(validateBody, 'Event payload does not match request body'); function validateBody(event: Event<27235>) {