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

@toruslabs/customauth-react-native-sdk

v4.0.1

Published

React Native sdk for CustomAuth

Downloads

151

Readme

customauth-react-native-sdk

Fully white-labelled UI/UX paired up to Torus PKI and auth for React Native.

Important

This SDK requires native modules and is designed to bring native experience to your React Native app without you doing any work.

🩹 Examples

Checkout the example of CustomAuth React Native SDK in our examples directory.

Getting Started

npm i --save @toruslabs/customauth-react-native-sdk

Please refer to the native SDKs for platform-specific configuration.

Manual installation

iOS

  1. Add the following to your Podfile then run pod install from the ios directory:
pod 'CustomAuth', '~> 2.1.0', :modular_headers => true
pod 'secp256k1.swift', :modular_headers => true
  1. Open Xcode, in the project navigator, select your project. Add libRNCustomAuthSdk.a to your project's Build PhasesLink Binary With Libraries
  2. Run your project Cmd+R

Android

  1. Add maven { url "https://jitpack.io" } to the repositories block of android/build.gradle

  2. Append the following lines to android/settings.gradle:

    include ':customauth-react-native-sdk'
    project(':customauth-react-native-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/@toruslabs/customauth-react-native-sdk/android')
  3. Insert the following lines inside the dependencies block in android/app/build.gradle:

    implementation project(':customauth-react-native-sdk')
  4. Add the following to android/app/build.grade

android {
  ...
  defaultConfig {
    manifestPlaceholders = [
          //... other placeholders if you have them
          'torusRedirectScheme': 'torusapp',
          'torusRedirectHost': 'org.torusresearch.customauthandroid',
          'torusRedirectPathPrefix': '/redirect'
      ]
  }
}

Usage

Initialize the SDK after your app is mounted (useEffect or componentDidMount):

import CustomAuth from '@toruslabs/customauth-react-native-sdk'

CustomAuth.init({
  network: 'testnet',

  // Final redirect to your app, can be either custom scheme or deep link
  redirectUri: 'torusapp://org.torusresearch.customauthexample/redirect',

  // Redirect from browser, some providers don't allow to redirect to custom scheme, you'll need to configure a proxy web address in which case
  browserRedirectUri: 'https://scripts.toruswallet.io/redirect.html',
})

Trigger user's login:

import CustomAuth from '@toruslabs/customauth-react-native-sdk'

const credentials = await CustomAuth.triggerLogin({
  typeOfLogin: 'google', // "facebook", "email_passwordless", "twitter", "discord", etc
  verifier: 'acme-google', // Your verifier registered on https://dashboard.web3auth.io
  clientId, // Your OAuth provider's client ID
  jwtParams, // Extra params vary by provider
})

FAQ

  1. I got BigInt not found build error when building for iOS, what should I do?

    Add the following snipplet to your ios/Podfile. See example/ios/Podfile for a full example.

      post_install do |installer|
        installer.pods_project.targets.each do |target|
          if target.name == "web3.swift"
            target.build_configurations.each do |config|
              config.build_settings["SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]"] = "$(inherited) $(PODS_CONFIGURATION_BUILD_DIR)/BigInt $(PODS_CONFIGURATION_BUILD_DIR)/GenericJSON $(PODS_TARGET_SRCROOT)/web3swift/lib/**"
              config.build_settings["SWIFT_INCLUDE_PATHS[sdk=iphoneos*]"] = "$(inherited) $(PODS_CONFIGURATION_BUILD_DIR)/BigInt $(PODS_CONFIGURATION_BUILD_DIR)/GenericJSON $(PODS_TARGET_SRCROOT)/web3swift/lib/**"
            end
          end
        end
      end

    This is a temporary mitigation for broken xcconfig in the podspec of web3.swift. You may know more at https://github.com/argentlabs/web3.swift/pull/161. If you are using web3.swift >= 0.8.2 this should be fixed.

    Want to know more or implement more advanced use cases? See our API reference.

  2. I got an error on my android build similar to Failed to transform bcprov-jdk15on-1.68.jar

    Add the following to android/app/build.gradle in the android block:

    android {
      //All other config in the android block should be above this
      configurations {
        all*.exclude module: 'bcprov-jdk15on'
      }
    }

    and add the following to gradle.properties:

    android.jetifier.blacklist=bcprov

💬 Troubleshooting and Discussions

  • Have a look at our GitHub Discussions to see if anyone has any questions or issues you might be having.
  • Checkout our Troubleshooting Documentation Page to know the common issues and solutions
  • Join our Discord to join our community and get private integration support or help with your integration.