lib/yubikey/otp_verify.rb in yubikey-1.3.0 vs lib/yubikey/otp_verify.rb in yubikey-1.3.1
- old
+ new
@@ -8,16 +8,16 @@
class OTP::Verify
# The raw status from the Yubico server
attr_reader :status
def initialize(args)
- raise(ArgumentError, "Must supply API ID") if args[:api_id].nil?
- raise(ArgumentError, "Must supply API Key") if args[:api_key].nil?
+ @api_key = args[:api_key] || Yubikey.api_key
+ @api_id = args[:api_id] || Yubikey.api_id
+ raise(ArgumentError, "Must supply API ID") if @api_id.nil?
+ raise(ArgumentError, "Must supply API Key") if @api_key.nil?
+
raise(ArgumentError, "Must supply OTP") if args[:otp].nil?
- @api_key = args[:api_key]
- @api_id = args[:api_id]
-
@url = args[:url] || API_URL
@nonce = args[:nonce] || OTP::Verify.generate_nonce(32)
verify(args)
end