Pamoja.Lorawan
0.1.18
dotnet add package Pamoja.Lorawan --version 0.1.18
NuGet\Install-Package Pamoja.Lorawan -Version 0.1.18
<PackageReference Include="Pamoja.Lorawan" Version="0.1.18" />
<PackageVersion Include="Pamoja.Lorawan" Version="0.1.18" />
<PackageReference Include="Pamoja.Lorawan" />
paket add Pamoja.Lorawan --version 0.1.18
#r "nuget: Pamoja.Lorawan, 0.1.18"
#:package Pamoja.Lorawan@0.1.18
#addin nuget:?package=Pamoja.Lorawan&version=0.1.18
#tool nuget:?package=Pamoja.Lorawan&version=0.1.18
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#.
Install
dotnet add package Pamoja.Lorawan
using Pamoja.Lorawan;
This pulls in Pamoja.Native, the compiled engine, and Pamoja.Codec. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/LorawanGuide.cs:
// 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.
byte[] appKey = new byte[16];
Array.Fill(appKey, (byte)7);
// The device asks to join with a nonce it has not used before, which is what stops
// an old accept being replayed at it.
const ushort DevNonce = 1;
using var node = new LorawanDevice(new byte[8], new byte[8], appKey);
// The network grants the join. It draws its own nonce, names the network the
// device is joining, and assigns the address it will answer to from then on.
const uint DevAddr = 0x26012E43;
var offer = new LorawanGrant(appNonce: 2, netId: 19, devAddr: DevAddr);
byte[] accept = offer.Accept(appKey, DevNonce);
Console.WriteLine($"granted address 0x{DevAddr:X8} in a {accept.Length}-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.
using LorawanJoinAccept joined = node.AcceptJoin(accept, DevNonce);
Console.WriteLine($"joined the device took address 0x{joined.DevAddr:X8}");
// 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.
using LorawanSession network = offer.Session(appKey, DevNonce);
using LorawanSession activated = joined.Session();
byte[] uplink = activated.EncodeUplink(1, 1, "level=high"u8);
LorawanRxData received = network.Decode(uplink, 1);
Console.WriteLine(
$"uplink the network read {System.Text.Encoding.UTF8.GetString(received.Payload)}");
// A single byte changed in the air fails that check, so no one else can admit the
// device or put words in its mouth.
byte[] forged = [.. accept];
forged[1] ^= 0xFF;
try
{
node.AcceptJoin(forged, DevNonce).Dispose();
Console.WriteLine("a forged accept was taken, which should never happen");
}
catch (PamojaException error)
{
Console.WriteLine($"forged accept refused: {error.Message}");
}
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
Pamoja.Lorawanreference, every type in this namespace.- The LoRaWAN guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Pamoja.Codec (>= 0.1.18)
- Pamoja.Native (>= 0.1.18)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Pamoja.Lorawan:
| Package | Downloads |
|---|---|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Radio
Radio and reach: Budgeting airtime, framing a mesh packet, routing it, and securing a LoRaWAN uplink: everything a node needs to reach a network it cannot see. |
GitHub repositories
This package is not used by any popular GitHub repositories.