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

wompi-hash-validator

v1.1.0

Published

Wompi Hash Validator for payment URL

Readme

Wompi Hash Validator

The Wompi Hash Validator library helps you validate the integrity of Wompi redirect URLs by verifying their HMAC-SHA256 hash. This ensures that the data has not been tampered with during transit.

Table of Contents

Installing

Using npm:

npm install wompi-hash-validator

Using yarn:

yarn add wompi-hash-validator

Using pnpm:

pnpm add wompi-hash-validator

Prerequisites

  • Node.js version >= 14.0.0
  • A valid Wompi API secret key
  • (Optional) A .env file for environment variables setup

Usage

Basic Validation

You can use the library to validate Wompi URLs and their parameters as follows:

import { validateHash } from 'wompi-hash-validator';

const url =
  'https://example.com/checkout?identificadorEnlaceComercio=ExampleCommerce&idTransaccion=123e4567-e89b-12d3-a456-426614174000&idEnlace=789456&monto=50.00&hash=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2';
const secretKey = 'your_api_secret_here';
const isValid = validateHash(url, secretKey);

console.log(`URL validation result: ${isValid ? 'Valid' : 'Invalid'}`);

Environment Variables

To improve security and keep sensitive data out of your codebase, you can use environment variables to store your API secret key. Use the dotenv package to load the secret key from a .env file:

WOMPI_SECRET=your_api_secret_here

Then, modify your script to use the environment variable:

import { validateHash } from 'wompi-hash-validator';
import * as dotenv from 'dotenv';

dotenv.config();

const url =
  'https://example.com/checkout?identificadorEnlaceComercio=ExampleCommerce&idTransaccion=123e4567-e89b-12d3-a456-426614174000&idEnlace=789456&monto=50.00&hash=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2';
const secretKey = process.env.WOMPI_SECRET;
const isValid = validateHash(url, secretKey);

console.log(`URL validation result: ${isValid ? 'Valid' : 'Invalid'}`);

Examples

Here are a few advanced examples of how you can use this library:

Example 1: Handling Dynamic URLs

import { validateHash } from 'wompi-hash-validator';

const generateUrl = (id: string, amount: string): string => {
  return `https://example.com/checkout?id=${id}&amount=${amount}&hash=generatedHashHere`;
};

const url = generateUrl('123e4567-e89b-12d3-a456-426614174000', '50.00');
const secretKey = 'your_api_secret_here';
const isValid = validateHash(url, secretKey);

console.log(`Dynamic URL validation: ${isValid ? 'Valid' : 'Invalid'}`);

Example 2: Validating Multiple URLs

import { validateHash } from 'wompi-hash-validator';

const urls = [
  'https://example.com/checkout?id=1&amount=100&hash=hash1',
  'https://example.com/checkout?id=2&amount=200&hash=hash2',
];

const secretKey = 'your_api_secret_here';

urls.forEach((url) => {
  const isValid = validateHash(url, secretKey);
  console.log(`Validation result for URL: ${url} - ${isValid ? 'Valid' : 'Invalid'}`);
});

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for more details.

License

This repository is licensed under the MIT License. You are free to use, modify, and distribute the scripts as long as you include the original license text.