check_cek_length.js 321 B

12345678
  1. import { JWEInvalid } from '../util/errors.js';
  2. const checkCekLength = (cek, expected) => {
  3. const actual = cek.byteLength << 3;
  4. if (actual !== expected) {
  5. throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);
  6. }
  7. };
  8. export default checkCekLength;