src/crypto/crypto.js
function(senderPriv, recipientPub, msg) {
    // Errors
    if (!senderPriv || !recipientPub || !msg) throw new Error('Missing argument !');
    //if (!Helpers.isPrivateKeyValid(senderPriv)) throw new Error('Private key is not valid !');
    //if (!Helpers.isPublicKeyValid(recipientPub)) throw new Error('Public key is not valid !');
    // Processing
    let iv = nacl.randomBytes(16)
    //console.log("IV:", convert.uint8ToHex(iv));
    let salt = nacl.randomBytes(32)
    let encoded = _encode(senderPriv, recipientPub, msg, iv, salt);
    // Result
    return encoded;
}
function(senderPriv, recipientPub, msg) {
    // Errors
    if (!senderPriv || !recipientPub || !msg) throw new Error('Missing argument !');
    //if (!Helpers.isPrivateKeyValid(senderPriv)) throw new Error('Private key is not valid !');
    //if (!Helpers.isPublicKeyValid(recipientPub)) throw new Error('Public key is not valid !');
    // Processing
    let iv = nacl.randomBytes(16)
    //console.log("IV:", convert.uint8ToHex(iv));
    let salt = nacl.randomBytes(32)
    let encoded = _encode(senderPriv, recipientPub, msg, iv, salt);
    // Result
    return encoded;
}
Encode a message

@param {string} senderPriv - A sender private key
@param {string} recipientPub - A recipient public key
@param {string} msg - A text message

@return {string} - The encoded message