Skip to content

Commit 5f6a232

Browse files
committed
[FAB-3708] cleanup unused/unimplemented msp code
This change set removes a few unused structs/types. Change-Id: I65ca1cf56dc1a1348e44cec08a15fe3833e4631f Signed-off-by: Alessandro Sorniotti <[email protected]>
1 parent fa63fb9 commit 5f6a232

File tree

7 files changed

+0
-152
lines changed

7 files changed

+0
-152
lines changed

common/cauthdsl/cauthdsl_test.go

-8
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ func (id *mockIdentity) Verify(msg []byte, sig []byte) error {
6666
}
6767
}
6868

69-
func (id *mockIdentity) VerifyOpts(msg []byte, sig []byte, opts msp.SignatureOpts) error {
70-
return nil
71-
}
72-
73-
func (id *mockIdentity) VerifyAttributes(proof []byte, spec *msp.AttributeProofSpec) error {
74-
return nil
75-
}
76-
7769
func (id *mockIdentity) Serialize() ([]byte, error) {
7870
return id.idBytes, nil
7971
}

common/mocks/msp/noopmsp.go

-20
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,6 @@ func (id *noopidentity) Verify(msg []byte, sig []byte) error {
105105
return nil
106106
}
107107

108-
func (id *noopidentity) VerifyOpts(msg []byte, sig []byte, opts m.SignatureOpts) error {
109-
return nil
110-
}
111-
112-
func (id *noopidentity) VerifyAttributes(proof []byte, spec *m.AttributeProofSpec) error {
113-
return nil
114-
}
115-
116108
func (id *noopidentity) Serialize() ([]byte, error) {
117109
return []byte("cert"), nil
118110
}
@@ -129,18 +121,6 @@ func (id *noopsigningidentity) Sign(msg []byte) ([]byte, error) {
129121
return []byte("signature"), nil
130122
}
131123

132-
func (id *noopsigningidentity) SignOpts(msg []byte, opts m.SignatureOpts) ([]byte, error) {
133-
return nil, nil
134-
}
135-
136-
func (id *noopsigningidentity) GetAttributeProof(spec *m.AttributeProofSpec) (proof []byte, err error) {
137-
return nil, nil
138-
}
139-
140124
func (id *noopsigningidentity) GetPublicVersion() m.Identity {
141125
return id
142126
}
143-
144-
func (id *noopsigningidentity) Renew() error {
145-
return nil
146-
}

core/policy/mocks/mocks.go

-8
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,6 @@ func (id *MockIdentity) Verify(msg []byte, sig []byte) error {
127127
return errors.New("Invalid Signature")
128128
}
129129

130-
func (id *MockIdentity) VerifyOpts(msg []byte, sig []byte, opts msp.SignatureOpts) error {
131-
return nil
132-
}
133-
134-
func (id *MockIdentity) VerifyAttributes(proof []byte, spec *msp.AttributeProofSpec) error {
135-
return nil
136-
}
137-
138130
func (id *MockIdentity) Serialize() ([]byte, error) {
139131
return []byte("cert"), nil
140132
}

msp/identities.go

-25
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,6 @@ func (id *identity) Verify(msg []byte, sig []byte) error {
150150
return nil
151151
}
152152

