Optimized file structur

This commit is contained in:
Kevin Veen-Birkenbach 2022-12-09 17:48:37 +01:00
parent 1017fa2257
commit 550b689c12
4 changed files with 16 additions and 13 deletions

9
.gitignore vendored
View File

@ -1,5 +1,6 @@
data/decrypted/splitted_password_files/*
data/decrypted/password_files/*
data/encrypted/splitted_password_files/*
data/encrypted/password_files/*
data/decrypted/group_files/*
data/decrypted/user_files/*
data/encrypted/group_files/*
data/encrypted/user_files/*
accumulated.json*
__pycache__

View File

@ -3,7 +3,9 @@ from .Cli import Cli
class AbstractSplittedSecret(Cli):
def __init__(self):
super(Cli, self).__init__()
self.encrypted_splitted_password_files_folder = "data/encrypted/splitted_password_files/"
self.encrypted_password_files_folder = "data/encrypted/password_files/"
self.encrypted_password_files_folder = "data/encrypted/password_files/"
self.decrypted_password_files_folder="data/decrypted/password_files/"
self.encrypted_folder="data/encrypted/"
self.decrypted_folder="data/encrypted/"
self.encrypted_group_files_folder = self.encrypted_folder + "group_files/"
self.decrypted_group_files_folder = self.decrypted_folder + "group_files/"
self.encrypted_user_files_folder = self.encrypted_folder + "user_files/"
self.decrypted_user_files_folder = self.encrypted_folder + "user_files/"

View File

@ -2,8 +2,8 @@ from .AbstractSplittedSecret import AbstractSplittedSecret
class Cleanup(AbstractSplittedSecret):
def __init__(self):
super(Cleanup, self).__init__()
self.encrypted_files_folders = [self.decrypted_password_files_folder,self.decrypted_password_files_folder]
self.decrypted_files_folders = [self.encrypted_splitted_password_files_folder,self.encrypted_password_files_folder]
self.encrypted_files_folders = [self.decrypted_group_files_folder,self.decrypted_user_files_folder]
self.decrypted_files_folders = [self.encrypted_group_files_folder,self.encrypted_user_files_folder]
def deleteAllFilesInFolder(self,folder_path):
try:

View File

@ -89,7 +89,7 @@ class Generate(AbstractSplittedSecret):
def generateEncryptedGroupFiles(self):
for password_group_index_int in self.group_mapped_data:
encrypted_splitted_password_file = AbstractSplittedSecret().encrypted_splitted_password_files_folder + str(password_group_index_int) + ".txt"
encrypted_splitted_password_file = AbstractSplittedSecret().encrypted_group_files_folder + str(password_group_index_int) + ".txt"
self.encryptStringToFile(self.master_password,encrypted_splitted_password_file,self.group_mapped_data[password_group_index_int]['password'])
def encryptToJsonFile(self,data,file_path,password):
@ -97,11 +97,11 @@ class Generate(AbstractSplittedSecret):
def encryptUserMappedData(self):
for user_id in self.user_mapped_data:
file_path=self.encrypted_password_files_folder+user_id+'.json'
file_path=self.encrypted_user_files_folder+user_id+'.json'
self.encryptToJsonFile(self.user_mapped_data[user_id]['groups'],file_path,self.user_mapped_data[user_id]['user_password'])
def encryptAccumulatedMappedData(self):
file_path=self.encrypted_password_files_folder+'accumulated.json'
file_path=self.encrypted_folder+'accumulated.json'
data={"user_mapped": self.user_mapped_data, "group_mapped": self.group_mapped_data}
self.encryptToJsonFile(data,file_path,self.master_password)