示例#1
0
    def get_config(
        self
    ):  # retrieving config from local files, creating one if it doesn't exist
        config = ConfigParser()
        if os.path.isfile('config.ini'):  # checking file exists
            config.read('config.ini')  # reading file

            # getting username, private key, and public key from config
            self.user = config['CONFIG']['user']
            self.priv_key = literal_eval(
                config['CONFIG']
                ['private_key'])  # getting private key as tuple
            self.pub_key = literal_eval(
                config['CONFIG']['public_key'])  # getting public key as tuple

        else:  # if no config file exists, create one
            self.priv_key, self.pub_key = gen_keys()  # generating keys
            config['CONFIG'] = {
                'user': '******',
                'private_key': str(self.priv_key),
                'public_key': str(self.pub_key)
            }

            self.user = "******"

            with open('config.ini', 'w') as configfile:  # writing to config
                config.write(configfile)
            configfile.close()
    def get_config(self):  # retrieving config from local files, creating one if it doesn't exist
        config = ConfigParser()
        if os.path.isfile('config.ini'):  # checking file exists
            config.read('config.ini')  # reading file

            self.user = config['CONFIG']['user']
            self.priv_key = config['CONFIG']['private_key']
            self.pub_key = config['CONFIG']['public_key']
        else:
            self.priv_key, self.pub_key = gen_keys()
            config['CONFIG'] = {'user': '******',
                                'private_key': self.priv_key,
                                'public_key': self.pub_key}

            with open('config.ini', 'w') as configfile:
                config.write(configfile)
            configfile.close()
示例#3
0
    def generate_new_keys(self):
        self.priv_key, self.pub_key = gen_keys()  # generating new keys
        Client.update_cfg(self)  # updating config to apply new keys

        Client.update_text_other(self, "Generated new keys")
示例#4
0
    def generate_new_keys(self):
        self.priv_key, self.pub_key = gen_keys()  # generating new keys
        Client.update_cfg(self)  # updating config to apply new keys

        Client.update_message_other(self, "New keys successfully generated.")