1.0.8 • Published 3 years ago

react-app-protect v1.0.8

Weekly downloads
73
License
MIT
Repository
github
Last release
3 years ago

react-app-protect

Password protect a react app.

Simple password field, not a replacment for basic auth.

Not secure at all.

NPM JavaScript Style Guide

Demo

password: test

Install

npm install --save react-app-protect
yarn add react-app-protect

Using FingerprintJS to encrypt the password via AES. Storing the cipher in the localStorage. Checking if the stored cipher is valid against the sha512 hash.

Props

NameTypeDefaultDescription
sha512StringSHA 512 Hash app
blurBooleanfalseBlur the content
boxTitleStringThis page is password protected.Title of the login box
inputPlaceholderStringPasswordPlaceholder for the input field
buttonLabelStringSubmitLabel used for the button
stylesObjectStyles

Usage

import React, { Component } from 'react'

import Protect from 'react-app-protect'
import 'react-app-protect/dist/index.css'

class App extends Component {
  render() {
    return (
      <Protect sha512='EE26B0DD4AF7E749AA1A8EE3C10AE9923F618980772E473F8819A5D4940E0DB27AC185F8A0E1D5F84F88BC887FD67B143732C304CC5FA9AD8E6F57F50028A8FF'>
        <div>Content</div>
      </Protect>
    )
  }
}

License

MIT © bay0