revocation-enable.go 1.4 KB
Newer Older
1
2
3
4
5
6
7
8
package cmd

import (
	irma "github.com/privacybydesign/irmago"
	"github.com/spf13/cobra"
)

var revokeEnableCmd = &cobra.Command{
9
	Use:   "enable CREDENTIALTYPE URL",
10
11
12
13
	Short: "Enable revocation for a credential type",
	Long: `Enable revocation for a given credential type.

Must be done (and can only be done) by the issuer of the specified credential type, if enable in the
14
scheme.`,
15
	Args: cobra.ExactArgs(2),
16
	Run: func(cmd *cobra.Command, args []string) {
17
18
19
20
21
22
		flags := cmd.Flags()
		schemespath, _ := flags.GetString("schemes-path")
		authmethod, _ := flags.GetString("auth-method")
		key, _ := flags.GetString("key")
		name, _ := flags.GetString("name")
		verbosity, _ := cmd.Flags().GetCount("verbose")
23
		url := args[1]
24
25
26
27
28

		request := &irma.RevocationRequest{
			LDContext:      irma.LDContextRevocationRequest,
			CredentialType: irma.NewCredentialTypeIdentifier(args[0]),
			Enable:         true,
29
30
		}

31
		postRevocation(request, url, schemespath, authmethod, key, name, verbosity)
32
33
34
35
	},
}

func init() {
36
37
38
39
40
41
42
	flags := revokeEnableCmd.Flags()
	flags.StringP("schemes-path", "s", irma.DefaultSchemesPath(), "path to irma_configuration")
	flags.StringP("auth-method", "a", "none", "Authentication method to server (none, token, rsa, hmac)")
	flags.String("key", "", "Key to sign request with")
	flags.String("name", "", "Requestor name")
	flags.CountP("verbose", "v", "verbose (repeatable)")

43
44
	revocationCmd.AddCommand(revokeEnableCmd)
}