API: first verify, then try to decrypt!

master
Tom Hacohen 7 years ago
parent 778999861e
commit 11aa1ffd94

@ -105,12 +105,12 @@ export class Journal extends BaseJournal<CollectionInfo> {
} }
getInfo(cryptoManager: CryptoManager): CollectionInfo { getInfo(cryptoManager: CryptoManager): CollectionInfo {
this.verify(cryptoManager);
if (this._content === undefined) { if (this._content === undefined) {
this._content = JSON.parse(cryptoManager.decrypt(this.encryptedContent())); this._content = JSON.parse(cryptoManager.decrypt(this.encryptedContent()));
} }
this.verify(cryptoManager);
return new CollectionInfo(this._content); return new CollectionInfo(this._content);
} }
@ -154,12 +154,12 @@ export class Entry extends BaseJournal<SyncEntry> {
} }
getSyncEntry(cryptoManager: CryptoManager, prevUid: string | null): SyncEntry { getSyncEntry(cryptoManager: CryptoManager, prevUid: string | null): SyncEntry {
this.verify(cryptoManager, prevUid);
if (this._content === undefined) { if (this._content === undefined) {
this._content = JSON.parse(cryptoManager.decrypt(this._encrypted)); this._content = JSON.parse(cryptoManager.decrypt(this._encrypted));
} }
this.verify(cryptoManager, prevUid);
return new SyncEntry(this._content); return new SyncEntry(this._content);
} }

Loading…
Cancel
Save