@bottomline/mobile-native-utils

1.0.0 • Public • Published

Mobile Native Utils

Conventional Commits Commitizen friendly

Mobile JavaScript utilities for native applications

Overview

In a hybrid app, biometric authentication is achieved via round trip communication between the Web/JavaScript (WJS) layer and the mobile-native-utils module (UTIL). To obtain information and invoke functionality, WJS calls the UTIL methods and UTIL methods fulfill or reject the promise.

Contents

Data

API

Development

Publishing

Data

Integrity

Objects passed as parameters to the UTIL methods are run through JSON.stringify(), encrypted, and stored on the device.

Objects stored on device are decrypted and returned as JSON.

Promise Response - Structure

Promise response returns JSON, containing two objects (data and error).

Fulfilled will contain populated data object

{
	"data": {
		"key1": "Value 1",
		"keyTwo": "Value for keyTwo"
	},
	"error": null
}

Rejected will contain populated error object

{
	"data": {},
	"error": {
		"type": "errorType",
		"message": "Error description"
	},
}

API

INITIALIZATION

getNativeParams()

Native params contain OS, Device, and Platform information.

Note: this information is also available in the window.BOTTOMLINE.NATIVE_PARAMS object on page request/load.

WJS can use this information to determine that the page has been requested/loaded by a mobile app user.

Values

osType: "iOS", 								// iOS or Android
osVersion: "13.3.1", 						// device OS version
deviceModel: "iPhone XR", 					// device hardware model
deviceName: "Bottomline iPhone XR", 		// device name or "Unavailable" if not set
deviceId: "ASDF38-ADK27-38SDK8",			// device ID or "Unavailable" if not set
platformBuild: "19", 						// the App build number
platformVersion: "5.5.0", 					// the App version number
platformId: "com.domain.identifer"			// the unique App identifier

STATUS

getStatusInformation()

UTIL will fulfill promise with information regarding device biometric capability and data storage or reject with error.

Parameters: None

Fulfilled will contain populated data object

{
	"data": {
		"biometricCapability": "touchID",			// values -> none, touchID, faceID, fingerprint 
		"sdkContainsSecureData": false,				// Bool
		"sdkContainsBiometricsSecureData": true		// Bool
	},
	"error": null
}

Rejected will contain populated error object

{
	"data": {},
	"error": {
		"type": "touchID",		// error enum
		"message": false,		// error description
	}
}

SECURE STORAGE

setSecureData(object)

UTIL will JSON.stringify(), encrypt and store the object securely on the device.

getSecureData()

Calling this method will prompt the SDK to decrypt and return the stored object in the promise response.

deleteSecureData()

Calling this method will prompt the UTIL to delete the stored object.

SECURE STORAGE - BIOMETRIC

setBiometricSecureData(object)

UTIL will JSON.stringify(), encrypt and store the object securely on the device.

getBiometricSecureData()

Initiates biometric authentication of user. Upon successful authentication, SDK will decrypt and return the stored object in the promise response.

  • Parameters : None
  • Return values: See Promise Response – Data Structure

deleteBiometricSecureData()

Deletes the stored biometrics secure data. Resets biometric status.

Development

Local development is broken into two parts (ideally using two tabs).

First, run rollup to watch your src/ module and automatically recompile it into dist/ whenever you make changes.

npm start # runs rollup with watch flag

The second part will be running the example/ create-react-app that's linked to the local version of your module.

# (in another tab)
cd example
npm start # runs create-react-app dev server

Now, anytime you make a change to your library in src/ or to the example app's example/src, create-react-app will live-reload your local dev server so you can iterate on your component in real-time.

Publishing to npm

npm publish

This builds cjs, es, and umd versions of your module to dist/ and then publishes your module to npm.

Make sure that any npm modules you want as peer dependencies are properly marked as peerDependencies in package.json. The rollup config will automatically recognize them as peers and not try to bundle them in your module.

Dependencies (0)

    Dev Dependencies (30)

    Package Sidebar

    Install

    npm i @bottomline/mobile-native-utils

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    68.1 kB

    Total Files

    21

    Last publish

    Collaborators

    • oculus42
    • ralphsmith80
    • unsingefou
    • mitchellhillman
    • rstowe