1.0.0 • Published 4 years ago

js-passcode v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

js-passcode

This is a custom element V1-based Passcode authentication.

passcode.jpg

Examples

There are some examples in "./examples" in this package.Here is the first one to get you started.

Installation

npm install js-passcode;

Usage

Add passcode element to HTML.

<js-passcode id="passcode"></js-passcode>

Perform passcode authentication with JS.

import 'js-passcode';

// Correct passcode
const correctPasscode = '1234';

// Passcode authentication
document.querySelector('#passcode').authenticate(correctPasscode, success => {
  // If the passcode is correct, the callback function argument returns true.
  if (success) alert('Authenticated Successfully');
  else alert('Authentication Failed');
});

License

MIT licensed