@@ -17,87 +17,83 @@ limitations under the License.
17
17
package msp
18
18
19
19
import (
20
+ m "github.com/hyperledger/fabric/msp"
20
21
"github.com/hyperledger/fabric/protos/msp"
21
22
)
22
23
23
24
type noopmsp struct {
24
25
}
25
26
26
- func NewNoopMsp () MSP {
27
- mspLogger . Infof ( "Creating no-op MSP instance" )
27
+ // NewNoopMsp returns a no-op implementation of the MSP inteface
28
+ func NewNoopMsp () m. MSP {
28
29
return & noopmsp {}
29
30
}
30
31
31
32
func (msp * noopmsp ) Setup (* msp.MSPConfig ) error {
32
33
return nil
33
34
}
34
35
35
- func (msp * noopmsp ) GetType () ProviderType {
36
+ func (msp * noopmsp ) GetType () m. ProviderType {
36
37
return 0
37
38
}
38
39
39
40
func (msp * noopmsp ) GetIdentifier () (string , error ) {
40
41
return "NOOP" , nil
41
42
}
42
43
43
- func (msp * noopmsp ) GetSigningIdentity (identifier * IdentityIdentifier ) (SigningIdentity , error ) {
44
- mspLogger .Infof ("Obtaining signing identity for %s" , identifier )
44
+ func (msp * noopmsp ) GetSigningIdentity (identifier * m.IdentityIdentifier ) (m.SigningIdentity , error ) {
45
45
id , _ := newNoopSigningIdentity ()
46
46
return id , nil
47
47
}
48
48
49
- func (msp * noopmsp ) GetDefaultSigningIdentity () (SigningIdentity , error ) {
50
- mspLogger .Infof ("Obtaining default signing identity" )
49
+ func (msp * noopmsp ) GetDefaultSigningIdentity () (m.SigningIdentity , error ) {
51
50
id , _ := newNoopSigningIdentity ()
52
51
return id , nil
53
52
}
54
53
55
54
// GetRootCerts returns the root certificates for this MSP
56
- func (msp * noopmsp ) GetRootCerts () []Identity {
55
+ func (msp * noopmsp ) GetRootCerts () []m. Identity {
57
56
return nil
58
57
}
59
58
60
59
// GetIntermediateCerts returns the intermediate root certificates for this MSP
61
- func (msp * noopmsp ) GetIntermediateCerts () []Identity {
60
+ func (msp * noopmsp ) GetIntermediateCerts () []m. Identity {
62
61
return nil
63
62
}
64
63
65
- func (msp * noopmsp ) DeserializeIdentity (serializedID []byte ) (Identity , error ) {
66
- mspLogger .Infof ("Obtaining identity for %s" , string (serializedID ))
64
+ func (msp * noopmsp ) DeserializeIdentity (serializedID []byte ) (m.Identity , error ) {
67
65
id , _ := newNoopIdentity ()
68
66
return id , nil
69
67
}
70
68
71
- func (msp * noopmsp ) Validate (id Identity ) error {
69
+ func (msp * noopmsp ) Validate (id m. Identity ) error {
72
70
return nil
73
71
}
74
72
75
- func (msp * noopmsp ) SatisfiesPrincipal (id Identity , principal * msp.MSPPrincipal ) error {
73
+ func (msp * noopmsp ) SatisfiesPrincipal (id m. Identity , principal * msp.MSPPrincipal ) error {
76
74
return nil
77
75
}
78
76
79
77
type noopidentity struct {
80
78
}
81
79
82
- func newNoopIdentity () (Identity , error ) {
83
- mspLogger .Infof ("Creating no-op identity instance" )
80
+ func newNoopIdentity () (m.Identity , error ) {
84
81
return & noopidentity {}, nil
85
82
}
86
83
87
84
func (id * noopidentity ) SatisfiesPrincipal (* msp.MSPPrincipal ) error {
88
85
return nil
89
86
}
90
87
91
- func (id * noopidentity ) GetIdentifier () * IdentityIdentifier {
92
- return & IdentityIdentifier {Mspid : "NOOP" , Id : "Bob" }
88
+ func (id * noopidentity ) GetIdentifier () * m. IdentityIdentifier {
89
+ return & m. IdentityIdentifier {Mspid : "NOOP" , Id : "Bob" }
93
90
}
94
91
95
92
func (id * noopidentity ) GetMSPIdentifier () string {
96
93
return "MSPID"
97
94
}
98
95
99
96
func (id * noopidentity ) Validate () error {
100
- mspLogger .Infof ("Identity is valid" )
101
97
return nil
102
98
}
103
99
@@ -106,46 +102,42 @@ func (id *noopidentity) GetOrganizationalUnits() []msp.FabricOUIdentifier {
106
102
}
107
103
108
104
func (id * noopidentity ) Verify (msg []byte , sig []byte ) error {
109
- mspLogger .Infof ("Signature is valid" )
110
105
return nil
111
106
}
112
107
113
- func (id * noopidentity ) VerifyOpts (msg []byte , sig []byte , opts SignatureOpts ) error {
108
+ func (id * noopidentity ) VerifyOpts (msg []byte , sig []byte , opts m. SignatureOpts ) error {
114
109
return nil
115
110
}
116
111
117
- func (id * noopidentity ) VerifyAttributes (proof []byte , spec * AttributeProofSpec ) error {
112
+ func (id * noopidentity ) VerifyAttributes (proof []byte , spec * m. AttributeProofSpec ) error {
118
113
return nil
119
114
}
120
115
121
116
func (id * noopidentity ) Serialize () ([]byte , error ) {
122
- mspLogger .Infof ("Serialinzing identity" )
123
117
return []byte ("cert" ), nil
124
118
}
125
119
126
120
type noopsigningidentity struct {
127
121
noopidentity
128
122
}
129
123
130
- func newNoopSigningIdentity () (SigningIdentity , error ) {
131
- mspLogger .Infof ("Creating no-op signing identity instance" )
124
+ func newNoopSigningIdentity () (m.SigningIdentity , error ) {
132
125
return & noopsigningidentity {}, nil
133
126
}
134
127
135
128
func (id * noopsigningidentity ) Sign (msg []byte ) ([]byte , error ) {
136
- mspLogger .Infof ("signing message" )
137
129
return []byte ("signature" ), nil
138
130
}
139
131
140
- func (id * noopsigningidentity ) SignOpts (msg []byte , opts SignatureOpts ) ([]byte , error ) {
132
+ func (id * noopsigningidentity ) SignOpts (msg []byte , opts m. SignatureOpts ) ([]byte , error ) {
141
133
return nil , nil
142
134
}
143
135
144
- func (id * noopsigningidentity ) GetAttributeProof (spec * AttributeProofSpec ) (proof []byte , err error ) {
136
+ func (id * noopsigningidentity ) GetAttributeProof (spec * m. AttributeProofSpec ) (proof []byte , err error ) {
145
137
return nil , nil
146
138
}
147
139
148
- func (id * noopsigningidentity ) GetPublicVersion () Identity {
140
+ func (id * noopsigningidentity ) GetPublicVersion () m. Identity {
149
141
return id
150
142
}
151
143
0 commit comments