Skip to content

Conversation

@kiriDevs
Copy link

@kiriDevs kiriDevs commented Dec 8, 2025

What does this PR do?

Fixes the code-snippet for adding custom parameters to argon2id on the "Hash a Password" page. The previous version did not specify the algorithm field in the second argument object to Bun.password.hash, which actually causes a TypeError.

Also adds an example of the "shorthand" notation for changing the algorithm without specifying custom cost parameters.

How did you verify your code works?

I wrote it in a .ts file, ran it locally, and then copy-pasted the snippets into the documentation file.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

Documentation file updated to clarify Argon2id as the default hashing algorithm by renaming comments and making algorithm options explicit. A new bcrypt shorthand usage example without custom cost is added for reference.

Changes

Cohort / File(s) Change Summary
Password hashing documentation
docs/guides/util/hash-a-password.mdx
Renamed inline comment from "use argon2 (default)" to "use argon2id (default)" and added explicit algorithm: "argon2id" parameter to example. Added new bcrypt shorthand usage snippet demonstrating await Bun.password.hash(password, "bcrypt") call.

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes: fixing code snippets and extending examples on the documentation page for password hashing.
Description check ✅ Passed The description includes both required sections with substantive content addressing the bug fix, the improvement made, and verification methodology.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3af0d23 and 9512d0e.

📒 Files selected for processing (1)
  • docs/guides/util/hash-a-password.mdx (2 hunks)
🔇 Additional comments (2)
docs/guides/util/hash-a-password.mdx (2)

23-28: ✓ Critical fix applied: missing algorithm field added.

The original snippet omitted the algorithm field in the second argument object, which would have caused a TypeError at runtime. Line 25 correctly adds algorithm: "argon2id" to fix this issue.

Additionally, line 23's comment clarification from "use argon2 (default)" to "use argon2id (default)" improves accuracy and helps readers understand the exact algorithm name.


41-43: New bcrypt shorthand example is helpful and well-placed.

The addition of a shorthand notation example (Bun.password.hash(password, "bcrypt")) complements the verbose example above it, showing users they can omit the cost parameter when using defaults. The blank line separator (line 41) improves readability.

Since the PR summary mentions the code was tested locally, this should be validated. However, please confirm that the string shorthand pattern ("bcrypt" as the second argument) is indeed a supported overload of the Bun.password.hash() function signature. If there is existing public API documentation or type definitions you can link to, that would strengthen the confidence in this API shape.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant