diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 92e265142..e7c372cc0 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -221,7 +221,12 @@ class TfMessageElement extends LitElement { } async try_decrypt(content) { - this.decrypted = JSON.parse(await tfrpc.rpc.try_decrypt(this.whoami, content)); + let result = await tfrpc.rpc.try_decrypt(this.whoami, content); + if (result) { + this.decrypted = JSON.parse(result); + } else { + this.decrypted = false; + } } render() { @@ -442,11 +447,13 @@ class TfMessageElement extends LitElement { `); } else if (typeof(this.message.content) == 'string') { - if (this.decrypted !== undefined) { + if (this.decrypted) { return small_frame(html`🔓
${JSON.stringify(this.decrypted, null, 2)}
`); + } else if (this.decrypted === undefined) { + this.try_decrypt(content); + return small_frame(html`🔐`); } else { - this.try_decrypt(content); - return small_frame(html`🔐`); + return small_frame(html`🔒`); } } else { return small_frame(html`
type: ${content.type}
`);