From 3cf6ea882be4fc4e124e2f05c2861f48627dbd39 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Thu, 16 Sep 2021 11:28:29 -0500 Subject: [PATCH] Remove unnecessary `any` casts from `ts/Crypto.ts` --- ts/Crypto.ts | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/ts/Crypto.ts b/ts/Crypto.ts index 291a2023f1d3..1a6ea087b354 100644 --- a/ts/Crypto.ts +++ b/ts/Crypto.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Signal Messenger, LLC +// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import { Buffer } from 'buffer'; @@ -406,11 +406,7 @@ export async function encryptAes256CbcPkcsPadding( const cryptoKey = await window.crypto.subtle.importKey( 'raw', key, - // `algorithm` appears to be an instance of AesCbcParams, - // which is not in the param's types, so we need to pass as `any`. - // TODO: just pass the string "AES-CBC", per the docs? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - algorithm as any, + algorithm, extractable, ['encrypt'] ); @@ -432,11 +428,7 @@ export async function decryptAes256CbcPkcsPadding( const cryptoKey = await window.crypto.subtle.importKey( 'raw', key, - // `algorithm` appears to be an instance of AesCbcParams, - // which is not in the param's types, so we need to pass as `any`. - // TODO: just pass the string "AES-CBC", per the docs? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - algorithm as any, + algorithm, extractable, ['decrypt'] ); @@ -477,11 +469,7 @@ export async function encryptAesGcm( const cryptoKey = await crypto.subtle.importKey( 'raw', key, - // `algorithm` appears to be an instance of AesGcmParams, - // which is not in the param's types, so we need to pass as `any`. - // TODO: just pass the string "AES-GCM", per the docs? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - algorithm as any, + algorithm, extractable, ['encrypt'] ); @@ -506,11 +494,7 @@ export async function decryptAesGcm( const cryptoKey = await crypto.subtle.importKey( 'raw', key, - // `algorithm` appears to be an instance of AesGcmParams, - // which is not in the param's types, so we need to pass as `any`. - // TODO: just pass the string "AES-GCM", per the docs? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - algorithm as any, + algorithm, extractable, ['decrypt'] );