fix: sync contacts

This commit is contained in:
2024-04-29 11:39:26 +01:00
parent a17c98ad25
commit b199d1a366
2 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ export class DiffSyncTags extends EventEmitter<SafeSyncEvents> {
#changesEncrypted: Array<TagDiff> = [];
#decryptedContent?: string;
constructor(readonly link: NostrLink) {
constructor(readonly link: NostrLink, readonly contentEncrypted: boolean) {
super();
this.#sync = new SafeSync(link);
this.#sync.on("change", () => {
@ -99,7 +99,7 @@ export class DiffSyncTags extends EventEmitter<SafeSyncEvents> {
async sync(signer: EventSigner, system: SystemInterface) {
await this.#sync.sync(system);
if (this.#sync.value?.content) {
if (this.#sync.value?.content && this.contentEncrypted) {
const decrypted = await signer.nip4Decrypt(this.#sync.value.content, await signer.getPubKey());
this.#decryptedContent = decrypted;
}