feat: error decrypting preferences section (#990)

* feat: error decrypting preferences section

* chore: upgrade snjs
This commit is contained in:
Mo
2022-04-21 10:33:59 -05:00
committed by GitHub
parent 1391f88263
commit fdf290ea1a
10 changed files with 265 additions and 90 deletions

View File

@@ -5,6 +5,7 @@ import {
BackupFile,
BackupFileDecryptedContextualPayload,
NoteContent,
EncryptedItemInterface,
} from '@standardnotes/snjs'
function sanitizeFileName(name: string): string {
@@ -148,7 +149,7 @@ export class ArchiveManager {
return this.textFile
}
downloadData(data: Blob | ObjectURL, fileName: string) {
downloadData(data: Blob | ObjectURL, fileName: string): void {
const link = document.createElement('a')
link.setAttribute('download', fileName)
link.href = typeof data === 'string' ? data : this.hrefForData(data)
@@ -156,4 +157,13 @@ export class ArchiveManager {
link.click()
link.remove()
}
downloadEncryptedItem(item: EncryptedItemInterface) {
this.downloadData(new Blob([JSON.stringify(item.payload.ejected())]), `${item.uuid}.txt`)
}
downloadEncryptedItems(items: EncryptedItemInterface[]) {
const data = JSON.stringify(items.map((i) => i.payload.ejected()))
this.downloadData(new Blob([data]), 'errored-items.txt')
}
}