refactor: MONOREPO

This commit is contained in:
Alexander Polynomdivision
2018-09-20 17:38:12 +02:00
parent 4c9e328ad0
commit 909149fdc7
50 changed files with 222 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
import { pbkdf2Sync } from "crypto";
export function isAuthenticated(token: string): Promise<boolean> {
return new Promise((res, rej) => {
// TODO
res(true);
});
}
export function performLogin(username: string, password: string): Promise<any | {}> {
return new Promise((res, rej) => {
// Hash the password
// TODO: Fetch the salt
const salt = "";
const hash = pbkdf2Sync(password, salt, 50000, 512, "sha512").toString("hex");
// TODO: Look up the user, compare hashes and send the returned user
res({
username: "Polynom",
uid: "1",
showWelcome: false,
classId: "test",
sessionToken: "abc123",
});
});
};