This commit is contained in:
Bruno Windels 2020-09-04 15:31:45 +02:00
parent baad4bd37f
commit dc0576f2db
2 changed files with 3 additions and 5 deletions

View file

@ -115,7 +115,7 @@ export class Decryption {
try { try {
payload = JSON.parse(plaintext); payload = JSON.parse(plaintext);
} catch (err) { } catch (err) {
throw new DecryptionError("NOT_JSON", event, {plaintext, err}); throw new DecryptionError("PLAINTEXT_NOT_JSON", event, {plaintext, err});
} }
this._validatePayload(payload, event); this._validatePayload(payload, event);
return {event: payload, senderKey}; return {event: payload, senderKey};

View file

@ -22,6 +22,7 @@ export class EventEntry extends BaseEntry {
super(fragmentIdComparer); super(fragmentIdComparer);
this._eventEntry = eventEntry; this._eventEntry = eventEntry;
this._decryptionError = null; this._decryptionError = null;
this._isEncrypted = false;
} }
get fragmentId() { get fragmentId() {
@ -32,10 +33,6 @@ export class EventEntry extends BaseEntry {
return this._eventEntry.eventIndex; return this._eventEntry.eventIndex;
} }
get internalId() {
return `${this.fragmentId}|${this.entryIndex}`;
}
get content() { get content() {
return this._eventEntry.event.content; return this._eventEntry.event.content;
} }
@ -74,6 +71,7 @@ export class EventEntry extends BaseEntry {
replaceWithDecrypted(event) { replaceWithDecrypted(event) {
this._eventEntry.event = event; this._eventEntry.event = event;
this._isEncrypted = true;
} }
setDecryptionError(err) { setDecryptionError(err) {