I have a PHP REST (Gateway) server. The client is a node.js server. THe data exchanged between them is encrypted (crypto_secretbox) & decrypted (crypto_secretbox_open) using libsodium easy api implementations of PHP & Node respectively.
Encrypted data in PHP doesn't have the 16 byte Zeros at the beginning (salt) where as the encrypted data in node.js has the 16 byte zeros.
To decrypt on node of the data encrypted in PHP, I have to prepend 16 bytes of zeros (salt) before calling the secretBox.decrypt.
To decrypt on PHP of the data encrypted in node, I have to first remove the 16 bytes of zeros before calling the \Sodium\crypto_secretbox_open.
The question: Is this the best possible approach or I am missing something very obvious?