aboutsummaryrefslogtreecommitdiff
path: root/src/IAuthenticator.cs
blob: 440a69fea581e1b8c88654b2ebc73bd978714e34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

using System;
using System.Security.Cryptography.X509Certificates;

using Yubico.YubiKey.Piv;

using VNLib.Hashing.IdentityUtility;

namespace PkiAuthenticator
{
    /// <summary>
    /// Represents an authenticaion device, backed by hardware or software keys.
    /// </summary>
    public interface IAuthenticator : IJwtSignatureProvider, IDisposable
    {
        /// <summary>
        /// The signature algorithm the devices/keys support.
        /// </summary>
        PivAlgorithm KeyAlgorithm { get; }

        /// <summary>
        /// Gets the public/key certificate for the authenticator
        /// </summary>
        /// <returns>The certificate</returns>
        X509Certificate2 GetCertificate();

        /// <summary>
        /// Initialies the authenticator's assets required for performing 
        /// authentication functions.
        /// </summary>
        /// <returns>True if the authenticator was successfully initialized.</returns>
        bool Initialize();

        /// <summary>
        /// Writes the internal devices to the log output
        /// </summary>
        /// <returns>The exit code for the process, 0 if successful, non-zero if the operation failed</returns>
        int ListDevices();
    }
}