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

react-native-rakshith

v2.2.2

Published

test

Downloads

3

Readme

Warning: The library is under active development and no major version is released yet. Please anticipate non-backward compatible changes to the API and functional behavior in the upcoming releases.

Tuvali - React native module library

This is the React native module for the OpenID for Verifiable Presentations over BLE implementation to support sending vc/vp using Bluetooth Low Energy local channel.

This contains the source code for the ios, android modules as well as a sample app under example/ folder. The sample app can be used for testing the modules being worked on in case it is needed.

Installing this library as a dependency

# Install latest version
npm install mosip/tuvali

# or

# Install specific version
npm install mosip/tuvali#v0.3.7

API documentation

Firstly, for establishing the secured connection over BLE the Verifier's URI needs to be exchanged between two devices. The exchange of URI can be accomplished, but is not limited to, by using a QR code.

For example use QR code generator to visually display URI and QR code scanner to read. A mobile app that displays a QR code can act as an Verifier by including its URI as data in the QR code and another device can act as Wallet which scans the QR code, it can extract the URI and initiate a BLE connection with the advertising device.

URI exchange and Establishing connection

Verifier

The Verifier device can show a QR code with the URI. Verifier can generate URI through startAdvertisement() method. Once advertisement is started, Verifier will keep advertising with an advertisement payload derived from URI.

import tuvali from 'react-native-tuvali';
const { verifier } = OpenIdBle;

const uri = verifier.startAdvertisement();
console.log(uri);

The URI contains:

OPENID4VP://connect?name=STADONENTRY&key=8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a

URI structure can be found in the spec --> https://bitbucket.org/openid/connect/src/master/openid-4-verifiable-presentations-over-ble/openid-4-verifiable-presentations-over-ble-1_0.md

E.g: OPENID4VP://connect?name=<CLIENT_NAME>&key=<VERIFIER_PUBLIC_KEY>

Wallet

The Wallet device that scans the QR code will extract the URI from QR code and start scanning using startConnection() method.

wallet.startConnection(uri);

The Wallet device will keep on scanning for a verifier that has same URI in its advertisement. If URI is matched, Wallet will initiate a connection with the Verifier and exchange Public Keys.

Share data

Once the connection is established, Wallet can send the data by:

wallet.send(data);

Wallet will start sending data in a secured way to the Verifier.

Note: At this moment, we currently support data transfer from Wallet to Verifier only.

Verifier Response

Once Data is received, Verifier can send verification status by:

verifier.sendVerificationStatus(status);

Status can be either ACCEPTED or REJECTED. Sending verification status acts as closure for transmission and devices will start disconnecting.

Events from Tuvali

Tuvali sends multiple events to propagate connection status, received data etc. These events can be subscribed to by calling:

on Wallet:

wallet.handleDataEvents((event: WalletDataEvent) => {
  // Add the code that needs to run once data is received
})

on Verifier:

verifier.handleDataEvents((event: VerifierDataEvent) => {
  // Add the code that needs to run once data is received
})

Here are the different types of events that can be received

Common Events

Events which are emitted by both Wallet and Verifier

  1. onConnected
    • {"type": "onConnected"}
    • on BLE connection getting established between Wallet and Verifier
  2. onSecureChannelEstablished
    • {"type": "onSecureChannelEstablished"}
    • on completion of key exchange between Wallet and Verifier
  3. onError
    • {"type": "onError", "message": "Something Went wrong in BLE", "code": "TVW_CON_001"}
    • on any error in Wallet or Verifier
  4. onDisconnected
    • {"type": "onDisconnected"}
    • on BLE disconnection between Wallet and Verifier

Wallet Specific Events

  1. onDataSent
    • {"type": "onDataSent"}
    • on completion of Data transfer from the Wallet Side
  2. onVerificationStatusReceived
    • {"type": "onVerificationStatusReceived", "status": "ACCEPTED"}
    • on received verification status from Verifier

Verifier Specific Events

  1. onDataReceived
  • {"type": "onDataReceived"}
  • on receiving data from the Wallet Side

Connection closure

The device on which app is running can destroy the connection by calling disconnect() method:

wallet/verifier.disconnect();