Fixed the undefined private key issue

This commit is contained in:
Vladyslav Matsiiako
2022-12-09 12:45:47 -05:00
parent 3d25baa319
commit 8266c4dd6d

View File

@@ -3,7 +3,7 @@ interface Props {
encryptedPrivateKey: string; encryptedPrivateKey: string;
iv: string; iv: string;
tag: string; tag: string;
privateTag: string; privateKey: string;
} }
export const saveTokenToLocalStorage = ({ export const saveTokenToLocalStorage = ({
@@ -11,14 +11,14 @@ export const saveTokenToLocalStorage = ({
encryptedPrivateKey, encryptedPrivateKey,
iv, iv,
tag, tag,
privateTag, privateKey,
}: Props) => { }: Props) => {
try { try {
localStorage.setItem("publicKey", publicKey); localStorage.setItem("publicKey", publicKey);
localStorage.setItem("encryptedPrivateKey", encryptedPrivateKey); localStorage.setItem("encryptedPrivateKey", encryptedPrivateKey);
localStorage.setItem("iv", iv); localStorage.setItem("iv", iv);
localStorage.setItem("tag", tag); localStorage.setItem("tag", tag);
localStorage.setItem("PRIVATE_KEY", privateTag); localStorage.setItem("PRIVATE_KEY", privateKey);
} catch (err) { } catch (err) {
if (err instanceof Error) { if (err instanceof Error) {
throw new Error( throw new Error(