mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
[PM-16831] TS Strict crypto function service (#12737)
* strict types in crypto function services * Improve aesDecrypt types
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
export class DecryptParameters<T> {
|
||||
export type CbcDecryptParameters<T> = {
|
||||
encKey: T;
|
||||
data: T;
|
||||
iv: T;
|
||||
macKey: T;
|
||||
mac: T;
|
||||
macKey?: T;
|
||||
mac?: T;
|
||||
macData: T;
|
||||
}
|
||||
};
|
||||
|
||||
export type EcbDecryptParameters<T> = {
|
||||
encKey: T;
|
||||
data: T;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ import { EncryptionType } from "../../enums";
|
||||
|
||||
export class SymmetricCryptoKey {
|
||||
key: Uint8Array;
|
||||
encKey?: Uint8Array;
|
||||
encKey: Uint8Array;
|
||||
macKey?: Uint8Array;
|
||||
encType: EncryptionType;
|
||||
|
||||
@@ -48,12 +48,8 @@ export class SymmetricCryptoKey {
|
||||
throw new Error("Unsupported encType/key length.");
|
||||
}
|
||||
|
||||
if (this.key != null) {
|
||||
this.keyB64 = Utils.fromBufferToB64(this.key);
|
||||
}
|
||||
if (this.encKey != null) {
|
||||
this.encKeyB64 = Utils.fromBufferToB64(this.encKey);
|
||||
}
|
||||
this.keyB64 = Utils.fromBufferToB64(this.key);
|
||||
this.encKeyB64 = Utils.fromBufferToB64(this.encKey);
|
||||
if (this.macKey != null) {
|
||||
this.macKeyB64 = Utils.fromBufferToB64(this.macKey);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user