// import * as crypto from "crypto-js" import { IUser } from "../models/user"; import { IClient } from "../models/client"; import * as crypto from "crypto" function sha512(text: string) { let hash = crypto.createHash("sha512") hash.update(text) return hash.digest("base64") } export function getEncryptionKey(user: IUser, client: IClient) { return sha512(sha512(user.encryption_key) + sha512(client._id.toHexString()) + sha512(client.client_id)) }