mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
fast decrypt
This commit is contained in:
8
src/models/domain/decryptParameters.ts
Normal file
8
src/models/domain/decryptParameters.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export class DecryptParameters<T> {
|
||||
encKey: T;
|
||||
data: T;
|
||||
iv: T;
|
||||
macKey: T;
|
||||
mac: T;
|
||||
macData: T;
|
||||
}
|
||||
@@ -9,6 +9,8 @@ export class SymmetricCryptoKey {
|
||||
encType: EncryptionType;
|
||||
|
||||
keyB64: string;
|
||||
encKeyB64: string;
|
||||
macKeyB64: string;
|
||||
|
||||
constructor(key: ArrayBuffer, encType?: EncryptionType) {
|
||||
if (key == null) {
|
||||
@@ -26,7 +28,6 @@ export class SymmetricCryptoKey {
|
||||
}
|
||||
|
||||
this.key = key;
|
||||
this.keyB64 = Utils.fromBufferToB64(key);
|
||||
this.encType = encType;
|
||||
|
||||
if (encType === EncryptionType.AesCbc256_B64 && key.byteLength === 32) {
|
||||
@@ -41,5 +42,15 @@ export class SymmetricCryptoKey {
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (this.macKey != null) {
|
||||
this.macKeyB64 = Utils.fromBufferToB64(this.macKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user