forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
idemixgen.go
61 lines (54 loc) · 1.37 KB
/
idemixgen.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
/*
Copyright IBM Corp All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package runner
import (
"os/exec"
"github.com/tedsuo/ifrit/ginkgomon"
)
// Idemixgen creates runners that call idemixgen functions.
type Idemixgen struct {
// Location of the idemixgen executable
Path string
// Output directory
Output string
// Enrollment ID for the default signer
EnrollID string
// The organizational unit for the default signer
OrgUnit string
// Flag for making the default signer an admin
IsAdmin bool
// Handle used to revoke the default signer
RevocationHandle int
}
// CAKeyGen uses idemixgen to generate CA key material for an IdeMix MSP.
func (c *Idemixgen) CAKeyGen(extraArgs ...string) *ginkgomon.Runner {
return ginkgomon.New(ginkgomon.Config{
Name: "idemix ca-keygen",
AnsiColorCode: "38m",
Command: exec.Command(
c.Path,
append([]string{
"ca-keygen",
"--output", c.Output,
}, extraArgs...)...,
),
})
}
// SignerConfig uses idemixgen to generate a signer for an IdeMix MSP.
func (c *Idemixgen) SignerConfig(extraArgs ...string) *ginkgomon.Runner {
return ginkgomon.New(ginkgomon.Config{
Name: "idemix signerconfig",
AnsiColorCode: "38m",
Command: exec.Command(
c.Path,
append([]string{
"signerconfig",
"-e", c.EnrollID,
"-u", c.OrgUnit,
"--output", c.Output,
}, extraArgs...)...,
),
})
}