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

@qr-plus/wifi

v1.0.0

Published

WiFi QR code string builder with validation. Generates properly formatted WiFi configuration strings following the ZXing standard.

Downloads

63

Readme

@qr-plus/wifi

WiFi QR code string builder with validation. Generates properly formatted WiFi configuration strings following the ZXing standard.

Features

  • Standard-compliant — Follows the WIFI: URI scheme used by Android and iOS 11+
  • Validated — SSID presence, password requirements, encryption type validation
  • Escaped — Handles special characters (;, :, ,, ", \) in SSID and password
  • Typed — Full TypeScript types with const-based enums
  • Zero dependencies — No runtime dependencies
  • Framework agnostic — Works with any QR code generator

Installation

npm install @qr-plus/wifi

Quick Start

import { buildWifiString } from "@qr-plus/wifi";

const content = buildWifiString({
  ssid: "MyNetwork",
  password: "super-secret",
  encryption: "WPA",
});
// => "WIFI:T:WPA;S:MyNetwork;P:super-secret;;"

Usage with @qr-plus/core

import { buildWifiString } from "@qr-plus/wifi";
import { renderToSVG } from "@qr-plus/core";

const svg = renderToSVG(
  buildWifiString({
    ssid: "MyNetwork",
    password: "super-secret",
  })
);

Usage with @qr-plus/react

import { buildWifiString } from "@qr-plus/wifi";
import { QRCode } from "@qr-plus/react";

function WifiQR() {
  const content = buildWifiString({
    ssid: "GuestWiFi",
    password: "welcome123",
  });

  return <QRCode value={content} />;
}

API

buildWifiString(config: WifiConfig): string

Builds a WiFi QR code content string from a configuration object.

Parameters

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | ssid | string | ✅ | — | Network name (SSID) | | password | string | For WPA/WEP | — | Network password | | encryption | WifiEncryption | — | "WPA" | Encryption type | | hidden | boolean | — | false | Whether the network is hidden |

Encryption types

| Constant | Value | Description | |----------|-------|-------------| | WIFI_ENCRYPTION.WPA | "WPA" | WPA/WPA2/WPA3 (recommended) | | WIFI_ENCRYPTION.WEP | "WEP" | WEP (legacy) | | WIFI_ENCRYPTION.NONE | "nopass" | Open network |

Examples

WPA network (default)

buildWifiString({
  ssid: "MyNetwork",
  password: "super-secret",
});
// => "WIFI:T:WPA;S:MyNetwork;P:super-secret;;"

Hidden network

buildWifiString({
  ssid: "HiddenNet",
  password: "pass123",
  hidden: true,
});
// => "WIFI:T:WPA;S:HiddenNet;P:pass123;H:true;;"

Open network

import { WIFI_ENCRYPTION } from "@qr-plus/wifi";

buildWifiString({
  ssid: "FreeWiFi",
  encryption: WIFI_ENCRYPTION.NONE,
});
// => "WIFI:T:nopass;S:FreeWiFi;;"

Special characters

buildWifiString({
  ssid: "My;Network",
  password: "p:ass",
});
// => "WIFI:T:WPA;S:My\;Network;P:p\:ass;;"

Error Handling

The function throws WifiError with specific error codes:

| Code | Condition | |------|-----------| | EMPTY_SSID | SSID is empty or whitespace-only | | PASSWORD_REQUIRED | Password missing for WPA or WEP encryption | | INVALID_ENCRYPTION | Unrecognized encryption type |

import { buildWifiString, WifiError, WIFI_ERROR_CODE } from "@qr-plus/wifi";

try {
  buildWifiString({ ssid: "" });
} catch (error) {
  if (error instanceof WifiError) {
    console.log(error.code); // "EMPTY_SSID"
    console.log(error.message); // "SSID must be a non-empty string."
  }
}

Part of the @qr-plus ecosystem

| Package | Description | |---------|-------------| | @qr-plus/core | Zero-dependency QR code engine | | @qr-plus/react | React components and hooks | | @qr-plus/cli | Terminal QR code generator | | @qr-plus/wifi | WiFi QR string builder | | @qr-plus/vcard | vCard QR string builder |

License

MIT