36 lines
809 B
TypeScript
36 lines
809 B
TypeScript
|
import EJSON from "../../../../../utils/ejson";
|
||
|
import encrypt from "../../../../dsql/encrypt";
|
||
|
|
||
|
type Param = {
|
||
|
email: string;
|
||
|
encryptionKey?: string;
|
||
|
encryptionSalt?: string;
|
||
|
};
|
||
|
|
||
|
export type EncryptResetPasswordObject = {
|
||
|
email: string;
|
||
|
createdAt: number;
|
||
|
};
|
||
|
|
||
|
export default function encryptReserPasswordUrl({
|
||
|
email,
|
||
|
encryptionKey,
|
||
|
encryptionSalt,
|
||
|
}: Param) {
|
||
|
const encryptObject: EncryptResetPasswordObject = {
|
||
|
email,
|
||
|
createdAt: Date.now(),
|
||
|
};
|
||
|
|
||
|
const encryptStr = encrypt({
|
||
|
data: EJSON.stringify(encryptObject) as string,
|
||
|
encryptionKey,
|
||
|
encryptionSalt,
|
||
|
});
|
||
|
|
||
|
const defaultUrlOrigin = `https://datasquirel.com`;
|
||
|
let urlOrigin = process.env.DSQL_HOST || defaultUrlOrigin;
|
||
|
|
||
|
const url = `${defaultUrlOrigin}`;
|
||
|
}
|