How to encrypt and decrypt a string?

Describe the problem/error/question

I would like to know how to encrypt and decrypt a string in n8n, I don’t know using node crypto and using node code it says that it doesn’t have the crypto library installed, when I try to install the library it says that it was discontinued in version 1.0.1 of n8n.

Information on your n8n setup

  • **n8n version:1.29.1 queue
  • **Database (default: SQLite):postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • **Operating system:ubunto 20

Hey @admdiegolima,

You would to use the Crypto package and handle this in the code node, As far as I know the crypto package should still be available but you would need to tell your n8n instance that it can use it with env options you would also need to do the same on any workers you are running.

I put this in the env and it will install?

  - NODE_FUNCTION_ALLOW_EXTERNAL=moment,lodash,moment-with-locales, sharp, crypto

in editor, worker and webhook

Hey @admdiegolima,

That won’t install them but if you have those packages installed it will let n8n use them, Crypto only needs to the internal package list as well.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.