sqrl.utils module¶
-
class
sqrl.utils.Base64[source]¶ Bases:
objectHelper class for base64 encoding/decoding
-
class
sqrl.utils.Encoder[source]¶ Bases:
objectHelper class for encoding/decoding SQRL response data.
-
classmethod
base64_dumps(data)[source]¶ Dumps given data into a single Base64 string.
Practically this is the same as
dumps()exceptdumps()can return multiline string fordict. This method normalizes that further by converting that multiline string to a single base64 encoded value.Returns: Base64 encoded binary data of input dataReturn type: binary
-
classmethod
dumps(data)[source]¶ Recursively dumps given data to SQRL response format.
Before data is dumped out, it is normalized by using
normalize().This dumps each data type as follows:
Dict: returns an \r\nmultiline string. Each line is for a single key-pair of format<key>=<dumped value>.List: tilde ( ~) joined dumped list of valuesOther: no operation
-
classmethod
normalize(data)[source]¶ Recursively normalize data for encoding.
This encodes each data type as follows:
Dict: returns an OrderedDictwhere all values are recursively normalized. Empty dict is normalized to empty stringList: each value is recursively normalized Binary: Base64 encode data Str: no operation Other: data is casted to string using __str__(or__unicode__)
-
classmethod