Example #1
0
        public async Task AuthVault(IDevice device, CancellationToken ct)
        {
            ct.ThrowIfCancellationRequested();

            if (device.AccessLevel.IsMasterKeyRequired && _hesConnection.State == HesConnectionState.Connected)
            {
                await _ui.SendNotification(TranslationSource.Instance["ConnectionFlow.MasterKey.AwaitingHESAuth"], device.Mac);

                await _hesConnection.AuthHwVault(device.SerialNo);

                await device.RefreshDeviceInfo();
            }

            if (device.AccessLevel.IsMasterKeyRequired)
            {
                if (_hesConnection.State == HesConnectionState.Connected)
                {
                    throw new WorkflowException(TranslationSource.Instance["ConnectionFlow.MasterKey.Error.AuthFailed"]);
                }
                else
                {
                    throw new WorkflowException(TranslationSource.Instance["ConnectionFlow.MasterKey.Error.AuthFailedNoNetwork"]);
                }
            }
        }