Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Module/Cmdlets/Yubikey/FindYubikey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/// </summary>

// Imports
using powershellYK.YubiKey;
using System.Management.Automation; // Windows PowerShell namespace.
using Yubico.YubiKey;

Expand Down Expand Up @@ -57,7 +58,7 @@ protected override void BeginProcessing()
// Return found YubiKeys
foreach (var yubiKey in yubiKeys)
{
WriteObject((YubiKeyDevice)yubiKey);
WriteObject(new YubikeyInformation(yubiKey: (YubiKeyDevice)yubiKey));
}

// Handle case when no YubiKeys are found
Expand Down
2 changes: 1 addition & 1 deletion Module/Cmdlets/Yubikey/GetYubikey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override void ProcessRecord()
try
{
// Get and return YubiKey information
WriteObject(new YubikeyInformation(yubiKey: (YubiKeyDevice)YubiKeyDevice.FindAll().Where(yk => yk.SerialNumber == YubiKeyModule._yubikey!.SerialNumber).First()));
WriteObject(new YubikeyInformation(yubiKey: YubiKeyModule._yubikey));
}
catch (System.InvalidOperationException e)
{
Expand Down
10 changes: 10 additions & 0 deletions Module/types/YubiKeyInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Yubico.YubiKey.Fido2.Cose;
using powershellYK.support;
using Yubico.YubiKey;
using powershellYK.PIV;

namespace powershellYK.YubiKey
{
Expand Down Expand Up @@ -110,5 +111,14 @@ public YubikeyInformation(YubiKeyDevice yubiKey)
this.YubiKeyDevice = yubiKey;
this.PrettyName = PowershellYKText.FriendlyName(yubiKey);
}

#region Operators

public static implicit operator YubiKeyDevice(YubikeyInformation info)
{
return info.YubiKeyDevice;
}

#endregion
}
}
Loading