perf(editor): ⚡️ Improve graph transition perf
This commit is contained in:
@ -6,7 +6,7 @@ const secretKey = process.env.ENCRYPTION_SECRET
|
||||
export const encrypt = (
|
||||
data: object
|
||||
): { encryptedData: string; iv: string } => {
|
||||
if (!secretKey) throw new Error(`SECRET is not in environment`)
|
||||
if (!secretKey) throw new Error(`ENCRYPTION_SECRET is not in environment`)
|
||||
const iv = randomBytes(16)
|
||||
const cipher = createCipheriv(algorithm, secretKey, iv)
|
||||
const dataString = JSON.stringify(data)
|
||||
@ -20,7 +20,7 @@ export const encrypt = (
|
||||
}
|
||||
|
||||
export const decrypt = (encryptedData: string, auth: string): object => {
|
||||
if (!secretKey) throw new Error(`SECRET is not in environment`)
|
||||
if (!secretKey) throw new Error(`ENCRYPTION_SECRET is not in environment`)
|
||||
const [iv, tag] = auth.split('.')
|
||||
const decipher = createDecipheriv(
|
||||
algorithm,
|
||||
|
Reference in New Issue
Block a user