Ejemplo n.º 1
0
 def get_sse_access(self, user_id, binary_id):
     data = {
         "user_id": user_id,
         "binary_id": binary_id
     }
     dump_data = json.dumps(data)
     message = dump_data.encode()
     encrypted = fernet.encrypt(message).decode('utf8')
     return encrypted
Ejemplo n.º 2
0
def get_callback():
    state = flask.request.args.get("state", "home")
    code = flask.request.args.get("code")
    auth_method = get_auth_method_from_cookie()
    token_response_json = exchange_code_for_token(code, auth_method)
    access_token = token_response_json["access_token"]
    expires_in = token_response_json["expires_in"]
    access_token_encrypted = fernet.encrypt(
        access_token.encode("utf-8")).decode("utf-8")
    expires = datetime.datetime.utcnow() + datetime.timedelta(
        seconds=float(expires_in))
    return redirect_and_set_cookies(state, access_token_encrypted, expires)
Ejemplo n.º 3
0
 def set_contact(self, contact):
     self.contact = fernet.encrypt(contact.encode('utf-8'))
     return True
Ejemplo n.º 4
0
 def set_description(self, desc):
     self.description = fernet.encrypt(desc.encode('utf-8'))
     return True
Ejemplo n.º 5
0
 def set_message(self, message):
     self.message = fernet.encrypt(message.encode('utf-8'))
     return True
Ejemplo n.º 6
0
 def set_subject(self, subject):
     self.subject = fernet.encrypt(subject.encode('utf-8'))
     return True
Ejemplo n.º 7
0
 def set_result(self, result):
     self.result_raw = fernet.encrypt(result.encode('utf-8'))
     return True
Ejemplo n.º 8
0
 def set_email(self, email):
     self.email = fernet.encrypt(email.encode('utf-8'))
     return True
Ejemplo n.º 9
0
 def set_name(self, name):
     self.name = fernet.encrypt(name.encode('utf-8'))
     return True
Ejemplo n.º 10
0
 def set_invitation(self, text):
     self.invitation_text = fernet.encrypt(text.encode('utf-8'))
     return True
Ejemplo n.º 11
0
def encrypt(raw_data):
    raw_data = raw_data.encode()
    return fernet.encrypt(raw_data).decode('utf8')