You are here

public function Base::getCryptInstance in DRD Agent 8.3

Same name and namespace in other branches
  1. 4.0.x src/Agent/Action/Base.php \Drupal\drd_agent\Agent\Action\Base::getCryptInstance()

Get authorised Crypt object or FALSE if none is available.

Parameters

string $uuid: UUID of the crypt instance that should be loaded.

Return value

\Drupal\drd_agent\Crypt\BaseMethodInterface|bool The loaded Crypt instance if available or FALSE otherwise.

Overrides BaseInterface::getCryptInstance

1 call to Base::getCryptInstance()
Base::run in src/Agent/Action/Base.php
Main callback to execute an action.

File

src/Agent/Action/Base.php, line 414

Class

Base
Base class for Remote DRD Action Code.

Namespace

Drupal\drd_agent\Agent\Action

Code

public function getCryptInstance($uuid) {
  $config = $this->configFactory
    ->get('drd_agent.settings');
  $authorised = $config
    ->get('authorised') ?? [];
  if (empty($authorised[$uuid])) {
    return FALSE;
  }
  return CryptBase::getInstance($this->container, $authorised[$uuid]['crypt'], (array) $authorised[$uuid]['cryptsetting']);
}