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 <[email protected]>
  • Loading branch information
marcelklehr committed Jul 8, 2024
1 parent af25b70 commit 943c25a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion 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) {
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) {
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))
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 {
Expand Down

0 comments on commit 943c25a

Please sign in to comment.