示例#1
0
    IEnumerator UserKeyModify()
    {
        if (NWallet.HasWallet())
        {
            yield return(StartCoroutine("WaitForPWD"));

            if (wallet.CheckUserPwd(pwd.rawPWD))
            {
                yield return(StartCoroutine("WaitForNewPWD"));

                var key = wallet.ExportSecKey(pwd.rawPWD);
                wallet.ImportKey(newPwd.rawPWD, key);
                msgBox.ShowMsgBox("", "密码修改成功");
            }
            else
            {
                msgBox.ShowMsgBox("警告", "密码错误");
                yield return(StartCoroutine("UserKeyModify"));
            }
        }
        else
        {
            msgBox.ShowMsgBox("", "尚未创建钱包");
        }
    }
示例#2
0
 public void Init()
 {
     if (NWallet.HasWallet())
     {
         wallet.dat.Load();
         addrLabel.text = wallet.GetAddress();
     }
 }
示例#3
0
    IEnumerator NewWallet()
    {
        if (NWallet.HasWallet())
        {
            msgBox.ShowMsgBox("", "已经存在钱包");
        }
        else
        {
            yield return(StartCoroutine("WaitForNewPWD"));

            wallet.GenerateKey(newPwd.rawPWD);
            msgBox.ShowMsgBox("成功创建新钱包", "地址:" + wallet.GetAddress());
            addrLabel.text = wallet.GetAddress();
        }
    }
示例#4
0
    IEnumerator ImportKey()
    {
        if (NWallet.HasWallet())
        {
            msgBox.ShowMsgBox("警告", "已经存在钱包,建议导入前先导出并备份本地钱包");
            yield return(StartCoroutine("WaitForPWD"));
        }
        yield return(StartCoroutine("WaitForTextInput"));

        var key = input.rawDat;

        yield return(StartCoroutine("WaitForNewPWD"));

        var pwd = newPwd.rawPWD;

        wallet.ImportKey(pwd, key);
        msgBox.ShowMsgBox("成功导入钱包", "地址:" + wallet.GetAddress());
        addrLabel.text = wallet.GetAddress();
    }
示例#5
0
    IEnumerator ExportKey()
    {
        if (NWallet.HasWallet())
        {
            yield return(StartCoroutine("WaitForPWD"));

            if (wallet.CheckUserPwd(pwd.rawPWD))
            {
                qrCode.Set(wallet.ExportSecKey(pwd.rawPWD));
            }
            else
            {
                msgBox.ShowMsgBox("警告", "密码错误");
                yield return(null);
            }
        }
        else
        {
            msgBox.ShowMsgBox("", "尚未创建钱包");
            yield return(null);
        }
    }