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 🎉)
24 lines
708 B
JavaScript
24 lines
708 B
JavaScript
/* eslint-disable no-param-reassign */
|
|
import test from 'ava';
|
|
|
|
const root = !('WEBCRYPTO' in process.env) ? '#dist' : '#dist/webcrypto';
|
|
import(`${root}/jwe/compact/decrypt`).then(
|
|
({ default: flattenedDecrypt }) => {
|
|
test('JWE format validation', async (t) => {
|
|
await t.throwsAsync(flattenedDecrypt(null, new Uint8Array()), {
|
|
message: 'Compact JWE must be a string',
|
|
code: 'ERR_JWE_INVALID',
|
|
});
|
|
await t.throwsAsync(flattenedDecrypt('...', new Uint8Array()), {
|
|
message: 'Invalid Compact JWE',
|
|
code: 'ERR_JWE_INVALID',
|
|
});
|
|
});
|
|
},
|
|
(err) => {
|
|
test('failed to import', (t) => {
|
|
console.error(err);
|
|
t.fail();
|
|
});
|
|
},
|
|
);
|