Implement PromptPinAsync
MODIFY
WalletWasabi.Tests/HwiTests/DeviceConnectedTests/Katas.cs
WalletWasabi.Tests/HwiTests/DeviceConnectedTests/Katas.cs
@@ -46,16 +46,16 @@ namespace WalletWasabi.Tests.HwiTests.DeviceConnectedTests
string devicePath = entry.Path;
HardwareWalletVendors deviceType = entry.Type.Value;
- // USER: REFUSE
await Assert.ThrowsAsync<HwiException>(async () => await client.SetupAsync(deviceType, devicePath, cts.Token));
- // USER: REFUSE
await Assert.ThrowsAsync<HwiException>(async () => await client.RestoreAsync(deviceType, devicePath, cts.Token));
- // Trezor doesn't support backup.
+ // Trezor T doesn't support it.
await Assert.ThrowsAsync<HwiException>(async () => await client.BackupAsync(deviceType, devicePath, cts.Token));
- // ToDo: promptpin (Assert not working)
+ // Trezor T doesn't support it.
+ await Assert.ThrowsAsync<HwiException>(async () => await client.PromptPinAsync(deviceType, devicePath, cts.Token));
+
// ToDo: sendpin (Assert not working)
// ToDo: getxpub
// ToDo: displayaddress

MODIFY
WalletWasabi.Tests/HwiTests/NoDeviceConnectedTests/IMockHwiProcessBridge.cs
WalletWasabi.Tests/HwiTests/NoDeviceConnectedTests/IMockHwiProcessBridge.cs
@@ -82,6 +82,15 @@ namespace WalletWasabi.Tests.HwiTests.NoDeviceConnectedTests
return Task.FromResult((response, code));
}
}
+ else if (arguments == "--device-path \"webusb: 001:4\" --device-type \"trezor\" promptpin" || arguments == "--testnet --device-path \"webusb: 001:4\" --device-type \"trezor\" promptpin")
+ {
+ if (Model == HardwareWalletModels.TrezorT)
+ {
+ var response = "{\"error\": \"The PIN has already been sent to this device\", \"code\": -11}\r\n";
+ var code = 0;
+ return Task.FromResult((response, code));
+ }
+ }
throw new NotImplementedException($"Mocking is not implemented for '{arguments}'");
}

MODIFY
WalletWasabi.Tests/HwiTests/NoDeviceConnectedTests/MockedDeviceTests.cs
WalletWasabi.Tests/HwiTests/NoDeviceConnectedTests/MockedDeviceTests.cs
@@ -49,8 +49,11 @@ namespace WalletWasabi.Tests.HwiTests.NoDeviceConnectedTests
await client.SetupAsync(deviceType, devicePath, cts.Token);
await client.RestoreAsync(deviceType, devicePath, cts.Token);
- // Trezor doesn't support backup.
+ // Trezor T doesn't support it.
await Assert.ThrowsAsync<HwiException>(async () => await client.BackupAsync(deviceType, devicePath, cts.Token));
+
+ // Trezor T doesn't support it.
+ await Assert.ThrowsAsync<HwiException>(async () => await client.PromptPinAsync(deviceType, devicePath, cts.Token));
}
}

MODIFY
WalletWasabi/Hwi2/HwiClient.cs
WalletWasabi/Hwi2/HwiClient.cs
@@ -71,6 +71,14 @@ namespace WalletWasabi.Hwi2
}
}
+ public async Task PromptPinAsync(HardwareWalletVendors deviceType, string devicePath, CancellationToken cancel)
+ {
+ await SendCommandAsync(
+ options: new[] { HwiOption.DevicePath(devicePath), HwiOption.DeviceType(deviceType) },
+ command: HwiCommands.PromptPin,
+ cancel).ConfigureAwait(false);
+ }
+
public async Task WipeAsync(HardwareWalletVendors deviceType, string devicePath, CancellationToken cancel)
{
await SendCommandAsync(

Implement PromptPinAsync