diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/gemcutter_utilities.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index 3ee8579933..c4f31dc0d6 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -2,6 +2,7 @@ require_relative "remote_fetcher" require_relative "text" +require_relative "webauthn_listener" ## # Utility methods for using the RubyGems API. @@ -260,13 +261,16 @@ module Gem::GemcutterUtilities end def wait_for_otp(webauthn_url) + server = TCPServer.new 0 + port = server.addr[1].to_s + thread = Thread.new do - Thread.current[:otp] = "Uvh6T57tkWuUnWYo" + Thread.current[:otp] = Gem::WebauthnListener.wait_for_otp_code(host, server) end thread.abort_on_exception = true thread.report_on_exception = false - url_with_port = "#{webauthn_url}?port=5678" + url_with_port = "#{webauthn_url}?port=#{port}" say "You have enabled multi-factor authentication. Please visit #{url_with_port} to authenticate via security device." thread.join |