Sha256: 2ffd2fd3b28094e98327f7bfa589fecaaa4a2aafa46dbd27e9561bf181eec985

Contents?: true

Size: 361 Bytes

Versions: 11

Compression:

Stored size: 361 Bytes

Contents

# frozen_string_literal: true

require 'base64'

module JWT
  # Base64 helpers
  class Base64
    class << self
      def url_encode(str)
        ::Base64.encode64(str).tr('+/', '-_').gsub(/[\n=]/, '')
      end

      def url_decode(str)
        str += '=' * (4 - str.length.modulo(4))
        ::Base64.decode64(str.tr('-_', '+/'))
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
jwt-2.7.1 lib/jwt/base64.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/jwt-2.7.0/lib/jwt/base64.rb
jwt-2.7.0 lib/jwt/base64.rb
jwt-2.6.0 lib/jwt/base64.rb
jwt-2.5.0 lib/jwt/base64.rb
jwt-2.3.0 lib/jwt/base64.rb
jwt-2.2.3 lib/jwt/base64.rb
jwt-2.2.2 lib/jwt/base64.rb
jwt-2.2.1 lib/jwt/base64.rb
jwt-2.2.0 lib/jwt/base64.rb
jwt-2.2.0.pre.beta.0 lib/jwt/base64.rb