Skip to main content

The Angaza Nexus Keycode for PAYG devices

Project description

Nexus Keycode: Python

This package allows you to encode Nexus Keycodes.

Learn more about about Angaza Nexus here!

Installation

Nexus Keycode is available on PyPI. Installation is as simple as:

pip install nexus-keycode

This package comes with a full suite of unit tests, which you can run like so:

nose2

Versioning

This package uses a form of semantic versioning. The version number is comprised of three components: MAJOR.MINOR.PATCH

Major version numbers represent breaking changes in the keycode protocol itself. This is the only version number that is relevant to keycodes themselves. For example, any keycode generated any version 1.X.Y of this encoder will be valid on any version 1.X.Y of the embedded decoder.

Minor version numbers represent breaking internal API changes. You may need to modify your code to accomodate these changes.

Patch version numbers represent changes that are fully backward compatible.

Usage

Generate keycodes for the full and small keypad protocols.

Full Protocol

Add Credit

secret_key = "\xde\xad\xbe\xef" * 4
message = FullMessage.add_credit(
    id_=42, hours=24 * 7, secret_key=secret_key
).to_keycode()
# outputs *599 791 493 194 43#

Set Credit

message = FullMessage.set_credit(
    id_=43, hours=24 * 10, secret_key=secret_key
).to_keycode()
# outputs *682 070 357 093 12#

Unlock

message = FullMessage.unlock(id_=44, secret_key=secret_key).to_keycode()
# outputs *578 396 697 305 45#

Wipe

message = FullMessage.wipe_state(
    id_=45, flags=FullMessageWipeFlags.WIPE_IDS_ALL, secret_key=secret_key
).to_keycode()
# outputs *356 107 776 307 38#

Enabled/Disabled Test

message = FactoryFullMessage.oqc_test().to_keycode()
# outputs *577 043 3#

Factory Test

message = FactoryFullMessage.allow_test().to_keycode()
# outputs *406 498 3#

Display PAYG ID

message = FactoryFullMessage.display_payg_id().to_keycode()
# outputs *634 776 5#

Small Protocol

Add Credit

SECRET_KEY = "\xde\xad\xbe\xef" * 4
AddCreditSmallMessage(id_=42, days=7, secret_key=secret_key).to_keycode()
# outputs 135 242 422 455 244

Update Credit

UpdateCreditSmallMessage(id_=43, days=14, secret_key=secret_key).to_keycode()
# outputs 145 222 453 233 453

Set Credit

SetCreditSmallMessage(id_=44, days=10, secret_key=secret_key).to_keycode()
# outputs 142 522 332 234 533

Unlock

UnlockSmallMessage(id_=45, secret_key=secret_key).to_keycode()
# outputs 152 323 254 454 322

Wipe

MaintenanceSmallMessage(type_=MaintenanceSmallMessageType.WIPE_IDS_ALL, secret_key=secret_key).to_keycode()
# outputs 122 324 235 545 545

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nexus-keycode, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size nexus_keycode-1.0.2-py2.py3-none-any.whl (17.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size nexus_keycode-1.0.2.tar.gz (13.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page