openpgpjs/src/crypto/cipher/getCipher.js
2023-02-21 18:27:59 +01:00

14 lines
327 B
JavaScript

import * as cipher from '.';
import enums from '../../enums';
/**
* Get implementation of the given cipher
* @param {enums.symmetric} algo
* @returns {Object}
* @throws {Error} on invalid algo
*/
export default function getCipher(algo) {
const algoName = enums.read(enums.symmetric, algo);
return cipher[algoName];
}