npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-visual-d-auth

v1.0.33

Published

NPM package for your projects decentralised graphical password authentication.

Downloads

18

Readme

Visual-D-Auth

The NPM package for your projects decentralised graphical password authentication.

Version License

Table of Contents

Introduction

Visual-D-Auth is a NPM package that allows you to use your wallet to authenticate your users in your projects. It uses the wallet you are using to sign a message and send it to the VisualDAuth contract. The contract then verifies the signature and returns the result. The result is then passed to the onSuccessHandler function. If there is an error in the process, the error is passed to the onErrorHandler function.

Installation

npm install react-visual-d-auth

Usage in React

Step 1: Import the package in your project and wrap your app with the VisualDAuthProvider. You need to also pass in the following props:

  • publicKey: The public key of your wallet
  • privateKey: The private key of your wallet
  • mode: The mode of the wallet. Can be either "Development" or "Production"
  • useWindowWallet: Whether to use the wallet in the window object or not
  • onErrorHandler: A function to handle errors
  • onSuccessHandler: A function to handle success
import React, { useState } from 'react'
import { VisualDAuthProvider } from 'react-visual-d-auth'

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
  <VisualDAuthProvider
    publicKey={WALLET_ADDRESS}
    privateKey={WALLET_PRIVATE_KEY}
    mode={'Development'}
    useWindowWallet={false}
    onErrorHandler={handleError(result)}
    onSuccessHandler={handleSuccess(result)}
  >
    <App />
  </VisualDAuthProvider>,
)

Step 2: Import the AuthButton component and use it in your project. You need to pass in the following props:

  • styles: The styles of the button (optional)
  • className: The class name of the button (optional)
import React from 'react'
import { AuthButton } from 'react-visual-d-auth'

const App = () => {
  return (
    <div>
      <AuthButton />
    </div>
  )
}

export default App

OR

import React from 'react'
import { AuthButton } from 'react-visual-d-auth'

const App = () => {
  return (
    <div>
      <AuthButton>
        <div>Custom Button</div>
      </AuthButton>
    </div>
  )
}

export default App

Thats it! You are now ready to use the package in your react project. You can also check out the example project in the examples folder.

Instructions for VisualDAuthProvider props

1. publicKey

  • The public key of your wallet. This is the address of your wallet. You can get this from the wallet you are using. For example, if you are using Metamask, you can get this from the Metamask extension. If you are using the wallet in the window object, you can get this from the window object.

  • For Development mode, VisualDAuthProvider is using the Sepolia testnet. You can get a testnet wallet from here, and get some testnet ETH from here.

  • For Production mode, VisualDAuthProvider is using the Ethereum mainnet. You can get a mainnet wallet from here, and get some mainnet ETH from here.

2.privateKey

  • The private key of your wallet. You can get this from the wallet you are using. For example, if you are using Metamask, you can get this from the Metamask extension. If you are using the wallet in the window object, you can get this from the window object.

  • For Development mode, VisualDAuthProvider is using the Sepolia testnet. You can get a testnet wallet from here, and get some testnet ETH from here.

  • For Production mode, VisualDAuthProvider is using the Ethereum mainnet. You can get a mainnet wallet from here, and get some mainnet ETH from here.

3.mode

  • The mode of the wallet. Can be either "Development" or "Production".

  • Provide the public and private keys of your wallet according to the mode you are using. For example, if you are using the Development mode, provide the public and private keys of your wallet in the Goerli testnet. If you are using the Production mode, provide the public and private keys of your wallet in the Ethereum mainnet.

3.useWindowWallet

  • Whether to use the wallet in the window object or not. If set to true, VisualDAuthProvider will use the wallet in the window object. If set to false, VisualDAuthProvider will use the wallet passed in the publicKey and privateKey props.

4.onErrorHandler

  • A function to handle errors. This function will be called when there is an error in the authentication process. The function will be passed the error object as a parameter.

5.onSuccessHandler

  • A function to handle success. This function will be called when the authentication process is successful. The function will be passed the result object as a parameter.

Instructions for AuthButton props

1.styles

  • The styles of the button. You can pass in the styles as an object. For example, if you want to change the background color of the button, you can pass in the following object:
const styles = {
  backgroundColor: 'red',
}

2.className

  • The class name of the button. You can pass in the class name as a string. For example, if you want to add a class name to the button, you can pass in the following string:
const className = 'my-class-name'

Support

If you like this project, please consider supporting it by giving it a star ⭐️.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Acknowledgements

Disclaimer

This project is not affiliated with VisualD in any way. It is a personal project.

License

MIT

Author

Rishikesh Shinde

Closing Notes

If you have any questions, feel free to reach out to me on Twitter. I would love to hear from you.

If you like this project, please consider supporting it by giving it a star ⭐️.

Thank you!