mirror of
https://github.com/danbulant/jose
synced 2026-05-25 13:01:49 +00:00
922 B
922 B
Function: fromKeyLike
▸ fromKeyLike(key: KeyLike): Promise<JWK>
Defined in src/jwk/from_key_like.ts:32
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 { default: fromKeyLike } = require('jose/jwk/from_key_like')
example
// usage
const privateJwk = fromKeyLike(privateKey)
const publicJwk = fromKeyLike(publicKey)
console.log(privateJwk)
console.log(publicJwk)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
KeyLike | Key representation to transform to a JWK. |
Returns: Promise<JWK>