0.0.0-beta.7 • Published 10 months ago

@vitacore-company/vita3auth v0.0.0-beta.7

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Vita3auth

React component based on ethers.js library for easy authorization in web3 applications. Login requires mail, password and a unique guid for more security. Save the generated guid for your next login. After creating the wallet, the component gives the Wallet object.

Installation

npm install @vitacore-company/vita3auth --save

Usage

import { Auth } from "@vitacore-company/vita3auth"
import "@vitacore-company/vita3auth/dist/index.css"

<Auth
  onEOAchange={setEOAwallet}
  label="Authorization"
  language="en"
  saveCodeExternal={[
    {
      label: "Console code",
      fn: (code) => console.log(code),
      icon: () => <div>Console</div>,
    },
  ]}
  addCodeExternal={[
    {
      label: "Add code external",
      fn: () => "cf0a4220-50c1-4539-89b4-9155195b5e9e",
      icon: () => <div>External</div>,
    },
  ]}
  providerURL="https://rpc.chiadochain.net"
/>

Acknowledgements

Styles

add @vitacore-company/vita3auth/dist/index.css/scss

API

Auth

ParameterTypeDescription
onEOAchange(wallet: Wallet) => voidRequired Returns wallet object after generating
labelstringRequired Title of the login page
saveCodeExternalobjRequired ISaveExternalMethod[]
addCodeExternalobjRequired IAddExternalMethod[]
providerURL?stringBlockchain provider
language?stringen,ru,ch,ar,sp,in,it,ge

Types

interface IAddExternalMethod {
  label: string
  fn: () => string
  icon: () => JSX.Element
}
interface ISaveExternalMethod {
  label: string
  fn: (e: string) => void
  icon: () => JSX.Element
}

Predefined localization

sp Spainish, ge Deutsch, ru Russian en English, ch Chinese, it Italian in Indian, ar Arabic

AddressEOA

import { AddressEOA } from "@vitacore-company/vita3auth"
import "@vitacore-company/vita3auth/dist/index.css"


<AddressEOA address={EOAwallet.address} />
ParameterTypeDescription
address?string
noAddressLabel?string

Authors

🔗 Links

github