1.0.5 โ€ข Published 5 months ago

@dwn-protocol/identifi-react v1.0.5

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

IdentifiReact

IdentifiReact is a React component that integrates with the Identifi service, enabling user identification and verification in your React applications with minimal setup.

๐Ÿš€ Features

  • Easy integration with the Identifi platform
  • Customizable configuration options
  • Callback hooks for success and error handling
  • Supports TypeScript

๐Ÿ“ฆ Installation

Install the package via npm:

npm install @dwn-protocol/identifi-react

๐Ÿ› ๏ธ Usage

import React from 'react';
import { IdentifiReact } from "identifi-react";
import "identifi-react/index.css"; // import "identifi-react/index.css" for the UI styling.

const App = () => {
  return (
    <IdentifiReact
      title="Identifi"
      appConfig={{
        pbUrl: import.meta.env.VITE_PB_URL,
        apiKey: import.meta.env.VITE_API_KEY,,
        userId: "your platforms users id",
      }}
      onError={(error) => {
        console.error("Identifi error:", error);
      }}
      onSuccess={(result) => {
        console.log("Identifi success:", result);
      }}
    />
  );
};

export default App;

โš™๏ธ Props

PropTypeRequiredDescription
titlestringโœ…Title displayed in the component
appConfigobjectโœ…Configuration object for Identifi API
onErrorfunctionโœ…Callback for error handling
onSuccessfunctionโœ…Callback when the process is successful

appConfig object

KeyTypeDescription
pbUrlstringURL of the Identifi API endpoint
userIdstringYour platforms user id
apiKeystringAPI key for authentication

๐Ÿงช Example Response

On success, the onSuccess callback receives a result object. On failure, the onError callback is triggered with an error object.

๐Ÿ”ง Environment Variables

Make sure you define your environment variables in a .env file:

VITE_PB_URL="your-pb-api-url"
VITE_API_KEY="your-pb-api-key"

๐Ÿ›  Development

  1. Clone the repo.
  2. Run npm install.
  3. Start development:
npm run dev

๐Ÿ“„ License

MIT License