@node-rs/argon2
Native Argon2 password hashing for Node.js via Rust bindings, with async hash, verify, and algorithm selection.
Official Documentation ↗v1.0. Check the official docs for the latest API surface.Installation
npm install @node-rs/argon2Methods
No methods match this filter.
@node-rs/argon2 is native argon2 password hashing for node.js via rust bindings, with async hash, verify, and algorithm selection. This page documents the core methods, installation, and common usage patterns for the current stable release.
Installation
Install @node-rs/argon2 with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.
Core methods
The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v1.0 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.
Frequently asked questions
The faq section in the frontmatter answers the most common questions about @node-rs/argon2, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.
Security
Official security statements captured from the package documentation:
- 官方类型声明称 Argon2id 为默认算法并符合规范推荐 — “Default value, this is the default algorithm for normative recommendations.” (source: https://raw.githubusercontent.com/napi-rs/node-rs/main/packages/argon2/index.d.ts, fetched 2026-11-08T17:29:00+08:00)
- 官方类型声明指出 Argon2d 抗 GPU 破解但对侧信道攻击脆弱 — “Optimizes against GPU cracking attacks but vulnerable to side-channels.” (source: https://raw.githubusercontent.com/napi-rs/node-rs/main/packages/argon2/index.d.ts, fetched 2026-11-08T17:29:00+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T17:29:00+08:00 via WebFetch https://raw.githubusercontent.com/napi-rs/node-rs/main/packages/argon2/index.d.ts.
hash→ signature from https://raw.githubusercontent.com/napi-rs/node-rs/main/packages/argon2/index.d.ts; official text: “export declare function hash(password: string | Uint8Array, options?: Options | undefined | null, abortSignal?: AbortSignal | undefined | null): Promise” verify→ signature from https://raw.githubusercontent.com/napi-rs/node-rs/main/packages/argon2/index.d.ts; official text: “export declare function verify(hashed: string | Uint8Array, password: string | Uint8Array, options?: Options | undefined | null, abortSignal?: AbortSignal | undefined | null): Promise” Algorithm→ signature from https://raw.githubusercontent.com/napi-rs/node-rs/main/packages/argon2/index.d.ts; official text: “export declare const enum Algorithm { /** * Optimizes against GPU cracking attacks but vulnerable to side-channels. * Accesses the memory array in a password dependent order, reducing the possibility of time–memory trade”
FAQ
- Why native bindings?
- Pure JS Argon2 is slow; native bindings use the reference C implementation via Rust for production speed.
- Does it work in Electron?
- Yes. node-rs packages ship prebuilds for Electron and multiple Node ABIs.
- Which variant should I use?
- Argon2id is recommended by RFC 9106; it resists both side-channel and GPU attacks.
Report a problem with this API docOpens a pre-filled issue on GitHub.