npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@intelligent-farming/lorawan-credential-format

v0.1.1

Published

Normalize, validate, and convert LoRaWAN credential strings — DevEUI / JoinEUI / AppKey / NwkKey / DevAddr. Handles whitespace and byte-separator stripping, hex/Uint8Array conversion, and MSB↔LSB byte-order swaps. Isomorphic: no Node-only APIs, runs in br

Readme

@intelligent-farming/lorawan-credential-format

Normalize, validate, and convert LoRaWAN credential strings.

Full API reference: docs/api-doc.md. Regenerate with npm run docs.

Install

npm install @intelligent-farming/lorawan-credential-format

Usage

import {
  normalize, isDevEui, isAppKey, inferKind,
  parseDevEui, tryParseAppKey, CredentialFormatError,
  toBytes, fromBytes, swapByteOrder,
} from '@intelligent-farming/lorawan-credential-format';

// Strip cosmetic separators and uppercase.
normalize('a8-40-41-03-56-60-e3-aa');   // → 'A84041035660E3AA'
normalize('A8:40:41:03:56:60:E3:AA');   // → 'A84041035660E3AA'

// Type-specific validators (return booleans).
isDevEui('A84041035660E3AA');           // → true
isAppKey('00112233445566778899AABBCCDDEEFF'); // → true

// Infer the kind from length alone.
inferKind('A84041035660E3AA');          // → 'devEui'

// Strict parsers normalize and validate, or throw CredentialFormatError.
parseDevEui('a8:40:41:03:56:60:e3:aa'); // → 'A84041035660E3AA'

// Lenient parsers return null instead of throwing.
tryParseAppKey('not-a-key');            // → null

// Hex ↔ Uint8Array.
const bytes = toBytes('A84041035660E3AA');
fromBytes(bytes);                       // → 'A84041035660E3AA'

// MSB ↔ LSB byte order. A device labeled A84041035660E3AA shows up in packet
// captures and join-server logs as AAE36056034140A8 — same EUI, opposite order.
swapByteOrder('A84041035660E3AA');      // → 'AAE36056034140A8'

Credential kinds

| Kind | Hex length | Notes | |-----------|------------|------------------------------------------------------| | devEui | 16 | Device EUI | | joinEui | 16 | Join EUI (a.k.a. AppEUI before LoRaWAN 1.1) | | appKey | 32 | Application root key (and 1.0.x OTAA root key) | | nwkKey | 32 | Network root key (LoRaWAN 1.1.x only) | | devAddr | 8 | Device address (post-join, network-assigned) |

Lengths are exposed at runtime as CREDENTIAL_LENGTHS.

Errors

Strict parsers and toBytes / swapByteOrder throw CredentialFormatError on bad input. The error carries the credential kind it was expecting and the original raw input, useful for surfacing form-validation messages:

try {
  parseDevEui(userInput);
} catch (e) {
  if (e instanceof CredentialFormatError) {
    console.error(`That's not a valid ${e.kind}: ${e.message}`);
  } else {
    throw e;
  }
}