Set the encryption secret
This commit is contained in:
parent
47ad8b575a
commit
85db7df8ef
|
@ -174,6 +174,7 @@ class common:
|
|||
|
||||
def init(self):
|
||||
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)
|
||||
return self.get_pub()
|
||||
|
||||
|
@ -195,6 +196,6 @@ class common:
|
|||
def set_secret(self, text):
|
||||
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)
|
||||
secret = self.dec(text, derived_key)
|
||||
self.otp = OTP(secret)
|
||||
self.enc_secret = self.dec(text, derived_key)
|
||||
self.otp = OTP(self.enc_secret)
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue
Block a user