Skip to main content

import_public_key_jwk

Function import_public_key_jwk 

Source
pub async fn import_public_key_jwk(
    variant: EcdhVariant,
    jwk: String,
) -> Result<PublicKey, Error>
Expand description

Import a public key as an EC public JWK (kty: "EC", with crv, x, and y). jwk is the JWK as JSON text; see mac-key.export-key-jwk for the package-wide JWK contract (alg is ignored entirely, WebCrypto’s rule for the ECDH family). The JWK’s crv must match the declared variant’s curve (error.invalid-key otherwise), and the encoded point is admitted exactly as import-public-key-raw admits it.