lyubo / react-native-sodium

ISC License
61 stars 46 forks source link

Provide access to libsodium's Precalculation interface #7

Closed jjzazuet closed 6 years ago

jjzazuet commented 6 years ago

Hi.

I'm finding that in a regular message exchange between Alice and Bob, the crypto_box_easy and crypto_box_open_easy methods allow Alice to send messages to Bob, and vice-versa.

I'm dealing with a server which stores the encrypted conversation contents between A and B, and upon retrieval of the raw messages, both parties can decrypt the messages that the other party sent, but not the messages that they themselves sent. In other words.

For this purpose, the libsodium documentation states that one should use the Pre-calculation Interface to compute a shared key to encrypt/decrypt messages between both parties on both ends.

Currently, this API only exposes the crypto_box_beforenm to compute said shared key, but not the wrapper calls to crypto_box_easy_afternm (to encrypt) and crypto_box_open_easy_afternm (to decrypt).

Would it be possible to add JNI/ObjectiveC wrappers for these?

Thanks again for the awesome library!