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

@mosaic-home/capacitor-home-assistant

v0.1.1

Published

Capacitor plugin for Home Assistant apps on Android: Home Assistant's login page, Keystore token storage, mDNS discovery, native HTTP, and a REST client for native code (widgets, services).

Readme

@mosaic-home/capacitor-home-assistant

A Capacitor plugin for Home Assistant apps on Android: Home Assistant's own login page in a native WebView, token storage encrypted with an Android Keystore key, finding Home Assistant on the network over mDNS, and native HTTP for REST calls. Native code (widgets, background work) gets a small REST client, HaRest, that reads the same tokens.

Part of the Mosaic Home Assistant kit.

Install

npm install @mosaic-home/capacitor-home-assistant @mosaic-home/ha-client
npx cap sync android

The Android library ships inside the npm package; npx cap sync adds it to the app's Gradle build. The native plugin is named HomeAssistant.

Use

import { authorizeUrl, exchangeCode, parseRedirect, type OAuthClient } from '@mosaic-home/ha-client';
import { capacitorHttp, discoverServers, nativeLogin, storeTokens } from '@mosaic-home/capacitor-home-assistant';

const client: OAuthClient = {
  clientId: 'https://example.org/my-app/',
  redirectUri: 'https://example.org/my-app/auth/callback',
};

// Home Assistants on the network, until stop() is called.
const stop = await discoverServers((server) => console.log(server.name, server.url));

// Home Assistant's login page; the redirect is caught inside the WebView and never loaded.
const baseUrl = 'http://homeassistant.local:8123';
const state = crypto.randomUUID();
const redirect = await nativeLogin(authorizeUrl(baseUrl, client, state), client.redirectUri, 'homeassistant.local');
const tokens = await exchangeCode(capacitorHttp, baseUrl, client, parseRedirect(redirect, client, state));

// Kept under tokens.<accountId>, where native code can read and refresh them.
await storeTokens('<the Home Assistant user id>', tokens);
stop();

secureStore holds any other secret the same way. loadTokens and forgetTokens read and remove an account's tokens. Off Android (a browser preview), login is unavailable, secureStore falls back to localStorage and capacitorHttp to fetch.

What it needs

  • Capacitor 8 (@capacitor/core 8 or newer as a peer dependency).
  • Android 8.0 (API 26) or newer, Java 21 for the build.
  • An OAuth client id for your app: a web address whose redirect address is on the same host, so Home Assistant accepts it without fetching anything.

Licence

Apache-2.0.