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 🙏

© 2025 – Pkg Stats / Ryan Hefner

whom-intercepts

v1.0.0

Published

Biblioteca JavaScript para interceptação e manipulação de eventos WebPKI no sistema ESAJ

Readme

WHOM Intercepts

CI Release npm version

Biblioteca standalone para interceptação e manipulação de eventos WebPKI no sistema ESAJ sem dependência da extensão Chrome.

🎯 Sobre

Esta biblioteca permite a integração com o sistema ESAJ (Sistema de Automação da Justiça) simulando extensões Web PKI (Lacuna, Softplan, Certisign) sem a necessidade de uma extensão Chrome. É ideal para casos onde você precisa de flexibilidade na distribuição e implementação.

✨ Características

  • Standalone: Funciona sem extensão Chrome
  • Compatibilidade Total: Simula extensões Web PKI (Lacuna, Softplan, Certisign)
  • Múltiplas Formas de Distribuição: CDN, Bookmarklet, UserScript, NPM
  • Sistema de Cache: Cache local para certificados
  • Logging Estruturado: Sistema de logs configurável
  • TypeScript: Código totalmente tipado
  • Modular: Arquitetura modular e extensível

📦 Instalação

NPM

npm install whom-intercepts

CDN

<script src="https://cdn.whom.com.br/whom-intercepts.min.js"></script>

🚀 Uso Básico

Importação ES6

import { WhomEsaj } from 'whom-intercepts';

const config = {
  token: 'seu-token-whom',
  environment: 'production',
  webpki: {
    type: 'lacuna', // lacuna, softplan, certSign
    certType: 'A1'
  }
};

await WhomEsaj.init(config);

Uso Global (CDN)

const config = {
  token: 'seu-token-whom',
  environment: 'production',
  webpki: {
    type: 'lacuna',
    certType: 'A1'
  }
};
const { WhomEsaj } = window.WhomIntercepts; 
WhomEsaj.init(config);

⚙️ Configuração

Configuração Completa

interface WhomEsajConfig {
  // Autenticação
  token: string;
  extensionId: string;
  environment: 'production' | 'development' | 'staging';
  
  // Web PKI
  webpki: {
    type: 'lacuna' | 'softplan' | 'certSign';
    xpath?: string; // Para iframes específicos
    certType?: 'A1' | 'A3';
  };
  
  // Cache
  cache: {
    enabled: boolean;
    ttl: number; // em segundos
    maxSize: number;
  };
  
  // Logging
  logging: {
    level: 'debug' | 'info' | 'warn' | 'error';
    enabled: boolean;
  };
  
  // Permissões
  permissions: {
    allowSignatures: boolean;
    allowCertificates: boolean;
    restrictions?: any;
  };
}

Configuração Mínima

const config = {
  token: 'seu-token',
  environment: 'production',
  webpki: { type: 'lacuna' }
};

📋 Exemplos de Uso

Bookmarklet

javascript:(function(){
  const script = document.createElement('script');
  script.src = 'https://cdn.whom.com.br/whom-intercepts.min.js';
  script.onload = function() {
    window.WhomIntercepts.init({
      token: 'seu-token-aqui',
      extensionId: 'seu-extension-id',
      environment: 'production',
      webpki: { type: 'lacuna', certType: 'A1' }
    });
  };
  document.head.appendChild(script);
})();

UserScript (Tampermonkey)

// ==UserScript==
// @name         WHOM ESAJ Integration
// @namespace    http://whom.com.br/
// @version      1.0
// @description  Integração WHOM com sistema ESAJ
// @match        https://*.esaj.tj*.jus.br/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  
  const config = {
    token: localStorage.getItem('whom-token'),
    environment: 'production',
    webpki: { type: 'lacuna', certType: 'A1' }
  };
  
  const script = document.createElement('script');
  script.src = 'https://cdn.whom.com.br/whom-intercepts.min.js';
  document.head.appendChild(script);
  
  script.onload = function() {
    window.WhomIntercepts.WhomEsaj.init(config);
  };
})();

Injeção Direta

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdn.whom.com.br/whom-intercepts.min.js"></script>
</head>
<body>
    <script>
        window.WhomIntercepts.WhomEsaj.init({
            token: 'seu-token',
            environment: 'production',
            webpki: { type: 'lacuna', certType: 'A1' }
        });
    </script>
</body>
</html>

🔧 Desenvolvimento

Instalação

git clone <repository>
cd whom-intercepts
npm install

Build

npm run build

Testes

npm test

Desenvolvimento

npm run build:dev

🚀 Publicação Automática

Este projeto usa GitHub Actions para publicação automática no NPM.

Publicação Manual (se necessário)

npm run publish:lib

📦 Exemplos de Uso

Instalação

npm install whom-intercepts

📁 Estrutura do Projeto

whom-intercepts/
├── src/
│   ├── core/           # Core da biblioteca
│   │   ├── types.ts    # Tipos TypeScript
│   │   ├── constants.ts # Constantes
│   │   └── WhomEsajCore.ts # Classe principal
│   ├── services/       # Serviços
│   │   └── ApiService.ts # Comunicação com API
│   ├── interceptors/   # Interceptadores
│   │   └── WebPkiInterceptor.ts # Interceptor Web PKI
│   ├── utils/          # Utilitários
│   │   ├── logger.ts   # Sistema de logs
│   │   ├── cache.ts    # Sistema de cache
│   │   └── dom.ts      # Utilitários DOM
│   └── WhomEsaj.ts     # Classe principal
├── dist/               # Build de produção
├── examples/           # Exemplos de uso
└── __tests__/          # Testes

🔄 Comandos Suportados

A biblioteca intercepta e responde aos seguintes comandos Web PKI:

  • getExtensionVersion - Versão da extensão
  • initialize - Inicialização da extensão
  • listCertificates - Lista de certificados
  • readCertificate - Leitura de certificado
  • preauthorizeSignatures - Autorização de assinaturas
  • signHash - Assinatura de hash
  • signData - Assinatura de dados
  • signWithRestPki - Assinatura com REST PKI

🚀 Distribuição

CDN

npm run build
# Upload dist/whom-esaj.min.js para CDN

NPM

npm publish

📚 Documentação

🤝 Contribuição

  1. Fork o projeto
  2. Crie uma branch para sua feature (git checkout -b feature/AmazingFeature)
  3. Commit suas mudanças (git commit -m 'Add some AmazingFeature')
  4. Push para a branch (git push origin feature/AmazingFeature)
  5. Abra um Pull Request

📄 Licença

Este projeto está sob a licença MIT. Veja o arquivo LICENSE para mais detalhes.

🆘 Suporte

Para suporte, entre em contato através dos canais oficiais da WHOM.