You are here

public static function KeyProviderBase::obscureKeyValue in Key 8

Obscures a key value.

Parameters

string $key_value: The key value to obscure.

array $options: Options to use when obscuring the value.

Return value

string The obscured key value.

Overrides KeyProviderInterface::obscureKeyValue

1 method overrides KeyProviderBase::obscureKeyValue()
ConfigKeyProvider::obscureKeyValue in src/Plugin/KeyProvider/ConfigKeyProvider.php
Obscures a key value.

File

src/Plugin/KeyProviderBase.php, line 16

Class

KeyProviderBase
Defines a base class for Key Provider plugins.

Namespace

Drupal\key\Plugin

Code

public static function obscureKeyValue($key_value, array $options = []) {
  switch ($options['key_type_group']) {
    case 'authentication':
      $options['visible_right'] = 4;
      $obscured_value = static::obscureValue($key_value, $options);
      break;
    case 'encryption':
      $options['visible_right'] = 0;
      $options['fixed_length'] = 30;
      $obscured_value = static::obscureValue($key_value, $options);
      break;
    default:
      $obscured_value = $key_value;
  }
  return $obscured_value;
}