jose/dist/node/esm/lib/check_iv_length.js
2021-10-17 13:04:57 +02:00

8 lines
276 B
JavaScript

import { JWEInvalid } from '../util/errors.js';
import { bitLength } from './iv.js';
const checkIvLength = (enc, iv) => {
if (iv.length << 3 !== bitLength(enc)) {
throw new JWEInvalid('Invalid Initialization Vector length');
}
};
export default checkIvLength;