fix(WebDav, GoogleDrive): Use new encryption

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2024-07-08 15:43:38 +02:00
Родитель af25b7098f
Коммит 943c25abd9
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -305,7 +305,9 @@ export default class GoogleDriveAdapter extends CachingAdapter {
let xbel = createXBEL(this.bookmarksCache, this.highestId)
if (this.server.password) {
xbel = await Crypto.encryptAES(this.server.password, xbel, this.server.bookmark_file)
const salt = Crypto.bufferToHexstr(Crypto.getRandomBytes(64))
const ciphertext = await Crypto.encryptAES(this.server.password, xbel, salt)
xbel = JSON.stringify({ciphertext, salt})
}
if (!this.fileId) {

Просмотреть файл

@ -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))
const ciphertext = await Crypto.encryptAES(this.server.passphrase, xbel, salt)
xbel = JSON.stringify({ciphertext, salt})
}
await this.uploadFile(fullUrl, this.server.bookmark_file_type === 'xbel' ? 'application/xml' : 'text/html', xbel)
} else {