Sha256: ab2cfeae7baa63007789a184515523749f56e92cca589748db02a562179e7181

Contents?: true

Size: 560 Bytes

Versions: 122

Compression:

Stored size: 560 Bytes

Contents

# frozen_string_literal: true

require 'graphql/schema/base_64_bp'

module GraphQL
  class Schema
    # @api private
    module Base64Encoder
      def self.encode(unencoded_text, nonce: false)
        Base64Bp.urlsafe_encode64(unencoded_text, padding: false)
      end

      def self.decode(encoded_text, nonce: false)
        # urlsafe_decode64 is for forward compatibility
        Base64Bp.urlsafe_decode64(encoded_text)
      rescue ArgumentError
        raise GraphQL::ExecutionError, "Invalid input: #{encoded_text.inspect}"
      end
    end
  end
end

Version data entries

122 entries across 122 versions & 2 rubygems

Version Path
graphql-2.0.6 lib/graphql/schema/base_64_encoder.rb
graphql-2.0.5 lib/graphql/schema/base_64_encoder.rb
graphql-2.0.4 lib/graphql/schema/base_64_encoder.rb
graphql-2.0.3 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.11 lib/graphql/schema/base_64_encoder.rb
graphql-2.0.2 lib/graphql/schema/base_64_encoder.rb
graphql-2.0.1 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.10 lib/graphql/schema/base_64_encoder.rb
graphql-2.0.0 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.9 lib/graphql/schema/base_64_encoder.rb
graphql-1.12.24 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.8 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.7 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.6 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.5 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.4 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.3 lib/graphql/schema/base_64_encoder.rb
graphql-1.12.23 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.2 lib/graphql/schema/base_64_encoder.rb
graphql-1.13.1 lib/graphql/schema/base_64_encoder.rb