FieldCrypt
trait FieldCrypt
Trait allowing objects to store fields encrypted with an account's crypto
The encryption uses the owner account's secret-key crypto (only accessible by them)
Properties
| private | $crypto_cache | Stores fields decrypted in memory |
Methods
Returns the list of fields encrypted in this object
Returns the account that owns this object
Returns all objects owned by the given account
Gets the extra DB fields required for this trait
Returns true if the given DB field is encrypted
Returns true if field crypto is unlockable
Decrypts and returns the value of the given field
Unlocks account crypto for usage and returns it
Decrypts and returns the value of the given field
Sets the value of the given field
Sets the crypto state of all stored fields
Loads any objects for the given account and decrypts their fields
Details
at line 19
abstract static protected array
getEncryptedFields()
Returns the list of fields encrypted in this object
at line 22
abstract protected Account|null
GetAccount()
Returns the account that owns this object
at line 25
abstract static array
LoadByAccount(ObjectDatabase $database, Account $account)
Returns all objects owned by the given account
at line 28
static array
GetFieldCryptFieldTemplate()
Gets the extra DB fields required for this trait
at line 35
protected bool
isFieldEncrypted($field)
Returns true if the given DB field is encrypted
at line 39
protected bool
isCryptoAvailable()
Returns true if field crypto is unlockable
at line 55
protected string
GetEncryptedScalar(string $field)
Decrypts and returns the value of the given field
at line 63
protected Account
RequireCrypto()
Unlocks account crypto for usage and returns it
at line 78
protected string|null
TryGetEncryptedScalar(string $field)
Decrypts and returns the value of the given field
at line 103
protected FieldCrypt
SetEncryptedScalar(string $field, string|null $value, bool|null $fieldcrypt = null)
Sets the value of the given field
at line 129
protected FieldCrypt
SetEncrypted(bool $crypt)
Sets the crypto state of all stored fields
at line 145
static void
DecryptAccount(ObjectDatabase $database, Account $account)
Loads any objects for the given account and decrypts their fields