Stringify jwk

This commit is contained in:
Pieter Vander Vennet 2023-01-21 22:42:58 +01:00
parent a0580038a3
commit b4f28bc225
2 changed files with 3 additions and 3 deletions

View file

@ -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(<JWTPayload>payload)
.setProtectedHeader({
alg: algo,
kid,
jwk,
jwk: <any> jwk,
enc: "utf-8"
})
.sign(keypair.privateKey);

View file

@ -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": {