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

@erin-living/erinsdk-ttlock

v2.0.0

Published

TTLock provider package for @erin-living/erinsdk-core

Readme

@erin-living/erinsdk-ttlock

TTLock BLE provider plugin for @erin-living/erinsdk-core.

Install

npm install @erin-living/erinsdk-ttlock @erin-living/erinsdk-core

react-native-ttlock is a direct dependency — it auto-links on iOS and Android when your project runs pod install / Gradle sync.

iOS setup

cd ios && pod install

Add Bluetooth permissions to your Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Required to communicate with TTLock smart locks via BLE.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Required to communicate with TTLock smart locks via BLE.</string>

Android setup

AndroidManifest.xml

<!-- Root <manifest> tag — add tools namespace -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

  <!-- Application tag — suppress label merge conflict -->
  <application
      ...
      tools:replace="android:label">

  <!-- Permissions -->
  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

  <!-- Android 12+ (API 31+) -->
  <uses-permission
      android:name="android.permission.BLUETOOTH_SCAN"
      android:usesPermissionFlags="neverForLocation"
      tools:targetApi="s" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
  <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

MainActivity.java

Override onRequestPermissionsResult so the TTLock SDK receives permission results:

import com.reactnativettlock.TtlockModule;
import com.facebook.react.ReactInstanceManager;

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    ReactInstanceManager mgr = getReactNativeHost().getReactInstanceManager();
    TtlockModule module = mgr.getCurrentReactContext().getNativeModule(TtlockModule.class);
    if (module != null) {
        module.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}

Disable ProGuard in release builds (android/app/build.gradle)

buildTypes {
    release {
        minifyEnabled false
        shrinkResources false
    }
}

Usage

import { init, register } from '@erin-living/erinsdk-core';
import { createErinSdkTtlockPlugin } from '@erin-living/erinsdk-ttlock';

// Once at app startup
init();
const ttlock = await register(createErinSdkTtlockPlugin());

// Unlock a door (deviceId = lockData string from TTLock initLock)
const result = await ttlock.access.unlock({ deviceId: lockData });
// result = { ok: true, deviceId }

// Create a passcode (label = 4–9 digit passcode string)
const key = await ttlock.credentials.createKey({
  label: '1234',
  deviceId: lockData,
  startDate: Date.now(),
  endDate: Date.now() + 7 * 24 * 60 * 60 * 1000, // 1 week
});
// key = { keyId: '1234' }

// Query lock status (BLE ping)
const status = await ttlock.monitoring.getStatus({ deviceId: lockData });
// status = { online: true, deviceId }

What is lockData?

lockData is an opaque string returned by TTLock's initLock during device pairing. Store it per-device in your app's secure storage and pass it as deviceId to all ErinSDK domain calls.

Lock state events

const unsubscribe = ttlock.events.subscribe('access.lockStateChanged', (evt) => {
  console.log(evt.deviceId, evt.lockState); // 'unlocked'
});

// Events are emitted after a successful ttlock.access.unlock call.
unsubscribe();

// When the provider is no longer needed
await ttlock.unregister();

Supported capabilities

| Capability | Status | |---|---| | access.unlock | BLE via react-native-ttlock | | credentials.createKey | BLE passcode via react-native-ttlock | | monitoring.getStatus | BLE battery query via react-native-ttlock | | intercom.call | Not supported by TTLock SDK |

Minimum OS / SDK

  • iOS 15.1+, Android API 24+
  • React Native 0.79+
  • Follows react-native-ttlock vendor-documented TLS minimums for any cloud operations

Security

Long-lived lock credentials (lockData) must be stored in platform secure storage (Keychain / Keystore). Do not log lockData or pass it through console.log in production.

Transport: all TTLock cloud operations go through HTTPS endpoints at euopen.ttlock.com (EU) / api.sciener.com (global). BLE operations are local-only.

See Security & privacy for the full posture.

Note for npm package page readers: the ../../docs path above is a repo-relative link and does not resolve on npmjs.com. Canonical URL: https://github.com/erinapp/erinsdk-monorepo/blob/main/docs/security-and-privacy.md