message: "data.split is not a function"
stack: "TypeError: data.split is not a function\n at decrypt (/opt/node_app/lib/formatters/crypto.js:57:37)\n at /opt/node_app/lib/core/parser.js:667:26\n at parser (/opt/node_app/lib/core/parser.js:356:19)\n at Object.parseValue (/opt/node_app/lib/core/parser.js:729:24)\n at App.parse (/opt/node_app/lib/core/app.js:456:23)\n at App.setvalue (/opt/node_app/lib/modules/core.js:132:26)\n at App._exec (/opt/node_app/lib/core/app.js:435:57)\n at App._exec (/opt/node_app/lib/core/app.js:406:28)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async App.exec (/opt/node_app/lib/core/app.js:375:9)"
status: "500"
Ah, hang on. These were originally encrypted using the PHP formatter for encrypt and I’m trying to move the project to NodeJS. Is there a difference between the encrypted data on each server model? I would have expected it to be the same…
Ben, if that’s not the case it would be great if you could start an independent thread with a list of incompatibilities with your findings where we can add to the list. People doing the jump will find it very useful.
It will also help the team if and when they add an automatic importer.
Other than the obvious missing Argon support, this, I think is the only incompatibility I’ve found so far. If more pop up, I will happily consolidate into a single list.
We are limited with what PHP and NodeJS provide, both use different Crypto libraries and can cause different implementations that are not compatible. We try to keep as much code compatible, but this is not always possible.
In the beginning we only released actions that would be available in all languages, that was not always optimal and we had in some languages that we had to make workarounds to make it work the same. We now try to use more specific language features, this also means that some actions are only for specific languages. We could try to get the same result in NodeJS as we get from PHP, but I think it is better to just optimize the code for the specific language and use it native features instead of trying to simulate an other language and producing slower code just to be compatible.
Thanks @patrick,
I’m trying to write a custom formatter for NodeJS to translate from the PHP version. It seems the key requirements differ so it’s proving far from straight forward. I have PHP projects that have existing encrypted data and wanted to move them over to NodeJS.
I might have to decrypt, write to another field (forcing the key length to be compatible with NodeJS) and then write a decrypt formatter for PHP and NodeJS to allow them both to work…
Possibly… I need to weigh up the options as both will be live concurrently as users beta test and users will need to be able to update and view the encrypted records in both. Ideally, I’d like something that I can run in either without a dependency on the other system.
Just in case you were curious. I have gone with writing new formatters for both PHP and NodeJS that are compatible. They generally follow the same code as the existing crypto formatters with the main difference being forcing the key length requirement of NodeJS crypto (must be 32 bytes) and following the same pattern (from NodeJS) of full stop separated iv/data. This way I can continue to have users working on either while making the data available to view/update on either.