D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Gem
/
GemcutterUtilities
/
Filename :
cdesc-GemcutterUtilities.ri
back
Copy
U:RDoc::NormalModule[iI"GemcutterUtilities:ETI"Gem::GemcutterUtilities;T0o:RDoc::Markup::Document:@parts[ o;;[o:RDoc::Markup::Paragraph;[I"0Utility methods for using the RubyGems API.;T: @fileI"(lib/rubygems/gemcutter_utilities.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o; ;[ I"hThe WebauthnListener class retrieves an OTP after a user successfully WebAuthns with the Gem host. ;TI"pAn instance opens a socket using the TCPServer instance given and listens for a request from the Gem host. ;TI"`The request should be a GET request to the root path and contains the OTP code in the form ;TI"fof a query parameter `code`. The listener will return the code which will be used as the OTP for ;TI"API requests.;To:RDoc::Markup::BlankLine o; ;[I"GTypes of responses sent by the listener after receiving a request:;To:RDoc::Markup::Verbatim;[ I"3- 200 OK: OTP code was successfully retrieved ;TI"=- 204 No Content: If the request was an OPTIONS request ;TI"P- 400 Bad Request: If the request did not contain a query parameter `code` ;TI";- 404 Not Found: The request was not to the root path ;TI"l- 405 Method Not Allowed: OTP code was not retrieved because the request was not a GET/OPTIONS request ;T:@format0o; ;[I"Example usage:;T@o; ;[ I"Xthread = Gem::WebauthnListener.listener_thread("https://rubygems.example", server) ;TI"thread.join ;TI"otp = thread[:otp] ;TI"error = thread[:error];T;0; I":lib/rubygems/gemcutter_utilities/webauthn_listener.rb;T;0o;;[o; ;[ I"SThe WebauthnListener Response class is used by the WebauthnListener to create ;TI"Xresponses to be sent to the Gem host. It creates a Gem::Net::HTTPResponse instance ;TI"jwhen initialized and can be converted to the appropriate format to be sent by a socket using `to_s`. ;TI"LGem::Net::HTTPResponse instances cannot be directly sent over a socket.;T@o; ;[I"Types of response classes:;To; ;[ I"- OkResponse ;TI"- NoContentResponse ;TI"- BadRequestResponse ;TI"- NotFoundResponse ;TI" - MethodNotAllowedResponse ;T;0o; ;[I"Example usage:;T@o; ;[I"server = TCPServer.new(0) ;TI"socket = server.accept ;TI" ;TI";response = OkResponse.for("https://rubygems.example") ;TI" socket.print response.to_s ;TI"socket.close;T;0; I"Clib/rubygems/gemcutter_utilities/webauthn_listener/response.rb;T;0o;;[ o; ;[ I"`The WebauthnPoller class retrieves an OTP after a user successfully WebAuthns. An instance ;TI"zpolls the Gem host for the OTP code. The polling request (api/v1/webauthn_verification/<webauthn_token>/status.json) ;TI"xis sent to the Gem host every 5 seconds and will timeout after 5 minutes. If the status field in the json response ;TI"<is "success", the code field will contain the OTP code.;T@o; ;[I"Example usage:;T@o; ;[I"/thread = Gem::WebauthnPoller.poll_thread( ;TI" {}, ;TI" "RubyGems.org", ;TI"M "https://rubygems.org/api/v1/webauthn_verification/odow34b93t6aPCdY", ;TI"< { email: "email@example.com", password: "password" } ;TI") ;TI"thread.join ;TI"otp = thread[:otp] ;TI"error = thread[:error];T;0; I"8lib/rubygems/gemcutter_utilities/webauthn_poller.rb;T;0; 0;0[[ I" host;TI"W;T:publicFI"(lib/rubygems/gemcutter_utilities.rb;T[ I" scope;T@g;F@h[U:RDoc::Constant[i I"ERROR_CODE;TI"(Gem::GemcutterUtilities::ERROR_CODE;T;0o;;[ ; @;0@@cRDoc::NormalModule0U;[i I"API_SCOPES;TI"(Gem::GemcutterUtilities::API_SCOPES;T;0o;;[ ; @;0@@@r0U;[i I"EXCLUSIVELY_API_SCOPES;TI"4Gem::GemcutterUtilities::EXCLUSIVELY_API_SCOPES;T;0o;;[ ; @;0@@@r0[[I"Gem::Text;To;;[ ; @;0@h[[I" class;T[[;[ [:protected[ [:private[ [I" instance;T[[;[[I"add_key_option;T@h[I"add_otp_option;T@h[I"api_key;T@h[I" host;T@h[I"mfa_unauthorized?;T@h[I"otp;T@h[I"rubygems_api_request;T@h[I"set_api_key;T@h[I"sign_in;T@h[I"update_scope;T@h[I"verify_api_key;T@h[I"webauthn_enabled?;T@h[I"with_response;T@h[;[ [;[[I"api_key_forbidden?;T@h[I"default_host?;T@h[I"fetch_otp;T@h[I"get_key_name;T@h[I"get_mfa_params;T@h[I"get_scope_params;T@h[I"get_user_profile;T@h[I"pretty_host;T@h[I"request_with_otp;T@h[I"wait_for_otp_thread;T@h[I"webauthn_verification_url;T@h[ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[ @@.@L@cI"Gem;T@r