Actions2
Overview
This node provides functionality to hash passwords and verify passwords against existing bcrypt hashes using the bcryptjs
library. It is useful in scenarios where you need to securely store user passwords by hashing them before saving, or when you want to authenticate users by verifying their entered password against a stored hash.
Practical examples include:
- Creating a hashed password for new user registrations.
- Verifying a user's login password against the stored hash during authentication.
Properties
Name | Meaning |
---|---|
Operation | Choose between two operations: "Hash Password" to generate a bcrypt hash, or "Verify Password" to compare a password with an existing bcrypt hash. |
Password | The password string to be hashed or verified. |
Hash | The bcrypt hash string to verify against (only required when operation is "Verify Password"). |
Salt Rounds | Number of salt rounds used to generate the hash (only applicable when operation is "Hash Password"). Valid values range from 1 to 20. |
Output
For the Hash Password operation, the output JSON contains:
{ "hash": "<bcrypt hash string>" }
This is the generated bcrypt hash of the input password.
For the Verify Password operation, the output JSON contains:
{ "match": true|false }
This boolean indicates whether the provided password matches the given bcrypt hash.
The node does not output binary data.
Dependencies
- Requires the
bcryptjs
library for hashing and verifying passwords. - No external API keys or services are needed.
- No special environment variables or n8n credentials are required beyond standard node configuration.
Troubleshooting
Common issues:
- Providing an empty password or hash may cause errors or unexpected results.
- Using an invalid bcrypt hash format for verification will result in an error.
- Setting salt rounds outside the allowed range (1-20) may cause failures.
Error messages:
- Errors thrown by the underlying bcryptjs library (e.g., invalid hash format) will be surfaced.
- If "Continue On Fail" is enabled, errors will be returned as part of the output JSON under the
error
field.
Resolutions:
- Ensure passwords and hashes are correctly provided and non-empty.
- Use valid bcrypt hash strings for verification.
- Keep salt rounds within the recommended range.