Overview
Icon for Argon2

Argon2

Add advanced Argon2 password hashing to Medusa

MedusaJS Argon2 Authentication Plugin

๐Ÿ” Enhanced password hashing for MedusaJS using the Argon2 algorithm - the most advanced and secure password hashing method.

๐ŸŒŸ Features

  • Utilizes Argon2, the winner of the Password Hashing Competition
  • Highly configurable password hashing
  • Provides robust protection against various password cracking techniques
  • Seamless integration with MedusaJS authentication

๐Ÿ›ก๏ธ Why Argon2?

Argon2 offers superior security compared to traditional hashing methods:

  • Resistant to GPU and ASIC cracking attempts
  • Configurable memory, time, and parallelism costs
  • Adaptable to changing computational power
  • Recommended by leading security experts

๐Ÿ“ฆ Installation

Install the package using npm:

npm install @vymalo/medusa-argon2

Or using yarn:

yarn add @vymalo/medusa-argon2

๐Ÿš€ Usage

Add the plugin to the Copy to clipboardmodules section of your MedusaJS configuration:

modules: [
{
resolve: '@medusajs/medusa/auth',
options: {
providers: [
{
resolve: '@vymalo/medusa-argon2',
id: 'emailpass', // Yes, `emailpass`, as the goal is to override the default
options: {
// Optional configuration parameters
argon2: {
timeCost: 3,
memoryCost: 12288, // 12 MB
parallelism: 1
}
},
},
],
},
},

๐Ÿ”ง Configuration Options

The plugin supports full Argon2 configuration:

interface Argon2Options {
hashLength?: number; // Length of the hash output (default: secure)
timeCost?: number; // Number of iterations (higher = more secure)
memoryCost?: number; // Memory usage in KB (higher = more secure)
parallelism?: number; // Number of parallel threads
type?: 0 | 1 | 2; // Argon2 variant (d, i, or id)
version?: number; // Argon2 version
// Advanced options
salt?: Buffer; // Custom salt (usually auto-generated)
associatedData?: Buffer; // Additional context data
secret?: Buffer; // Secret key for additional security
}
  • Copy to clipboardtimeCost: Minimum 3, increase for more security
  • Copy to clipboardmemoryCost: At least 12288 KB (12 MB)
  • Copy to clipboardparallelism: 1-4 depending on your server
  • Copy to clipboardtype: Recommended Copy to clipboard2 (Argon2id - hybrid mode)

๐Ÿ›ก๏ธ Security Recommendations

  • Always use environment variables for sensitive configurations
  • Periodically review and adjust hashing parameters
  • Monitor computational resources and update costs as hardware evolves

๐Ÿค Contributing

Contributions are welcome! Please submit pull requests or open issues.

๐Ÿ”’ Security Reporting

If you discover a security vulnerability, please send an email to [your security contact].

๐Ÿ“„ License

Check the license

You may also like

Browse all integrations

Build your own

Develop your own custom integraiton

Build your own integration with our API to speed up your processes. Make your integration available via npm for it to be shared in our Library with the broader Medusa community.

gift card interface

Ready to build your custom commerce setup?