MCPcopy Create free account
hub / github.com/datapane/datapane / cookie_encode

Function cookie_encode

python-client/src/datapane/_vendor/bottle.py:3060–3067  ·  view source on GitHub ↗

Encode and sign a pickle-able object. Return a (byte) string

(data, key, digestmod=None)

Source from the content-addressed store, hash-verified

3058
3059
3060def cookie_encode(data, key, digestmod=None):
3061 """ Encode and sign a pickle-able object. Return a (byte) string """
3062 depr(0, 13, "cookie_encode() will be removed soon.",
3063 "Do not use this API directly.")
3064 digestmod = digestmod or hashlib.sha256
3065 msg = base64.b64encode(pickle.dumps(data, -1))
3066 sig = base64.b64encode(hmac.new(tob(key), msg, digestmod=digestmod).digest())
3067 return tob('!') + sig + tob('?') + msg
3068
3069
3070def cookie_decode(data, key, digestmod=None):

Callers

nothing calls this directly

Calls 2

deprFunction · 0.85
tobFunction · 0.85

Tested by

no test coverage detected