/// <summary>
        /// Finishes a registration as a new device.
        /// Called by the new device. This method blocks until the already verified device has verified this device.
        /// </summary>
        /// <param name="token"></param>
        /// <param name="provisionMessage"></param>
        /// <param name="signalingKey"></param>
        /// <param name="password"></param>
        /// <param name="sms"></param>
        /// <param name="fetches"></param>
        /// <param name="regid"></param>
        /// <param name="name"></param>
        /// <returns>Device id</returns>
        public async Task <int> FinishNewDeviceRegistration(CancellationToken token, SignalServiceProvisionMessage provisionMessage, string signalingKey, string password, bool sms, bool fetches, int regid, string name)
        {
            pushServiceSocket = new PushServiceSocket(configuration, new StaticCredentialsProvider(provisionMessage.Number, password, null, -1), userAgent, httpClient);

            // update credentials and pushServiceSocket to keep internal state consistent
            int deviceId = await pushServiceSocket.FinishNewDeviceRegistration(token, provisionMessage.Code, signalingKey, sms, fetches, regid, name);

            credentials       = new StaticCredentialsProvider(provisionMessage.Number, password, null, deviceId);
            pushServiceSocket = new PushServiceSocket(configuration, credentials, userAgent, httpClient);
            return(deviceId);
        }
コード例 #2
0
 /// <summary>
 /// Finishes a registration as a new device.
 /// Called by the new device. This method blocks until the already verified device has verified this device.
 /// </summary>
 /// <param name="token"></param>
 /// <param name="provisionMessage"></param>
 /// <param name="signalingKey"></param>
 /// <param name="password"></param>
 /// <param name="sms"></param>
 /// <param name="fetches"></param>
 /// <param name="regid"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public async Task <int> FinishNewDeviceRegistration(CancellationToken token, SignalServiceProvisionMessage provisionMessage, string signalingKey, string password, bool sms, bool fetches, int regid, string name)
 {
     PushServiceSocket = new PushServiceSocket(Configuration, new StaticCredentialsProvider(provisionMessage.Number, password, null, -1), UserAgent);
     return(await PushServiceSocket.FinishNewDeviceRegistration(token, provisionMessage.Code, signalingKey, sms, fetches, regid, name));
 }