lib/faye/authentication.rb in faye-authentication-0.2.0 vs lib/faye/authentication.rb in faye-authentication-0.3.0

- old
+ new

@@ -1,17 +1,18 @@ require 'jwt' require 'faye/authentication/version' -require 'faye/authentication/extension' +require 'faye/authentication/server_extension' +require 'faye/authentication/client_extension' require 'faye/authentication/http_client' require 'faye/authentication/engine' module Faye module Authentication class AuthError < StandardError; end class ExpiredError < AuthError; end class PayloadError < AuthError; end - # Return jwt signature, pass hash of payload including channel and client_id + # Return jwt signature, pass hash of payload including channel and client_id def self.sign(payload, secret, options = {}) options = {expires_at: Time.now + 12*3600, algorithm: 'HS256'}.merge(options) JWT.encode(payload.merge(exp: options[:expires_at].to_i), secret, options[:algorithm]) end