summaryrefslogtreecommitdiffstats
path: root/src/main.lib/Configuration/AccountArgumentsProvider.cs
blob: 883e7ba44bf32ce7e943e8e69dad93232d6b5de0 (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
41
42
43
44
45
46
using Fclp;

namespace PKISharp.WACS.Configuration
{
    internal class AccountArgumentsProvider : BaseArgumentsProvider<AccountArguments>
    {
        public override string Name => "Account";
        public override string Group => "";
        public override string Condition => "";

        protected override bool IsActive(AccountArguments current)
        {
            return
                current.AcceptTos ||
                !string.IsNullOrEmpty(current.EabAlgorithm) ||
                !string.IsNullOrEmpty(current.EabKey) ||
                !string.IsNullOrEmpty(current.EabKeyIdentifier) ||
                !string.IsNullOrEmpty(current.EmailAddress);
        }

        public override void Configure(FluentCommandLineParser<AccountArguments> parser)
        {
            // Acme account registration
            parser.Setup(o => o.AcceptTos)
                .As("accepttos")
                .WithDescription("Accept the ACME terms of service.");

            parser.Setup(o => o.EmailAddress)
                .As("emailaddress")
                .WithDescription("Email address to use by ACME for renewal fail notices.");

            // External account binding
            parser.Setup(o => o.EabKeyIdentifier)
                .As("eab-key-identifier")
                .WithDescription("Key identifier to use for external account binding.");

            parser.Setup(o => o.EabKey)
                .As("eab-key")
                .WithDescription("Key to use for external account binding. Must be base64url encoded.");

            parser.Setup(o => o.EabAlgorithm)
              .As("eab-algorithm")
              .WithDescription("Algorithm to use for external account binding. Valid values are HS256 (default), HS384, and HS512.");
        }
    }
}