Skip to content

Commit

Permalink
refactor: decrypt private key
Browse files Browse the repository at this point in the history
  • Loading branch information
AlefrankM committed Nov 15, 2022
1 parent 7a9cc0e commit 9d0198f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/metis/controllers/cryptoLoginController.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,19 @@ module.exports = (app, jobs, websocket) => {
},

decryptPrivateKey: async (req, res) => {
const { passphrase, privateKeyArmored, config } = req.body
const { passphrase, privateKeyArmored } = req.body

const config = {
preferredHashAlgorithm: enums.hash.sha256,
preferredSymmetricAlgorithm: enums.symmetric.aes128
}

const privateKey = await readPrivateKey({ armoredKey: privateKeyArmored, config })
const data = await decryptKey({
privateKey,
passphrase
})

res.json(data)
},

Expand Down

0 comments on commit 9d0198f

Please sign in to comment.