This module provides instance methods for a digest implementation object to calculate message digest values.
Adds basic type aliases to the including class for use with Fiddle::Importer
.
The aliases added are uint
and u_int
(unsigned int
) and ulong
and u_long
(unsigned long
)
Use SSLContext
to set up the parameters for a TLS (former SSL
) connection. Both client and server TLS connections are supported, SSLSocket
and SSLServer
may be used in conjunction with an instance of SSLContext
to set up connections.
Net::HTTP
exception class. You cannot use Net::HTTPExceptions
directly; instead, you must use its subclasses.
Acceptable argument classes. Now contains DecimalInteger, OctalInteger and DecimalNumeric. See Acceptable argument classes (in source code).
The DSL
module provides a set of methods that can be used to create prism nodes in a more concise manner. For example, instead of writing:
source = Prism::Source.for("[1]") Prism::ArrayNode.new( source, 0, Prism::Location.new(source, 0, 3), 0, [ Prism::IntegerNode.new( source, 0, Prism::Location.new(source, 1, 1), Prism::IntegerBaseFlags::DECIMAL, 1 ) ], Prism::Location.new(source, 0, 1), Prism::Location.new(source, 2, 1) )
you could instead write:
class Builder include Prism::DSL attr_reader :default_source def initialize @default_source = source("[1]") end def build array_node( location: location(start_offset: 0, length: 3), elements: [ integer_node( location: location(start_offset: 1, length: 1), flags: integer_base_flag(:decimal), value: 1 ) ], opening_loc: location(start_offset: 0, length: 1), closing_loc: location(start_offset: 2, length: 1) ) end end
This is mostly helpful in the context of generating trees programmatically.
A module responsible for deserializing parse results.
This module is responsible for converting the prism syntax tree into other syntax trees.
Utility methods for using the RubyGems API.
The WebauthnListener
class retrieves an OTP after a user successfully WebAuthns with the Gem
host. An instance opens a socket using the TCPServer
instance given and listens for a request from the Gem
host. The request should be a GET request to the root path and contains the OTP code in the form of a query parameter ‘code`. The listener will return the code which will be used as the OTP for API requests.
Types of responses sent by the listener after receiving a request:
- 200 OK: OTP code was successfully retrieved - 204 No Content: If the request was an OPTIONS request - 400 Bad Request: If the request did not contain a query parameter `code` - 404 Not Found: The request was not to the root path - 405 Method Not Allowed: OTP code was not retrieved because the request was not a GET/OPTIONS request
Example usage:
thread = Gem::WebauthnListener.listener_thread("https://rubygems.example", server) thread.join otp = thread[:otp] error = thread[:error]
The WebauthnListener
Response class is used by the WebauthnListener
to create responses to be sent to the Gem
host. It creates a Gem::Net::HTTPResponse instance when initialized and can be converted to the appropriate format to be sent by a socket using ‘to_s`. Gem::Net::HTTPResponse instances cannot be directly sent over a socket.
Types of response classes:
- OkResponse - NoContentResponse - BadRequestResponse - NotFoundResponse - MethodNotAllowedResponse
Example usage:
server = TCPServer.new(0) socket = server.accept response = OkResponse.for("https://rubygems.example") socket.print response.to_s socket.close
The WebauthnPoller
class retrieves an OTP after a user successfully WebAuthns. An instance polls the Gem
host for the OTP code. The polling request (api/v1/webauthn_verification/<webauthn_token>/status.json) is sent to the Gem
host every 5 seconds and will timeout after 5 minutes. If the status field in the json response is “success”, the code field will contain the OTP code.
Example usage:
thread = Gem::WebauthnPoller.poll_thread( {}, "RubyGems.org", "https://rubygems.org/api/v1/webauthn_verification/odow34b93t6aPCdY", { email: "email@example.com", password: "password" } ) thread.join otp = thread[:otp] error = thread[:error]
A stub yaml serializer that can handle only hashes and strings (as of now).
An SSLContext
is used to set various options regarding certificates, algorithms, verification, session caching, etc. The SSLContext
is used to create an SSLSocket
.
All attributes must be set before creating an SSLSocket
as the SSLContext
will be frozen afterward.
SSLServer
represents a TCP/IP server socket with Secure Sockets Layer.
An OpenSSL::OCSP::BasicResponse
contains the status of a certificate check which is created from an OpenSSL::OCSP::Request
. A BasicResponse
is more detailed than a Response
.
Generic error class raised by SSLSocket
and SSLContext
.
This class represents a YAML Alias. It points to an anchor
.
A Psych::Nodes::Alias
is a terminal node and may have no children.
This class represents a YAML sequence.
A YAML
sequence is basically a list, and looks like this:
%YAML 1.1 --- - I am - a Sequence
A YAML
sequence may have an anchor like this:
%YAML 1.1 --- &A [ "This sequence", "has an anchor" ]
A YAML
sequence may also have a tag like this:
%YAML 1.1 --- !!seq [ "This sequence", "has a tag" ]
This class represents a sequence in a YAML
document. A Psych::Nodes::Sequence
node may have 0 or more children. Valid children for this node are: