Skip to content

mosip/ble-verifier-sdk

Repository files navigation

ble-verifier-sdk

This module facilitates seamless interaction with Tuvali's verifier module for BLE (Bluetooth Low Energy) transfers. It offers a user-friendly API tailored for the verifier App's convenience. Additionally, it maintains essential state data within its context, which the UI module can access and utilize effectively.

Also have React Hooks, Request Util and any other utilities that makes it easier for verifier to integrate.

Installation

npm install @mosip/ble-verifier-sdk

Usage

import OVP_BLE from "@mosip/ble-verifier-sdk";
import OVP_BLE_Verifier_UI from "mosip-react-native-ble-verifier-ui";
const instance = new OVP_BLE({deviceName: "simVerifier"});

const VPShare = ({onSuccess}) => {
	useEffect(() => {
            instance.startTransfer().then((data) => onSuccess(data));
	})

	return <OVPBLE_Verifier_UI instance={instance} theme={theme} />
}

Note: The mosip-react-native-ble-verifier-ui module is yet to be build. If you want to implement your own UI screens, please look at the documentation for internal APIs.

API Reference

1. new new OVP_BLE(config)

Initialize the ovp-ble module with the config provided

const instance = new OVP_BLE({deviceName: "simVerifier"});

  1. deviceName : This name is provided in the advertisment payload during the BLE advertisement. This field have a limit of 11 characters.

2. startTransfer()

This API starts the BLE transfer with the config provided. This method returns a Promise<String>.

Success Case

Promise resolves with the VC.

{ vc: string }

Note: Once the specification is completed, this will be returning VP instead.

Error Case

Promise rejects with error code and error method.

{
  errorCode: string;
  errorMessage: string;
}

Most of the error code are coming from Tuvali. Some of them are from ovp-ble itself. Such as

  • OVP_001 --> 'Transfer stopped'
  • OVP_002 --> 'Device name length exceeded limit of 11 characters'
  • Tuvali error codes

3. stopTransfer()

This API stops the BLE trasfer.

Contributing

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