1.0.5 โข Published 5 months ago
@dwn-protocol/identifi-react v1.0.5
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
Prop | Type | Required | Description |
---|---|---|---|
title | string | โ | Title displayed in the component |
appConfig | object | โ | Configuration object for Identifi API |
onError | function | โ | Callback for error handling |
onSuccess | function | โ | Callback when the process is successful |
appConfig
object
Key | Type | Description |
---|---|---|
pbUrl | string | URL of the Identifi API endpoint |
userId | string | Your platforms user id |
apiKey | string | API 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
- Clone the repo.
- Run
npm install
. - Start development:
npm run dev
๐ License
MIT License