Remove unnecessary any casts from ts/Crypto.ts

This commit is contained in:
Evan Hahn 2021-09-16 11:28:29 -05:00 committed by GitHub
parent 139e17f695
commit 3cf6ea882b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
// Copyright 2020 Signal Messenger, LLC // Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { Buffer } from 'buffer'; import { Buffer } from 'buffer';
@ -406,11 +406,7 @@ export async function encryptAes256CbcPkcsPadding(
const cryptoKey = await window.crypto.subtle.importKey( const cryptoKey = await window.crypto.subtle.importKey(
'raw', 'raw',
key, key,
// `algorithm` appears to be an instance of AesCbcParams, algorithm,
// 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,
extractable, extractable,
['encrypt'] ['encrypt']
); );
@ -432,11 +428,7 @@ export async function decryptAes256CbcPkcsPadding(
const cryptoKey = await window.crypto.subtle.importKey( const cryptoKey = await window.crypto.subtle.importKey(
'raw', 'raw',
key, key,
// `algorithm` appears to be an instance of AesCbcParams, algorithm,
// 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,
extractable, extractable,
['decrypt'] ['decrypt']
); );
@ -477,11 +469,7 @@ export async function encryptAesGcm(
const cryptoKey = await crypto.subtle.importKey( const cryptoKey = await crypto.subtle.importKey(
'raw', 'raw',
key, key,
// `algorithm` appears to be an instance of AesGcmParams, algorithm,
// 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,
extractable, extractable,
['encrypt'] ['encrypt']
); );
@ -506,11 +494,7 @@ export async function decryptAesGcm(
const cryptoKey = await crypto.subtle.importKey( const cryptoKey = await crypto.subtle.importKey(
'raw', 'raw',
key, key,
// `algorithm` appears to be an instance of AesGcmParams, algorithm,
// 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,
extractable, extractable,
['decrypt'] ['decrypt']
); );