Sha256: 5b96d6ca0e37fbe6b1795afa698c1bfc878f50a0818494a8f47d518397f69d4c

Contents?: true

Size: 497 Bytes

Versions: 45

Compression:

Stored size: 497 Bytes

Contents

require 'jwt'

module Ecom
  module Core
    class TokenAuthService
      AUTH_SECRET = '31a70abfaa57e5e77a3fc9f27aeaaf59b9a9f5355b5e16c842ee172035a8ed40bf82c1c971ecc176e4f0b4c9e6141db07fd4a5af3f7db9265e719fbe340b105a'

      def self.issue(payload)
        JWT.encode(payload, auth_secret, 'HS256')
      end

      def self.decode(token)
        JWT.decode(token, auth_secret, true, algorithm: 'HS256').first
      end

      def self.auth_secret
        AUTH_SECRET
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
ecom_core-1.1.0 app/services/ecom/core/token_auth_service.rb
ecom_core-1.0.25 app/services/ecom/core/token_auth_service.rb
ecom_core-1.0.24 app/services/ecom/core/token_auth_service.rb
ecom_core-1.0.23 app/services/ecom/core/token_auth_service.rb
ecom_core-1.0.22 app/services/ecom/core/token_auth_service.rb