check_iv_length.js 276 B

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