Overview
This node provides various bcryptjs operations for password hashing and verification. It supports generating salts, hashing passwords, comparing passwords against hashes, extracting salt or rounds from a hash, and testing password truncation behavior. This node is useful in scenarios where secure password handling is required, such as user authentication systems, password storage, or verifying credentials.
Practical examples:
- Hashing a new user's password before storing it in a database.
- Comparing a login attempt password with a stored hash to authenticate a user.
- Generating a salt value with a specified number of rounds for custom hashing.
- Extracting the number of rounds or salt from an existing hash for analysis or migration.
- Testing if a password will be truncated by bcryptjs due to length limits.
Properties
| Name | Meaning |
|---|---|
| Options | Collection of additional options: |
| - Output Field Name | The name of the field in the output JSON where the result of the operation will be saved (default: "result"). |
Note: The node also supports an "Operation" property (not listed here per user request) that determines which bcryptjs function to execute.
Output
The node outputs an array of items, each containing a json object. The json object includes all original input fields plus one additional field named as specified by the "Output Field Name" option (default "result"). This field holds the result of the selected bcryptjs operation, which can be:
- A generated salt string.
- A hashed password string.
- A boolean indicating password/hash comparison success.
- A numeric value representing the number of rounds used in a hash.
- A salt string extracted from a hash.
- A boolean indicating whether a password would be truncated.
No binary data output is produced by this node.
Dependencies
- Requires the
bcryptjslibrary bundled with the node. - No external API keys or services are needed.
- No special environment variables or n8n configurations are required beyond standard node setup.
Troubleshooting
Common issues:
- Providing invalid or empty passwords or hashes may cause errors.
- Using unsupported operations will throw an error.
- Incorrectly formatted salt or rounds parameters can lead to hashing failures.
Error messages:
"Unknown operation: <operation>": Indicates an unsupported operation was selected; verify the operation parameter."Bcryptjs <operation> operation failed: <message>": General failure during bcryptjs processing; check input values for correctness.
To resolve errors, ensure all required inputs are valid and conform to bcryptjs expectations (e.g., non-empty strings for passwords and hashes, numeric rounds where expected).