1.0.2 • Published 7 years ago

morse-passcode v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

morse-passcode

A React Native component that implements security with morse code

Install

npm install --save morse-passcode

Import

import Doorman from 'morse-passcode';

Usage

render() {
  return (
    <Doorman
      style={styles.container}
      onPress={(x, y) => {}}
      onRelease={(x, y) => {}}
      passcode={[[0,84],[448,528],[960,1036]]}
      leeway={1000}
      onFail={input => {
        // set leeway to something high like 5000 and use this to find a passcode
        console.log('Failed', JSON.stringify(input));
      }}
      onSuccess={input => {}}
      rippleDuration={2000}
      fadeOutDuration={1000}
      rippleColor="#ccf2ff"
      >
      {/* children of Doorman will act as if they were in a View */}
    </Doorman>
  );
}

Example code

SOS

npm.io

Shave and a haircut two bits

npm.io

Maybe TODO if (this gets popular)

  1. passcode incorporating tap location
  2. multiple passcodes granting different access

Inspired by this CodePen by Fabrizio Bianchi

Main differences being that this example uses React Native and takes into account press length as opposed to just taps.