Sha256: 8e91b05f0a98f1c8f16e399ebe3d82197433e61d7f372648a82af0ce680934ef

Contents?: true

Size: 1.5 KB

Versions: 7

Compression:

Stored size: 1.5 KB

Contents

# <!-- rdoc-file=lib/securerandom.rb -->
# ## Secure random number generator interface.
#
# This library is an interface to secure random number generators which are
# suitable for generating session keys in HTTP cookies, etc.
#
# You can use this library in your application by requiring it:
#
#     require 'securerandom'
#
# It supports the following secure random number generators:
#
# *   openssl
# *   /dev/urandom
# *   Win32
#
# SecureRandom is extended by the Random::Formatter module which defines the
# following methods:
#
# *   alphanumeric
# *   base64
# *   choose
# *   gen_random
# *   hex
# *   rand
# *   random_bytes
# *   random_number
# *   urlsafe_base64
# *   uuid
#
# These methods are usable as class methods of SecureRandom such as
# `SecureRandom.hex`.
#
# If a secure random number generator is not available, `NotImplementedError` is
# raised.
#
module SecureRandom
  extend Random::Formatter

  # <!--
  #   rdoc-file=lib/securerandom.rb
  #   - alphanumeric(n = nil, chars: ALPHANUMERIC)
  # -->
  # Compatibility methods for Ruby 3.2, we can remove this after dropping to
  # support Ruby 3.2
  #
  def self.alphanumeric: (?Integer?) -> String

  def self.base64: (?Integer?) -> String

  def self.hex: (?Integer?) -> String

  def self.random_bytes: (?Integer?) -> String

  def self.random_number: () -> Float
                        | (Integer) -> Integer
                        | (Numeric) -> Numeric

  def self.urlsafe_base64: (?Integer?, ?bool?) -> String

  def self.uuid: () -> String
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rbs-3.9.0 stdlib/securerandom/0/securerandom.rbs
rbs-3.9.0.pre.2 stdlib/securerandom/0/securerandom.rbs
rbs-3.9.0.pre.1 stdlib/securerandom/0/securerandom.rbs
rbs-3.9.0.dev.1 stdlib/securerandom/0/securerandom.rbs
rbs-relaxed-3.9.0.1 stdlib/securerandom/0/securerandom.rbs
rbs-3.8.1 stdlib/securerandom/0/securerandom.rbs
rbs-3.8.0 stdlib/securerandom/0/securerandom.rbs