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]>
14 lines
466 B
TypeScript
14 lines
466 B
TypeScript
import test from 'ava'
|
|
|
|
import { generateIv } from '../../src/lib/content_encryption.js'
|
|
import { jweEncryption } from '../../src/lib/jwe_algorithms.js'
|
|
|
|
test('lib/content_encryption.ts generateIv', (t) => {
|
|
t.throws(() => jweEncryption('foo'), {
|
|
code: 'ERR_JOSE_NOT_SUPPORTED',
|
|
message: 'Unsupported JWE Algorithm: foo',
|
|
})
|
|
t.is(generateIv(jweEncryption('A256GCM')).byteLength, 12)
|
|
t.is(generateIv(jweEncryption('A256CBC-HS512')).byteLength, 16)
|
|
})
|