Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.06 KB

key_import.importSPKI.md

File metadata and controls

32 lines (23 loc) · 1.06 KB

Function: importSPKI

💗 Help the project

importSPKI(spki, alg, options?): Promise<KeyLike>

Imports a PEM-encoded SPKI string as a runtime-specific public key representation (KeyObject or CryptoKey). See Algorithm Key Requirements to learn about key to algorithm requirements and mapping.

example Usage

const algorithm = 'ES256'
const spki = `-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM
YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg==
-----END PUBLIC KEY-----`
const ecPublicKey = await jose.importSPKI(spki, algorithm)

Parameters

Name Type Description
spki string -
alg string JSON Web Algorithm identifier to be used with the imported key.
options? PEMImportOptions -

Returns

Promise<KeyLike>