Skip to content

Generate Key #417

Answered by panva
willyprayogo26 asked this question in Q&A
Discussion options

You must be logged in to vote
import * as jose from 'jose'

const keyPair = await jose.generateKeyPair('ES256')
const jwk = await jose.exportJWK(keyPair.publicKey)
const kid = await jose.calculateJwkThumbprint(jwk)

console.log({
  keys: [
    {
      ...jwk,
      kid,
      use: 'sig',
      alg: 'ES256'
    }
  ]
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by willyprayogo26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants