Exemple #1
0
        /// <summary>
        /// Asynchronously sends a key generation request to the emitter.io service.
        /// </summary>
        /// <param name="secretKey">The secret key for this request.</param>
        /// <param name="channel">The target channel for the requested key.</param>
        /// <param name="keyType">The type of the requested key.</param>
        /// <param name="ttl">The number of seconds for which this key will be usable.</param>
        public void GenerateKey(string secretKey, string channel, EmitterKeyType keyType, int ttl, KeygenHandler handler)
        {
            // Prepare the request
            var request = new KeygenRequest();

            request.Key     = secretKey;
            request.Channel = channel;
            request.Type    = keyType;
            request.Ttl     = ttl;

            // Register the handler
            this.KeygenHandlers[channel] = handler;

            //this.Client.Subscribe(new string[] { "emitter/keygen/" }, new byte[] { 0 });

            // Serialize and publish the request
            this.Publish("emitter/", "keygen/", Encoding.UTF8.GetBytes(request.ToJson()));
        }
Exemple #2
0
 /// <summary>
 /// Asynchronously sends a key generation request to the emitter.io service.
 /// </summary>
 /// <param name="secretKey">The secret key for this request.</param>
 /// <param name="channel">The target channel for the requested key.</param>
 /// <param name="keyType">The type of the requested key.</param>
 public void GenerateKey(string secretKey, string channel, EmitterKeyType keyType, KeygenHandler handler)
 {
     this.GenerateKey(secretKey, channel, keyType, 0, handler);
 }