UNPKG

jose

Version:

JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes

8 lines (7 loc) 249 B
import { JWEInvalid } from '../util/errors.js'; import { bitLength } from './iv.js'; export function checkIvLength(enc, iv) { if (iv.length << 3 !== bitLength(enc)) { throw new JWEInvalid('Invalid Initialization Vector length'); } }