0.4.7 • Published 1 year ago

react-tokenproof v0.4.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Eduardo SanMarco 8:13 AM (0 minutes ago) to me

React-Tokenproof

This package is to be used when authenticating with Tokenproof in a React environment.

Quick Features

  • Context provider for configuring keys
  • Utility methods provided from TokenProof: login, logout, close, loginButton, setEvents

Installation

# npm
npm install react-tokenproof

# yarn
yarn add react-tokenproof

# pnpm
pnpm install react-rokenproof

React environment

In order to use react-tokenproof you will need to have a React environment setup.

Setup

The current version of this package leverages a TokenProofProvider to inject a config object:

<TokenProofProvider config={{
    appId: 'my-app-id',
    webhook: 'https://my-webhook.com',
}}>
    <App />
</TokenProofProvider>

Usage

After adding & configuring the TokenProofProvider, pull in the useTokenProof. You can use the following methods:

const { login, logout, close, loginButton, setEvents } = useTokenProof();

Set the onNonce and/or onVerify callbacks using setEvents on load of the component

useEffect(() => {
    setEvents({
        onNonce: (nonceEvent) => console.log("onNonce:", nonceEvent),
        onVerify: (verifyEvent) => console.log("onVerify:", verifyEvent),
    })
}, []);

Now you can authenticate/login and utilize the Tokenproof utility methods.

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.3.2

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.3.4

1 year ago

0.4.2

1 year ago

0.3.3

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago