Skip to content

Commit 46fce42

Browse files
authored
Drop base64 gem dependency (#51)
1 parent e47cada commit 46fce42

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/protocol/http/header/authorization.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2023, by Samuel Williams.
55

6-
require 'base64'
7-
86
module Protocol
97
module HTTP
108
module Header
@@ -21,10 +19,10 @@ def credentials
2119
end
2220

2321
def self.basic(username, password)
24-
encoded = "#{username}:#{password}"
22+
strict_base64_encoded = ["#{username}:#{password}"].pack('m0')
2523

2624
self.new(
27-
"Basic #{Base64.strict_encode64(encoded)}"
25+
"Basic #{strict_base64_encoded}"
2826
)
2927
end
3028
end

protocol-http.gemspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ Gem::Specification.new do |spec|
2222
spec.files = Dir.glob(['{lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)
2323

2424
spec.required_ruby_version = ">= 3.0"
25-
26-
spec.add_dependency "base64"
2725
end

0 commit comments

Comments
 (0)