2.0.0 • Published 1 month ago

asliri-passive-liveness-react v2.0.0

Weekly downloads
-
License
Asliri License
Repository
-
Last release
1 month ago

ASLIRI - PASSIVE LIVENESS - WEB SDK (React Component)

Description

You can verification face with passive liveness by ASLIRI. The SDK support for ReactJS / NextJS

Check out the SDK for a simplified integration.

1. Copy wasm folder to public directory

  • wasm folder provided by ASLIRI
  • copy to projectname/public/copyhere...

2. Get your token with ASLIRI Team

3. Install Library via NPM

npm i asliri-passive-liveness-react

sample in App.tsx :

import { CheckAuthentication, PassiveLiveness } from "asliri-passive-liveness-react"
import { useCallback, useEffect, useState } from "react";
function App() {

  const result = (data:any) => {
    console.log(data.message); // message response
    console.log(data.result); // result liveness
    console.log(data.image); // image base64
  };

  const [auth, setAuth]:any = useState("");
  const [apiCalled, setApiCalled] = useState(false);

  const getAuth = async () => {
    const getAuthenticationResult = await CheckAuthentication("provided by ASLIRI");
    setAuth(getAuthenticationResult);
    console.log({ getAuthenticationResult });
  };

  useEffect(() => {
    setApiCalled(true);
  }, []);

  useEffect(() => {
    if (apiCalled) {
      getAuth();
    }
  }, [apiCalled]);

  const handleError = useCallback((error: Error) => {
    alert(error);
  }, []);

  return (
    <>
      <PassiveLiveness getAuthentication={auth} getResult={result} onError={handleError} />
    </>
  )
}

export default App

Thank you.

2.0.0

1 month ago

1.0.0

4 months ago