GetPrivateKey() public method

Retrieves the private key of this Tox instance.
public GetPrivateKey ( ) : ToxKey
return ToxKey
Esempio n. 1
0
        public void TestToxDataParsing()
        {
            var tox = new Tox(ToxOptions.Default);
            tox.Name = "Test";
            tox.StatusMessage = "Status";
            tox.Status = ToxUserStatus.Away;

            var data = tox.GetData();
            ToxDataInfo info = null;

            if (data == null || !data.TryParse(out info))
                Assert.Fail("Parsing the data file failed");

            if (info.Id != tox.Id || info.Name != tox.Name || info.SecretKey != tox.GetPrivateKey() || info.Status != tox.Status || info.StatusMessage != tox.StatusMessage)
                Assert.Fail("Parsing the data file failed");

            tox.Dispose();
        }
Esempio n. 2
0
        public void TestToxLoadSecretKey()
        {
            var tox1 = new Tox(ToxOptions.Default);
            var key1 = tox1.GetPrivateKey();

            var tox2 = new Tox(ToxOptions.Default, key1);
            var key2 = tox2.GetPrivateKey();

            if (key1 != key2)
                Assert.Fail("Private keys do not match");
        }