rename KeyfileKeyBase -> FlexiKeyBase

it is used as direct base class for both:
- RepoKey
- KeyfileKey
This commit is contained in:
Thomas Waldmann 2022-03-06 17:07:17 +01:00
parent d42e6f2c41
commit ad405892ca
2 changed files with 5 additions and 5 deletions

View File

@ -527,7 +527,7 @@ class PassphraseKey:
NAME = 'passphrase'
class KeyfileKeyBase(AESKeyBase):
class FlexiKeyBase(AESKeyBase):
@classmethod
def detect(cls, repository, manifest_data):
key = cls(repository)
@ -640,7 +640,7 @@ class KeyfileKeyBase(AESKeyBase):
raise NotImplementedError
class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
class KeyfileKey(ID_HMAC_SHA_256, FlexiKeyBase):
TYPE = 0x00
TYPES_ACCEPTABLE = {TYPE}
NAME = 'key file'
@ -731,7 +731,7 @@ class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
self.target = target
class RepoKey(ID_HMAC_SHA_256, KeyfileKeyBase):
class RepoKey(ID_HMAC_SHA_256, FlexiKeyBase):
TYPE = 0x03
TYPES_ACCEPTABLE = {TYPE, PassphraseKey.TYPE}
NAME = 'repokey'

View File

@ -36,7 +36,7 @@ from ..cache import Cache, LocalCache
from ..chunker import has_seek_hole
from ..constants import * # NOQA
from ..crypto.low_level import bytes_to_long, num_cipher_blocks
from ..crypto.key import KeyfileKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError
from ..crypto.key import FlexiKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError
from ..crypto.keymanager import RepoIdMismatch, NotABorgKeyFile
from ..crypto.file_integrity import FileIntegrityError
from ..helpers import Location, get_security_dir
@ -2850,7 +2850,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
def raise_eof(*args):
raise EOFError
with patch.object(KeyfileKeyBase, 'create', raise_eof):
with patch.object(FlexiKeyBase, 'create', raise_eof):
self.cmd('init', '--encryption=repokey', self.repository_location, exit_code=1)
assert not os.path.exists(self.repository_location)