Reputation: 729
I've generated a private/public key pair with Jose.generateKeyPair()
and I exported the public key with Jose.exportJWK()
But the exported key does not have a KID or ALG property. Is there a way to generate these properties, or do I have to add them manually? Or, conversely, do I need to go about this differently?
import { NextResponse } from "next/server"
import { generateKeyPair, exportJWK } from "jose"
export async function GET(request: Request) {
const { publicKey, privateKey } = await generateKeyPair("RS256")
const exportedPublicKey = await exportJWK(publicKey)
return NextResponse.json({
keys: [exportedPublicKey]
})
}
Upvotes: 0
Views: 25