You are here

public function HashService::getKey in Fast Autocomplete 8

Returns the key used for getting a hash.

Parameters

bool $renewal: If TRUE, the key is renewed.

Return value

string The key.

Overrides HashServiceInterface::getKey

1 call to HashService::getKey()
HashService::getHash in src/HashService.php
Returns a hash.

File

src/HashService.php, line 80

Class

HashService
Class HashService.

Namespace

Drupal\fac

Code

public function getKey($renewal = FALSE) {
  $key = $this->state
    ->get('fac_key');
  if (!$key || $renewal) {
    $key = Crypt::randomBytesBase64();
    $this->state
      ->set('fac_key', $key);
    $this->state
      ->set('fac_key_timestamp', (int) $_SERVER['REQUEST_TIME']);
  }
  return $key;
}