Upgrade nostr-tools to v1.17.0

This commit is contained in:
Alex Gleason 2023-11-20 12:35:58 -06:00
parent 6868f39719
commit bedc8fdf91
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 4 additions and 3 deletions

View File

@ -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"

View File

@ -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')