github.com/canhui/fabric_ca2_2@v2.0.0-alpha+incompatible/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 "net/http" 11 12 "github.com/hyperledger/fabric-ca/api" 13 ) 14 15 // Credential represents an credential of an identity 16 type Credential interface { 17 // Type returns type of this credential 18 Type() string 19 // EnrollmentID returns enrollment ID associated with this credential 20 // Returns an error if the credential value is not set (SetVal is not called) 21 // or not loaded from the disk (Load is not called) 22 EnrollmentID() (string, error) 23 // Val returns credential value. 24 // Returns an error if the credential value is not set (SetVal is not called) 25 // or not loaded from the disk (Load is not called) 26 Val() (interface{}, error) 27 // Sets the credential value 28 SetVal(val interface{}) error 29 // Stores the credential value to disk 30 Store() error 31 // Loads the credential value from disk and sets the value of this credential 32 Load() error 33 // CreateToken returns authorization token for the specified request with 34 // specified body 35 CreateToken(req *http.Request, reqBody []byte) (string, error) 36 // Submits revoke request to the Fabric CA server to revoke this credential 37 RevokeSelf() (*api.RevocationResponse, error) 38 }