From b4777e87b5e13bff5dd1b0d5ec39d96cc84fb689 Mon Sep 17 00:00:00 2001 From: balzack Date: Sat, 11 Jan 2025 23:12:44 -0800 Subject: [PATCH] avoid unsealing unconfirmed topics --- app/sdk/src/focus.ts | 5 +---- app/sdk/src/stream.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/sdk/src/focus.ts b/app/sdk/src/focus.ts index a167db24..ae9fdea2 100644 --- a/app/sdk/src/focus.ts +++ b/app/sdk/src/focus.ts @@ -414,14 +414,12 @@ export class FocusModule implements Focus { for (const asset of files) { for (const transform of asset.transforms) { if (transform.type === TransformType.Thumb && transform.thumb) { -console.log("GET THUMB??"); const assetItem = { assetId: `${assetItems.length}`, encrytped: true, hosting: HostingMode.Inline, inline: await transform.thumb(), } -console.log("GOT THUMB!!"); appAsset.push({appId: transform.appId, assetId: assetItem.assetId}); assetItems.push(assetItem); } else if (transform.type === TransformType.Copy) { @@ -591,7 +589,6 @@ console.log("GOT THUMB!!"); await this.setRemoteChannelTopicSubject(topicId, type, updated); } } catch (err) { -console.log("THROWING!"); this.log.error(err); await this.removeRemoteChannelTopic(topicId); throw new Error('failed to add topic'); @@ -866,7 +863,7 @@ console.log("THROWING!"); } private async unsealTopicDetail(item: TopicItem): Promise { - if (item.detail.sealed && !item.unsealedDetail && this.sealEnabled && this.channelKey && this.crypto) { + if (item.detail.status === 'confirmed' && item.detail.sealed && !item.unsealedDetail && this.sealEnabled && this.channelKey && this.crypto) { try { const { messageEncrypted, messageIv } = item.detail.data; if (!messageEncrypted || !messageIv) { diff --git a/app/sdk/src/stream.ts b/app/sdk/src/stream.ts index a89cc015..1aa6f345 100644 --- a/app/sdk/src/stream.ts +++ b/app/sdk/src/stream.ts @@ -657,7 +657,7 @@ export class StreamModule { } private async unsealChannelSummary(channelId: string, item: ChannelItem): Promise { - if (item.unsealedSummary == null && item.summary.dataType === 'sealedtopic' && this.seal && this.crypto) { + if (item.unsealedSummary == null && item.summary.status === 'confirmed' && item.summary.dataType === 'sealedtopic' && this.seal && this.crypto) { try { if (!item.channelKey) { const { seals } = JSON.parse(item.detail.data);