You are here

protected function GALoginTotpValidation::getSeed in Google Authenticator login 8

Get seed for this account.

Return value

string Decrypted account OTP seed or FALSE if none exists.

2 calls to GALoginTotpValidation::getSeed()
GALoginTotpValidation::ready in src/Plugin/TfaValidation/GALoginTotpValidation.php
Determine if the plugin can run for the current TFA context.
GALoginTotpValidation::validate in src/Plugin/TfaValidation/GALoginTotpValidation.php
Validate code.

File

src/Plugin/TfaValidation/GALoginTotpValidation.php, line 287

Class

GALoginTotpValidation
TOTP validation class for performing TOTP validation.

Namespace

Drupal\ga_login\Plugin\TfaValidation

Code

protected function getSeed() {

  // Lookup seed for account and decrypt.
  $result = $this
    ->getUserData('tfa', 'tfa_totp_seed', $this->uid, $this->userData);
  if (!empty($result)) {
    $encrypted = base64_decode($result['seed']);
    $seed = $this
      ->decrypt($encrypted);
    if (!empty($seed)) {
      return $seed;
    }
  }
  return FALSE;
}