Tag the nip05 request in the grant event

This commit is contained in:
Alex Gleason 2024-06-09 12:13:50 -05:00
parent 2a2f43d106
commit 5379863d36
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 5 additions and 4 deletions

View File

@ -64,20 +64,20 @@ function renderRelays(event: NostrEvent): RelayEntity[] {
} }
const nameRequestSchema = z.object({ const nameRequestSchema = z.object({
nip05: z.string().email(), name: z.string().email(),
reason: z.string().max(500).optional(), reason: z.string().max(500).optional(),
}); });
export const nameRequestController: AppController = async (c) => { export const nameRequestController: AppController = async (c) => {
const { nip05, reason } = nameRequestSchema.parse(await c.req.json()); const { name, reason } = nameRequestSchema.parse(await c.req.json());
const event = await createEvent({ const event = await createEvent({
kind: 3036, kind: 3036,
content: reason, content: reason,
tags: [ tags: [
['r', nip05], ['r', name],
['L', 'nip05.domain'], ['L', 'nip05.domain'],
['l', nip05.split('@')[1], 'nip05.domain'], ['l', name.split('@')[1], 'nip05.domain'],
['p', Conf.pubkey], ['p', Conf.pubkey],
], ],
}, c); }, c);
@ -213,6 +213,7 @@ export const adminNameApproveController: AppController = async (c) => {
['L', 'nip05.domain'], ['L', 'nip05.domain'],
['l', r.split('@')[1], 'nip05.domain'], ['l', r.split('@')[1], 'nip05.domain'],
['p', event.pubkey], ['p', event.pubkey],
['e', event.id],
], ],
}, c); }, c);