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