paixaop / node-sodium

Port of the lib sodium encryption library to Node.js
MIT License
351 stars 126 forks source link

allow Box.decrypt to get passed a nonce parameter #135

Open bdargan opened 5 years ago

bdargan commented 5 years ago

Needed Box.decrypt to handle a nonce buffer.

also includes the Nan to fix https://github.com/paixaop/node-sodium/issues/124#issuecomment-345090082

paixaop commented 5 years ago

@bdargan thanks for the pull request. The Box.encrypt method returns a cypher box which includes the nonce already therefore no need to include it as an extra parameter. What's the use case?

bdargan commented 5 years ago

Main use case is to encrypt and serialize a Box and then deserialize and decrypt it, this requires the original nonce . Also there is inconsistency with docs and method signature on Box.decrypt. 2nd param described as a nonce, but this is not on the method signature.

thx

rawr51919 commented 4 years ago

@bdargan Can you please fix the conflicts?