Skip to content

Commit

Permalink
Fix lib types
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed May 29, 2022
1 parent 3ffb886 commit 1172ad9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
2 changes: 2 additions & 0 deletions lib/aes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = {
encrypt: (text, key) => {
const iv = crypto.randomBytes(ALGORITHM.IV_BYTE_LEN)
const cipher = crypto.createCipheriv(ALGORITHM.BLOCK_CIPHER, key, iv, {
// @ts-ignore
authTagLength: ALGORITHM.AUTH_TAG_BYTE_LEN,
})
let encryptedMessage = cipher.update(text)
Expand All @@ -64,6 +65,7 @@ module.exports = {
const iv = text.slice(0, 12)
const encryptedMessage = text.slice(12, -16)
const decipher = crypto.createDecipheriv(ALGORITHM.BLOCK_CIPHER, key, iv, {
// @ts-ignore
authTagLength: ALGORITHM.AUTH_TAG_BYTE_LEN,
})
decipher.setAuthTag(authTag)
Expand Down
25 changes: 4 additions & 21 deletions lib/logger/main/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
const fs = require("fs")
const path = require("path")

Expand Down Expand Up @@ -27,7 +28,6 @@ module.exports = logger = {
* Writes a log to the console
* @param {string} message
* @param {string|object} log
* @return {string} log
*/
log: (message, log) => {
if (typeof log === "object") {
Expand Down Expand Up @@ -56,7 +56,6 @@ module.exports = logger = {
* @param {string} id
* @param {string} message
* @param {string|object} log
* @return {string} log
*/
rendererLog: (id, message, log) => {
if (typeof log === "object") {
Expand Down Expand Up @@ -84,7 +83,6 @@ module.exports = logger = {
* Writes a warn to the console
* @param {string} message
* @param {string|object} warn
* @return {string} warn
*/
warn: (message, warn) => {
if (typeof warn === "object") {
Expand All @@ -110,10 +108,9 @@ module.exports = logger = {

/**
* Writes a warn to the console
* @param {string} id
* @param {string} id
* @param {string} message
* @param {string|object} warn
* @return {string} warn
*/
rendererWarn: (id, message, warn) => {
if (typeof warn === "object") {
Expand Down Expand Up @@ -141,7 +138,6 @@ module.exports = logger = {
* Writes an error to the console
* @param {string} message
* @param {string|object} error
* @return {string} error
*/
error: (message, error) => {
if (typeof error === "object") {
Expand Down Expand Up @@ -170,7 +166,6 @@ module.exports = logger = {
* @param {string} id
* @param {string} message
* @param {string|object} error
* @return {string} error
*/
rendererError: (id, message, error) => {
if (typeof error === "object") {
Expand Down Expand Up @@ -206,13 +201,7 @@ module.exports = logger = {
fs.mkdirSync(path.join(file, "logs"))
}

fs.writeFileSync(path.join(path.join(file, "logs"), `${name}-${time}.log`), "", (err) => {
if (err) {
return console.log(`error creating log ${err}`)
} else {
return console.log("log created")
}
})
fs.writeFileSync(path.join(path.join(file, "logs"), `${name}-${time}.log`), "")

file_name = `${name}-${time}.log`
file_path = path.join(file, "logs")
Expand All @@ -223,13 +212,7 @@ module.exports = logger = {
* @param {string} message
*/
writeFile: (message) => {
fs.appendFileSync(path.join(file_path, file_name), message, (err) => {
if (err) {
return console.log(`error creating log ${err}`)
} else {
return console.log("log created")
}
})
fs.appendFileSync(path.join(file_path, file_name), message)
},

/**
Expand Down
1 change: 0 additions & 1 deletion lib/logger/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module.exports = {
/**
* Get window name
* @param {string} name
* @return {string} window name
*/
getWindow: (name) => {
window = name
Expand Down

0 comments on commit 1172ad9

Please sign in to comment.