fix: base64 zod doesn't work for us

also fix delete in a private chat
pull/3281/head
Audric Ackermann 11 months ago
parent c7995a05d2
commit 93c451048a
No known key found for this signature in database

@ -227,9 +227,10 @@ export async function deleteMessagesFromSwarmAndCompletelyLocally(
throw new Error('deleteMessagesFromSwarmAndCompletelyLocally needs a 03 or 05 pk'); throw new Error('deleteMessagesFromSwarmAndCompletelyLocally needs a 03 or 05 pk');
} }
if (PubKey.is05Pubkey(pubkey) && pubkey !== UserUtils.getOurPubKeyStrFromCache()) { if (PubKey.is05Pubkey(pubkey) && pubkey !== UserUtils.getOurPubKeyStrFromCache()) {
throw new Error( window.log.warn(
'deleteMessagesFromSwarmAndCompletelyLocally with 05 pk can only delete for ourself' 'deleteMessagesFromSwarmAndCompletelyLocally with 05 pk can only delete for ourself'
); );
return;
} }
// LEGACY GROUPS -- we cannot delete on the swarm (just unsend which is done separately) // LEGACY GROUPS -- we cannot delete on the swarm (just unsend which is done separately)
if (conversation.isClosedGroup() && PubKey.is05Pubkey(pubkey)) { if (conversation.isClosedGroup() && PubKey.is05Pubkey(pubkey)) {

@ -940,8 +940,8 @@ export class SwarmPolling {
// zod schema for retrieve items as returned by the snodes // zod schema for retrieve items as returned by the snodes
const retrieveItemSchema = z.object({ const retrieveItemSchema = z.object({
hash: z.string().base64('retrieveItemSchema: hash was not base64'), hash: z.string(),
data: z.string().base64('retrieveItemSchema: data was not base64'), data: z.string(),
expiration: z.number().finite(), expiration: z.number().finite(),
timestamp: z.number().finite().positive(), timestamp: z.number().finite().positive(),
}); });

Loading…
Cancel
Save