diff --git a/src/lib/adapters/GoogleDrive.ts b/src/lib/adapters/GoogleDrive.ts index 55582a405f..4f5b38cd05 100644 --- a/src/lib/adapters/GoogleDrive.ts +++ b/src/lib/adapters/GoogleDrive.ts @@ -305,7 +305,9 @@ export default class GoogleDriveAdapter extends CachingAdapter { let xbel = createXBEL(this.bookmarksCache, this.highestId) if (this.server.password) { + const salt = Crypto.bufferToHexstr(Crypto.getRandomBytes(64)) xbel = await Crypto.encryptAES(this.server.password, xbel, this.server.bookmark_file) + xbel = JSON.stringify({ciphertext: xbel, salt}) } if (!this.fileId) { diff --git a/src/lib/adapters/WebDav.ts b/src/lib/adapters/WebDav.ts index 85297cfa59..1ce9b944c3 100644 --- a/src/lib/adapters/WebDav.ts +++ b/src/lib/adapters/WebDav.ts @@ -324,7 +324,9 @@ export default class WebDavAdapter extends CachingAdapter { const fullUrl = this.getBookmarkURL() let xbel = this.server.bookmark_file_type === 'xbel' ? createXBEL(this.bookmarksCache, this.highestId) : createHTML(this.bookmarksCache, this.highestId) if (this.server.passphrase) { - xbel = await Crypto.encryptAES(this.server.passphrase, xbel, this.server.bookmark_file) + const salt = Crypto.bufferToHexstr(Crypto.getRandomBytes(64)) + xbel = await Crypto.encryptAES(this.server.passphrase, xbel, salt) + xbel = JSON.stringify({ciphertext: xbel, salt}) } await this.uploadFile(fullUrl, this.server.bookmark_file_type === 'xbel' ? 'application/xml' : 'text/html', xbel) } else {