fix: decryption errors
This commit is contained in:
parent
29dc5a8bb4
commit
9b67a253f1
1 changed files with 17 additions and 11 deletions
|
|
@ -96,6 +96,7 @@ export const base64Decode = (text: string): string => {
|
||||||
};
|
};
|
||||||
export const decrypt = (hashString: string) => {
|
export const decrypt = (hashString: string) => {
|
||||||
if (hashString) {
|
if (hashString) {
|
||||||
|
try {
|
||||||
const hash = JSON.parse(hashString);
|
const hash = JSON.parse(hashString);
|
||||||
const decipher = crypto.createDecipheriv(
|
const decipher = crypto.createDecipheriv(
|
||||||
algorithm,
|
algorithm,
|
||||||
|
|
@ -107,6 +108,11 @@ export const decrypt = (hashString: string) => {
|
||||||
decipher.final()
|
decipher.final()
|
||||||
]);
|
]);
|
||||||
return decrpyted.toString();
|
return decrpyted.toString();
|
||||||
|
} catch (error) {
|
||||||
|
console.log({ decryptionError: error.message })
|
||||||
|
return hashString
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export const encrypt = (text: string) => {
|
export const encrypt = (text: string) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue