Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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")
Ejemplo n.º 3
0
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)