npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@deconve/liveness-3d

v0.1.9

Published

Deconve integration layer for AWS Amplify face liveness 3D detection

Readme

@deconve/liveness-3d

Integração Deconve para detecção de liveness 3D. Encapsula autenticação e gerenciamento de sessão contra o backend Deconve.

Instalação

npm install @deconve/liveness-3d

Peer dependencies

npm install react react-dom @aws-amplify/ui-react @aws-amplify/ui-react-liveness

Inclua os estilos no ponto de entrada da aplicação:

import "@aws-amplify/ui-react/styles.css";
import "@aws-amplify/ui-react-liveness/styles.css";

API

getToken(apiKey, authUrl?)

Troca a chave de API por um JWT de acesso.

import { getToken } from "@deconve/liveness-3d";

const token = await getToken("sua-api-key");

useFaceLivenessSession(apiBaseUrl, token)

Hook React que inicia uma sessão de liveness e retorna as credenciais necessárias para o detector.

const { faceLivenessData, faceLivenessLoading, faceLivenessError, createSession } =
  useFaceLivenessSession(apiBaseUrl, token);

| Retorno | Tipo | Descrição | |---|---|---| | faceLivenessData | FaceLivenessData \| null | Dados da sessão ativa | | faceLivenessLoading | boolean | true enquanto a sessão está sendo criada | | faceLivenessError | unknown | Erro da requisição, se houver | | createSession | () => Promise<void> | Recria a sessão manualmente |

createLivenessSession(apiBaseUrl, token)

Versão imperativa (sem hook) de criação de sessão.

const data: FaceLivenessData = await createLivenessSession(apiBaseUrl, token);

finishLivenessSession(livenessSessionId, apiBaseUrl, token)

Finaliza a sessão e retorna o resultado da verificação.

const result: FinishResponse = await finishLivenessSession(
  faceLivenessData.livenessSessionId,
  apiBaseUrl,
  token
);

console.log(result.isLive);  // true | false
console.log(result.status);  // detalhe opcional
console.log(result.image);   // frame capturado em base64, se disponível

Tipos

interface FaceLivenessData {
  livenessSessionId: string;
  accessCredentials: AccessCredentials;
}

interface AccessCredentials {
  accessKeyId: string;
  secretAccessKey: string;
  sessionToken: string;
}

interface FinishResponse {
  isLive: boolean;
  status?: string;
  image?: string;
}

Exemplo de uso

import { useState, useEffect } from "react";
import {
  getToken,
  useFaceLivenessSession,
  finishLivenessSession,
  FaceLivenessDetectorCore,
  type FinishResponse,
} from "@deconve/liveness-3d";

const API_URL = "https://api.deconve.com";

interface Props {
  apiKey: string;
  onResult: (result: FinishResponse) => void;
}

export function LivenessCapture({ apiKey, onResult }: Props) {
  const [token, setToken] = useState<string | null>(null);

  useEffect(() => {
    getToken(apiKey).then(setToken);
  }, [apiKey]);

  const { faceLivenessData, faceLivenessLoading, faceLivenessError, createSession } =
    useFaceLivenessSession(API_URL, token ?? "");

  if (!token || faceLivenessLoading) return <p>Iniciando sessão...</p>;

  if (faceLivenessError) {
    return (
      <div>
        <p>Não foi possível iniciar a sessão.</p>
        <button onClick={createSession}>Tentar novamente</button>
      </div>
    );
  }

  const handleAnalysisComplete = async () => {
    const result = await finishLivenessSession(
      faceLivenessData!.livenessSessionId,
      API_URL,
      token
    );
    onResult(result);
  };

  return (
    <FaceLivenessDetectorCore
      sessionId={faceLivenessData?.livenessSessionId ?? ""}
      region="us-east-1"
      onAnalysisComplete={handleAnalysisComplete}
      onError={createSession}
      onUserCancel={createSession}
      config={{
        credentialProvider: async () => faceLivenessData!.accessCredentials,
      }}
    />
  );
}

Build

npm install
npm run build   # gera dist/
npm run dev     # watch mode