Skip to main content

Xiongxiong Decoder

Bearer token decoder for Python (>= 2.7 and 3).

Installation

Using pip:

pip install xiongxiong

Xiongxiong Class

The class must be instantiated with the private key and, optionally, the hashing algorithm (defaults to sha1).

For example:

from xiongxiong import Xiongxiong
xiongxiong = Xiongxiong(privateKey, 'md5')

n.b., An exception will be thrown if the specified hashing algorithm is not supported. If you are using Python greater than 2.7.9 or 3.2, you will have access to all the algorithms supported by your platform’s instance of OpenSSL; otherwise you are limited to MD5, SHA1, SHA224, SHA256, SHA384 and SHA512.

Obviously, the private key and hashing algorithm must match those used by a token’s encoder in order to successfully decode it.

xiongxiong(accessToken)

xiongxiong(basicLogin, basicPassword)

An instantiation of the Xiongxiong class is callable and will decode the seed data, expiration and validate from the bearer token/basic authentication pair, returning a Token object (see below).

Token Object

The decoded Token is built, called by the above function, in such a way that its properties are read-only. (The factory function shouldn’t be invoked directly and has been designed to be a private module function, insofar as Python allows.) It nonetheless has the following members:

  • .data The original seed data, which will be split into a list by : characters, wherever possible (a string, otherwise).

  • .expiration The expiration time (datetime.datetime)

  • .valid The validity of the token/basic pair (Boolean).

For example, continuing from the above:

from datetime import datetime

tokenData = xiongxiong(someBearerToken)

if tokenData.valid:
  expiresIn = tokenData.expiration - datetime.now()
  print('Token expires in %d seconds.' % expiresIn.seconds)
  print('Contents: %s' % tokenData.data)

The validity property (valid) will return false if the token can’t be authenticated, otherwise it will test whether the token has passed its best before date.

Metadata

Release files for xiongxiong 0.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xiongxiong 0.7.4
File Size Uploaded Provenance Actions
xiongxiong-0.7.4.tar.gz 4.1 kB Without provenance Details for xiongxiong-0.7.4.tar.gz

Release files / xiongxiong-0.7.4.tar.gz

Download URL xiongxiong-0.7.4.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6e742328b2cfaad2d03ce8cae661ff4f2be4c035b9c1bdab7e1fc06ea7043a52
BLAKE2b-256 checksum
How to use checksums
7ebca387aadbda938b5093ab3fb869c10a49f0956cdb0f7b0189de9b3f9ab116
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for xiongxiong 0.7.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page