class SecureToken::SecureTokenHash

Public Class Methods

from_token(token, key_pair) click to toggle source
# File lib/secure_token.rb, line 22
def from_token(token, key_pair)
  decryptor = SecureTokenService::Decryptor.new(SecureTokenService::JSONSerializer.new)
  decrypted_token = decryptor.decrypt_and_verify(token, key_pair)
  decrypted_token ? new.merge(decrypted_token) : nil
end

Public Instance Methods

to_token(key_pair) click to toggle source
# File lib/secure_token.rb, line 29
def to_token(key_pair)
  encryptor = SecureTokenService::Encryptor.new(SecureTokenService::JSONSerializer.new)
  encryptor.encrypt_and_sign(self, key_pair)
end