Skip to main content

import_key_jwk

Function import_key_jwk 

Source
pub async fn import_key_jwk(
    variant: Sha2Variant,
    jwk: String,
    options: MacKeyOptions,
) -> Result<MacKey, Error>
Expand description

Import an RFC 7517 JSON Web Key as an HMAC key over the declared SHA-2 variant.

jwk is the JWK as JSON text; the implementation owns the parse (see README.md, “JWK contract”). The key must be an oct key whose alg, if present, names the declared variant ("HS256"/"HS384"/"HS512"), with ext validated against the options’ extractability; the decoded material is then subject to import-key-raw’s contract.