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

@onekeyfe/react-native-sni-connect

v3.0.80

Published

A React Native library for SNI-based HTTP requests with DNS caching and request management

Readme

@onekeyfe/react-native-sni-connect

OneKey SNI HTTP client for React Native. Performs HTTPS requests to a caller-supplied IP address while preserving the original TLS SNI / Host of a hostname, so certificate chain and hostname verification are still enforced against the real hostname (not the IP).

Backed by EMASCurl (libcurl) on iOS and OkHttp on Android.

Installation

This package is published as part of the OneKey app-modules workspace:

yarn add @onekeyfe/react-native-sni-connect

iOS: add Aliyun's spec repo and make EMASCurl modular in your app Podfile, then run pod install:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/aliyun/aliyun-specs.git'

target 'YourApp' do
  # React Native autolinks SniConnect. This explicit pod keeps Swift
  # `import EMASCurl` visible when building static libraries.
  pod 'EMASCurl', :modular_headers => true
end

Android autolinks.

Usage

import {
  request,
  cancelRequest,
  cancelAllRequests,
  clearDNSCache,
  isProxyActiveForUrl,
} from '@onekeyfe/react-native-sni-connect';

const proxyActive = await isProxyActiveForUrl('https://example.com/api/v1/ping');
if (proxyActive) {
  // Product adapters should avoid entering SNI mode when a per-URL/system proxy
  // is active. Low-level SNI requests still bypass proxies directly.
}

const res = await request({
  // requestId is optional; required only if you want to cancel the request.
  requestId: 'health-check-1',
  ip: '93.184.216.34', // must be a public IP literal (private/loopback/metadata are rejected)
  hostname: 'example.com', // used for SNI, Host header and certificate validation
  method: 'GET',
  path: '/api/v1/ping', // relative path only — absolute URLs are rejected
  headers: { 'Content-Type': 'application/json' },
  timeout: 30_000,
});

console.log(res.status, res.headers, res.data);

// Cancellation (requires requestId on the request)
await cancelRequest('health-check-1');
await cancelAllRequests();

// Drop pinned-IP connections / cached clients
await clearDNSCache();

multiValueHeaders preserves repeated response headers when the native transport exposes them as raw entries. On iOS, EMASCurl 1.5.5 currently hands this module a HTTPURLResponse dictionary view, so duplicate header names may already be collapsed by the transport before this adapter can observe them. Full duplicate header preservation on iOS requires an EMASCurl version that exposes the raw response header list.

Specification

The behavior of the SNI connect module is governed by a normative, platform-agnostic standard that all implementations (iOS, Android, Node/Desktop, shared JS adapters, and any future platform) must conform to:

-> OneKey SNI Connect Standard (OSCS)

Any change to request validation, destination pinning, TLS validation, redirect handling, cancellation, response shape, or cache behavior must be checked against OSCS. When an implementation and the standard disagree, the implementation is wrong.

Security notes

  • The request scheme is always https on port 443; path cannot override scheme, host or port.
  • isProxyActiveForUrl(url) is a preflight probe for adapters. It does not enable proxying; native SNI transport still bypasses system proxy configuration.
  • ip must be an IPv4/IPv6 literal that routes to a public destination; loopback, private, link-local (incl. cloud metadata), CGNAT, multicast and reserved ranges are rejected.
  • Header names/values containing CR/LF/control characters are rejected; the Host header is managed by the module.
  • Native logs go through OneKey's native logger (with sensitive-data redaction); there is no JS log event channel.

License

MIT