153-
func (id *identity) VerifyOpts(msg []byte, sig []byte, opts SignatureOpts) error {
154-
// TODO
155-
return errors.New("This method is unimplemented")
156-
}
157-
158-
func (id *identity) VerifyAttributes(proof []byte, spec *AttributeProofSpec) error {
159-
// TODO
160-
return errors.New("This method is unimplemented")
161-
}
162-
163153
// Serialize returns a byte array representation of this identity
164154
func (id *identity) Serialize() ([]byte, error) {
165155
// mspIdentityLogger.Infof("Serializing identity %s", id.id)
@@ -233,21 +223,6 @@ func (id *signingidentity) Sign(msg []byte) ([]byte, error) {
233223
return id.signer.Sign(rand.Reader, digest, nil)
234224
}
235225

236-
func (id *signingidentity) SignOpts(msg []byte, opts SignatureOpts) ([]byte, error) {
237-
// TODO
238-
return nil, errors.New("This method is unimplemented")
239-
}
240-
241-
func (id *signingidentity) GetAttributeProof(spec *AttributeProofSpec) (proof []byte, err error) {
242-
// TODO
243-
return nil, errors.New("This method is unimplemented")
244-
}
245-
246226
func (id *signingidentity) GetPublicVersion() Identity {
247227
return &id.identity
248228
}
249-
250-
func (id *signingidentity) Renew() error {
251-
// TODO
252-
return errors.New("This method is unimplemented")
253-
}

msp/msp.go

-63
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ type Identity interface {
153153
// Verify a signature over some message using this identity as reference
154154
Verify(msg []byte, sig []byte) error
155155

156-
// VerifyOpts a signature over some message using this identity as reference
157-
VerifyOpts(msg []byte, sig []byte, opts SignatureOpts) error
158-
159-
// VerifyAttributes verifies attributes given a proof
160-
VerifyAttributes(proof []byte, spec *AttributeProofSpec) error
161-
162156
// Serialize converts an identity to bytes
163157
Serialize() ([]byte, error)
164158

@@ -181,67 +175,10 @@ type SigningIdentity interface {
181175
// Sign the message
182176
Sign(msg []byte) ([]byte, error)
183177

184-
// SignOpts the message with options
185-
SignOpts(msg []byte, opts SignatureOpts) ([]byte, error)
186-
187-
// GetAttributeProof creates a proof for a set of attributes
188-
GetAttributeProof(spec *AttributeProofSpec) (proof []byte, err error)
189-
190178
// GetPublicVersion returns the public parts of this identity
191179
GetPublicVersion() Identity
192-
193-
// Renew this identity
194-
Renew() error
195-
}
196-
197-
// ImportRequest is data required when importing a member or
198-
// enrollment identity that was created off-band
199-
type ImportRequest struct {
200-
201-
// IdentityProvider to enroll with
202-
Idp string
203-
204-
// The certificate to import
205-
IdentityDesc []byte
206-
207-
// Key reference associated to the key of the imported member
208-
KeyReference []string
209180
}
210181

211-
// SignatureOpts are signature options
212-
type SignatureOpts struct {
213-
Policy []string
214-
Label string
215-
}
216-
217-
// Attribute is an arbitrary name/value pair
218-
type Attribute interface {
219-
Key() AttributeName
220-
Value() []byte
221-
Serialise() []byte
222-
}
223-
224-
// AttributeName defines the name of an attribute assuming a
225-
// namespace defined by the entity that certifies this attributes'
226-
// ownership.
227-
type AttributeName struct {
228-
// provider/guarantor of a certain attribute; this can be
229-
// expressed by the enrollment identifier of the entity that
230-
// issues/certifies possession of such attributes.
231-
provider string
232-
// the actual name of the attribute; should be unique for a given
233-
// provider
234-
name string
235-
}
236-
237-
type AttributeProofSpec struct {
238-
Attributes []Attribute
239-
Message []byte
240-
}
241-
242-
// Structures defining the identifiers for identity providers and members
243-
// and members that belong to them.
244-
245182
// IdentityIdentifier is a holder for the identifier of a specific
246183
// identity, naturally namespaced, by its provider identifier.
247184
type IdentityIdentifier struct {

msp/msp_test.go

-20
Original file line numberDiff line numberDiff line change
@@ -344,26 +344,6 @@ func TestIdentitiesGetters(t *testing.T) {
344344
assert.NotNil(t, mspid)
345345
}
346346

347-
func TestUnimplementedMethods(t *testing.T) {
348-
id, err := localMsp.GetDefaultSigningIdentity()
349-
if err != nil {
350-
t.Fatalf("GetSigningIdentity should have succeeded, got err %s", err)
351-
return
352-
}
353-
354-
// these methods are currently unimplemented - we assert that they return an error
355-
err = id.VerifyOpts(nil, nil, SignatureOpts{})
356-
assert.Error(t, err)
357-
err = id.VerifyAttributes(nil, nil)
358-
assert.Error(t, err)
359-
_, err = id.SignOpts(nil, SignatureOpts{})
360-
assert.Error(t, err)
361-
_, err = id.GetAttributeProof(nil)
362-
assert.Error(t, err)
363-
err = id.Renew()
364-
assert.Error(t, err)
365-
}
366-
367347
func TestSignAndVerify(t *testing.T) {
368348
id, err := localMsp.GetDefaultSigningIdentity()
369349
if err != nil {

peer/gossip/mocks/mocks.go

-8
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ func (id *Identity) Verify(msg []byte, sig []byte) error {
150150
return errors.New("Invalid Signature")
151151
}
152152

153-
func (id *Identity) VerifyOpts(msg []byte, sig []byte, opts msp.SignatureOpts) error {
154-
return nil
155-
}
156-
157-
func (id *Identity) VerifyAttributes(proof []byte, spec *msp.AttributeProofSpec) error {
158-
return nil
159-
}
160-
161153
func (id *Identity) Serialize() ([]byte, error) {
162154
return []byte("cert"), nil
163155
}

0 commit comments

Comments
 (0)