SharpTox.Core.Tox.GetPrivateKey C# (CSharp) Method

GetPrivateKey() public method

Retrieves the private key of this Tox instance.
public GetPrivateKey ( ) : ToxKey
return ToxKey
        public ToxKey GetPrivateKey()
        {
            ThrowIfDisposed();

            byte[] key = new byte[ToxConstants.PublicKeySize];
            ToxFunctions.SelfGetSecretKey(_tox, key);

            return new ToxKey(ToxKeyType.Secret, key);
        }

Usage Example

Example #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();
        }
All Usage Examples Of SharpTox.Core.Tox::GetPrivateKey