From bedc8fdf91e68af5a11344793f36b68f93a00f13 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 20 Nov 2023 12:35:58 -0600 Subject: [PATCH] Upgrade nostr-tools to v1.17.0 --- src/deps.ts | 3 ++- src/utils/nip98.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/deps.ts b/src/deps.ts index 9c460f69..ee8277b5 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -25,8 +25,9 @@ export { nip19, nip21, type UnsignedEvent, + type VerifiedEvent, verifySignature, -} from 'npm:nostr-tools@^1.14.0'; +} from 'npm:nostr-tools@^1.17.0'; export { findReplyTag } from 'https://gitlab.com/soapbox-pub/mostr/-/raw/c67064aee5ade5e01597c6d23e22e53c628ef0e2/src/nostr/tags.ts'; export { parseFormData } from 'npm:formdata-helper@^0.3.0'; // @deno-types="npm:@types/lodash@4.14.194" diff --git a/src/utils/nip98.ts b/src/utils/nip98.ts index facc9af9..bd7e6733 100644 --- a/src/utils/nip98.ts +++ b/src/utils/nip98.ts @@ -1,4 +1,4 @@ -import { type Event, type EventTemplate, nip13 } from '@/deps.ts'; +import { type Event, type EventTemplate, nip13, type VerifiedEvent } from '@/deps.ts'; import { decode64Schema, jsonSchema } from '@/schema.ts'; import { signedEventSchema } from '@/schemas/nostr.ts'; import { eventAge, findTag, nostrNow, sha256 } from '@/utils.ts'; @@ -32,7 +32,7 @@ function validateAuthEvent(req: Request, event: Event, opts: ParseAuthRequestOpt const { maxAge = Time.minutes(1), validatePayload = true, pow = 0 } = opts; const schema = signedEventSchema - .refine((event): event is Event<27235> => event.kind === 27235, 'Event must be kind 27235') + .refine((event): event is VerifiedEvent<27235> => event.kind === 27235, 'Event must be kind 27235') .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')