You are here

protected function TfaBasePlugin::encrypt in Two-factor Authentication (TFA) 8

Encrypt a plaintext string.

Should be used when writing codes to storage.

Parameters

string $data: The string to be encrypted.

Return value

string The encrypted string.

Throws

\Drupal\encrypt\Exception\EncryptException

2 calls to TfaBasePlugin::encrypt()
TfaRecoveryCode::storeCodes in src/Plugin/TfaValidation/TfaRecoveryCode.php
Save recovery codes for current account.
TfaTestValidationPluginSetupPlugin::submitSetupForm in tests/modules/tfa_test_plugins/src/Plugin/TfaSetup/TfaTestValidationPluginSetupPlugin.php
Submit the setup form.

File

src/Plugin/TfaBasePlugin.php, line 186

Class

TfaBasePlugin
Base plugin class.

Namespace

Drupal\tfa\Plugin

Code

protected function encrypt($data) {
  return $this->encryptService
    ->encrypt($data, $this->encryptionProfile);
}