Skip to content

Commit

Permalink
fix utf8 convert bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lzg0321 committed Aug 5, 2021
1 parent 533c7f2 commit 1fbc001
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/encryptUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function decryptWithKey (key, payload) {
return crypto.subtle.decrypt({name: 'AES-GCM', iv: vector}, key, encryptedData)
.then(function (result) {
const decryptedData = new Uint8Array(result)
const decryptedStr = new Buffer(decryptedData).toString('uft8')
const decryptedStr = new Buffer(decryptedData).toString('utf8')
const decryptedObj = JSON.parse(decryptedStr)
return decryptedObj
})
Expand Down Expand Up @@ -106,7 +106,7 @@ async function keyFromPasswordV2 (password, salt) {

}
function keyFromPassword (password, salt) {
var passBuffer = Buffer.from(password, 'uft8')
var passBuffer = Buffer.from(password, 'utf8')
var saltBuffer = Buffer.from(salt, 'base64')

return global.crypto.subtle.importKey(
Expand Down

0 comments on commit 1fbc001

Please sign in to comment.