lib/gallactickeys.js
function exportKs (password, privateKey, salt, iv, type, option = {}) {
  if (!password || !privateKey || !type) {
    throw new Error('Missing parameter! Make sure password, privateKey and type provided')
  }

  if (!crypto.isPrivateKey(privateKey)) {
    throw new Error('given Private Key is not a valid Private Key string');
  }

  salt = salt || util.bytesToHexUpperString(crypto.generateSalt());
  iv = iv || util.bytesToHexUpperString(crypto.generateIv())

  return crypto.marshal(
    crypto.deriveKey(password, salt, option), privateKey,
    util.strToBuffer(salt), util.strToBuffer(iv), type, option
  );
}
function exportKs (password, privateKey, salt, iv, type, option = {}) {
  if (!password || !privateKey || !type) {
    throw new Error('Missing parameter! Make sure password, privateKey and type provided')
  }

  if (!crypto.isPrivateKey(privateKey)) {
    throw new Error('given Private Key is not a valid Private Key string');
  }

  salt = salt || util.bytesToHexUpperString(crypto.generateSalt());
  iv = iv || util.bytesToHexUpperString(crypto.generateIv())

  return crypto.marshal(
    crypto.deriveKey(password, salt, option), privateKey,
    util.strToBuffer(salt), util.strToBuffer(iv), type, option
  );
}
function exportKs ( password , privateKey , salt , iv , type , option = { } ) { if ( ! password || ! privateKey || ! type ) { throw new Error ( 'Missing parameter! Make sure password, privateKey and type provided' ) } if ( ! crypto . isPrivateKey ( privateKey ) ) { throw new Error ( 'given Private Key is not a valid Private Key string' ) ; } salt = salt || util . bytesToHexUpperString ( crypto . generateSalt ( ) ) ; iv = iv || util . bytesToHexUpperString ( crypto . generateIv ( ) ) return crypto . marshal ( crypto . deriveKey ( password , salt , option ) , privateKey , util . strToBuffer ( salt ) , util . strToBuffer ( iv ) , type , option ) ; }
PRIVATE METHODS
 helper function to export keystore
PRIVATE METHODS helper function to export keystore