Skip to content

Instantly share code, notes, and snippets.

@bshambaugh
Created December 1, 2023 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bshambaugh/6c8faa3d57f8aa3bb0d127239fe2ea0f to your computer and use it in GitHub Desktop.
Save bshambaugh/6c8faa3d57f8aa3bb0d127239fe2ea0f to your computer and use it in GitHub Desktop.
did-jwt-error-log
npm run test
> did-jwt@7.4.1 test
> cross-env NODE_OPTIONS="--experimental-vm-modules" jest
(node:56793) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS src/__tests__/SignerAlgorithm.test.ts (13.237 s)
PASS src/__tests__/didkey.test.ts
(node:56746) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS src/__tests__/VerifierAlgorithm.test.ts (16.002 s)
PASS src/__tests__/Digest.test.ts
PASS src/__tests__/EdDSASigner.test.ts
PASS src/__tests__/ES256KSigner.test.ts
(node:56754) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS src/__tests__/JWE.test.ts (17.198 s)
(node:56772) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS src/__tests__/xc20pEncryption.test.ts (17.55 s)
PASS src/__tests__/util.test.ts
PASS src/__tests__/ES256Signer.test.ts
PASS src/__tests__/EllipticSigner.test.ts
PASS src/__tests__/SimpleSigner.test.ts
PASS src/__tests__/NaclSigner.test.ts
(node:56745) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
FAIL src/__tests__/a256gcmEncryption.test.ts (19.107 s)
● ECDH-ES+A256KW (P-256), Key Wrapping Mode with A256GCM content encryption › Multiple recipients › Creates with only ciphertext
TypeError: Cannot read properties of undefined (reading 'enc')
72 | validateJWE(jwe)
73 | const protHeader = JSON.parse(decodeBase64url(jwe.protected))
> 74 | if (protHeader.enc !== decrypter.enc)
| ^
75 | throw new Error(`not_supported: Decrypter does not supported: '${protHeader.enc}'`)
76 | const sealed = toSealed(jwe.ciphertext, jwe.tag)
77 | const aad = fromString(jwe.aad ? `${jwe.protected}.${jwe.aad}` : jwe.protected, 'utf-8')
at decryptJWE (src/encryption/JWE.ts:74:36)
at Object.<anonymous> (src/__tests__/a256gcmEncryption.test.ts:736:20)
● ECDH-ES+A256KW (P-256), Key Wrapping Mode with A256GCM content encryption › Multiple recipients › Creates with only ciphertext
expect.assertions(4)
Expected four assertions to be called but received two assertion calls.
730 |
731 | it('Creates with only ciphertext', async () => {
> 732 | expect.assertions(4)
| ^
733 | const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter])
734 | expect(jwe.aad).toBeUndefined()
735 | expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })
at Object.<anonymous> (src/__tests__/a256gcmEncryption.test.ts:732:14)
● ECDH-ES+A256KW (P-256), Key Wrapping Mode with A256GCM content encryption › Multiple recipients › Creates with data in protected header
TypeError: Cannot read properties of undefined (reading 'enc')
72 | validateJWE(jwe)
73 | const protHeader = JSON.parse(decodeBase64url(jwe.protected))
> 74 | if (protHeader.enc !== decrypter.enc)
| ^
75 | throw new Error(`not_supported: Decrypter does not supported: '${protHeader.enc}'`)
76 | const sealed = toSealed(jwe.ciphertext, jwe.tag)
77 | const aad = fromString(jwe.aad ? `${jwe.protected}.${jwe.aad}` : jwe.protected, 'utf-8')
at decryptJWE (src/encryption/JWE.ts:74:36)
at Object.<anonymous> (src/__tests__/a256gcmEncryption.test.ts:749:20)
● ECDH-ES+A256KW (P-256), Key Wrapping Mode with A256GCM content encryption › Multiple recipients › Creates with data in protected header
expect.assertions(4)
Expected four assertions to be called but received two assertion calls.
739 |
740 | it('Creates with data in protected header', async () => {
> 741 | expect.assertions(4)
| ^
742 | const skid = 'did:example:sender#key-1'
743 | const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter], {
744 | more: 'protected',
at Object.<anonymous> (src/__tests__/a256gcmEncryption.test.ts:741:14)
● ECDH-ES+A256KW (P-256), Key Wrapping Mode with A256GCM content encryption › Multiple recipients › Creates with aad
TypeError: Cannot read properties of undefined (reading 'enc')
72 | validateJWE(jwe)
73 | const protHeader = JSON.parse(decodeBase64url(jwe.protected))
> 74 | if (protHeader.enc !== decrypter.enc)
| ^
75 | throw new Error(`not_supported: Decrypter does not supported: '${protHeader.enc}'`)
76 | const sealed = toSealed(jwe.ciphertext, jwe.tag)
77 | const aad = fromString(jwe.aad ? `${jwe.protected}.${jwe.aad}` : jwe.protected, 'utf-8')
at decryptJWE (src/encryption/JWE.ts:74:36)
at Object.<anonymous> (src/__tests__/a256gcmEncryption.test.ts:766:20)
● ECDH-ES+A256KW (P-256), Key Wrapping Mode with A256GCM content encryption › Multiple recipients › Creates with aad
expect.assertions(6)
Expected six assertions to be called but received two assertion calls.
752 |
753 | it('Creates with aad', async () => {
> 754 | expect.assertions(6)
| ^
755 | //const aad = u8a.fromString('this data is authenticated')
756 | const aad = fromString('this data is authenticated')
757 | const jwe = await createJWE(
at Object.<anonymous> (src/__tests__/a256gcmEncryption.test.ts:754:14)
(node:56783) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS src/__tests__/ConditionalAlgorithm.test.ts (23.9 s)
(node:56744) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
PASS src/__tests__/JWT.test.ts (24.845 s)
Test Suites: 1 failed, 15 passed, 16 total
Tests: 3 failed, 346 passed, 349 total
Snapshots: 20 passed, 20 total
Time: 25.643 s
Ran all test suites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment