Module: UffizziCore::TokenService

Defined in:
app/services/uffizzi_core/token_service.rb

Class Method Summary collapse

Class Method Details

.decode(token) ⇒ Object



9
10
11
12
13
# File 'app/services/uffizzi_core/token_service.rb', line 9

def decode(token)
  JWT.decode(token, Settings.rails.secret_key_base, true, algorithm: 'HS256')
rescue JWT::DecodeError
  nil
end

.encode(payload) ⇒ Object



5
6
7
# File 'app/services/uffizzi_core/token_service.rb', line 5

def encode(payload)
  JWT.encode(payload, Settings.rails.secret_key_base, 'HS256')
end

.generateObject



15
16
17
# File 'app/services/uffizzi_core/token_service.rb', line 15

def generate
  SecureRandom.hex
end