Set the encryption secret
This commit is contained in:
parent
47ad8b575a
commit
85db7df8ef
|
@ -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
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -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',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user