github.com/tw-bc-group/fabric-ca-gm@v0.0.0-20201218004200-3b690512bd5a/lib/client/credential/credential.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package credential 8 9 import ( 10 "github.com/tw-bc-group/fabric-ca-gm/api" 11 "github.com/tw-bc-group/net-go-gm/http" 12 ) 13 14 // Credential represents an credential of an identity 15 type Credential interface { 16 // Type returns type of this credential 17 Type() string 18 // EnrollmentID returns enrollment ID associated with this credential 19 // Returns an error if the credential value is not set (SetVal is not called) 20 // or not loaded from the disk (Load is not called) 21 EnrollmentID() (string, error) 22 // Val returns credential value. 23 // Returns an error if the credential value is not set (SetVal is not called) 24 // or not loaded from the disk (Load is not called) 25 Val() (interface{}, error) 26 // Sets the credential value 27 SetVal(val interface{}) error 28 // Stores the credential value to disk 29 Store() error 30 // Loads the credential value from disk and sets the value of this credential 31 Load() error 32 // CreateToken returns authorization token for the specified request with 33 // specified body 34 CreateToken(req *http.Request, reqBody []byte) (string, error) 35 // Submits revoke request to the Fabric CA server to revoke this credential 36 RevokeSelf() (*api.RevocationResponse, error) 37 }