Skip to content

Commit

Permalink
Removed base64 require
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Dec 29, 2024
1 parent 694bc28 commit 8381f8c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.1 (unreleased)

- Added support for Ruby 3.4

## 2.0.0 (2024-10-26)

- Improved `attributes`, `attribute_names`, and `has_attribute?` when ciphertext attributes not loaded
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ gem "sqlite3"
gem "pg"
gem "mysql2"
gem "shrine"
gem "base64"
1 change: 0 additions & 1 deletion lib/lockbox.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# stdlib
require "base64"
require "openssl"
require "securerandom"
require "stringio"
Expand Down
4 changes: 2 additions & 2 deletions lib/lockbox/encryptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def initialize(**options)
def encrypt(message, **options)
message = check_string(message)
ciphertext = @boxes.first.encrypt(message, **options)
ciphertext = Base64.strict_encode64(ciphertext) if @encode
ciphertext = [ciphertext].pack("m0") if @encode
ciphertext
end

def decrypt(ciphertext, **options)
ciphertext = Base64.decode64(ciphertext) if @encode
ciphertext = ciphertext.unpack1("m") if @encode
ciphertext = check_string(ciphertext)

# ensure binary
Expand Down

0 comments on commit 8381f8c

Please sign in to comment.