Set the encryption secret

This commit is contained in:
Tanner Collin 2019-09-28 09:11:42 +00:00
parent 47ad8b575a
commit 85db7df8ef
2 changed files with 4 additions and 3 deletions

View File

@ -174,6 +174,7 @@ class common:
def init(self): def init(self):
self.init_secret = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(14)) self.init_secret = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(14))
self.enc_secret = self.init_secret
self.otp = OTP(self.init_secret) self.otp = OTP(self.init_secret)
return self.get_pub() return self.get_pub()
@ -195,6 +196,6 @@ class common:
def set_secret(self, text): def set_secret(self, text):
shared_key = self.key.exchange(self.master_pub) shared_key = self.key.exchange(self.master_pub)
derived_key = HKDF(SHA256(), length=32, salt=b'Qot.', info=None, backend=default_backend()).derive(shared_key) derived_key = HKDF(SHA256(), length=32, salt=b'Qot.', info=None, backend=default_backend()).derive(shared_key)
secret = self.dec(text, derived_key) self.enc_secret = self.dec(text, derived_key)
self.otp = OTP(secret) self.otp = OTP(self.enc_secret)
return True return True

View File

@ -5,7 +5,7 @@ with io.open('README.md', encoding='utf-8') as fh:
long_description = fh.read() long_description = fh.read()
setuptools.setup(name='bwb', setuptools.setup(name='bwb',
version='2.1.0', version='2.1.1',
description='bwb', description='bwb',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',