Merge pull request #740 from shocknet/noffer

catch decrypt err
This commit is contained in:
Justin (shocknet) 2024-09-09 11:26:57 -04:00 committed by GitHub
commit 6306f16127
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -166,7 +166,15 @@ export default class Handler {
const startAtMs = Date.now()
const startAtNano = process.hrtime.bigint().toString()
const decoded = decodePayload(e.content)
const content = await decryptData(decoded, getSharedSecret(app.privateKey, e.pubkey))
let content = ""
try {
content = await decryptData(decoded, getSharedSecret(app.privateKey, e.pubkey))
} catch (e: any) {
this.log(ERROR, "failed to decrypt event", e.message)
return
}
this.eventCallback({ id: eventId, content, pub: e.pubkey, appId: app.appId, startAtNano, startAtMs, kind: e.kind })
}