mirror of
https://github.com/hanzoai/jose.git
synced 2026-09-24 17:00:01 +00:00
11 lines
285 B
TypeScript
11 lines
285 B
TypeScript
import { JWEInvalid } from '../util/errors.ts'
|
|
import { bitLength } from './iv.ts'
|
|
|
|
const checkIvLength = (enc: string, iv: Uint8Array) => {
|
|
if (iv.length << 3 !== bitLength(enc)) {
|
|
throw new JWEInvalid('Invalid Initialization Vector length')
|
|
}
|
|
}
|
|
|
|
export default checkIvLength
|