Unverified Commit 24a76d0c authored by Hong Minhee's avatar Hong Minhee
Browse files

Add alg property to Ed25519 keys in exportJwk()

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

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.5.1
-------------
+2 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ const ed25519Pem = "-----BEGIN PUBLIC KEY-----\n" +
// cSpell: enable

const ed25519Jwk = {
  alg: "Ed25519",
  kty: "OKP",
  crv: "Ed25519",
  // cSpell: disable
@@ -159,6 +160,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
@@ -100,7 +100,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;
}

/**