summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authoricebaker <icebaker@proton.me>2023-06-03 20:35:23 -0300
committericebaker <icebaker@proton.me>2023-06-03 20:35:23 -0300
commit1be75c768ca9595b54d8e2d5a8287adbc950f659 (patch)
tree39df8578dd2bbed230e0d222d0175e088f97537e /components
parent7d728d02dea1430005ec9a24c20dd48ffa2c8efa (diff)
typo
Diffstat (limited to 'components')
-rw-r--r--components/crypto.rb4
1 files changed, 0 insertions, 4 deletions
diff --git a/components/crypto.rb b/components/crypto.rb
index 3f97f57..1848c9b 100644
--- a/components/crypto.rb
+++ b/components/crypto.rb
@@ -19,15 +19,11 @@ module NanoBot
end
def encrypt(content, soft: false)
- return content unless @box
-
nonce = soft ? @fixed_nonce : RbNaCl::Random.random_bytes(@box.nonce_bytes)
Base64.urlsafe_encode64(nonce + @box.encrypt(nonce, content))
end
def decrypt(content)
- return content unless @box
-
decoded_content = Base64.urlsafe_decode64(content)
nonce = decoded_content[0...@box.nonce_bytes]
cipher_text = decoded_content[@box.nonce_bytes..]