You are here

public function LockrKeyProvider::getKeyValue in Lockr 8.2

Same name and namespace in other branches
  1. 8.4 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
  2. 8.3 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
  3. 4.x src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()

Returns the value of a key.

Parameters

\Drupal\key\KeyInterface $key: The key whose value will be retrieved.

Return value

string The key value.

Overrides KeyProviderInterface::getKeyValue

File

src/Plugin/KeyProvider/LockrKeyProvider.php, line 115
Contains Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider.

Class

LockrKeyProvider
Adds a key provider that allows a key to be stored in Lockr.

Namespace

Drupal\lockr\Plugin\KeyProvider

Code

public function getKeyValue(KeyInterface $key) {
  $name = $key
    ->id();
  $encoded = $this
    ->getConfiguration()['encoded'];
  $key_client = $this->clientFactory
    ->getKeyClient();
  return $key_client
    ->encrypted($encoded)
    ->get($name);
}