using System.Runtime.InteropServices;
using ProtonVPN.OperatingSystems.WebAuthn.Enums;
using ProtonVPN.OperatingSystems.WebAuthn.Interop.Marshalers;
using ProtonVPN.OperatingSystems.WebAuthn.Interop.StructVersions;
namespace ProtonVPN.OperatingSystems.WebAuthn.Interop.Structs;
///
/// Information about credential with extra information, such as, Transports.
///
/// Corresponds to WEBAUTHN_CREDENTIAL_EX.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public class CredentialEx : IDisposable
{
///
/// Version of this structure, to allow for modifications in the future.
///
private CredentialExVersion Version { get; set; } = CredentialExVersion.Current;
private int _idLength;
///
/// Unique ID for this particular credential.
///
private ByteArrayIn _id;
///
/// Well-known credential type specifying what this particular credential is.
///
private string _type;
///
/// Transports.
///
private AuthenticatorTransport _transport;
public CredentialEx(byte[] id, string type, AuthenticatorTransport transport)
{
_id = new ByteArrayIn(id);
_idLength = id?.Length ?? 0;
_type = type;
_transport = transport;
}
public void Dispose()
{
_id?.Dispose();
_id = null;
}
}