Unverified Commit ec818548 authored by Hong Minhee's avatar Hong Minhee
Browse files

Add alg property to Ed25519 keys in exportJwk()

parent edcb945f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ Version 1.0.25

To be released.

 -  The `exportJwk()` function now populates the `alg` property of a returned
    `JsonWebKey` object with `"Ed25519"` if the input key is an Ed25519 key.


Version 1.0.24
--------------
+2 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ const ed25519Pem = "-----BEGIN PUBLIC KEY-----\n" +
// cSpell: enable

const ed25519Jwk = {
  alg: "Ed25519",
  kty: "OKP",
  crv: "Ed25519",
  // cSpell: disable
@@ -130,6 +131,7 @@ test("exportMultibaseKey()", async () => {
  );

  const ed25519Key2 = await importJwk({
    alg: "Ed25519",
    crv: "Ed25519",
    ext: true,
    key_ops: ["verify"],
+3 −1
Original line number Diff line number Diff line
@@ -93,7 +93,9 @@ export function generateCryptoKeyPair(
 */
export async function exportJwk(key: CryptoKey): Promise<JsonWebKey> {
  validateCryptoKey(key);
  return await crypto.subtle.exportKey("jwk", key);
  const jwk = await crypto.subtle.exportKey("jwk", key);
  if (jwk.crv === "Ed25519") jwk.alg = "Ed25519";
  return jwk;
}

/**