Remove storage of protected key

This commit is contained in:
Tuan Dang
2023-02-21 12:31:19 +07:00
parent 74e78bb967
commit 1ff2c61b3a
8 changed files with 14 additions and 15 deletions

View File

@@ -166,9 +166,6 @@ export default function UserInfoStep({
SecurityClient.setToken(response.token);
saveTokenToLocalStorage({
protectedKey,
protectedKeyIV,
protectedKeyTag,
publicKey,
encryptedPrivateKey,
iv: encryptedPrivateKeyIV,

View File

@@ -97,9 +97,6 @@ const attemptLogin = async (
});
saveTokenToLocalStorage({
protectedKey,
protectedKeyIV,
protectedKeyTag,
publicKey,
encryptedPrivateKey,
iv,

View File

@@ -70,9 +70,6 @@ const attemptLoginMfa = async ({
});
saveTokenToLocalStorage({
protectedKey,
protectedKeyIV,
protectedKeyTag,
publicKey,
encryptedPrivateKey,
iv,

View File

@@ -117,9 +117,6 @@ const changePassword = async (
});
saveTokenToLocalStorage({
protectedKey,
protectedKeyIV,
protectedKeyTag,
encryptedPrivateKey,
iv: encryptedPrivateKeyIV,
tag: encryptedPrivateKeyTag

View File

@@ -1,6 +1,8 @@
import Aes256Gcm from '@app/components/utilities/cryptography/aes-256-gcm';
import { deriveArgonKey } from '@app/components/utilities/cryptography/crypto';
import { KeyService } from '../services';
/**
* @param {Object} obj
* @param {Number} obj.encryptionVersion
@@ -79,6 +81,7 @@ let privateKey;
throw new Error('Failed to decrypt private key');
}
KeyService.setPrivateKey(privateKey);
return privateKey;
}

View File

@@ -152,9 +152,6 @@ export default function SignupInvite() {
SecurityClient.setToken(jwtToken);
saveTokenToLocalStorage({
protectedKey,
protectedKeyIV,
protectedKeyTag,
publicKey,
encryptedPrivateKey,
iv: encryptedPrivateKeyIV,

View File

@@ -12,6 +12,10 @@ import {
*/
class KeyService {
private static privateKey: string = '';
static setPrivateKey(privateKey: string) {
KeyService.privateKey = privateKey;
}
/** Return the user's decrypted private key
* @param {Object} obj

View File

@@ -0,0 +1,7 @@
import KeyService from './KeyService';
import ProjectService from './ProjectService';
export {
KeyService,
ProjectService
}