chore: cleanup chat links

This commit is contained in:
2024-08-27 14:11:23 +01:00
parent 2c58239e2c
commit 8f0b1d3f66
10 changed files with 23 additions and 133 deletions

View File

@ -26,7 +26,7 @@ export class Nip28ChatSystem implements ChatSystem {
];
subscription(session: LoginSession): RequestBuilder | undefined {
const chats = (session.extraChats ?? []).filter(a => a.startsWith("chat281"));
const chats = (session.extraChats ?? []).filter(a => a.startsWith(NostrPrefix.Chat28));
if (chats.length === 0) return;
const chatId = (v: string) => unwrap(decodeTLV(v).find(a => a.type === TLVEntryType.Special)).value as string;
@ -57,7 +57,7 @@ export class Nip28ChatSystem implements ChatSystem {
}
static chatId(id: string) {
return encodeTLVEntries("chat28" as NostrPrefix, {
return encodeTLVEntries(NostrPrefix.Chat28, {
type: TLVEntryType.Special,
value: id,
length: id.length,