src/crypto/crypto.js
function(privateKey, password) {
    // Errors
    if (!privateKey || !password) throw new Error('Missing argument !');
    //if (!Helpers.isPrivateKeyValid(privateKey)) throw new Error('Private key is not valid !');
    // Processing
    let pass = derivePassSha(password, 20);
    let r = encrypt(privateKey, convert.hexToUint8(pass.priv));
    // Result
    return {
        ciphertext: CryptoJS.enc.Hex.stringify(r.ciphertext),
        iv: convert.uint8ToHex(r.iv)
    };
}
function(privateKey, password) {
    // Errors
    if (!privateKey || !password) throw new Error('Missing argument !');
    //if (!Helpers.isPrivateKeyValid(privateKey)) throw new Error('Private key is not valid !');
    // Processing
    let pass = derivePassSha(password, 20);
    let r = encrypt(privateKey, convert.hexToUint8(pass.priv));
    // Result
    return {
        ciphertext: CryptoJS.enc.Hex.stringify(r.ciphertext),
        iv: convert.uint8ToHex(r.iv)
    };
}
function ( privateKey , password ) { // Errors if ( ! privateKey || ! password ) throw new Error ( 'Missing argument !' ) ; //if (!Helpers.isPrivateKeyValid(privateKey)) throw new Error('Private key is not valid !'); // Processing let pass = derivePassSha ( password , 20 ) ; let r = encrypt ( privateKey , convert . hexToUint8 ( pass . priv ) ) ; // Result return { ciphertext : CryptoJS . enc . Hex . stringify ( r . ciphertext ) , iv : convert . uint8ToHex ( r . iv ) } ; }
Encode a private key using a password

@param {string} privateKey - An hex private key
@param {string} password - A password

@return {object} - The encoded data
Encode a private key using a password