module documentation
Serializer abstraction module
This module introduces a simple abstraction over the serialization backend (currently json).
| Class | |
Undocumented |
| Class | |
Undocumented |
| Class | |
Undocumented |
| Class | |
Wrap a value so it is hard to leak it accidentally. |
| Class | |
A dictionary that turns its values to private fields. |
| Function | |
Serialize a given object. |
| Function | |
Serialize a given object and authenticate it. |
| Function | |
Parses and verifies JSON data. |
| Function | |
Unserialize data from bytes. |
| Function | |
Verify that a given message was signed with the given key, and load it. |
| Function | |
Crawl a JSON decoded structure for private values and wrap them. |
| Constant | _RE |
Undocumented |
Serialize a given object.
| Parameters | |
| data | the data to serialize |
| private | specify serializer.EncodeWithPrivateFields if you require the produced JSON to also contain private parameters. Otherwise, they will encode to null. |
| Returns | |
| the bytes representation of data | |
Serialize a given object and authenticate it.
| Parameters | |
| data | the data to serialize |
| key | shared hmac key |
| salt | Undocumented |
| key | name/id that identifies the key (in case there are multiple keys in use, e.g. in a multi-cluster environment) |
| private | see DumpJson |
| Returns | |
| the string representation of data signed by the hmac key | |
Parses and verifies JSON data.
| Parameters | |
| raw:string | Input data in JSON format |
| verify | Verification function, usually from ht |
| Returns | |
| De-serialized data | |
Unserialize data from bytes.
| Parameters | |
| data:str or bytes | the json-encoded form |
| Returns | |
| the original data | |
| Raises | |
JSONDecodeError | if txt is not a valid JSON document |
Verify that a given message was signed with the given key, and load it.
| Parameters | |
| txt | json-encoded hmac-signed message |
| key | the shared hmac key or a callable taking one argument (the key selector), which returns the hmac key belonging to the key selector. Typical usage is to pass a reference to the get method of a dict. |
| Returns | |
| tuple of original data, string | original data, salt |
| Raises | |
errors.SignatureError | if the message signature doesn't verify |