mirror of
https://github.com/hanzoai/jose.git
synced 2026-09-24 17:00:01 +00:00
I'm done trying to educate other JOSE producers about interoperability so i'm going to be accepting their non-conform base64url so that users of this module don't suffer performance loss.
18 lines
644 B
JavaScript
18 lines
644 B
JavaScript
const test = require('ava')
|
|
|
|
const { errors } = require('../..')
|
|
const JWA = require('../../lib/jwa')
|
|
const JWK = require('../../lib/jwk')
|
|
|
|
;['sign', 'verify', 'keyManagementEncrypt', 'keyManagementDecrypt', 'encrypt', 'decrypt'].forEach((op) => {
|
|
let label
|
|
if (op.startsWith('keyManagement')) {
|
|
label = `key management (${op.substr(13).toLowerCase()}ion)`
|
|
}
|
|
test(`JWA.${op} will not accept an "unimplemented" algorithm`, t => {
|
|
t.throws(() => {
|
|
JWA[op]('foo', JWK.generateSync('oct'))
|
|
}, { instanceOf: errors.JOSENotSupported, code: 'ERR_JOSE_NOT_SUPPORTED', message: `unsupported ${label || op} alg: foo` })
|
|
})
|
|
})
|