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

tirl-validator

v0.5.0

Published

Utilities for integrating with the TrustlessIRL protocol. Built for React Native

Downloads

25

Readme

tirl-validator

Utilities to enable verifying TrustlessIRL physical labels. Built for React Native

Installation

npm install --save tirl-validator

# If building for IOS
npx pod-install

About

This library facilitates easy integration with the TrustlessIRL protocol by enabling mobile applications to perform camera based scans of TIRL labels.

Read more about the TrustlessIRL protocol here.

Successful scans must capture images of the label with the camera tilted slightly to the left, and slightly to the right - as TIRL labels are 3-Dimensional.

Usage

The TirlValidator class exposes a single function:

validate(imagePath): Promise

Read the image at imagePath and return result if scan completed, or further scan requirements if not.

Params

  • imagePath string - should contain an image of a valid TIRL label

Returns

{
  labelId: string; // ID of TIRL label being scanned
  scanDone: boolean; // Returns true when both scanLeft and scanRight are true. Indicates scanning has completed.
  valid: boolean; // Notifies whether scanned label is authentic. Field is set only when scanDone === true
  scanLeft: boolean; // Indicates whether sufficient data has been captured with the camera tilted left.
  scanRight: boolean; // Indicates whether sufficient data has been captured with the camera tilted right.
  error: Object; // Any errors will be returned here
}

Error Handling

Occasionally the validate() function can return a property called error. The following is a list of common errors and how best to handle them based on the error.message property.

| Code | Description | Handling | | ---- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | 1 | Indicates that the image being processed does not contain a TIRL label or is out of focus | Safe to continue with scan. Can optionally prompt the user to adjust camera distance | | 2 | Indicates that the user may be scanning multiple unique labels within a single scan session. | Should instantiate a new instance of the TirlValidator class and restart the scan | | 3 | Indicates a network request to fetch label data has failed. | Safe to continue with scan. May indicate general connectivity issues | | 4 | Indicates that the Tirl label being scanned is not known by the network | FATAL: This label is not known by the network and cannot be validated | | 999 | Indicates an unexpected error was thrown by the image processing module | Safe to continue with scan. Can inspect error.message for more detail |

Example

A full example can be found in this repository which utilizes vision-camera and react-native-fs

Running the example

Make sure you have followed all of the steps required for setting up your React Native Development Environment

Running on an IOS Device

Follow the instructions for running React Native on your IOS Device

Running on Android

npm run bootstrap
cd example
npm run android

You may need to add the following to the example/android/local.properties file

# On Windows
sdk.dir=C:\\Users\\<name>\\AppData\\Local\\Android\\sdk

# On Mac
sdk.dir=/Users/<name>/Library/Android/sdk

You will also need to have a working webcam or camera device attached to your mobile simulator

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library