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

argon2-extension-mv3

v1.0.1

Published

Argon2id WASM implementation compatible with Chrome Extension Manifest V3 (No unsafe-eval)

Readme

argon2-extension-mv3

npm version License: MIT Platform

A secure, WebAssembly-based Argon2id implementation specifically designed for Chrome Extensions (Manifest V3).

🧐 The Problem

Most existing WebAssembly ports of Argon2 (such as argon2-browser or hash-wasm) rely on dynamic code generation (eval() or new Function()) within their JavaScript "glue code" to instantiate the WASM module.

This is strictly prohibited in Chrome Extensions under Manifest V3 due to the Content Security Policy (CSP), which disallows 'unsafe-eval'. Attempting to use standard libraries results in:

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive...

💡 The Solution

This package provides a custom compilation of the reference C implementation (phc-winner-argon2) using Emscripten with specific flags to ensure full MV3 compliance:

  • DYNAMIC_EXECUTION=0: Removes all reliance on eval() and dynamic code generation.
  • EMBIND_AOT=1: Generates bindings Ahead-Of-Time during compilation.
  • Type Safety: Includes TypeScript definitions out of the box.

🚀 Installation

npm install argon2-extension-mv3

🛠 Configuration (Vite)

Since this is a WASM library, the .wasm binary file must be served alongside your JavaScript bundle. For a Chrome Extension built with Vite, you need to copy the WASM file from node_modules to your output directory.

1. Install vite-plugin-static-copy:

npm install -D vite-plugin-static-copy

2. Update vite.config.ts:

import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';

export default defineConfig({
  plugins: [
    viteStaticCopy({
      targets: [
        {
          // Copy the WASM binary from the package to the root of your build
          src: 'node_modules/argon2-extension-mv3/dist/argon2_wasm.wasm',
          dest: '.' 
        }
      ]
    })
  ]
});

💻 Usage

Here is a complete example of how to use it in a TypeScript service.

import createArgon2Module from 'argon2-extension-mv3';

export class CryptoService {
    
    async hashPassword(password: string, salt: string): Promise<string> {
        // 1. Initialize the module
        const argon2 = await createArgon2Module({
            // Important: Tell the module where to find the .wasm file
            // usage in Chrome Extension:
            locateFile: (path: string) => {
                if (typeof chrome !== "undefined" && chrome.runtime) {
                    return chrome.runtime.getURL('argon2_wasm.wasm');
                }
                return path;
            }
        });

        // 2. Generate Hash
        // The salt must be a hex string for this implementation
        const hashHex = argon2.generateArgon2idHash(password, salt);
        
        return hashHex;
    }
}

🏗 Building from Source

If you want to compile the WASM binary yourself, you will need the Emscripten SDK installed and active in your terminal.

  1. Clone the repository:

    git clone [https://github.com/ArturCharylo/argon2-extension-mv3.git](https://github.com/ArturCharylo/argon2-extension-mv3.git)
    cd argon2-extension-mv3
  2. Install dependencies:

    npm install
  3. Build:

    npm run build

    This command will:

    • Compile the C++ source code to WASM using emcc.
    • Compile the TypeScript wrapper.
    • Output files to the dist/ folder.

🤝 Contributing

Contributions are welcome! If you find a bug or want to add a feature, please open an issue or submit a Pull Request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.

🙏 Acknowledgments