예제 #1
0
def test_hmac_512():
    payload = "Please take a moment to register today"
    keycol = {"hmac": "My hollow echo"}

    _jwt = jwt.sign(payload, keycol, "HS512")

    info = jwt.verify(_jwt, keycol)

    assert info == payload
예제 #2
0
    def to_jwt(self, key=None, algorithm="", lev=0):
        """
        Create a signed JWT representation of the class instance
        draft-jones-json-web-signature-02

        :param key: The signing key
        :param algorithm: The signature algorithm to use
        :return: A signed JWT
        """
        if not algorithm:
            algorithm = DEF_SIGN_ALG
        return jwt.sign(self.to_json(lev), key, algorithm)