Comparing version 5.12.3 to 5.12.4
{ | ||
"name": "did-jwt", | ||
"version": "5.12.3", | ||
"version": "5.12.4", | ||
"description": "Library for Signing and Verifying JWTs that use DIDs as issuers and JWEs that use DIDs as recipients", | ||
@@ -5,0 +5,0 @@ "type": "module", |
import { VerificationMethod } from 'did-resolver' | ||
import { TokenVerifier } from 'jsontokens' | ||
import MockDate from 'mockdate' | ||
import { fromString } from 'uint8arrays/from-string' | ||
import { toString } from 'uint8arrays/to-string' | ||
import { | ||
@@ -672,3 +674,3 @@ createJWS, | ||
// use the hex public key as an arbitrary payload | ||
const encodedPayload = bytesToBase64url(Buffer.from(publicKey, 'hex')) | ||
const encodedPayload = bytesToBase64url(fromString(publicKey, 'base16')) | ||
const jws = await createJWS(encodedPayload, signer) | ||
@@ -688,3 +690,3 @@ expect(jws).toMatchSnapshot() | ||
expect.assertions(1) | ||
const encodedPayload = bytesToBase64url(Buffer.from(publicKey, 'hex')) | ||
const encodedPayload = bytesToBase64url(fromString(publicKey, 'base16')) | ||
const jws = await createJWS(encodedPayload, signer) | ||
@@ -691,0 +693,0 @@ expect(() => verifyJWS(jws, { publicKeyHex: publicKey } as VerificationMethod)).not.toThrow() |
import { parseKey } from '../util' | ||
import { fromString } from 'uint8arrays/from-string' | ||
@@ -12,4 +13,5 @@ describe('parseKey', () => { | ||
const privateKeyBytes = Uint8Array.from( | ||
Buffer.from('XfWLsGwi/rrGOClsD2KXA+K55KHZ1oKY3ewT0XV9c+BW0pm4zy/FqxLt72wLKKfVftBkmhiLbFuI508gh5LmLQ', 'base64') | ||
const privateKeyBytes = fromString( | ||
'XfWLsGwi/rrGOClsD2KXA+K55KHZ1oKY3ewT0XV9c+BW0pm4zy/FqxLt72wLKKfVftBkmhiLbFuI508gh5LmLQ', | ||
'base64' | ||
) | ||
@@ -16,0 +18,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { fromString } from 'uint8arrays' | ||
import { base64ToBytes, bytesToBase64url, decodeBase64url, toSealed } from './util' | ||
@@ -131,3 +132,3 @@ | ||
const sealed = toSealed(jwe.ciphertext, jwe.tag) | ||
const aad = new Uint8Array(Buffer.from(jwe.aad ? `${jwe.protected}.${jwe.aad}` : jwe.protected)) | ||
const aad = fromString(jwe.aad ? `${jwe.protected}.${jwe.aad}` : jwe.protected) | ||
let cleartext = null | ||
@@ -134,0 +135,0 @@ if (protHeader.alg === 'dir' && decrypter.alg === 'dir') { |
@@ -9,2 +9,3 @@ import { XChaCha20Poly1305 } from '@stablelib/xchacha20poly1305' | ||
import { ECDH } from './ECDH' | ||
import { fromString } from 'uint8arrays/from-string' | ||
@@ -149,3 +150,3 @@ /** | ||
const protHeader = encodeBase64url(JSON.stringify(Object.assign({ alg }, protectedHeader, { enc }))) | ||
const encodedAad = new Uint8Array(Buffer.from(aad ? `${protHeader}.${bytesToBase64url(aad)}` : protHeader)) | ||
const encodedAad = fromString(aad ? `${protHeader}.${bytesToBase64url(aad)}` : protHeader) | ||
return { | ||
@@ -152,0 +153,0 @@ ...xc20pEncrypt(cleartext, encodedAad), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1122450
10551