Ejemplo n.º 1
0
        public void TestChangePassword()
        {
            JObject wallet = new();

            wallet["name"]     = "name";
            wallet["version"]  = new Version("1.0").ToString();
            wallet["scrypt"]   = new ScryptParameters(2, 1, 1).ToJson();
            wallet["accounts"] = new JArray();
            wallet["extra"]    = new JObject();
            File.WriteAllText(wPath, wallet.ToString());
            uut = new NEP6Wallet(wPath, "123", ProtocolSettings.Default);
            uut.CreateAccount(keyPair.PrivateKey);
            uut.ChangePassword("456", "123").Should().BeFalse();
            uut.ChangePassword("123", "456").Should().BeTrue();
            uut.VerifyPassword("456").Should().BeTrue();
            uut.ChangePassword("456", "123").Should().BeTrue();
        }
Ejemplo n.º 2
0
        public void TestChangePassword()
        {
            JObject wallet = new JObject();

            wallet["name"]     = "name";
            wallet["version"]  = new System.Version("3.0").ToString();
            wallet["scrypt"]   = new ScryptParameters(0, 0, 0).ToJson();
            wallet["accounts"] = new JArray();
            wallet["extra"]    = new JObject();
            File.WriteAllText(wPath, wallet.ToString());
            uut = new NEP6Wallet(wPath);
            uut.Unlock("123");
            uut.CreateAccount(keyPair.PrivateKey);
            uut.ChangePassword("456", "123").Should().BeFalse();
            uut.ChangePassword("123", "456").Should().BeTrue();
            uut.VerifyPassword("456").Should().BeTrue();
            uut.ChangePassword("456", "123").Should().BeTrue();
            uut.Lock();
        }