Skip to content

Commit

Permalink
Merge pull request #1671 from floccusaddon/fix/webdav-gdrive-new-encr…
Browse files Browse the repository at this point in the history
…yption

fix(WebDav, GoogleDrive): Use new encryption
  • Loading branch information
marcelklehr authored Oct 14, 2024
2 parents c799bb0 + 943c25a commit d752772
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 @@ -322,7 +322,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 @@ -332,7 +332,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 d752772

Please sign in to comment.