forked from hyperledger/fabric-private-chaincode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
44 lines (32 loc) · 1.45 KB
/
interface.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
/*
Copyright IBM Corp. All Rights Reserved.
Copyright 2020 Intel Corporation
SPDX-License-Identifier: Apache-2.0
*/
package enclave
import (
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric/common/flogging"
)
var logger = flogging.MustGetLogger("enclave")
type StubInterface interface {
// Init initializes the chaincode enclave.
// The input and output parameters are serialized protobufs
// triggered by an admin
Init(chaincodeParams, hostParams, attestationParams []byte) (credentials []byte, err error)
// GetEnclaveId returns the EnclaveId hosted by the peer
GetEnclaveId() (string, error)
// key distribution (Post-MVP Feature)
// GenerateCCKeys, key generation
// The output parameters is a serialized protobuf
GenerateCCKeys() (signedCCKeyRegistrationMessage []byte, err error)
// ExportCCKeys exports chaincode secrets to enclave with provided credentials
// The input and output parameters are serialized protobufs
ExportCCKeys(credentials []byte) (signedExportMessage []byte, err error)
// ImportCCKeys imports chaincode secrets
// The output parameters is a serialized protobuf
ImportCCKeys() (signedCCKeyRegistrationMessage []byte, err error)
// ChaincodeInvoke invokes fpc chaincode inside enclave
// chaincodeRequestMessage and chaincodeResponseMessage are serialized protobuf
ChaincodeInvoke(stub shim.ChaincodeStubInterface, chaincodeRequestMessage []byte) (chaincodeResponseMessage []byte, err error)
}