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

Fix type errors on Deno 2.5

parent 28f89453
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -119,6 +119,11 @@ await build({
      diagnostic.file?.fileName.endsWith("2KNRVU.ts")
    ) {
      return false; // ignore all diagnostics in this file
    } else if (
      diagnostic.code === 2315 &&
      diagnostic.messageText === "Type 'Uint8Array' is not generic."
    ) {
      return false;
    }
    // etc... more checks here
    return true;
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ test("MemoryKvStore", async (t) => {
    await store.set(["foo", "baz"], "baz", {
      ttl: Temporal.Duration.from({ seconds: 0 }),
    });
    await new Promise((resolve) => setTimeout(resolve, 10));
    assertEquals(await store.get(["foo", "baz"]), undefined);
  });

+6 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ const algorithms: Record<
 */
export async function importSpki(pem: string): Promise<CryptoKey> {
  pem = pem.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "");
  let spki: Uint8Array;
  let spki: Uint8Array<ArrayBuffer>;
  try {
    spki = decodeBase64(pem);
  } catch (_) {
@@ -111,7 +111,10 @@ export async function importMultibaseKey(key: string): Promise<CryptoKey> {
      format: "der",
      type: "pkcs1",
    });
    const spki = keyObject.export({ type: "spki", format: "der" }).buffer;
    const exported = keyObject.export({ type: "spki", format: "der" }).buffer;
    const spki = exported instanceof Uint8Array
      ? exported
      : new Uint8Array(exported);
    return await crypto.subtle.importKey(
      "spki",
      new Uint8Array(spki),
@@ -122,7 +125,7 @@ export async function importMultibaseKey(key: string): Promise<CryptoKey> {
  } else if (code === 0xed) { // ed25519-pub
    return await crypto.subtle.importKey(
      "raw",
      content,
      content.slice(),
      "Ed25519",
      true,
      ["verify"],
+2 −2
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ export async function verifySignature(
  const verified = await crypto.subtle.verify(
    "RSASSA-PKCS1-v1_5",
    key.publicKey,
    signature,
    signature.slice(),
    messageBytes,
  );
  if (verified) return key;
@@ -339,7 +339,7 @@ export async function verifySignature(
    const verified = await crypto.subtle.verify(
      "RSASSA-PKCS1-v1_5",
      key.publicKey,
      signature,
      signature.slice(),
      messageBytes,
    );
    return verified ? key : null;
+1 −1
Original line number Diff line number Diff line
@@ -352,7 +352,7 @@ async function verifyProofInternal(
  const verified = await crypto.subtle.verify(
    "Ed25519",
    publicKey.publicKey,
    proof.proofValue,
    proof.proofValue.slice(),
    digest,
  );
  if (!verified) {