summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-05 09:04:58 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-05 09:04:58 +0000
commit05da76b0e2670f5829a171ded2103af7bf0bf5fa (patch)
tree040298015484406bedcb14a7815f5937bf8303a2
parent778f154f222f5b99f7808c74f6e674dd171bf1f0 (diff)
automatic import of python-nexus-keycodeopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-nexus-keycode.spec649
-rw-r--r--sources1
3 files changed, 651 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..32ea31d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/nexus_keycode-1.5.1.tar.gz
diff --git a/python-nexus-keycode.spec b/python-nexus-keycode.spec
new file mode 100644
index 0000000..15e78f1
--- /dev/null
+++ b/python-nexus-keycode.spec
@@ -0,0 +1,649 @@
+%global _empty_manifest_terminate_build 0
+Name: python-nexus-keycode
+Version: 1.5.1
+Release: 1
+Summary: Angaza Nexus backend libraries for managing PAYG devices
+License: MIT
+URL: https://github.com/angaza/nexus-python
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2d/19/d6b08a7c7f88bb16405026fcb0edff0535e4ba504546f7fec13d1ec87753/nexus_keycode-1.5.1.tar.gz
+BuildArch: noarch
+
+Requires: python3-bitstring
+Requires: python3-enum34
+Requires: python3-siphash
+Requires: python3-typing
+
+%description
+# Nexus Python
+
+This repository contains server-side code for managing devices using Nexus
+protocols, including Nexus Keycode.
+
+Learn more about about Angaza Nexus [here](https://angaza.github.io/nexus)!
+
+## Installation
+
+Nexus Keycode will be available on PyPI. Installation will be as simple as:
+
+```shell
+pip install nexus-keycode
+```
+
+This package comes with a full suite of unit tests, which you can run like so:
+
+```shell
+nose2
+```
+
+## Versioning
+
+### Package Version
+
+This package uses a form of [semantic versioning](semver.org). The version
+number is comprised of three components: MAJOR.MINOR.PATCH
+
+Major version numbers represent breaking internal API changes. You may need
+to modify your code to accomodate these changes. Minor version numbers
+represent feature additions or changes that do not break the library's API,
+and are fully backward compatible. Patch version numbers represent bug fixes
+or minor changes that do not add additional functionality.
+
+The package version is independent of the Nexus System Version that the
+package supports.
+
+## Usage
+
+Generate keycodes for the full and small keypad protocols.
+
+### Full Protocol
+
+Add Credit
+
+```python
+secret_key = b"\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
+
+```python
+message = FullMessage.set_credit(
+ id_=43, hours=24 * 10, secret_key=secret_key
+).to_keycode()
+# outputs *682 070 357 093 12#
+```
+
+Unlock
+
+```python
+message = FullMessage.unlock(id_=44, secret_key=secret_key).to_keycode()
+# outputs *578 396 697 305 45#
+```
+
+Wipe
+```python
+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
+```python
+message = FactoryFullMessage.oqc_test().to_keycode()
+# outputs *577 043 3#
+```
+
+Factory Test
+```python
+message = FactoryFullMessage.allow_test().to_keycode()
+# outputs *406 498 3#
+```
+
+Display PAYG ID
+```python
+message = FactoryFullMessage.display_payg_id().to_keycode()
+# outputs *634 776 5#
+```
+
+
+#### Nexus Channel Origin Commands
+
+These commands are accepted by [Nexus Channel](https://nexus.angaza.com/channel.html)
+"Controller" devices using the "Full Protocol". Typically, these are used
+to manage the secured link state of "Controller" and "Accessory" devices.
+
+See also: `protocols/channel_origin_commands.py`
+
+Create Nexus Channel Secured Link
+```python
+from nexus_keycode.protocols.full import FactoryFullMessage
+from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
+
+message = FactoryFullMessage.passthrough_channel_origin_command(
+ ChannelOriginAction.LINK_ACCESSORY_MODE_3,
+ controller_command_count=5,
+ accessory_command_count=2,
+ accessory_sym_key=b"\xAB" * 16,
+ controller_sym_key=b"\xCD" * 16,
+)
+message.to_keycode()
+# outputs *817 307 500 565 772#
+```
+
+Delete Nexus Channel Secured Link (All Accessory Links)
+```python
+from nexus_keycode.protocols.full import FactoryFullMessage
+from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
+
+message = FactoryFullMessage.passthrough_channel_origin_command(
+ ChannelOriginAction.UNLINK_ALL_ACCESSORIES,
+ controller_command_count=7,
+ controller_sym_key=b"\xCD" * 16,
+)
+
+message.to_keycode()
+# outputs *810 023 592 81#
+```
+
+### Small Protocol
+
+Add Credit
+
+```python
+SECRET_KEY = b"\xde\xad\xbe\xef" * 4
+AddCreditSmallMessage(id_=42, days=7, secret_key=secret_key).to_keycode()
+# outputs 135 242 422 455 244
+```
+
+Set Credit
+
+```python
+SetCreditSmallMessage(id_=44, days=10, secret_key=secret_key).to_keycode()
+# outputs 142 522 332 234 533
+```
+
+Unlock
+
+```python
+UnlockSmallMessage(id_=45, secret_key=secret_key).to_keycode()
+# outputs 152 323 254 454 322
+```
+
+Wipe Message IDs
+
+```python
+MaintenanceSmallMessage(type_=MaintenanceSmallMessageType.WIPE_IDS_ALL, secret_key=secret_key).to_keycode()
+# outputs 122 324 235 545 545
+```
+
+Wipe Custom "Restricted Flag"
+
+```python
+CustomCommandSmallMessage(id_=46, type_=CustomCommandSmallMessageType.WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# outputs 154 545 254 542 523
+```
+
+Set Credit + Wipe Custom "Restricted Flag"
+
+```python
+# Creating a message of this type *may* lead to a 'message ID collision',
+# meaning the message cannot be unambiguously interpreted by the unit
+# (it might be mistaken for a different message if entered into the unit).
+# If this occurs, an `ExtendedSmallMessageIdInvalidError` error will be raised.
+# Typically incrementing the ID by 1 and creating the message again will
+# succeed.
+
+In [25]: ExtendedSmallMessage(id_=50, days=84, type_=ExtendedSmallMessageType.SET_CREDIT_WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# raises `ExtendedSmallMessageIdInvalidError: ID 50 yields MAC collision, next valid ID is 51.`
+
+In [26]: ExtendedSmallMessage(id_=51, days=84, type_=ExtendedSmallMessageType.SET_CREDIT_WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# outputs 145 545 244 442 435
+```
+
+
+
+
+%package -n python3-nexus-keycode
+Summary: Angaza Nexus backend libraries for managing PAYG devices
+Provides: python-nexus-keycode
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-nexus-keycode
+# Nexus Python
+
+This repository contains server-side code for managing devices using Nexus
+protocols, including Nexus Keycode.
+
+Learn more about about Angaza Nexus [here](https://angaza.github.io/nexus)!
+
+## Installation
+
+Nexus Keycode will be available on PyPI. Installation will be as simple as:
+
+```shell
+pip install nexus-keycode
+```
+
+This package comes with a full suite of unit tests, which you can run like so:
+
+```shell
+nose2
+```
+
+## Versioning
+
+### Package Version
+
+This package uses a form of [semantic versioning](semver.org). The version
+number is comprised of three components: MAJOR.MINOR.PATCH
+
+Major version numbers represent breaking internal API changes. You may need
+to modify your code to accomodate these changes. Minor version numbers
+represent feature additions or changes that do not break the library's API,
+and are fully backward compatible. Patch version numbers represent bug fixes
+or minor changes that do not add additional functionality.
+
+The package version is independent of the Nexus System Version that the
+package supports.
+
+## Usage
+
+Generate keycodes for the full and small keypad protocols.
+
+### Full Protocol
+
+Add Credit
+
+```python
+secret_key = b"\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
+
+```python
+message = FullMessage.set_credit(
+ id_=43, hours=24 * 10, secret_key=secret_key
+).to_keycode()
+# outputs *682 070 357 093 12#
+```
+
+Unlock
+
+```python
+message = FullMessage.unlock(id_=44, secret_key=secret_key).to_keycode()
+# outputs *578 396 697 305 45#
+```
+
+Wipe
+```python
+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
+```python
+message = FactoryFullMessage.oqc_test().to_keycode()
+# outputs *577 043 3#
+```
+
+Factory Test
+```python
+message = FactoryFullMessage.allow_test().to_keycode()
+# outputs *406 498 3#
+```
+
+Display PAYG ID
+```python
+message = FactoryFullMessage.display_payg_id().to_keycode()
+# outputs *634 776 5#
+```
+
+
+#### Nexus Channel Origin Commands
+
+These commands are accepted by [Nexus Channel](https://nexus.angaza.com/channel.html)
+"Controller" devices using the "Full Protocol". Typically, these are used
+to manage the secured link state of "Controller" and "Accessory" devices.
+
+See also: `protocols/channel_origin_commands.py`
+
+Create Nexus Channel Secured Link
+```python
+from nexus_keycode.protocols.full import FactoryFullMessage
+from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
+
+message = FactoryFullMessage.passthrough_channel_origin_command(
+ ChannelOriginAction.LINK_ACCESSORY_MODE_3,
+ controller_command_count=5,
+ accessory_command_count=2,
+ accessory_sym_key=b"\xAB" * 16,
+ controller_sym_key=b"\xCD" * 16,
+)
+message.to_keycode()
+# outputs *817 307 500 565 772#
+```
+
+Delete Nexus Channel Secured Link (All Accessory Links)
+```python
+from nexus_keycode.protocols.full import FactoryFullMessage
+from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
+
+message = FactoryFullMessage.passthrough_channel_origin_command(
+ ChannelOriginAction.UNLINK_ALL_ACCESSORIES,
+ controller_command_count=7,
+ controller_sym_key=b"\xCD" * 16,
+)
+
+message.to_keycode()
+# outputs *810 023 592 81#
+```
+
+### Small Protocol
+
+Add Credit
+
+```python
+SECRET_KEY = b"\xde\xad\xbe\xef" * 4
+AddCreditSmallMessage(id_=42, days=7, secret_key=secret_key).to_keycode()
+# outputs 135 242 422 455 244
+```
+
+Set Credit
+
+```python
+SetCreditSmallMessage(id_=44, days=10, secret_key=secret_key).to_keycode()
+# outputs 142 522 332 234 533
+```
+
+Unlock
+
+```python
+UnlockSmallMessage(id_=45, secret_key=secret_key).to_keycode()
+# outputs 152 323 254 454 322
+```
+
+Wipe Message IDs
+
+```python
+MaintenanceSmallMessage(type_=MaintenanceSmallMessageType.WIPE_IDS_ALL, secret_key=secret_key).to_keycode()
+# outputs 122 324 235 545 545
+```
+
+Wipe Custom "Restricted Flag"
+
+```python
+CustomCommandSmallMessage(id_=46, type_=CustomCommandSmallMessageType.WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# outputs 154 545 254 542 523
+```
+
+Set Credit + Wipe Custom "Restricted Flag"
+
+```python
+# Creating a message of this type *may* lead to a 'message ID collision',
+# meaning the message cannot be unambiguously interpreted by the unit
+# (it might be mistaken for a different message if entered into the unit).
+# If this occurs, an `ExtendedSmallMessageIdInvalidError` error will be raised.
+# Typically incrementing the ID by 1 and creating the message again will
+# succeed.
+
+In [25]: ExtendedSmallMessage(id_=50, days=84, type_=ExtendedSmallMessageType.SET_CREDIT_WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# raises `ExtendedSmallMessageIdInvalidError: ID 50 yields MAC collision, next valid ID is 51.`
+
+In [26]: ExtendedSmallMessage(id_=51, days=84, type_=ExtendedSmallMessageType.SET_CREDIT_WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# outputs 145 545 244 442 435
+```
+
+
+
+
+%package help
+Summary: Development documents and examples for nexus-keycode
+Provides: python3-nexus-keycode-doc
+%description help
+# Nexus Python
+
+This repository contains server-side code for managing devices using Nexus
+protocols, including Nexus Keycode.
+
+Learn more about about Angaza Nexus [here](https://angaza.github.io/nexus)!
+
+## Installation
+
+Nexus Keycode will be available on PyPI. Installation will be as simple as:
+
+```shell
+pip install nexus-keycode
+```
+
+This package comes with a full suite of unit tests, which you can run like so:
+
+```shell
+nose2
+```
+
+## Versioning
+
+### Package Version
+
+This package uses a form of [semantic versioning](semver.org). The version
+number is comprised of three components: MAJOR.MINOR.PATCH
+
+Major version numbers represent breaking internal API changes. You may need
+to modify your code to accomodate these changes. Minor version numbers
+represent feature additions or changes that do not break the library's API,
+and are fully backward compatible. Patch version numbers represent bug fixes
+or minor changes that do not add additional functionality.
+
+The package version is independent of the Nexus System Version that the
+package supports.
+
+## Usage
+
+Generate keycodes for the full and small keypad protocols.
+
+### Full Protocol
+
+Add Credit
+
+```python
+secret_key = b"\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
+
+```python
+message = FullMessage.set_credit(
+ id_=43, hours=24 * 10, secret_key=secret_key
+).to_keycode()
+# outputs *682 070 357 093 12#
+```
+
+Unlock
+
+```python
+message = FullMessage.unlock(id_=44, secret_key=secret_key).to_keycode()
+# outputs *578 396 697 305 45#
+```
+
+Wipe
+```python
+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
+```python
+message = FactoryFullMessage.oqc_test().to_keycode()
+# outputs *577 043 3#
+```
+
+Factory Test
+```python
+message = FactoryFullMessage.allow_test().to_keycode()
+# outputs *406 498 3#
+```
+
+Display PAYG ID
+```python
+message = FactoryFullMessage.display_payg_id().to_keycode()
+# outputs *634 776 5#
+```
+
+
+#### Nexus Channel Origin Commands
+
+These commands are accepted by [Nexus Channel](https://nexus.angaza.com/channel.html)
+"Controller" devices using the "Full Protocol". Typically, these are used
+to manage the secured link state of "Controller" and "Accessory" devices.
+
+See also: `protocols/channel_origin_commands.py`
+
+Create Nexus Channel Secured Link
+```python
+from nexus_keycode.protocols.full import FactoryFullMessage
+from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
+
+message = FactoryFullMessage.passthrough_channel_origin_command(
+ ChannelOriginAction.LINK_ACCESSORY_MODE_3,
+ controller_command_count=5,
+ accessory_command_count=2,
+ accessory_sym_key=b"\xAB" * 16,
+ controller_sym_key=b"\xCD" * 16,
+)
+message.to_keycode()
+# outputs *817 307 500 565 772#
+```
+
+Delete Nexus Channel Secured Link (All Accessory Links)
+```python
+from nexus_keycode.protocols.full import FactoryFullMessage
+from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
+
+message = FactoryFullMessage.passthrough_channel_origin_command(
+ ChannelOriginAction.UNLINK_ALL_ACCESSORIES,
+ controller_command_count=7,
+ controller_sym_key=b"\xCD" * 16,
+)
+
+message.to_keycode()
+# outputs *810 023 592 81#
+```
+
+### Small Protocol
+
+Add Credit
+
+```python
+SECRET_KEY = b"\xde\xad\xbe\xef" * 4
+AddCreditSmallMessage(id_=42, days=7, secret_key=secret_key).to_keycode()
+# outputs 135 242 422 455 244
+```
+
+Set Credit
+
+```python
+SetCreditSmallMessage(id_=44, days=10, secret_key=secret_key).to_keycode()
+# outputs 142 522 332 234 533
+```
+
+Unlock
+
+```python
+UnlockSmallMessage(id_=45, secret_key=secret_key).to_keycode()
+# outputs 152 323 254 454 322
+```
+
+Wipe Message IDs
+
+```python
+MaintenanceSmallMessage(type_=MaintenanceSmallMessageType.WIPE_IDS_ALL, secret_key=secret_key).to_keycode()
+# outputs 122 324 235 545 545
+```
+
+Wipe Custom "Restricted Flag"
+
+```python
+CustomCommandSmallMessage(id_=46, type_=CustomCommandSmallMessageType.WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# outputs 154 545 254 542 523
+```
+
+Set Credit + Wipe Custom "Restricted Flag"
+
+```python
+# Creating a message of this type *may* lead to a 'message ID collision',
+# meaning the message cannot be unambiguously interpreted by the unit
+# (it might be mistaken for a different message if entered into the unit).
+# If this occurs, an `ExtendedSmallMessageIdInvalidError` error will be raised.
+# Typically incrementing the ID by 1 and creating the message again will
+# succeed.
+
+In [25]: ExtendedSmallMessage(id_=50, days=84, type_=ExtendedSmallMessageType.SET_CREDIT_WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# raises `ExtendedSmallMessageIdInvalidError: ID 50 yields MAC collision, next valid ID is 51.`
+
+In [26]: ExtendedSmallMessage(id_=51, days=84, type_=ExtendedSmallMessageType.SET_CREDIT_WIPE_RESTRICTED_FLAG, secret_key=secret_key).to_keycode()
+# outputs 145 545 244 442 435
+```
+
+
+
+
+%prep
+%autosetup -n nexus-keycode-1.5.1
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-nexus-keycode -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.5.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..a775608
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+3e6973f4f6b75af0075b3f2a75eb805a nexus_keycode-1.5.1.tar.gz