Skip to content

Commit

Permalink
Remove unnecessary type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Jul 13, 2024
1 parent 44d22af commit cac3962
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/checksum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ export async function verifyChecksum(mod: IChecksumModule, key: Uint8Array, ciph
if (globalThis?.crypto?.subtle) {
return verifyChecksumWebCrypto(mod, key, ciphertext);
}
return equalsBytes(hexToBytes(mod.message), sha256(checksumData(key as Uint8Array, ciphertext)));
return equalsBytes(hexToBytes(mod.message), sha256(checksumData(key, ciphertext)));
} else {
throw new Error("Invalid checksum type");
}
}

async function verifyChecksumWebCrypto(mod: IChecksumModule, key: Uint8Array, ciphertext: Uint8Array) {
async function verifyChecksumWebCrypto(mod: IChecksumModule, key: Uint8Array, ciphertext: Uint8Array): Promise<boolean> {
if (mod.function === "sha256") {
const data = checksumData(key, ciphertext);
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", data));
Expand Down

0 comments on commit cac3962

Please sign in to comment.