summaryrefslogtreecommitdiff
path: root/controllers/security.rb
diff options
context:
space:
mode:
authoricebaker <icebaker@proton.me>2023-06-03 20:33:53 -0300
committericebaker <icebaker@proton.me>2023-06-03 20:33:53 -0300
commit7d728d02dea1430005ec9a24c20dd48ffa2c8efa (patch)
tree7b5cf92efa043f9633813838864fcde272f0687e /controllers/security.rb
parentec1975b2c499f1639d0926641128d9382bd84485 (diff)
security
Diffstat (limited to 'controllers/security.rb')
-rw-r--r--controllers/security.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/controllers/security.rb b/controllers/security.rb
index 94cc9ff..8f066a5 100644
--- a/controllers/security.rb
+++ b/controllers/security.rb
@@ -5,12 +5,20 @@ require_relative '../components/crypto'
module NanoBot
module Controllers
module Security
+ def self.decrypt(content)
+ Components::Crypto.decrypt(content)
+ end
+
def self.check
password = ENV.fetch('NANO_BOTS_ENCRYPTION_PASSWORD', nil)
password = 'UNSAFE' unless password && password != ''
{
- encryption: Components::Crypto.encrypt('SAFE') != 'SAFE',
+ encryption: (
+ Components::Crypto.encrypt('SAFE') != 'SAFE' &&
+ Components::Crypto.encrypt('SAFE') != Components::Crypto.encrypt('SAFE') &&
+ Components::Crypto.decrypt(Components::Crypto.encrypt('SAFE')) == 'SAFE'
+ ),
password: password != 'UNSAFE'
}
end