2022-12-09 13:22:57 +01:00
|
|
|
from .Cli import Cli
|
|
|
|
|
|
|
|
class AbstractSplittedSecret(Cli):
|
2022-12-10 12:21:43 +01:00
|
|
|
USER_PASSWORD_LENGTHS = 64
|
|
|
|
OVERALL_PASSWORD_LENGTHS = 128
|
|
|
|
|
|
|
|
# At the moment the programm can used deal with one digit numbers.
|
|
|
|
MAXIMUM_SECRET_HOLDERS = 9
|
|
|
|
MINIMUM_SECRET_HOLDERS = 2
|
2022-12-09 20:10:12 +01:00
|
|
|
|
2022-12-09 13:08:07 +01:00
|
|
|
def __init__(self):
|
2022-12-09 13:22:57 +01:00
|
|
|
super(Cli, self).__init__()
|
2022-12-09 20:10:12 +01:00
|
|
|
self.data_folder = "data/"
|
|
|
|
|
2022-12-10 12:21:43 +01:00
|
|
|
def getCoSecretHoldersRange():
|
|
|
|
return range(AbstractSplittedSecret.MINIMUM_SECRET_HOLDERS,AbstractSplittedSecret.MAXIMUM_SECRET_HOLDERS)
|
|
|
|
|
|
|
|
def getSecretHoldersRange():
|
|
|
|
return range(1,AbstractSplittedSecret.MAXIMUM_SECRET_HOLDERS)
|
|
|
|
|
2022-12-09 20:10:12 +01:00
|
|
|
def getFolderPath(self,folder_type):
|
|
|
|
return self.data_folder + folder_type + "/"
|
|
|
|
|
|
|
|
def getGroupFilesFolderPath(self,folder_type):
|
|
|
|
return self.getFolderPath(folder_type) + "group_files/"
|
|
|
|
|
|
|
|
def getUserFilesFolderPath(self,folder_type):
|
|
|
|
return self.getFolderPath(folder_type) + "user_files/"
|
|
|
|
|
|
|
|
def getFileExtension(self,file_type):
|
|
|
|
if file_type == "encrypted":
|
2022-12-09 20:39:00 +01:00
|
|
|
return '.gpg'
|
|
|
|
return ''
|
2022-12-09 20:10:12 +01:00
|
|
|
|
|
|
|
def getUserFilePath(self,user_id,file_type):
|
|
|
|
return self.getUserFilesFolderPath(file_type)+user_id+'.json' + self.getFileExtension(file_type);
|
|
|
|
|
|
|
|
def getGroupFilePath(self,group_id,file_type):
|
|
|
|
return self.getGroupFilesFolderPath(file_type) + str(group_id) + '.txt' + self.getFileExtension(file_type);
|
|
|
|
|
|
|
|
def getAccumulatedFilePath(self,file_type):
|
|
|
|
return self.getFolderPath(file_type) + 'accumulated.json' + self.getFileExtension(file_type);
|