Skip to content

Commit

Permalink
fix(WebDav, GoogleDrive): Use new encryption
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jul 8, 2024
1 parent af25b70 commit 79f301e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib/adapters/GoogleDrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/adapters/WebDav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 79f301e

Please sign in to comment.