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 🙏

© 2024 – Pkg Stats / Ryan Hefner

obit-hcaptcha

v1.3.6

Published

hCaptcha Library for React Native (both Android and iOS), specifically for obit

Downloads

6

Readme

npm ci

react-native-hcaptcha

hCaptcha wrapper for React Native (Android and iOS)

Installation

  1. Install package:
  • Using NPM npm install @hcaptcha/react-native-hcaptcha
  • Using Yarn yarn add @hcaptcha/react-native-hcaptcha
  1. Import package: import ConfirmHcaptcha from '@hcaptcha/react-native-hcaptcha';

Full examples for expo and react-native, as well as debugging guides, are in MAINTAINER.md

Demo

See live demo in Snack.

Usage

See Example.App.js example in repo for a fully worked example implementation.

For users familiar with the hCaptcha JS API, calling show() in this wrapper triggers an hcaptcha.execute() call.

This means that if you are an Enterprise user with a 99.9% passive or purely passive sitekey configured, no additional work is required to get the expected behavior: either a visual challenge will be shown or a token will be returned immediately via onMessage, in accordance with your configuration.

Also, please note the following special message strings that can be returned via onMessage:

| name | purpose | | --- | --- | | expired | passcode response expired and the user must re-verify | | error | there was an error displaying the challenge | | cancel | the user closed the challenge, or did not answer before session expired |

Any other string returned by onMessage will be a passcode.

Handling the post-issuance expiration lifecycle

This extension is a lightweight wrapper, and does not currently attempt to manage post-verification state in the same way as the web JS API, e.g. with an on-expire callback.

In particular, if you do not plan to immediately consume the passcode returned by submitting it to your backend, you should start a timer to let your application state know that a new passcode is required when it expires.

By default, this value is 120 seconds. Thus, you would want code similar to the following in your app when handling onMessage responses that return a passcode:

this.timeoutCheck = setTimeout(() => {
   this.setPasscodeExpired();
   }, 120000);

Dependencies

  1. react-native-modal

  2. react-native-webview

Building on iOS

Required frameworks/libraries

Your app must have the following frameworks/libraries linked:

  • libswiftWebKit.tbd
  • JavaScriptCore.framework

Flipper version

You must have a recent version of flipper to build this app. If you have upgraded React Native recently, your Flipper version may be out of date. This will cause compilation errors.

Your Podfile should be updated to something like:

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
  post_install do |installer|
    flipper_post_install(installer)
  end

If you encounter build-time errors related to Flipper.

Localization

Make sure the value you pass to languageCode is the one the user has set in your app if you allow them to override the system defaults.

Otherwise, you should pass in the preferred device locale, e.g. fetched from getLocales() if using react-native-localize.

Note

You can import Hcaptcha from '@hcaptcha/react-native-hcaptcha/Hcaptcha'; to customize the UI yourself.

Properties

  • siteKey (String) - The hCaptcha sitekey
  • baseUrl (String) The url domain defined on your hCaptcha. You generally will not need to change this.
  • onMessage (Function) - The callback function that runs after receiving a response, error, or when user cancels.
  • languageCode (String) - Default language for hCaptcha. Overrides phone defaults. A complete list of supported languages and their codes can be found at this link
  • showLoading (Bool) - show loading indicator for webview till hCaptcha web content loads?
  • loadingIndicatorColor (String) - color for the ActivityIndicator
  • backgroundColor (String) - background color used in HTML
  • theme (String|Object) - theme parameter can be 'light', 'dark', 'contrast' or custom theme object (see Enterprise docs)
  • rqdata (String) - see Enterprise docs

Status

Fully functional, but additional releases will be made in the near term.

Changes within the same major release are expected to be additive, i.e. non-breaking.

License

MIT License. (C) 2021 hCaptcha.

Credits: Originally forked from xuho and filipepiresg's Google reCAPTCHA v2 work. (MIT license)