You are here

protected function TfaTestBase::generateEncryptionKey in Two-factor Authentication (TFA) 8

Generates an encryption key.

1 call to TfaTestBase::generateEncryptionKey()
TfaTestBase::setUp in tests/src/Functional/TfaTestBase.php

File

tests/src/Functional/TfaTestBase.php, line 63

Class

TfaTestBase
Base class for testing the Tfa module.

Namespace

Drupal\Tests\tfa\Functional

Code

protected function generateEncryptionKey() {
  $key = Key::create([
    'id' => 'testing_key_128',
    'label' => 'Testing Key 128 bit',
    'key_type' => 'encryption',
    'key_type_settings' => [
      'key_size' => '128',
    ],
    'key_provider' => 'config',
    'key_provider_settings' => [
      'key_value' => 'mustbesixteenbit',
    ],
  ]);
  $key
    ->save();
  $this->testKey = $key;
}