mirror of
https://github.com/danbulant/jose
synced 2026-05-25 04:51:47 +00:00
BREAKING CHANGE: Revised, Promise-based API BREAKING CHANGE: No dependencies BREAKING CHANGE: Browser support (using [Web Cryptography API](https://www.w3.org/TR/WebCryptoAPI/)) BREAKING CHANGE: Support for verification using a remote JWKS endpoint BREAKING CHANGE: Experimental Node.js libuv thread pool based runtime (non-blocking 🎉)
10 lines
291 B
TypeScript
10 lines
291 B
TypeScript
import { JWEInvalid } from '../util/errors.js'
|
|
import { bitLengths } from './iv.js'
|
|
|
|
const checkIvLength = (enc: string, iv: Uint8Array) => {
|
|
if (iv.length << 3 !== bitLengths.get(enc)) {
|
|
throw new JWEInvalid('Invalid Initialization Vector length')
|
|
}
|
|
}
|
|
|
|
export default checkIvLength
|