mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
wip kind 14/15 within nip17 seal for attachments
This commit is contained in:
1 parent
5d8a4d4ace
commit
7a52562926
3 files changed
+48
-4
No files matched your search
@@ -704,6 +704,10 @@ export function DMProvider({ children, protocolMode = PROTOCOL_MODE.NIP17_ONLY,
|
||||
const sealEvent = JSON.parse(sealContent) as NostrEvent;
|
||||
|
||||
if (sealEvent.kind !== 13) {
|
||||
console.log(`[DM] ⚠️ NIP-17 INVALID SEAL - expected kind 13, got ${sealEvent.kind}`, {
|
||||
giftWrapId: event.id,
|
||||
sealKind: sealEvent.kind,
|
||||
});
|
||||
return {
|
||||
processedMessage: {
|
||||
...event,
|
||||
@@ -718,13 +722,21 @@ export function DMProvider({ children, protocolMode = PROTOCOL_MODE.NIP17_ONLY,
|
||||
const messageContent = await user.signer.nip44.decrypt(sealEvent.pubkey, sealEvent.content);
|
||||
const messageEvent = JSON.parse(messageContent) as NostrEvent;
|
||||
|
||||
if (messageEvent.kind !== 14) {
|
||||
// Accept both kind 14 (text) and kind 15 (files/attachments)
|
||||
if (messageEvent.kind !== 14 && messageEvent.kind !== 15) {
|
||||
console.log(`[DM] ⚠️ NIP-17 MESSAGE WITH UNSUPPORTED INNER EVENT KIND:`, {
|
||||
giftWrapId: event.id,
|
||||
innerKind: messageEvent.kind,
|
||||
expectedKinds: [14, 15],
|
||||
sealPubkey: sealEvent.pubkey,
|
||||
messageEvent: messageEvent,
|
||||
});
|
||||
return {
|
||||
processedMessage: {
|
||||
...event,
|
||||
content: '',
|
||||
decryptedContent: '',
|
||||
error: `Invalid message format - expected kind 14, got ${messageEvent.kind}`,
|
||||
error: `Invalid message format - expected kind 14 or 15, got ${messageEvent.kind}`,
|
||||
},
|
||||
conversationPartner: event.pubkey,
|
||||
};
|
||||
@@ -750,6 +762,13 @@ export function DMProvider({ children, protocolMode = PROTOCOL_MODE.NIP17_ONLY,
|
||||
conversationPartner = sealEvent.pubkey;
|
||||
}
|
||||
|
||||
console.log(`[DM] ✅ NIP-17 message processed successfully`, {
|
||||
giftWrapId: event.id,
|
||||
innerKind: messageEvent.kind, // 14 for text, 15 for files
|
||||
messageId: messageEvent.id,
|
||||
conversationPartner,
|
||||
});
|
||||
|
||||
return {
|
||||
processedMessage: {
|
||||
...messageEvent,
|
||||
|
||||
Reference in new issue
Block a user