From b4f28bc225057e2f36554790e64dd462b87e3692 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 21 Jan 2023 22:42:58 +0100 Subject: [PATCH] Stringify jwk --- lib/Mangrove-reviews.ts | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Mangrove-reviews.ts b/lib/Mangrove-reviews.ts index 921b89e..2e22e80 100644 --- a/lib/Mangrove-reviews.ts +++ b/lib/Mangrove-reviews.ts @@ -75,12 +75,12 @@ export class MangroveReviews { payload = MangroveReviews.cleanPayload(payload) const algo = 'ES256' const kid = await MangroveReviews.publicToPem(keypair.publicKey) - const jwk = await crypto.subtle.exportKey('jwk', keypair.publicKey) + const jwk = JSON.stringify(await crypto.subtle.exportKey('jwk', keypair.publicKey)) return await new SignJWT(payload) .setProtectedHeader({ alg: algo, kid, - jwk, + jwk: jwk, enc: "utf-8" }) .sign(keypair.privateKey); diff --git a/package.json b/package.json index ebe07da..eacb66e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mangrove-reviews-typescript", - "version": "0.0.5", + "version": "0.0.6", "description": "A library to interface with Mangrove.reviews", "main": "lib/index.ts", "scripts": {