1.2.0 • Published 3 years ago

react-bitclout-login v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

React BitClout Login

This project is based on mubashariqbal/login-with-bitclout repository.

@mubashariqbal, Thanks a lot for your code!

Developed by @transhumanist

https://bitclout.com/u/transhumanist

ui

Install

npm install react-bitclout-login

Security

This code is very raw and may contain vulnerabilities. I ask you to help make it better. Feel free to add issues and pull requests to react-bitclout-login github.

JWT

If you only want to verify Bitclout users, JWT token would be enough for this goal. Storing it in the database is safer than encryptedSeedHex(with high access level) because JWT can't sign Bitclout transactions. You can validate user publicKey by JWT token. See an example here: https://docs.bitclout.com/devs/identity-api#validation-in-go

How to use

import './App.css';
import React from "react";
import BitcloutLogin from "react-bitclout-login";
import { makeStyles } from '@material-ui/core/styles';
import LockOpenIcon from '@material-ui/icons/LockOpen';

const useStyles = makeStyles((theme) => ({
  loginButton: {
    backgroundColor: '#FFFFFF',
    textTransform: 'none'
  }
}));


function App() {
  const responseClout = (response) => {
    console.log(response)
    /**
    {
        "hasExtraText": false,
        "publicKey": USER_publicKey,
        "btcDepositAddress": USER_btcDepositAddress,
        "encryptedSeedHex": USER_encryptedSeedHex,
        "network": "mainnet",
        "accessLevel":  USER_accessLevel,
        "accessLevelHmac": USER_accessLevelHmac,
        "jwt": USER_jwt
    }
    */
  }
  /**
   * Users can control access level on a per-domain and per-account basis.
   * Read more:
   * https://docs.bitclout.com/devs/identity-api#access-levels
  */
  const accessLevel = 4;
  /**
   * JWT requires access leve 2+
   * Read more:
   * https://github.com/bitclout/identity/blob/main/src/app/identity.service.ts#L115
   * https://github.com/bitclout/identity/blob/main/src/types/identity.ts#L31
   */
  const JWT = true;
  return (
    <div className="App">
      <BitcloutLogin
        accessLevel={accessLevel}
        onSuccess={responseClout}
        onFailure={responseClout}
        JWT={JWT}
        customization={{className: classes.loginButton}}
        // customIcon={<LockOpenIcon/>}
      />
    </div>
  );
}

export default App;
1.2.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago