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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@bouncecode/mrlogin-sdk-rn

v1.0.0-alpha.20

Published

BounceCode's MrLogin SDK For React Native

Downloads

46

Readme

Mrlogin-sdk

This SDK helps developers get started with the SSO login service in React-Native provided by Bouncecode.

Installation

npm install @bouncecode/mrlogin-sdk-rn
npm install base-64
npm install buffer

// or

yarn add @bouncecode/mrlogin-sdk
yarn add base-64
yarn add buffer

Set up

In APP.js you need to set encode, decode and buffer.

// App.js

import {decode, encode} from 'base-64';
import {Buffer} from 'buffer';

const App = () => {

if (!global.btoa) {
    global.btoa = encode;
}

if (!global.atob) {
  global.atob = decode;
}

if (!global.Buffer) {
  global.Buffer = Buffer;
}

  //...
}

The entry point to the react-native SDK is a Mrlogin instance that will give you access to its API.

import Mrlogin from "@bouncecode/mrlogin-sdk";

// MrloginOptions { projectId, endpoint, port }  default endpoint = https://mrlogin.io
// projectId :
// 1. go to https://mrlogin.io
// 2. sign up
// 3. Check the project id in url . https://mrlogin.io/manage/{your-project-id}/users/list/

const mrlogin = new Mrlogin({
  projectId: 'your project id', // required.
  endpoint: 'https://mrlogin.io', // optional, default: `https://mrlogin.io`
  port: 'endpoint port' // optional
});

Authentication Flow using Deep Linking

In order to redirect back to your application from a web browser, you must specify a unique URI to your app. To do this, define your app scheme and replace my-scheme and my-host with your info. Please refer to the InAppBrowser documentation. Go to InAppBrowser README.MD

<activity
  ...
  android:launchMode="singleTask">
  <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data android:scheme="my-scheme" android:host="my-host" android:pathPrefix="" />
  </intent-filter>
</activity>
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLName</key>
    <string>my-scheme</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>my-scheme</string>
    </array>
  </dict>
</array>

Usage

login

The login method open InAppBrowser and proceed login. if login success, return an TokenObject


const mrlogin = new Mrlogin({
  projectId: 'your project id', // required.
  endpoint: 'https://mrlogin.io', // optional, default: `https://mrlogin.io`
  port: 'endpoint port' // optional
});

const redirectUri =
  Platform.OS == 'android'
    ? `mrloginrnexample://mrlogin/auth` // android deep link setting (AndroidManifest.xml)
    : `mrloginrnexample://auth`;        // ios deep link setting (Info.plist)

const result = await mrlogin.login(redirectUri);
// login result : TokenObject { accessToken: string, refreshToken: string }

decodeToken

The decode Token method decodes the access token issued after completing login and returns the data included in the access_token. an JwtPayload & AccessTokenData


const mrlogin = new Mrlogin({
  projectId: 'your project id', // required.
  endpoint: 'https://mrlogin.io', // optional, default: `https://mrlogin.io`
  port: 'endpoint port' // optional
});

const token = 'user-access-token';

const data = mrlogin.decodeToken(token);

verifyToken

The 'verify Token' method returns the data included in access_token by verifying and decrypting the access token issued after login on the server. an AccessTokenData


const mrlogin = new Mrlogin({
  projectId: 'your project id', // required.
  endpoint: 'https://mrlogin.io', // optional, default: `https://mrlogin.io`
  port: 'endpoint port' // optional
});

const token = 'user-access-token';

const data = await mrlogin.verifyToken(token);

createDidToken

The 'createDidToken' method issues and returns a did_Token containing a decentralized ID (DID) from the server through an access_token.

The DID token is encoded as a Base64 JSON string tuple representing [proof, claim]:

proof: A digital signature that proves the validity of the given claim.

claim: Unsigned data the user asserts. This should equal the proof after Elliptic Curve recovery.


const mrlogin = new Mrlogin({
  projectId: 'your project id', // required.
  endpoint: 'https://mrlogin.io', // optional, default: `https://mrlogin.io`
  port: 'endpoint port' // optional
});

const token = 'user-access-token';

const didtokenSolana = await mrlogin.createDidToken(
  'solana',
  token
);

const didtokenEth = await mrlogin.createDidToken(
  'ether',
  token
);

verifyDidToken

The 'verifyDidToken' method verifies and decrypts the did token and returns the data contained in did_token. an IDidToken


const mrlogin = new Mrlogin({
  projectId: 'your project id', // required.
  endpoint: 'https://mrlogin.io', // optional, default: `https://mrlogin.io`
  port: 'endpoint port' // optional
});

const decodeSolanaDidData = await mrlogin.verifyDidToken(didSolana, 'solana');
const decodeEtherDidData = await mrlogin.verifyDidToken(didSolana, 'ether');

token-object


interface TokenObject {
    accessToken: string;
    refreshToken: string;
}

access-token-data

interface AccessTokenData {
    customUserData?: any;
    email: string;
    multiFactor?: string;
    oauthToken?: any;
    passwordUpdatedDate?: Date;
    phoneNumber?: string;
    projectAdmin?: any;
    projectId: string;
    protectedBackupKey?: string;
    protectedShareKey?: string;
    provider: string;
    reported?: Date;
    tokenId?: string;
    userId: string;
    verifiedAt?: Date;
    verifiedEmail?: boolean;
    verifiedEmailAt?: Date;
    verifiedMobileIdentity?: boolean;
    verifiedMobileIdentityAt?: Date;
    verifyInterest?: Date;
    verifySMS?: boolean;
    verifyTerm?: Date;
}

did-token-data

interface IDidTokenAdd {
    tokenId: string;
    protectedKey: string;
}
interface IDidToken {
    iat: number;
    ext: number;
    iss: string;
    sub: string;
    aud: string;
    add: IDidTokenAdd;
    nbf: number;
    tid: string;
}