def post_secret(): logger.debug("Invoke: put from a post") result = request.json msg = result["msg"] pin = result["pin"] exp = result["exp"] encrypted_msg = libencryption.encrypt(msg) sid = dblib.put_secret(encrypted_msg, pin, exp) return jsonify(sid=sid)
def add_secret(): logger.debug("Invoke: put from a post") if request.json is None \ or request.json is not None \ and ("msg" not in request.json.keys() or "pin" not in request.json.keys() or "exp" not in request.json.keys()): logger.debug("Such sid and/or pin does not exist") return jsonify({ 'status': "404: request", 'message': 'Invalid Body url: ' + request.url, }) else: result = request.json msg = result["msg"] pin = result["pin"] exp = result["exp"] encrypted_msg = libencryption.encrypt(msg) sid = dblib.put_secret(encrypted_msg, pin, exp) logger.debug("put from a post return sid=" + sid) # return jsonify(sid=sid) if len(str(sid)) > 0: return jsonify(sid=sid) else: return jsonify(sid=sid, Data="Data is not received from DB")
def put(msg, pin, exp): encrypted_msg = libencryption.encrypt(msg) logger.debug("Invoke: put a get") sid = dblib.put_secret(encrypted_msg, pin, exp) logger.debug("Obtain sid: " + sid) return jsonify(sid=sid)