Exemple #1
0
 private void ForgetSigner(IKeyId keyId)
 {
     lock (signersInProgressLock)
     {
         signersInProgress.Remove(keyId);
     }
 }
Exemple #2
0
        private bool StartSingleSigner(IKeyId keyId, TaskCompletionSource <T> tcs, CancellationToken cancellationToken)
        {
            var task = operation(keyId, cancellationToken);

            task.ContinueWith(t =>
            {
                switch (t.Status)
                {
                case TaskStatus.RanToCompletion:
                    if (resultValidator(t.Result))
                    {
                        var setResultSucceeded = tcs.TrySetResult(t.Result);
                        Debug.Assert(setResultSucceeded);
                    }
                    // If the result is null it mean that there is no way that it can sign any of the requests,
                    // so we  remember it so that we won't query it again.
                    break;

                case TaskStatus.Faulted:
                    // Will be re-discovered next iteration
                    ForgetSigner(keyId);
                    break;
                }
            }, cancellationToken);

            return(true);
        }
        public RegisterOperation([NotNull] IKeyId keyId, [NotNull] ICollection<KeyRegisterRequest> requests)
        {
            if (keyId == null)
            {
                throw new ArgumentNullException(nameof(keyId));
            }
            if (requests == null)
            {
                throw new ArgumentNullException(nameof(requests));
            }

            this.keyId = keyId;
            this.requests = requests;
        }
        public RegisterOperation([NotNull] IKeyId keyId, [NotNull] ICollection <KeyRegisterRequest> requests)
        {
            if (keyId == null)
            {
                throw new ArgumentNullException(nameof(keyId));
            }
            if (requests == null)
            {
                throw new ArgumentNullException(nameof(requests));
            }

            this.keyId    = keyId;
            this.requests = requests;
        }
 public bool Equals(IKeyId other)
 {
     return(other.Product == Product && other.Manufacturer == Manufacturer);
 }
 public SignOperation(IKeyId keyId, ICollection<KeySignRequest> requests)
 {
     this.keyId = keyId;
     this.requests = requests;
 }
Exemple #7
0
        public bool Equals(IKeyId other)
        {
            var u2FHidKeyId = other as U2FHidKeyId;

            return(u2FHidKeyId != null && Equals(u2FHidKeyId));
        }
 public SignOperation(IKeyId keyId, ICollection <KeySignRequest> requests)
 {
     this.keyId    = keyId;
     this.requests = requests;
 }