mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
30 lines
662 B
TypeScript
30 lines
662 B
TypeScript
interface Props {
|
|
publicKey: string;
|
|
encryptedPrivateKey: string;
|
|
iv: string;
|
|
tag: string;
|
|
privateTag: string;
|
|
}
|
|
|
|
export const saveTokenToLocalStorage = ({
|
|
publicKey,
|
|
encryptedPrivateKey,
|
|
iv,
|
|
tag,
|
|
privateTag,
|
|
}: Props) => {
|
|
try {
|
|
localStorage.setItem("publicKey", publicKey);
|
|
localStorage.setItem("encryptedPrivateKey", encryptedPrivateKey);
|
|
localStorage.setItem("iv", iv);
|
|
localStorage.setItem("tag", tag);
|
|
localStorage.setItem("PRIVATE_KEY", privateTag);
|
|
} catch (err) {
|
|
if (err instanceof Error) {
|
|
throw new Error(
|
|
"Unable to send the tokens in local storage:" + err.message
|
|
);
|
|
}
|
|
}
|
|
};
|