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-capture-protection

v6.7.0-14

Published

Permission-minimal screenshot, recording and app-switcher protection

Readme

@onekeyfe/react-native-capture-protection

Permission-minimal capture protection for OneKey iOS and Android.

Installation

yarn add @onekeyfe/react-native-capture-protection [email protected]

Install iOS pods and rebuild the native application. Web and desktop callers use their existing platform integration; this package has no implementation for those runtimes. Import is lazy, while a missing native registration throws when protection or a listener is requested.

Usage and cleanup

import {
  CaptureProtection,
  CaptureEventType,
} from '@onekeyfe/react-native-capture-protection';

await CaptureProtection.prevent();
const subscription = CaptureProtection.addListener((event) => {
  if (event === CaptureEventType.CAPTURED) {
    /* Show a warning. */
  }
});
subscription.remove();
await CaptureProtection.allow();

Only the application's existing prevent/allow/listener API is supported. No photo-library or filesystem permission is declared or requested. Android screenshot notifications require Android 14; older Android versions still block capture with FLAG_SECURE. iOS secure-layer behavior requires device testing.

See SPEC and Acknowledgements.

API and ownership

| Method | Contract | | --- | --- | | prevent() | Promise<void>; request screenshot, recording and app-switcher protection together. | | allow() | Promise<void>; release only the calling native object's protection. | | addListener(callback) | Return a subscription with an idempotent remove() method. |

Repeated prevent() calls by the same object are idempotent. Protection is owned by a native object rather than by each screen or each call: applications sharing one JS object across sensitive screens must coordinate their prevent/allow lifecycle. A separate runtime/object cannot release another object's protection.

Remove subscriptions when their owner unmounts. Removing the final JS subscriber releases its native callback; it does not call allow(). There are at most 128 JS subscribers per runtime and 32 native owner/subscriber identities. Excess registration throws. No providers, React hooks, custom-overlay API or upstream permission-request API is exported.

Events and platform limits

CaptureEventType exports NONE, RECORDING, END_RECORDING, CAPTURED, APP_SWITCHING, UNKNOWN, ALLOW, PREVENT_SCREEN_CAPTURE, PREVENT_SCREEN_RECORDING and PREVENT_SCREEN_APP_SWITCHING. They represent native event values; the module never reads screenshot contents.

Android declares DETECT_SCREEN_CAPTURE, a normal permission used for Android 14+ screenshot callbacks. Its recording events use a virtual-display heuristic, which can also reflect casting or external displays. It is not proof that a recording was made. iOS uses notifications, an upstream secure-text-field layer technique and opaque overlays; this is not a documented system-wide prevention API. Missing activity/window or an unavailable secure layer rejects protection.

Check nested navigation, recording, app-switcher snapshots, activity recreation and cleanup on each target device. The contract lists required runtime acceptance; source and unit checks do not establish physical capture prevention.

License and attribution

MIT; LICENSE covers this package and LICENSE.upstream preserves the adapted upstream notice. ACKNOWLEDGEMENTS.md identifies the upstream subset and source provenance.