예제 #1
0
 public ShhKeyPair(IClient client) : base(client)
 {
     AddPrivateKey = new ShhAddPrivateKey(client);
     NewKeyPair    = new ShhNewKeyPair(client);
     HasKeyPair    = new ShhHasKeyPair(client);
     DeleteKeyPair = new ShhDeleteKeyPair(client);
     GetPublicKey  = new ShhGetPublicKey(client);
     GetPrivateKey = new ShhGetPrivateKey(client);
 }
예제 #2
0
        public async void ShouldReturnResultUsingAsymKey()
        {
            var shhNewKeyPair    = new ShhPost(Client);
            var shhAddPrivateKey = new ShhAddPrivateKey(Client);

            var keyPair = await shhAddPrivateKey.SendRequestAsync(Settings.GetDefaultShhPrivateKey());

            //4 Bytes
            var topic   = UTF8Encoding.ASCII.GetBytes("default_topic").Take(4).ToArray().ToHex(true);
            var payload = UTF8Encoding.ASCII.GetBytes("default_message").ToHex(true);
            var result  = await shhNewKeyPair.SendRequestAsync(new Shh.DTOs.MessageInput
            {
                PubKey    = Settings.GetDefaultShhPublicKey(),
                Ttl       = 7,
                Topic     = topic,
                PowTarget = 2.1,
                PowTime   = 100,
                Payload   = payload,
                Sig       = keyPair
            });

            Assert.NotNull(result);
        }
예제 #3
0
        public async void ShouldReturnResult()
        {
            var addPrivateKey = new ShhAddPrivateKey(Client);
            var hasKeyPair    = new ShhHasKeyPair(Client);
            var getPrivateKey = new ShhGetPrivateKey(Client);
            var getPublicKey  = new ShhGetPublicKey(Client);
            var deleteKeyPair = new ShhDeleteKeyPair(Client);

            var addResult = await addPrivateKey.SendRequestAsync(Settings.GetDefaultShhPrivateKey());

            var hasKeyPairResult = await hasKeyPair.SendRequestAsync(addResult);

            var getPrivateKeyResult = await getPrivateKey.SendRequestAsync(addResult);

            var getPublicKeyResult = await getPublicKey.SendRequestAsync(addResult);

            var deleteKeyPairResult = await deleteKeyPair.SendRequestAsync(addResult);

            Assert.NotNull(addResult);
            Assert.True(hasKeyPairResult);
            Assert.Equal(Settings.GetDefaultShhPrivateKey(), getPrivateKeyResult);
            Assert.Equal(Settings.GetDefaultShhPublicKey(), getPublicKeyResult);
            Assert.True(deleteKeyPairResult);
        }
예제 #4
0
        public override Task <string> ExecuteAsync(IClient client)
        {
            var shhAddPrivateKey = new ShhAddPrivateKey(client);

            return(shhAddPrivateKey.SendRequestAsync(Settings.GetDefaultShhPrivateKey()));
        }