Beispiel #1
0
def generate_sign_token(string, secret_key=None, salt=None, sep=None):

    if not salt:
        salt = constants["SALT_KEY"]
    if not sep:
        sep = constants["SEP_KEY"]
    if not secret_key:
        secret_key = constants["SECRET_KEY"]

    signer = TimestampSigner(secret_key, salt=salt, sep=sep)
    signed_string = signer.sign(string).decode()

    ts = signer.get_timestamp()
    return signed_string, ts