module PlaceOS::Encryption

Overview

Provides symmetric key encryption/decryption

Defined in:

placeos-models/utilities/encryption.cr

Constant Summary

Log = ::Log.for(self)

Class Method Summary

Class Method Detail

def self.check?(encrypted : String, test : String, id : String, level : Level) : Bool #

Encrypt a test string with the encryption context in the cipher context and test for equality


def self.decrypt(string : String, id : String, level : Level, secret : String = SECRET) : String #

Decrypt cipher text. Does not decrypt

  • previously decrypted
  • values with Level::None encryption

def self.decrypt_for(user : Model::User | Model::UserJWT, string : String, id : String, level : Level) #

def self.encrypt(string : String, id : String, level : Level, secret : String = SECRET) : String #

Encrypt clear text

Does not encrypt

  • previously encrypted
  • values with Level::NoEncryption encryption

def self.is_encrypted?(string : String) #

Check if string has been encrypted