mirror of
https://github.com/hanzoai/jose.git
synced 2026-09-24 17:00:01 +00:00
Resolve the content-encryption entry with the protected header and pass it through JWE processing. Use entry metadata for CEK and IV sizing, cipher selection, and AES-GCM key wrapping. Signed-off-by: Filip Skokan <[email protected]>
15 lines
549 B
TypeScript
15 lines
549 B
TypeScript
import test from 'ava'
|
|
|
|
import { checkIvLength } from '../../src/lib/content_encryption.js'
|
|
import { jweEncryption } from '../../src/lib/jwe_algorithms.js'
|
|
|
|
test('lib/content_encryption.ts checkIvLength', (t) => {
|
|
const gcm = jweEncryption('A256GCM')
|
|
t.throws(() => checkIvLength(gcm, new Uint8Array(13)), {
|
|
code: 'ERR_JWE_INVALID',
|
|
message: 'Invalid Initialization Vector length',
|
|
})
|
|
t.notThrows(() => checkIvLength(gcm, new Uint8Array(12)))
|
|
t.notThrows(() => checkIvLength(jweEncryption('A256CBC-HS512'), new Uint8Array(16)))
|
|
})
|