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

@tech-back/decript-sdk

v0.0.1

Published

SDK em NestJS para descriptografia SHA

Readme

Decrypter

Uma classe utilitária em TypeScript/JavaScript para validar labels (whitelabels) e descriptografar strings codificadas com AES-256-CBC.


📦 Instalação

Você pode copiar a classe diretamente para seu projeto ou publicar como pacote privado.

Se estiver usando como parte de um projeto, certifique-se de que as dependências nativas do Node.js (crypto) estejam disponíveis.


🚀 Uso

Importação

import { Decrypter } from './caminho/para/Decrypter';

Instanciando

const decrypter = new Decrypter();

🔐 Método: decrypt

Descriptografa uma string criptografada em base64 utilizando AES-256-CBC.

Parâmetros

  • encryptedUserId: string – A string criptografada em base64.
  • key: string – A chave usada para gerar o IV e descriptografar o conteúdo. Deve ter até 32 caracteres.

Retorno

  • string – A string descriptografada.

Exemplo

const key = 'minha-chave-secreta';
const encrypted = 'aGVsbG93b3JsZA=='; // Exemplo fictício
const decrypted = decrypter.decrypt(encrypted, key);

console.log(decrypted); // Saída: valor descriptografado

🏷️ Método: validadeLabel

Valida se um whitelabel informado está presente em uma lista de labels permitidos.

Parâmetros

  • whitelabel: string – O valor a ser validado.
  • labels: string[] – Lista de valores válidos.

Regras de validação:

  • Ignora espaços em branco e diferenciação de maiúsculas/minúsculas.
  • O whitelabel deve ter no máximo 50 caracteres.
  • Pelo menos um label válido deve ser fornecido.
  • Lança exceções se as regras forem violadas.

Retorno

  • boolean – true se for válido, caso contrário uma exceção será lançada.

Exemplo

const labels = ['abc', 'xyz', '123'];
const isValid = decrypter.validadeLabel('ABC', labels);

console.log(isValid); // true

⚠️ Exceções

Ambos os métodos podem lançar erros:

validadeLabel:

  • 'No valid labels provided for validation.'
  • 'Label cannot be an empty string.'
  • 'Label cannot exceed 5 characters.'
  • 'Invalid label provided. Valid labels are: ...'

decrypt:

  • Pode lançar erros se a chave for inválida ou a string não for descriptografável.