Class: Clavis::Security::TokenStorage::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/clavis/security/token_storage.rb

Overview

Serializer class for ActiveRecord::Encryption

Instance Method Summary collapse

Instance Method Details

#dump(token) ⇒ String Also known as: serialize

Serialize and encrypt a token

Parameters:

  • token (String, Hash)

    The token to serialize

Returns:

  • (String)

    The serialized and encrypted token



97
98
99
# File 'lib/clavis/security/token_storage.rb', line 97

def dump(token)
  TokenStorage.encrypt(token)
end

#load(encrypted_token) ⇒ String, Hash Also known as: deserialize

Deserialize and decrypt a token

Parameters:

  • encrypted_token (String)

    The encrypted token to deserialize

Returns:

  • (String, Hash)

    The deserialized and decrypted token



104
105
106
# File 'lib/clavis/security/token_storage.rb', line 104

def load(encrypted_token)
  TokenStorage.decrypt(encrypted_token)
end