- Switches from pycurl to requests library - Allows for less janky decoding, especially with non-latin character sets - Adds session level management of user configs - Allows for each session to set its own config (people are probably going to complain about this, though not sure if it'll be the same number of people who are upset that their friends/family have to share their config) - Updates key gen/regen to more aggressively swap out keys after each request
21 lines
454 B
Python
21 lines
454 B
Python
from cryptography.fernet import Fernet
|
|
|
|
SESSION_VALS = ['uuid', 'config', 'keys']
|
|
|
|
|
|
def generate_user_keys():
|
|
# Generate/regenerate unique key per user
|
|
return {
|
|
'element_key': Fernet.generate_key(),
|
|
'text_key': Fernet.generate_key()
|
|
}
|
|
|
|
|
|
def valid_user_session(session):
|
|
# Generate secret key for user if unavailable
|
|
for value in SESSION_VALS:
|
|
if value not in session:
|
|
return False
|
|
|
|
return True
|