Sha256: fea3ea09b15451f7e580e2133ed98e3c7bd1f6330d87d663e3013540026a02f9

Contents?: true

Size: 391 Bytes

Versions: 1

Compression:

Stored size: 391 Bytes

Contents

module AmazonAuth
  class Converter

    def self.encode(str)
      raise "Empty string" if str.to_s.size == 0
      Base64.strict_encode64("#{salt}#{str}")
    end

    def self.decode(code)
      raise "Empty string" if code.to_s.size == 0
      Base64.strict_decode64(code).gsub(/\A#{salt}/, '')
    end

    def self.salt
      ENV['AMAZON_CODE_SALT'] || "iloveamazon"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amazon_auth-0.1.0 lib/amazon_auth/converter.rb