refactor/support multiple discord guilds with 1 nitrado server each + better handling for NitradoAPI
This commit is contained in:
33 files changed
+888
-1028
No files matched your search
@@ -0,0 +1,19 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
module.exports = {
|
||||
encrypt: (data, EncryptionMethod, Key, EncryptionIV) => {
|
||||
const cipher = crypto.createCipheriv(EncryptionMethod, Key, EncryptionIV)
|
||||
return Buffer.from(
|
||||
cipher.update(data, 'utf8', 'hex') + cipher.final('hex')
|
||||
).toString('base64') // Encrypts data and converts to hex and base64
|
||||
},
|
||||
|
||||
decrypt: (data, EncryptionMethod, Key, EncryptionIV) => {
|
||||
const buff = Buffer.from(data, 'base64')
|
||||
const decipher = crypto.createDecipheriv(EncryptionMethod, Key, EncryptionIV)
|
||||
return (
|
||||
decipher.update(buff.toString('utf8'), 'hex', 'utf8') +
|
||||
decipher.final('utf8')
|
||||
) // Decrypts data and converts to utf8
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user