You are here

protected function TfaTotp::getSeed in TFA Basic plugins 7

Get seed for this account.

Return value

string Decrypted account OTP seed or FALSE if none exists.

3 calls to TfaTotp::getSeed()
TfaTotp::ready in includes/tfa_totp.inc
@copydoc TfaBasePlugin::ready()
TfaTotp::validate in includes/tfa_totp.inc
@copydoc TfaBasePlugin::validate()
TfaTotpSetup::storeSeed in includes/tfa_totp.inc
Save seed for account.

File

includes/tfa_totp.inc, line 144
classes for tfa_totp

Class

TfaTotp
Class TfaTotp

Code

protected function getSeed() {

  // Lookup seed for account and decrypt.
  $result = db_query("SELECT seed FROM {tfa_totp_seed} WHERE uid = :uid", array(
    ':uid' => $this->context['uid'],
  ))
    ->fetchAssoc();
  if (!empty($result)) {
    $encrypted = base64_decode($result['seed']);
    $seed = $this
      ->decrypt($encrypted);
    if (!empty($seed)) {
      return $seed;
    }
  }
  return FALSE;
}