Skip to content

Commit 62f508c

Browse files
refactor: remove default value from Encoders.lookup encoding argument
Let's add it to `Encoders.new` for backward compatibility.
1 parent e1b26bc commit 62f508c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/webauthn/encoder.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class Encoder
99

1010
def_delegators :@encoder_klass, :encode, :decode
1111

12-
def initialize(*args)
13-
@encoder_klass = Encoders.lookup(*args)
12+
def initialize(encoding = Encoders::STANDARD_ENCODING)
13+
@encoder_klass = Encoders.lookup(encoding)
1414
end
1515
end
1616
end

lib/webauthn/encoders.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
module WebAuthn
44
def self.standard_encoder
5-
@standard_encoder ||= Encoders.lookup
5+
@standard_encoder ||= Encoders.lookup(Encoders::STANDARD_ENCODING)
66
end
77

88
module Encoders
99
# https://www.w3.org/TR/webauthn-2/#base64url-encoding
1010
STANDARD_ENCODING = :base64url
1111

1212
class << self
13-
def lookup(encoding = STANDARD_ENCODING)
13+
def lookup(encoding)
1414
case encoding
1515
when :base64
1616
Base64Encoder

0 commit comments

Comments
 (0)