(hash: Hash)
| 5 | import { Hash } from './decrypt.type'; |
| 6 | |
| 7 | export const decrypt = (hash: Hash) => { |
| 8 | const decipher = crypto.createDecipheriv( |
| 9 | CRYPTO_ALGORITHM, |
| 10 | CRYPTO_SECRET_KEY, |
| 11 | Buffer.from(hash.iv, 'hex'), |
| 12 | ); |
| 13 | |
| 14 | const decrypted = Buffer.concat([ |
| 15 | decipher.update(Buffer.from(hash.content, 'hex')), |
| 16 | decipher.final(), |
| 17 | ]); |
| 18 | |
| 19 | return decrypted.toString(); |
| 20 | }; |
no outgoing calls
no test coverage detected