Skip to main content

pamoja-lorawan

LoRaWAN 1.0.x MAC framing, AES-CMAC and AES encryption, and both halves of the OTAA join. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.

read the guide documentation API reference

Install

pip install pamoja-lorawan
from pamoja import lorawan

This pulls in pamoja-native, the compiled engine. pip install pamoja is the whole framework in one package.

Example

The script the test suite runs, spliced here as it ran.

From bindings/python/guides/lorawan.py:

from pamoja.core import PamojaError
from pamoja.lorawan import device, grant

# The root key is provisioned into the device at the factory and known to the network
# server. It is the only secret either side starts with; any 16 bytes stand in here.
app_key = bytes([7]) * 16

# The device asks to join with a nonce it has not used before, which is what stops an old
# accept being replayed at it.
dev_nonce = 1
node = device(bytes(8), bytes(8), app_key)

# The network grants the join. It draws its own nonce, names the network the device is
# joining, and assigns the address the device will answer to from then on.
dev_addr = 0x26012E43
offer = grant(app_nonce=2, net_id=19, dev_addr=dev_addr)
accept = offer.accept(app_key, dev_nonce)
print(f"granted   address 0x{dev_addr:08X} in a {len(accept)}-byte accept")

# The device verifies it against the root key. A join accept carries no device identifier,
# so only that key decides whether it is for this device.
joined = node.accept_join(accept, dev_nonce)
print(f"joined    the device took address 0x{joined.dev_addr:08X}")

# Neither side transmits a session key. Both derive the same pair from the root key and the
# two nonces, so the network reads what the device sends without ever having been told how.
network = offer.session(app_key, dev_nonce)
uplink = joined.session().encode_uplink(1, 1, b"level=high")
received = network.decode(uplink, 1)
print(f"uplink    the network read {received.payload.decode()}")

# A single byte changed in the air fails that check, so no one else can admit the device or
# put words in its mouth.
forged = bytearray(accept)
forged[1] ^= 0xFF
try:
    node.accept_join(bytes(forged), dev_nonce)
    print("a forged accept was taken, which should never happen")
except PamojaError as error:
    print(f"forged    accept refused: {error}")

The same capability in every language

Language Package Reference
Rust pamoja-lorawan reference, docs.rs, install
TypeScript @pamoja/lorawan reference, install
Python pamoja-lorawan reference, install
C# Pamoja.Lorawan reference, install

Documentation

License

MIT

Metadata

Release files for pamoja-lorawan 0.2.1

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

Source distribution (sdist)

Source distribution for pamoja-lorawan 0.2.1
File Size Uploaded Provenance Actions
pamoja_lorawan-0.2.1.tar.gz 14.6 kB Without provenance Details for pamoja_lorawan-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pamoja-lorawan 0.2.1
File Interpreter ABI Platform Actions
pamoja_lorawan-0.2.1-py3-none-any.whl Python 3 none any Details for pamoja_lorawan-0.2.1-py3-none-any.whl

Total release size: 32.0 kB

Release files / pamoja_lorawan-0.2.1.tar.gz

Download URL pamoja_lorawan-0.2.1.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1afba77f94d052a10f5bd2d0d9e5462a9c81ca9acca713423ae6b1a4c0820bea
BLAKE2b-256 checksum
How to use checksums
b6c8b004ee710b555d6a25e1785b849eb17eebf4ca40e2a74f811dd997e3599c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / pamoja_lorawan-0.2.1-py3-none-any.whl

Download URL pamoja_lorawan-0.2.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89caad7d1d2fce2f43fea6e0e6a1a5d603f88c0821a54692d6b3436f78077591
BLAKE2b-256 checksum
How to use checksums
7924ce9fc9df776b106d54202b4ba4096f375634c53b508106c26aafe0dc72cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for pamoja-lorawan 0.2.1

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.

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