forked from corneh-king/KEITH-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.js
More file actions
24 lines (21 loc) · 680 Bytes
/
Copy pathauth.js
File metadata and controls
24 lines (21 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require('fs');
const { session } = require("./settings");
// Function to handle authentication and session management
async function authenticationn() {
try {
const credsPath = "./session/creds.json";
// Check if session file exists
if (!fs.existsSync(credsPath)) {
console.log("Connecting...");
await fs.writeFileSync(credsPath, atob(session), "utf8");
}
// If session is not "zokk", update session file
else if (session !== "zokk") {
await fs.writeFileSync(credsPath, atob(session), "utf8");
}
} catch (error) {
console.log("Session is invalid: " + error);
return;
}
}
module.exports = authenticationn;