Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The "Generate Hash" operation under the Utilities resource in this n8n node allows you to generate a cryptographic hash from a given input string using the Directus API. This is useful for scenarios where you need to securely store, compare, or verify sensitive data such as passwords, tokens, or any other information that should not be stored in plain text.
Common use cases:
- Storing hashed versions of user passwords.
- Generating unique identifiers or checksums for data integrity.
- Comparing hashes to verify data authenticity.
Practical example:
You have a workflow where users submit passwords, and you want to store only their hashed values in your database for security reasons. You can use this operation to generate the hash before saving the password.
Properties
| Name | Type | Meaning |
|---|---|---|
| String | String | The input string to be hashed. This is the value that will be converted into a hash by the Directus API. |
Output
The output will be an object with a json field containing the result of the hash generation. The structure is as follows:
{
"result": "<hashed_value>"
}
result: The generated hash string corresponding to the input.
If the response from the API is not an object (e.g., a simple string, number, or boolean), it will still be wrapped in a result property.
Dependencies
- Directus API: Requires access to a Directus instance with the appropriate endpoint enabled.
- API Credentials: The node requires valid Directus API credentials (
directusApi) configured in n8n.
Troubleshooting
Common issues:
- Missing or invalid credentials: If the Directus API credentials are not set up correctly, the node will fail to connect.
- Empty or invalid input: If the "String" property is empty or not provided, the operation will fail.
- API errors: Any error returned by the Directus API (such as server errors or misconfiguration) will cause the node to throw an error.
Error messages and resolutions:
"Cannot read property 'string' of undefined": Ensure the "String" input is provided."401 Unauthorized": Check your Directus API credentials in n8n."Network Error": Verify network connectivity to the Directus server.
Links and References
- Directus Documentation – Utilities
- n8n Documentation – Custom Nodes
- Cryptographic Hash Functions (Wikipedia)