js-passcode

This is a custom element V1-based Passcode authentication.

Usage no npm install needed!

<script type="module">
  import jsPasscode from 'https://cdn.skypack.dev/js-passcode';
</script>

README

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