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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nxcd/datavalid-sdk

v2.0.0

Published

DataValid SDK for NodeJS

Downloads

11

Readme

Datavalid Node SDK

NodeJS SDK to Serpro's DataValid API

Build Status

Summary

What is it

This is a client SDK for DataValid a brazilian service to validate citizen data against government databases.

Usage

Install:

$ npm i @nxcd/datavalid-sdk

Instantiate class:

import {DataValidClient} from '@nxcd/datavalid-sdk'

const options = {
  apiUrl: 'https://apigateway.serpro.gov.br/datavalid/vbeta1',
  authUrl: 'https://apigateway.serpro.gov.br',
  consumerKey: 'key',
  consumerSecret: 'secret'
}

function foo () {
  const client = new DataValidClient(options)
}

All options are required to the client

API

Validate PF Data

Validates data against a physical person database and compare the data results from the database to the ones you sent:

Signature: async validatePFData (data: IDataValidPFInput): Promise<IDataValidSuccessPFResponse>

Input Parameters:

interface IDataValidPFInput {
  key: {
    cpf: string
  }
  answer?: {
    nome?: string
    sexo?: 'M' | 'F'
    data_nascimento?: string
    situacao_cpf?: string
    filiacao?: {
      nome_mae?: string
      nome_pai?: string
    }
    nacionalidade?: number
    endereco?: Address
    documento?: {
      tipo?: number
      numero?: string
      orgao_expedidor?: string
      uf_expedidor?: string
    }
    cnh?: {
      numero_registro?: string
      registro_nacional_estrangeiro?: string
      categoria?: string
      data_primeira_habilitacao?: string
      data_validade?: string
    }
  }
}

type Address = {
  logradouro: string
  numero: string
  complemento: string
  bairro: string
  cep: string
  municipio: string
  uf: string
}

Response:

interface IDataValidSuccessPFResponse {
  sexo: boolean
  data_nascimento: boolean
  situacao_cpf: boolean
  filiacao: {
    nome_mae: boolean
    nome_mae_similaridade: number
    nome_pai: boolean
    nome_pai_similaridade: number
  }
  nacionalidade: boolean
  endereco: {
    logradouro: boolean
    logradouro_similaridade: number
    numero: boolean
    numero_similaridade: number
    bairro: boolean
    bairro_similaridade: number
    cep: boolean
    municipio: boolean
    municipio_similaridade: number
    uf: boolean
    uf_similaridade: number
  }
  documento: {
    tipo: boolean
    numero: boolean
    orgao_expedidor: boolean
    uf_expedidor: boolean
  }
  cnh: {
    categoria: boolean
    registro_nacional_estrangeiro: boolean
    data_primeira_habilitacao: boolean
    data_validade: boolean
    numero_registro: boolean
  }
}

Validate PF Image

Will validate an image against the database to compare similarity

Signature: async validatePFImage (data: IDataValidImageInput): Promise<IDataValidSuccessImageResponse>

Input Parameters:

interface IDataValidImageInput {
  key: {
    cpf: string
  }
  answer: {
    biometria_face: string
  }
}

biometria_face should be the base64 data of an image

Response:

interface IDataValidSuccessImageResponse {
  filiacao: {}
  endereco: {}
  documento: {}
  cnh: {}
  biometria_face: {
    disponivel: boolean
    probabilidade: string
    similaridade: number
  }
}

Validata PJ data

Validates data from a juridic person.

Signature: async validatePJData (data: IDataValidPJInput): Promise<IDataValidSuccessPJResponse>

Input parameters:

export interface IDataValidPJInput {
  key: {
    cnpj: string
  }
  answer?: {
    razao_social?: string
    nome_fantasia?: string
    data_abertura?: string
    cnae_principal?: {
      codigo?: string
      descricao?: string
    }
    natureza_juridica?: {
      codigo?: string
      descricao?: string
    }
    endereco?: Address
    situacao_especial?: string
    situacao_cadastral?: {
      codigo?: number
      data?: string
      motivo?: string
    }
    nome_orgao?: string
    ente_federativo?: string
    correio_eletronico?: string
    capital_social?: number
    porte?: string
    telefone?: {
      ddd?: string
      numero?: string
    }
  }
}

type Address = {
  logradouro: string
  numero: string
  complemento: string
  bairro: string
  cep: string
  municipio: string
  uf: string
}

Response:

interface IDataValidSuccessPJResponse {
  razao_social: boolean
  razao_social_similaridade: number
  nome_fantasia: boolean
  nome_fantasia_similaridade: number
  data_abertura: boolean
  cnae_principal: {
    codigo: boolean
    descricao: boolean
    descricao_similaridade: number
  }
  natureza_juridica: {
    codigo: boolean
    descricao: boolean
    descricao_similaridade: number
  }
  endereco: {
    logradouro: boolean
    logradouro_similaridade: number
    numero: boolean
    numero_similaridade: number
    complemento: boolean
    complemento_similaridade: number
    bairro: boolean
    bairro_similaridade: number
    cep: boolean
    municipio: boolean
    municipio_similaridade: number
    uf: boolean
    uf__similaridade: number
  }
  situacao_especial: boolean
  situacao_especial_similaridade: number
  situacao_cadastral: {
    codigo: boolean
    data: boolean
    motivo: boolean
    motivo_similaridade: number
  }
  nome_orgao: boolean
  nome_orgao_similaridade: number
  ente_federativo: boolean
  ente_similaridade: number
  correio_eletronico: boolean
  correio_eletronico_similaridade: number
  capital_social: boolean
  porte: boolean
  telefone: {
    ddd: boolean
    numero: boolean
    data_primeira_habilitacao: boolean
    data_validade: true
  }
}