-
Notifications
You must be signed in to change notification settings - Fork 247
/
eab.go
69 lines (60 loc) 路 1.61 KB
/
eab.go
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package eab
import (
"encoding/base64"
"github.com/smallstep/certificates/ca"
"github.com/urfave/cli"
"go.step.sm/linkedca"
)
type cliEAK struct {
id string
provisioner string
reference string
key string
createdAt string
boundAt string
account string
}
func toCLI(ctx *cli.Context, client *ca.AdminClient, eak *linkedca.EABKey) *cliEAK {
boundAt := ""
if !eak.BoundAt.AsTime().IsZero() {
boundAt = eak.BoundAt.AsTime().Format("2006-01-02 15:04:05 -07:00")
}
return &cliEAK{
id: eak.Id,
provisioner: eak.Provisioner,
reference: eak.Reference,
key: base64.RawURLEncoding.Strict().EncodeToString(eak.HmacKey),
createdAt: eak.CreatedAt.AsTime().Format("2006-01-02 15:04:05 -07:00"),
boundAt: boundAt,
account: eak.Account,
}
}
// Command returns the eab subcommand.
func Command() cli.Command {
return cli.Command{
Name: "eab",
Usage: "create and manage ACME External Account Binding Keys",
UsageText: "**step beta ca acme eab** <subcommand> [arguments] [global-flags] [subcommand-flags]",
Subcommands: cli.Commands{
listCommand(),
addCommand(),
removeCommand(),
},
Description: `**step beta ca acme eab** command group provides facilities for managing ACME
External Account Binding Keys.
## EXAMPLES
List the active ACME External Account Binding Keys:
'''
$ step beta ca acme eab list <provisioner>
'''
Add an ACME External Account Binding Key:
'''
$ step beta ca acme eab add provisioner_name some_name_or_reference
'''
Remove an ACME External Account Binding Key:
'''
$ step beta ca acme eab remove key_id
'''
`,
}
}