fix: follow graph / readonly login
This commit is contained in:
@ -99,10 +99,10 @@ export class DiffSyncTags extends EventEmitter<SafeSyncEvents> {
|
||||
this.emit("change");
|
||||
}
|
||||
|
||||
async sync(signer: EventSigner, system: SystemInterface) {
|
||||
async sync(signer: EventSigner | undefined, system: SystemInterface) {
|
||||
await this.#sync.sync(system);
|
||||
|
||||
if (this.#sync.value?.content && this.contentEncrypted) {
|
||||
if (this.#sync.value?.content && this.contentEncrypted && signer) {
|
||||
const decrypted = await signer.nip4Decrypt(this.#sync.value.content, await signer.getPubKey());
|
||||
this.#decryptedContent = decrypted;
|
||||
}
|
||||
|
@ -25,11 +25,12 @@ export class JsonEventSync<T> extends EventEmitter<SafeSyncEvents> {
|
||||
return Object.freeze(ret);
|
||||
}
|
||||
|
||||
async sync(signer: EventSigner, system: SystemInterface) {
|
||||
async sync(signer: EventSigner | undefined, system: SystemInterface) {
|
||||
const res = await this.#sync.sync(system);
|
||||
this.#log("Sync result %O", res);
|
||||
if (res) {
|
||||
if (this.encrypt) {
|
||||
if (!signer) return;
|
||||
this.#json = JSON.parse(await signer.nip4Decrypt(res.content, await signer.getPubKey())) as T;
|
||||
} else {
|
||||
this.#json = JSON.parse(res.content) as T;
|
||||
|
Reference in New Issue
Block a user