mirror of
https://github.com/danbulant/jose
synced 2026-05-25 04:51:47 +00:00
1 KiB
1 KiB
Function: fromKeyLike
jwk/from_key_like.fromKeyLike
▸ fromKeyLike(key): Promise<JWK>
Converts a runtime-specific key representation (KeyLike) to a JWK.
example ESM import
import { fromKeyLike } from 'jose/jwk/from_key_like'
example CJS import
const { fromKeyLike } = require('jose/jwk/from_key_like')
example Deno import
import { fromKeyLike } from 'https://deno.land/x/jose@v3.15.5/jwk/from_key_like.ts'
example Usage
const privateJwk = await fromKeyLike(privateKey)
const publicJwk = await fromKeyLike(publicKey)
console.log(privateJwk)
console.log(publicJwk)
Parameters
| Name | Type | Description |
|---|---|---|
key |
KeyLike |
Key representation to transform to a JWK. |
Returns
Promise<JWK>