Trying to fix TrezorT

This commit is contained in:
nicolas.dorier
2019-12-04 22:12:38 +09:00
parent a1d82b0e8b
commit 84d943d6cc

View File

@@ -82,16 +82,26 @@ namespace BTCPayServer.Controllers
if ((deviceEntry.Code is HwiErrorCode.DeviceNotReady || deviceEntry.NeedsPinSent is true) if ((deviceEntry.Code is HwiErrorCode.DeviceNotReady || deviceEntry.NeedsPinSent is true)
&& !pinProvided) && !pinProvided)
{ {
if (IsTrezorT(deviceEntry)) if (!IsTrezorT(deviceEntry))
{ {
await websocketHelper.Send("{ \"error\": \"need-pin-on-device\"}", cancellationToken); await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
return true;
} }
else else
{ {
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken); try
{
// On trezor T this will prompt the password!
await device.PromptPinAsync(cancellationToken);
} }
catch (HwiException ex) when (ex.ErrorCode == HwiErrorCode.DeviceAlreadyUnlocked)
{
pinProvided = true;
}
await websocketHelper.Send("{ \"error\": \"need-passphrase-on-device\"}", cancellationToken);
return true; return true;
} }
}
if ((deviceEntry.Code is HwiErrorCode.DeviceNotReady || deviceEntry.NeedsPassphraseSent is true) && password == null) if ((deviceEntry.Code is HwiErrorCode.DeviceNotReady || deviceEntry.NeedsPassphraseSent is true) && password == null)
{ {
if (IsTrezorT(deviceEntry)) if (IsTrezorT(deviceEntry))