MCPcopy Create free account
hub / github.com/EasyIME/PIME / create_signed_value

Method create_signed_value

python/python3/tornado/web.py:726–750  ·  view source on GitHub ↗

Signs and timestamps a string so it cannot be forged. Normally used via set_secure_cookie, but provided as a separate method for non-cookie uses. To decode a value not stored as a cookie use the optional value argument to get_secure_cookie. .. versionchanged:: 3.2.

(
        self, name: str, value: Union[str, bytes], version: Optional[int] = None
    )

Source from the content-addressed store, hash-verified

724 )
725
726 def create_signed_value(
727 self, name: str, value: Union[str, bytes], version: Optional[int] = None
728 ) -> bytes:
729 """Signs and timestamps a string so it cannot be forged.
730
731 Normally used via set_secure_cookie, but provided as a separate
732 method for non-cookie uses. To decode a value not stored
733 as a cookie use the optional value argument to get_secure_cookie.
734
735 .. versionchanged:: 3.2.1
736
737 Added the ``version`` argument. Introduced cookie version 2
738 and made it the default.
739 """
740 self.require_setting("cookie_secret", "secure cookies")
741 secret = self.application.settings["cookie_secret"]
742 key_version = None
743 if isinstance(secret, dict):
744 if self.application.settings.get("key_version") is None:
745 raise Exception("key_version setting must be used for secret_key dicts")
746 key_version = self.application.settings["key_version"]
747
748 return create_signed_value(
749 secret, name, value, version=version, key_version=key_version
750 )
751
752 def get_secure_cookie(
753 self,

Callers 1

set_secure_cookieMethod · 0.95

Calls 3

require_settingMethod · 0.95
create_signed_valueFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected