/// <summary> /// Helper function to create Profile object based on privateKey /// </summary> /// <param name="name">name of profile</param> /// <param name="privateKey">private key of account</param> /// <returns></returns> public static Profile CreateProfileDirect(string name, string privateKey) { ErrorCallbackProvider.ReportInfo("Generating user account."); var ecKey = new Nethereum.Signer.EthECKey(privateKey); Profile profile = new KeyStoreProfile(name, new HoardID(ecKey.GetPublicAddress()), privateKey.HexToByteArray()); return(profile); }
/// <summary> /// Creates new profile with given name /// </summary> /// <param name="name">name of profile </param> /// <returns>new account</returns> public async Task <Profile> CreateProfile(string name) { ErrorCallbackProvider.ReportInfo("Generating user account."); string password = await UserInputProvider.RequestInput(name, null, eUserInputType.kPassword, "new password"); Tuple <string, byte[]> accountTuple = KeyStoreUtils.CreateProfile(name, password, ProfilesDir); Profile profile = new KeyStoreProfile(name, new HoardID(accountTuple.Item1), accountTuple.Item2); accountTuple.Item2.Initialize(); return(profile); }