导入 public 键 'SubtleCrypto' 时出错:提供的值无法转换为序列

Error on importing a public key 'SubtleCrypto': The provided value cannot be converted to a sequence

我正在尝试将 public 密钥导入 crypto.subtle,但我收到了一个神秘的(双关语)错误:

Uncaught (in promise) TypeError: Failed to execute 'importKey' on 'SubtleCrypto': The provided value cannot be converted to a sequence.

这是我的钥匙:

jPublicJWK = {
  "crv":"P-256",
  "key_ops":"verify",
  "kty":"EC",
  "x":"QcQI-5wvczyuzU0SWl91tdUWbG5RMYFdNrOCNHen-08",
  "y":"sYVMwVF4ZO2-u0xPMyOXff7VoOQo6kdBv0IeEcnrYno",
  "use":"sig"
}

这是我导入的方式:

let jwkCryptoKey = await crypto.subtle.importKey(
    "jwk",
    jPublicJWK, 
    {
        name: "ECDSA",
        namedCurve: "P-256",
    },
    true,
    ["verify"]
);

我做错了什么?

根据rfckey_ops是一个数组。 “它的值是一个关键操作值的数组。”难以错过的小句子。

由于key_ops是可选的,可以全部删除,也可以放在一个数组中:

jPublicJWK = {
    "crv": "P-256",
    "kty": "EC",
    "key_ops": ["verify"],
    "x": "NDeK5mTx7Tse16x4ipl1m6NYDkwLO-YBU_BUqEtOuIM",
    "y": "9Q3XDebaKId0pmrPqVTTR__UnpBn2oxqY8nAlrTw_qU",
    "use": "sig"
};