forked from Hri7566/mpp-server-dev2
User ID functions
This commit is contained in:
parent
cc3a7a7b43
commit
68f445ea03
|
@ -0,0 +1,10 @@
|
|||
import { createHash, randomBytes } from "crypto";
|
||||
import env from "./env";
|
||||
|
||||
export function createID() {
|
||||
return randomBytes(12).toString("hex");
|
||||
}
|
||||
|
||||
export function createUserID(ip: string) {
|
||||
return createHash("sha-256").update(ip).update(env.SALT).digest("hex");
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
Loading…
Reference in New Issue