I am trying to implement database level encryption at the entity level.
I can create a `beforeSave` hook on the entity to encrypt data.
However, I do not see any `afterRead` hook in documentation or code base, where I would decrypt.
There is a `beforeRead` hook in the RecordService class:
	
From this, it seems that the `beforeRead` is called after the entity is retrieved from the database, and so decryption in this hook would be workable.
Am I reading this correctly?
Thanks!
					I can create a `beforeSave` hook on the entity to encrypt data.
However, I do not see any `afterRead` hook in documentation or code base, where I would decrypt.
There is a `beforeRead` hook in the RecordService class:
PHP Code:
	
    /**
     * Read a record by ID. Access control check is performed.
     *
     * @param non-empty-string $id
     * @return TEntity
     * @throws NotFoundSilent If not found.
     * @throws Forbidden If no read access.
     */
    public function read(string $id, ReadParams $params): Entity
    {
        if ($id === '') {
            throw new InvalidArgumentException();
        }
        if (!$this->acl->check($this->entityType, AclTable::ACTION_READ)) {
            throw new ForbiddenSilent();
        }
        $entity = $this->getEntity($id);
        if (!$entity) {
            throw new NotFoundSilent("Record $id does not exist.");
        }
        $this->recordHookManager->processBeforeRead($entity, $params);
        $this->processActionHistoryRecord(Action::READ, $entity);
        return $entity;
    }
 
Am I reading this correctly?
Thanks!

Comment