verify-once

VerifyOnce integration library and example

Usage no npm install needed!

<script type="module">
  import verifyOnce from 'https://cdn.skypack.dev/verify-once';
</script>

README

VerifyOnce

Downloads

Version

License

VerifyOnce verification service integration library and example.

Provides helpers for simple VerifyOnce service integration and example how to use it.

  • Works with express server.
  • Written in TypeScript, no need for extra typings.

Installation

This package is distributed via npm

npm install verify-once
yarn add verify-once

Usage

Credentials should be stored in projects config file. BaseUrl is optional param, for testing use dev or test prefix, defaults to https://app.verifyonce.com/api/verify

...

"verifyOnce": {
   "password": "integratorPassword",
   "username": "integratorUserName",
   "baseUrl":  "https://test-app.verifyonce.com/api/verify"
  },

...

Initiating Verify Once transaction

import { VerifyOnce } from "verify-once";

...

// all optional, are used for autofill
const userData : InitiateRequest = {
    country: CountryCode.BLR,
    firstName: "John",
    lastName: "Wick",
    email: "john@wick.com",
}

// initiate verification
const verifyOnce = new VerifyOnce(config.verifyOnce);

// passing userData object is optional
const verifyOnceInitiateResponse : InitiateResponse = await verifyOnce.initiate(userData);

...

Example

The example is located in the /example directory.

Running the example

  • Copy the example configuration file _.env to .env.
  • Make changes in the .env as needed.
  • Start the example by executing yarn start (npm start etc works as well).

Commands

  • yarn start to start the example application.
  • yarn build to build the production version.
  • yarn lint to lint the codebase.
  • yarn prettier to run prettier.