mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-20 21:27:32 +00:00
move key type/storage constants to borg.constants
This commit is contained in:
parent
2e536bcbe2
commit
a63614e35b
2 changed files with 23 additions and 28 deletions
|
@ -104,6 +104,27 @@
|
|||
PBKDF2_ITERATIONS = 100000
|
||||
|
||||
|
||||
class KeyBlobStorage:
|
||||
NO_STORAGE = 'no_storage'
|
||||
KEYFILE = 'keyfile'
|
||||
REPO = 'repository'
|
||||
|
||||
|
||||
class KeyType:
|
||||
KEYFILE = 0x00
|
||||
# repos with PASSPHRASE mode could not be created any more since borg 1.0, see #97.
|
||||
# in borg 1.3 all of its code and also the "borg key migrate-to-repokey" command was removed.
|
||||
# if you still need to, you can use "borg key migrate-to-repokey" with borg 1.0, 1.1 and 1.2.
|
||||
# Nowadays, we just dispatch this to RepoKey and assume the passphrase was migrated to a repokey.
|
||||
PASSPHRASE = 0x01 # legacy, attic and borg < 1.0
|
||||
PLAINTEXT = 0x02
|
||||
REPO = 0x03
|
||||
BLAKE2KEYFILE = 0x04
|
||||
BLAKE2REPO = 0x05
|
||||
BLAKE2AUTHENTICATED = 0x06
|
||||
AUTHENTICATED = 0x07
|
||||
|
||||
|
||||
REPOSITORY_README = """This is a Borg Backup repository.
|
||||
See https://borgbackup.readthedocs.io/
|
||||
"""
|
||||
|
|
|
@ -76,23 +76,6 @@ class TAMUnsupportedSuiteError(IntegrityError):
|
|||
traceback = False
|
||||
|
||||
|
||||
class KeyBlobStorage:
|
||||
NO_STORAGE = 'no_storage'
|
||||
KEYFILE = 'keyfile'
|
||||
REPO = 'repository'
|
||||
|
||||
|
||||
class KeyType:
|
||||
KEYFILE = 0x00
|
||||
PASSPHRASE = 0x01 # legacy, attic and borg < 1.0
|
||||
PLAINTEXT = 0x02
|
||||
REPO = 0x03
|
||||
BLAKE2KEYFILE = 0x04
|
||||
BLAKE2REPO = 0x05
|
||||
BLAKE2AUTHENTICATED = 0x06
|
||||
AUTHENTICATED = 0x07
|
||||
|
||||
|
||||
def key_creator(repository, args):
|
||||
for key in AVAILABLE_KEY_TYPES:
|
||||
if key.ARG_NAME == args.encryption:
|
||||
|
@ -108,8 +91,8 @@ def key_argument_names():
|
|||
|
||||
def identify_key(manifest_data):
|
||||
key_type = manifest_data[0]
|
||||
if key_type == PassphraseKey.TYPE:
|
||||
return RepoKey # see comment in PassphraseKey class.
|
||||
if key_type == KeyType.PASSPHRASE: # legacy, see comment in KeyType class.
|
||||
return RepoKey
|
||||
|
||||
for key in AVAILABLE_KEY_TYPES:
|
||||
if key.TYPE == key_type:
|
||||
|
@ -642,15 +625,6 @@ def remove(self, target):
|
|||
target.save_key(b'') # save empty key (no new api at remote repo necessary)
|
||||
|
||||
|
||||
class PassphraseKey:
|
||||
# this is only a stub, repos with this mode could not be created any more since borg 1.0, see #97.
|
||||
# in borg 1.3 all of its code and also the "borg key migrate-to-repokey" command was removed.
|
||||
# if you still need to, you can use "borg key migrate-to-repokey" with borg 1.0, 1.1 and 1.2.
|
||||
# Nowadays, we just dispatch this to RepoKey and assume the passphrase was migrated to a repokey.
|
||||
TYPE = KeyType.PASSPHRASE
|
||||
NAME = 'passphrase'
|
||||
|
||||
|
||||
class KeyfileKey(FlexiKey):
|
||||
TYPE = KeyType.KEYFILE
|
||||
NAME = 'key file'
|
||||
|
|
Loading…
Reference in a new issue