diff --git a/.generators/deps.go b/.generators/deps.go index 27e90cea..917d4a6d 100644 --- a/.generators/deps.go +++ b/.generators/deps.go @@ -6,4 +6,11 @@ package generators import ( // proto/grpc _ "github.com/golang/protobuf/protoc-gen-go" + + // validation schema + _ "github.com/envoyproxy/protoc-gen-validate" + + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" + + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" ) diff --git a/.generators/install.sh b/.generators/install.sh index eb829112..be0b20de 100755 --- a/.generators/install.sh +++ b/.generators/install.sh @@ -34,7 +34,8 @@ pwd for genpkg in `go list -f '{{ join .Imports "\n" }}' deps.go` do echo "building $genpkg..." - go build -mod=vendor -o ${GENERATOR_DIR}/bin/`basename $genpkg` -trimpath ${genpkg} + go get ${genpkg} + go build -mod=readonly -o ${GENERATOR_DIR}/bin/`basename $genpkg` -trimpath ${genpkg} echo "installed $genpkg" done diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1fb624f4..75e26967 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,6 +1,6 @@ name: Go Quality -on: [push, pull_request] +on: [ push, pull_request ] jobs: test: @@ -11,7 +11,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: '1.16' + go-version: '1.18' - name: Check out code uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index d1baf58c..013094e7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ GOFLAGS ?= -mod=vendor PROTO_PACKAGES_GO := proto +PROTO_PACKAGES_SVC := service test: @echo "go test -mod vendor ./..." @@ -8,6 +9,8 @@ test: proto: clean @for pkg in $(PROTO_PACKAGES_GO) ;do echo $$pkg && buf generate --template buf.gen.go.yaml $$pkg -o ./$$(echo $$pkg | cut -d "/" -f1); done + @for pkg in $(PROTO_PACKAGES_SVC) ;do echo $$pkg && buf generate --template buf.gen.svc.yaml $$pkg -o ./$$(echo $$pkg | cut -d "/" -f1); done clean: @for pkg in $(PROTO_PACKAGES_GO); do find $$pkg \( -name '*.pb.go' -or -name '*.pb.md' \) -delete;done + @for pkg in $(PROTO_PACKAGES_SVC); do find $$pkg \( -name '*.pb.go' -or -name '*.pb.cc.go' -or -name '*.pb.gw.go' -or -name '*.swagger.json' -or -name '*.pb.md' \) -delete;done \ No newline at end of file diff --git a/api/chaincode_lifecycle.go b/api/chaincode_lifecycle.go deleted file mode 100644 index 5a3ce426..00000000 --- a/api/chaincode_lifecycle.go +++ /dev/null @@ -1,43 +0,0 @@ -package api - -import ( - "context" - - lb "github.com/hyperledger/fabric-protos-go/peer/lifecycle" -) - -// Lifecycle contains methods for interacting with system _lifecycle chaincode -type Lifecycle interface { - // QueryInstalledChaincode returns chaincode package installed on peer - QueryInstalledChaincode(ctx context.Context, args *lb.QueryInstalledChaincodeArgs) ( - *lb.QueryInstalledChaincodeResult, error) - - // QueryInstalledChaincodes returns chaincode packages list installed on peer - QueryInstalledChaincodes(ctx context.Context) (*lb.QueryInstalledChaincodesResult, error) - - // InstallChaincode sets up chaincode package on peer - InstallChaincode(ctx context.Context, args *lb.InstallChaincodeArgs) (*lb.InstallChaincodeResult, error) - - // ApproveChaincodeDefinitionForMyOrg marks chaincode definition on a channel - ApproveChaincodeDefinitionForMyOrg(ctx context.Context, channel string, args *lb.ApproveChaincodeDefinitionForMyOrgArgs) error - - // QueryApprovedChaincodeDefinition returns approved chaincode definition - QueryApprovedChaincodeDefinition(ctx context.Context, channel string, args *lb.QueryApprovedChaincodeDefinitionArgs) ( - *lb.QueryApprovedChaincodeDefinitionResult, error) - - // CheckCommitReadiness returns commitments statuses of participants on chaincode definition - CheckCommitReadiness(ctx context.Context, channel string, args *lb.CheckCommitReadinessArgs) ( - *lb.CheckCommitReadinessResult, error) - - // CommitChaincodeDefinition the chaincode definition on the channel - CommitChaincodeDefinition(ctx context.Context, channel string, args *lb.CommitChaincodeDefinitionArgs) ( - *lb.CommitChaincodeDefinitionResult, error) - - // QueryChaincodeDefinition returns chaincode definition committed on the channel - QueryChaincodeDefinition(ctx context.Context, channel string, args *lb.QueryChaincodeDefinitionArgs) ( - *lb.QueryChaincodeDefinitionResult, error) - - // QueryChaincodeDefinitions returns chaincode definitions committed on the channel - QueryChaincodeDefinitions(ctx context.Context, channel string, args *lb.QueryChaincodeDefinitionsArgs) ( - *lb.QueryChaincodeDefinitionsResult, error) -} diff --git a/api/channel.go b/api/channel.go new file mode 100644 index 00000000..1babf825 --- /dev/null +++ b/api/channel.go @@ -0,0 +1,19 @@ +package api + +import ( + "context" +) + +type Channel interface { + // Chaincode returns chaincode instance by chaincode name + Chaincode(ctx context.Context, name string) (Chaincode, error) + // Join channel + Join(ctx context.Context) error +} + +// types which identify tx "wait'er" policy +// we don't make it as alias for preventing binding to our lib +const ( + TxWaiterSelfType string = "self" + TxWaiterAllType string = "all" +) diff --git a/api/public.go b/api/client.go similarity index 98% rename from api/public.go rename to api/client.go index ec49d2a7..babd8e61 100644 --- a/api/public.go +++ b/api/client.go @@ -76,8 +76,10 @@ type Invoker interface { ) (res *peer.Response, chaincodeTx string, err error) } -type Public interface { +type Client interface { EventsDeliverer BlocksDeliverer Invoker + + FabricV2() bool } diff --git a/api/config/config.go b/api/config/config.go index 929e12ac..b7e619fe 100644 --- a/api/config/config.go +++ b/api/config/config.go @@ -4,10 +4,12 @@ import ( "strconv" "strings" "time" + + "github.com/s7techlab/hlf-sdk-go/crypto" ) type Config struct { - Crypto CryptoConfig `yaml:"crypto"` + Crypto *crypto.Config `yaml:"crypto"` Orderers []ConnectionConfig `yaml:"orderers"` Discovery DiscoveryConfig `yaml:"discovery"` // peer pool for local configuration without gossip discovery @@ -25,9 +27,9 @@ type ConnectionConfig struct { } type CAConfig struct { - Crypto CryptoConfig `yaml:"crypto"` - Host string `yaml:"host"` - Tls TlsConfig `yaml:"tls"` + Crypto *crypto.Config `yaml:"crypto"` + Host string `yaml:"host"` + Tls TlsConfig `yaml:"tls"` } type PoolConfig struct { @@ -99,13 +101,6 @@ type DiscoveryChaincode struct { Policy string `json:"policy"` } -type CryptoConfig struct { - Type string `yaml:"type"` - Options CryptoSuiteOpts `yaml:"options"` -} - -type CryptoSuiteOpts map[string]interface{} - type Duration struct { time.Duration } diff --git a/api/core.go b/api/core.go deleted file mode 100644 index fb7e48c4..00000000 --- a/api/core.go +++ /dev/null @@ -1,38 +0,0 @@ -package api - -import ( - "context" - - "github.com/hyperledger/fabric/msp" -) - -type Channel interface { - // Chaincode returns chaincode instance by chaincode name - Chaincode(ctx context.Context, name string) (Chaincode, error) - // Join channel - Join(ctx context.Context) error -} - -type Core interface { - // Channel returns channel instance by channel name - Channel(name string) Channel - // CurrentIdentity identity returns current signing identity used by core - CurrentIdentity() msp.SigningIdentity - // CurrentMspPeers returns current msp peers - CurrentMspPeers() []Peer - // CryptoSuite returns current crypto suite implementation - CryptoSuite() CryptoSuite - // PeerPool current peer pool - PeerPool() PeerPool - // FabricV2 returns if core works in fabric v2 mode - FabricV2() bool - - Public -} - -// types which identify tx "wait'er" policy -// we don't make it as alias for preventing binding to our lib -const ( - TxWaiterSelfType string = "self" - TxWaiterAllType string = "all" -) diff --git a/api/errors.go b/api/errors.go deleted file mode 100644 index 54c25b7e..00000000 --- a/api/errors.go +++ /dev/null @@ -1,41 +0,0 @@ -package api - -import ( - "fmt" -) - -const ( - ErrEmptyConfig = Error(`empty core configuration`) - ErrInvalidPEMStructure = Error(`invalid PEM structure`) -) - -type MultiError struct { - Errors []error -} - -func (e *MultiError) Error() string { - errStr := "next errors occurred:\n" - for _, err := range e.Errors { - errStr += fmt.Sprintf("%s\n", err.Error()) - } - return errStr -} - -func (e *MultiError) Add(err error) { - e.Errors = append(e.Errors, err) -} - -type ErrUnexpectedHTTPStatus struct { - Status int - Body []byte -} - -func (err ErrUnexpectedHTTPStatus) Error() string { - return fmt.Sprintf("unexpected HTTP status code: %d with body %s", err.Status, string(err.Body)) -} - -type Error string - -func (e Error) Error() string { - return string(e) -} diff --git a/api/identity.go b/api/identity.go deleted file mode 100644 index d2a94a03..00000000 --- a/api/identity.go +++ /dev/null @@ -1,18 +0,0 @@ -package api - -import ( - "crypto/x509" - - "github.com/hyperledger/fabric/msp" -) - -type Identity interface { - // GetSigningIdentity returns signing identity which will use presented crypto suite - GetSigningIdentity(cs CryptoSuite) msp.SigningIdentity - // GetMSPIdentifier return msp id - GetMSPIdentifier() string - // GetPEM returns certificate in PEM format - GetPEM() []byte - // GetCert returns X509 Certificate - GetCert() *x509.Certificate -} diff --git a/api/peer.go b/api/peer.go index 794c807f..9ed43a97 100644 --- a/api/peer.go +++ b/api/peer.go @@ -15,11 +15,11 @@ type Endorser interface { Endorse(ctx context.Context, proposal *peer.SignedProposal) (*peer.ProposalResponse, error) } -type ChannelsFetcher interface { +type ChannelListGetter interface { GetChannels(ctx context.Context) (*peer.ChannelQueryResponse, error) } -type ChannelInfo interface { +type ChainInfoGetter interface { GetChainInfo(ctx context.Context, channel string) (*common.BlockchainInfo, error) } @@ -29,9 +29,9 @@ type Peer interface { Endorser - ChannelInfo + ChannelListGetter - ChannelsFetcher + ChainInfoGetter BlocksDeliverer diff --git a/api/peer_pool.go b/api/peer_pool.go index 1156e6f7..c4af0a71 100644 --- a/api/peer_pool.go +++ b/api/peer_pool.go @@ -2,30 +2,11 @@ package api import ( "context" - "fmt" - "time" "github.com/hyperledger/fabric-protos-go/peer" "github.com/hyperledger/fabric/msp" - "google.golang.org/grpc/connectivity" ) -const ( - ErrNoPeersForMSP = Error(`no peers for MSP`) - ErrMSPNotFound = Error(`MSP not found`) - ErrPeerNotReady = Error(`peer not ready`) - - DefaultGrpcCheckPeriod = 5 * time.Second -) - -type ErrNoReadyPeers struct { - MspId string -} - -func (e ErrNoReadyPeers) Error() string { - return fmt.Sprintf("no ready peers for MspId: %s", e.MspId) -} - type MSPPeerPool interface { Peers() []Peer FirstReadyPeer() (Peer, error) @@ -45,21 +26,3 @@ type PeerPool interface { } type PeerPoolCheckStrategy func(ctx context.Context, peer Peer, alive chan bool) - -func StrategyGRPC(d time.Duration) PeerPoolCheckStrategy { - return func(ctx context.Context, peer Peer, alive chan bool) { - t := time.NewTicker(d) - for { - select { - case <-ctx.Done(): - return - case <-t.C: - if peer.Conn().GetState() == connectivity.Ready { - alive <- true - } else { - alive <- false - } - } - } - } -} diff --git a/buf.gen.go.yaml b/buf.gen.go.yaml index 8128d313..32c6c38a 100644 --- a/buf.gen.go.yaml +++ b/buf.gen.go.yaml @@ -6,4 +6,12 @@ plugins: path: .generators/bin/protoc-gen-go out: . opt: + - plugins=grpc - paths=source_relative + + - name: go-validate + path: .generators/bin/protoc-gen-validate + out: . + opt: + - paths=source_relative + - lang=go diff --git a/buf.gen.svc.yaml b/buf.gen.svc.yaml new file mode 100644 index 00000000..de30afdd --- /dev/null +++ b/buf.gen.svc.yaml @@ -0,0 +1,30 @@ +version: v1 + +plugins: + + - name: go + path: .generators/bin/protoc-gen-go + out: . + opt: + - plugins=grpc + - paths=source_relative + + - name: go-validate + path: .generators/bin/protoc-gen-validate + out: . + opt: + - paths=source_relative + - lang=go + + - name: swagger + path: .generators/bin/protoc-gen-swagger + out: . + opt: + - logtostderr=true + + - name: grpc-gateway + path: .generators/bin/protoc-gen-grpc-gateway + out: . + opt: + - logtostderr=true + - paths=source_relative diff --git a/buf.work.yaml b/buf.work.yaml index d148a32c..30e4eb0a 100644 --- a/buf.work.yaml +++ b/buf.work.yaml @@ -1,4 +1,5 @@ version: v1 directories: - proto + - service - third_party \ No newline at end of file diff --git a/ca/core_opts.go b/ca/core_opts.go deleted file mode 100644 index 999e9f71..00000000 --- a/ca/core_opts.go +++ /dev/null @@ -1,51 +0,0 @@ -package ca - -import ( - "io/ioutil" - "net/http" - - "github.com/pkg/errors" - "gopkg.in/yaml.v2" - - "github.com/s7techlab/hlf-sdk-go/api/config" -) - -type opt func(c *core) error - -// WithYamlConfig allows using YAML config from file -func WithYamlConfig(configPath string) opt { - return func(c *core) error { - if configBytes, err := ioutil.ReadFile(configPath); err != nil { - return errors.Wrap(err, `failed to read file contents`) - } else { - c.config = new(config.CAConfig) - if err = yaml.Unmarshal(configBytes, c.config); err != nil { - return errors.Wrap(err, `failed to read YAML content`) - } - } - return nil - } -} - -func WithBytesConfig(configBytes []byte) opt { - return func(c *core) error { - if err := yaml.Unmarshal(configBytes, c.config); err != nil { - return errors.Wrap(err, `failed to read YAML content`) - } - return nil - } -} - -func WithRawConfig(conf *config.CAConfig) opt { - return func(c *core) error { - c.config = conf - return nil - } -} - -func WithHTTPClient(client *http.Client) opt { - return func(c *core) error { - c.client = client - return nil - } -} diff --git a/api/ca/core.go b/client/ca/client.go similarity index 51% rename from api/ca/core.go rename to client/ca/client.go index 18f64c1a..8e2f8ef3 100644 --- a/api/ca/core.go +++ b/client/ca/client.go @@ -4,59 +4,24 @@ import ( "context" "crypto/x509" "crypto/x509/pkix" - "net/url" ) -type Core interface { - // Getting information about CA +type Client interface { + // CAInfo Getting information about CA CAInfo(ctx context.Context) (*ResponseCAInfo, error) - // Common operations over certificates Register(ctx context.Context, req RegistrationRequest) (string, error) - Enroll(ctx context.Context, name, secret string, req *x509.CertificateRequest, opts ...EnrollOpt) (*x509.Certificate, interface{}, error) + Enroll(ctx context.Context, name, secret string, req *x509.CertificateRequest, opts ...EnrollOpt) ( + *x509.Certificate, interface{}, error) Revoke(ctx context.Context, req RevocationRequest) (*pkix.CertificateList, error) - // Operations over identities IdentityList(ctx context.Context) ([]Identity, error) IdentityGet(ctx context.Context, enrollId string) (*Identity, error) - // Operations over certificates CertificateList(ctx context.Context, opts ...CertificateListOpt) ([]*x509.Certificate, error) - // Operations over affiliations // AffiliationList lists all affiliations and identities of identity affiliation AffiliationList(ctx context.Context, rootAffiliation ...string) ([]Identity, []Affiliation, error) AffiliationCreate(ctx context.Context, name string, opts ...AffiliationOpt) error AffiliationDelete(ctx context.Context, name string, opts ...AffiliationOpt) ([]Identity, []Affiliation, error) } - -type EnrollOpts struct { - PrivateKey interface{} -} - -type EnrollOpt func(opts *EnrollOpts) error - -func WithEnrollPrivateKey(privateKey interface{}) EnrollOpt { - return func(opts *EnrollOpts) error { - opts.PrivateKey = privateKey - return nil - } -} - -type CertificateListOpt func(values *url.Values) error - -func WithEnrollId(enrollId string) CertificateListOpt { - return func(values *url.Values) error { - values.Add(`id`, enrollId) - return nil - } -} - -type AffiliationOpt func(values *url.Values) error - -func WithForce() AffiliationOpt { - return func(values *url.Values) error { - values.Set(`force`, `true`) - return nil - } -} diff --git a/api/ca/entity.go b/client/ca/entity.go similarity index 100% rename from api/ca/entity.go rename to client/ca/entity.go diff --git a/api/ca/errors.go b/client/ca/errors.go similarity index 100% rename from api/ca/errors.go rename to client/ca/errors.go diff --git a/ca/affiliation.go b/client/ca/http/affiliation.go similarity index 88% rename from ca/affiliation.go rename to client/ca/http/affiliation.go index 2e904fa0..48636a21 100644 --- a/ca/affiliation.go +++ b/client/ca/http/affiliation.go @@ -1,4 +1,4 @@ -package ca +package http import ( "bytes" @@ -10,7 +10,7 @@ import ( "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) const ( @@ -19,7 +19,7 @@ const ( endpointAffiliationDelete = "%s/api/v1/affiliations/%s" ) -func (c *core) AffiliationList(ctx context.Context, rootAffiliation ...string) ([]ca.Identity, []ca.Affiliation, error) { +func (c *Client) AffiliationList(ctx context.Context, rootAffiliation ...string) ([]ca.Identity, []ca.Affiliation, error) { var reqUrl string if len(rootAffiliation) == 1 { @@ -51,7 +51,7 @@ func (c *core) AffiliationList(ctx context.Context, rootAffiliation ...string) ( return affiliationResponse.Identities, affiliationResponse.Affiliations, nil } -func (c *core) AffiliationCreate(ctx context.Context, name string, opts ...ca.AffiliationOpt) error { +func (c *Client) AffiliationCreate(ctx context.Context, name string, opts ...ca.AffiliationOpt) error { var ( reqUrl string err error @@ -98,7 +98,7 @@ func (c *core) AffiliationCreate(ctx context.Context, name string, opts ...ca.Af return nil } -func (c *core) AffiliationDelete(ctx context.Context, name string, opts ...ca.AffiliationOpt) ([]ca.Identity, []ca.Affiliation, error) { +func (c *Client) AffiliationDelete(ctx context.Context, name string, opts ...ca.AffiliationOpt) ([]ca.Identity, []ca.Affiliation, error) { var ( reqUrl string err error diff --git a/ca/certificate.go b/client/ca/http/certificate.go similarity index 89% rename from ca/certificate.go rename to client/ca/http/certificate.go index 5c90b80a..bf82a4bd 100644 --- a/ca/certificate.go +++ b/client/ca/http/certificate.go @@ -1,4 +1,4 @@ -package ca +package http import ( "context" @@ -10,12 +10,12 @@ import ( "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) const endpointCertificateList = "%s/api/v1/certificates%s" -func (c *core) CertificateList(ctx context.Context, opts ...ca.CertificateListOpt) ([]*x509.Certificate, error) { +func (c *Client) CertificateList(ctx context.Context, opts ...ca.CertificateListOpt) ([]*x509.Certificate, error) { var ( reqUrl string err error diff --git a/ca/core.go b/client/ca/http/client.go similarity index 55% rename from ca/core.go rename to client/ca/http/client.go index 4a5456d8..9d2bf452 100644 --- a/ca/core.go +++ b/client/ca/http/client.go @@ -1,4 +1,4 @@ -package ca +package http import ( "encoding/base64" @@ -12,44 +12,76 @@ import ( "github.com/hyperledger/fabric/msp" "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api" - "github.com/s7techlab/hlf-sdk-go/api/ca" "github.com/s7techlab/hlf-sdk-go/api/config" + "github.com/s7techlab/hlf-sdk-go/client" + "github.com/s7techlab/hlf-sdk-go/client/ca" + clienterrors "github.com/s7techlab/hlf-sdk-go/client/errors" "github.com/s7techlab/hlf-sdk-go/crypto" - "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa" ) -type core struct { - mspId string - cs api.CryptoSuite - config *config.CAConfig - client *http.Client - identity msp.SigningIdentity +type Client struct { + crypto crypto.Suite + config *config.CAConfig + client *http.Client + signer msp.SigningIdentity } -func (c *core) createAuthToken(request []byte) (string, error) { - id, err := c.identity.Serialize() +func New(signer msp.SigningIdentity, opts ...Opt) (*Client, error) { + var err error + + c := &Client{ + signer: signer, + } + + for _, opt := range opts { + if err = opt(c); err != nil { + return nil, fmt.Errorf(`apply ca.Client option: %w`, err) + } + } + + if c.config == nil { + return nil, client.ErrEmptyConfig + } + + if c.crypto == nil { + c.crypto, err = crypto.NewSuiteByConfig(c.config.Crypto, true) + if err != nil { + return nil, err + } + } + + if c.client == nil { + c.client = http.DefaultClient + } + + c.signer = signer + + return c, nil +} + +func (c *Client) createAuthToken(request []byte) (string, error) { + id, err := c.signer.Serialize() if err != nil { - return ``, errors.Wrap(err, `failed to get serialized identity`) + return ``, errors.Wrap(err, `failed to get serialized signer`) } var serId mspPb.SerializedIdentity if err = proto.Unmarshal(id, &serId); err != nil { - return ``, errors.Wrap(err, `failed to unmarshal serialized identity`) + return ``, errors.Wrap(err, `failed to unmarshal serialized signer`) } baseCert := base64.StdEncoding.EncodeToString(serId.IdBytes) baseReq := base64.StdEncoding.EncodeToString(request) - if signature, err := c.identity.Sign([]byte(baseReq + `.` + baseCert)); err != nil { + if signature, err := c.signer.Sign([]byte(baseReq + `.` + baseCert)); err != nil { return ``, errors.Wrap(err, `failed to sign data`) } else { return fmt.Sprintf("%s.%s", baseCert, base64.StdEncoding.EncodeToString(signature)), nil } } -func (c *core) setAuthToken(req *http.Request, body []byte) error { +func (c *Client) setAuthToken(req *http.Request, body []byte) error { if token, err := c.createAuthToken(body); err != nil { return errors.Wrap(err, `failed to create auth token`) } else { @@ -58,7 +90,7 @@ func (c *core) setAuthToken(req *http.Request, body []byte) error { return nil } -func (c *core) processResponse(resp *http.Response, out interface{}, expectedHTTPStatuses ...int) error { +func (c *Client) processResponse(resp *http.Response, out interface{}, expectedHTTPStatuses ...int) error { defer func() { _ = resp.Body.Close() }() body, err := ioutil.ReadAll(resp.Body) if err != nil { @@ -66,7 +98,7 @@ func (c *core) processResponse(resp *http.Response, out interface{}, expectedHTT } if !c.expectedHTTPStatus(resp.StatusCode, expectedHTTPStatuses...) { - return api.ErrUnexpectedHTTPStatus{Status: resp.StatusCode, Body: body} + return clienterrors.ErrUnexpectedHTTPStatus{Status: resp.StatusCode, Body: body} } var caResp ca.Response @@ -85,7 +117,7 @@ func (c *core) processResponse(resp *http.Response, out interface{}, expectedHTT return nil } -func (c *core) expectedHTTPStatus(status int, expected ...int) bool { +func (c *Client) expectedHTTPStatus(status int, expected ...int) bool { for _, s := range expected { if s == status { return true @@ -93,36 +125,3 @@ func (c *core) expectedHTTPStatus(status int, expected ...int) bool { } return false } - -func NewCore(mspId string, identity api.Identity, opts ...opt) (ca.Core, error) { - var err error - - c := &core{mspId: mspId} - - // Applying user opts - for _, opt := range opts { - if err = opt(c); err != nil { - return nil, fmt.Errorf(`apply ca.core option: %w`, err) - } - } - - if c.config == nil { - return nil, api.ErrEmptyConfig - } - - if c.config.Crypto.Type == `` { - c.config.Crypto = ecdsa.DefaultConfig - } - - if c.cs, err = crypto.GetSuite(c.config.Crypto.Type, c.config.Crypto.Options); err != nil { - return nil, fmt.Errorf(`initialize crypto suite: %w`, err) - } - - if c.client == nil { - c.client = http.DefaultClient - } - - c.identity = identity.GetSigningIdentity(c.cs) - - return c, nil -} diff --git a/ca/enroll.go b/client/ca/http/enroll.go similarity index 86% rename from ca/enroll.go rename to client/ca/http/enroll.go index b0051664..306cac80 100644 --- a/ca/enroll.go +++ b/client/ca/http/enroll.go @@ -1,4 +1,4 @@ -package ca +package http import ( "bytes" @@ -13,12 +13,12 @@ import ( "github.com/cloudflare/cfssl/signer" "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) const enrollEndpoint = `/api/v1/enroll` -func (c *core) Enroll(ctx context.Context, name, secret string, req *x509.CertificateRequest, opts ...ca.EnrollOpt) (*x509.Certificate, interface{}, error) { +func (c *Client) Enroll(ctx context.Context, name, secret string, req *x509.CertificateRequest, opts ...ca.EnrollOpt) (*x509.Certificate, interface{}, error) { var err error options := &ca.EnrollOpts{} @@ -29,14 +29,14 @@ func (c *core) Enroll(ctx context.Context, name, secret string, req *x509.Certif } if options.PrivateKey == nil { - if options.PrivateKey, err = c.cs.NewPrivateKey(); err != nil { + if options.PrivateKey, err = c.crypto.NewPrivateKey(); err != nil { return nil, nil, errors.Wrap(err, `failed to generate private key`) } } // Add default signature algorithm if not defined if req.SignatureAlgorithm == x509.UnknownSignatureAlgorithm { - req.SignatureAlgorithm = c.cs.GetSignatureAlgorithm() + req.SignatureAlgorithm = c.crypto.GetSignatureAlgorithm() } csr, err := x509.CreateCertificateRequest(rand.Reader, req, options.PrivateKey) diff --git a/ca/identity.go b/client/ca/http/identity.go similarity index 86% rename from ca/identity.go rename to client/ca/http/identity.go index 4f07ea62..71857a05 100644 --- a/ca/identity.go +++ b/client/ca/http/identity.go @@ -1,4 +1,4 @@ -package ca +package http import ( "context" @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) const ( @@ -15,7 +15,7 @@ const ( endpointIdentityGet = "%s/api/v1/identities/%s" ) -func (c *core) IdentityList(ctx context.Context) ([]ca.Identity, error) { +func (c *Client) IdentityList(ctx context.Context) ([]ca.Identity, error) { req, err := http.NewRequest(http.MethodGet, fmt.Sprintf(endpointIdentityList, c.config.Host), nil) if err != nil { return nil, errors.Wrap(err, `failed to create request`) @@ -41,7 +41,7 @@ func (c *core) IdentityList(ctx context.Context) ([]ca.Identity, error) { return identityListResp.Identities, nil } -func (c *core) IdentityGet(ctx context.Context, enrollId string) (*ca.Identity, error) { +func (c *Client) IdentityGet(ctx context.Context, enrollId string) (*ca.Identity, error) { req, err := http.NewRequest(http.MethodGet, fmt.Sprintf(endpointIdentityGet, c.config.Host, enrollId), nil) if err != nil { diff --git a/ca/info.go b/client/ca/http/info.go similarity index 79% rename from ca/info.go rename to client/ca/http/info.go index f8429907..33c1885c 100644 --- a/ca/info.go +++ b/client/ca/http/info.go @@ -1,4 +1,4 @@ -package ca +package http import ( "context" @@ -6,10 +6,10 @@ import ( "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) -func (c *core) CAInfo(ctx context.Context) (*ca.ResponseCAInfo, error) { +func (c *Client) CAInfo(ctx context.Context) (*ca.ResponseCAInfo, error) { req, err := http.NewRequest(http.MethodGet, c.config.Host+`/api/v1/cainfo`, nil) if err != nil { return nil, errors.Wrap(err, `failed to create http request`) diff --git a/client/ca/http/opts.go b/client/ca/http/opts.go new file mode 100644 index 00000000..dce35ada --- /dev/null +++ b/client/ca/http/opts.go @@ -0,0 +1,51 @@ +package http + +import ( + "fmt" + "net/http" + "os" + + "gopkg.in/yaml.v2" + + "github.com/s7techlab/hlf-sdk-go/api/config" +) + +type Opt func(c *Client) error + +// WithYamlConfig allows using YAML config from file +func WithYamlConfig(configPath string) Opt { + return func(c *Client) error { + if configBytes, err := os.ReadFile(configPath); err != nil { + return fmt.Errorf(`read file=%s: %w`, configPath, err) + } else { + c.config = new(config.CAConfig) + if err = yaml.Unmarshal(configBytes, c.config); err != nil { + return fmt.Errorf(`unmarshal YAML config: %w`, err) + } + } + return nil + } +} + +func WithBytesConfig(configBytes []byte) Opt { + return func(c *Client) error { + if err := yaml.Unmarshal(configBytes, c.config); err != nil { + return fmt.Errorf(`unmarshal YAML config: %w`, err) + } + return nil + } +} + +func WithRawConfig(conf *config.CAConfig) Opt { + return func(c *Client) error { + c.config = conf + return nil + } +} + +func WithHTTPClient(client *http.Client) Opt { + return func(c *Client) error { + c.client = client + return nil + } +} diff --git a/ca/register.go b/client/ca/http/register.go similarity index 86% rename from ca/register.go rename to client/ca/http/register.go index 6cff487d..87019b9f 100644 --- a/ca/register.go +++ b/client/ca/http/register.go @@ -1,4 +1,4 @@ -package ca +package http import ( "bytes" @@ -8,12 +8,12 @@ import ( "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) const regEndpoint = `/api/v1/register` -func (c *core) Register(ctx context.Context, req ca.RegistrationRequest) (string, error) { +func (c *Client) Register(ctx context.Context, req ca.RegistrationRequest) (string, error) { reqBytes, err := json.Marshal(req) if err != nil { return ``, errors.Wrap(err, `failed to marshal request to JSON`) diff --git a/ca/revoke.go b/client/ca/http/revoke.go similarity index 86% rename from ca/revoke.go rename to client/ca/http/revoke.go index 2ed4ef01..628888a5 100644 --- a/ca/revoke.go +++ b/client/ca/http/revoke.go @@ -1,4 +1,4 @@ -package ca +package http import ( "bytes" @@ -11,14 +11,14 @@ import ( "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) const ( endpointRevoke = "%s/api/v1/revoke" ) -func (c *core) Revoke(ctx context.Context, req ca.RevocationRequest) (*pkix.CertificateList, error) { +func (c *Client) Revoke(ctx context.Context, req ca.RevocationRequest) (*pkix.CertificateList, error) { reqBytes, err := json.Marshal(req) if err != nil { return nil, errors.Wrap(err, `failed to marshal JSON request`) diff --git a/ca/camock/ca.go b/client/ca/mock/ca.go similarity index 80% rename from ca/camock/ca.go rename to client/ca/mock/ca.go index 06e1c3b5..010ec3a6 100644 --- a/ca/camock/ca.go +++ b/client/ca/mock/ca.go @@ -1,4 +1,4 @@ -package camock +package mock import ( "context" @@ -15,7 +15,7 @@ import ( "sync" "time" - caapi "github.com/s7techlab/hlf-sdk-go/api/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" ) type ( @@ -78,19 +78,19 @@ func New(privateKey, cert []byte, opts ...Opt) (*CA, error) { return c, nil } -func (c *CA) CAInfo(ctx context.Context) (*caapi.ResponseCAInfo, error) { - return &caapi.ResponseCAInfo{ +func (c *CA) CAInfo(ctx context.Context) (*ca.ResponseCAInfo, error) { + return &ca.ResponseCAInfo{ CAName: "Mocked CA", CAChain: base64.StdEncoding.EncodeToString([]byte(c.CAChain)), Version: "", }, nil } -func (c *CA) Register(ctx context.Context, req caapi.RegistrationRequest) (string, error) { +func (c *CA) Register(ctx context.Context, req ca.RegistrationRequest) (string, error) { return ``, nil } -func (c *CA) Enroll(_ context.Context, name, _ string, req *x509.CertificateRequest, _ ...caapi.EnrollOpt) (*x509.Certificate, interface{}, error) { +func (c *CA) Enroll(_ context.Context, name, _ string, req *x509.CertificateRequest, _ ...ca.EnrollOpt) (*x509.Certificate, interface{}, error) { pk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { return nil, nil, fmt.Errorf(`generate private key: %w`, err) @@ -115,31 +115,31 @@ func (c *CA) Enroll(_ context.Context, name, _ string, req *x509.CertificateRequ return cert, pk, nil } -func (c *CA) Revoke(ctx context.Context, req caapi.RevocationRequest) (*pkix.CertificateList, error) { +func (c *CA) Revoke(ctx context.Context, req ca.RevocationRequest) (*pkix.CertificateList, error) { panic("implement me") } -func (c *CA) IdentityList(ctx context.Context) ([]caapi.Identity, error) { +func (c *CA) IdentityList(ctx context.Context) ([]ca.Identity, error) { panic("implement me") } -func (c *CA) IdentityGet(ctx context.Context, enrollId string) (*caapi.Identity, error) { +func (c *CA) IdentityGet(ctx context.Context, enrollId string) (*ca.Identity, error) { panic("implement me") } -func (c *CA) CertificateList(ctx context.Context, opts ...caapi.CertificateListOpt) ([]*x509.Certificate, error) { +func (c *CA) CertificateList(ctx context.Context, opts ...ca.CertificateListOpt) ([]*x509.Certificate, error) { panic("implement me") } -func (c *CA) AffiliationList(ctx context.Context, rootAffiliation ...string) ([]caapi.Identity, []caapi.Affiliation, error) { +func (c *CA) AffiliationList(ctx context.Context, rootAffiliation ...string) ([]ca.Identity, []ca.Affiliation, error) { panic("implement me") } -func (c *CA) AffiliationCreate(ctx context.Context, name string, opts ...caapi.AffiliationOpt) error { +func (c *CA) AffiliationCreate(ctx context.Context, name string, opts ...ca.AffiliationOpt) error { panic("implement me") } -func (c *CA) AffiliationDelete(ctx context.Context, name string, opts ...caapi.AffiliationOpt) ([]caapi.Identity, []caapi.Affiliation, error) { +func (c *CA) AffiliationDelete(ctx context.Context, name string, opts ...ca.AffiliationOpt) ([]ca.Identity, []ca.Affiliation, error) { panic("implement me") } diff --git a/ca/camock/ca_test.go b/client/ca/mock/ca_test.go similarity index 70% rename from ca/camock/ca_test.go rename to client/ca/mock/ca_test.go index df306816..e2331f66 100644 --- a/ca/camock/ca_test.go +++ b/client/ca/mock/ca_test.go @@ -1,4 +1,4 @@ -package camock_test +package mock_test import ( "context" @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/s7techlab/hlf-sdk-go/api/ca" - "github.com/s7techlab/hlf-sdk-go/ca/camock" + "github.com/s7techlab/hlf-sdk-go/client/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca/mock" ) var ( @@ -19,23 +19,23 @@ var ( //go:embed testdata/ca-key.pem pk []byte - core ca.Core + client ca.Client ctx = context.Background() ) func TestNewMockCaClientInvalidCert(t *testing.T) { var err error - core, err = camock.New([]byte(`invalid`), []byte(`invalid_cert`)) - assert.Nil(t, core) + client, err = mock.New([]byte(`invalid`), []byte(`invalid_cert`)) + assert.Nil(t, client) assert.Error(t, err) } func TestNewMockCaClientValid(t *testing.T) { var err error - core, err = camock.New(pk, cert) + client, err = mock.New(pk, cert) assert.NoError(t, err) - assert.NotNil(t, core) + assert.NotNil(t, client) } @@ -47,7 +47,7 @@ func TestCaClient_Enroll(t *testing.T) { CommonName: `org1`, }} - certificate, privateKey, err := core.Enroll(ctx, ``, ``, req) + certificate, privateKey, err := client.Enroll(ctx, ``, ``, req) assert.NoError(t, err) assert.NotNil(t, certificate) assert.NotNil(t, privateKey) diff --git a/ca/camock/testdata/README.md b/client/ca/mock/testdata/README.md similarity index 100% rename from ca/camock/testdata/README.md rename to client/ca/mock/testdata/README.md diff --git a/ca/camock/testdata/ca-key.pem b/client/ca/mock/testdata/ca-key.pem similarity index 100% rename from ca/camock/testdata/ca-key.pem rename to client/ca/mock/testdata/ca-key.pem diff --git a/ca/camock/testdata/ca.csr b/client/ca/mock/testdata/ca.csr similarity index 100% rename from ca/camock/testdata/ca.csr rename to client/ca/mock/testdata/ca.csr diff --git a/ca/camock/testdata/ca.pem b/client/ca/mock/testdata/ca.pem similarity index 100% rename from ca/camock/testdata/ca.pem rename to client/ca/mock/testdata/ca.pem diff --git a/ca/camock/testdata/csr.json b/client/ca/mock/testdata/csr.json similarity index 100% rename from ca/camock/testdata/csr.json rename to client/ca/mock/testdata/csr.json diff --git a/client/ca/opts.go b/client/ca/opts.go new file mode 100644 index 00000000..e95b1054 --- /dev/null +++ b/client/ca/opts.go @@ -0,0 +1,36 @@ +package ca + +import ( + "net/url" +) + +type EnrollOpts struct { + PrivateKey interface{} +} + +type EnrollOpt func(opts *EnrollOpts) error + +func WithEnrollPrivateKey(privateKey interface{}) EnrollOpt { + return func(opts *EnrollOpts) error { + opts.PrivateKey = privateKey + return nil + } +} + +type CertificateListOpt func(values *url.Values) error + +func WithEnrollId(enrollId string) CertificateListOpt { + return func(values *url.Values) error { + values.Add(`id`, enrollId) + return nil + } +} + +type AffiliationOpt func(values *url.Values) error + +func WithForce() AffiliationOpt { + return func(values *url.Values) error { + values.Set(`force`, `true`) + return nil + } +} diff --git a/api/ca/request.go b/client/ca/request.go similarity index 100% rename from api/ca/request.go rename to client/ca/request.go diff --git a/api/ca/response.go b/client/ca/response.go similarity index 98% rename from api/ca/response.go rename to client/ca/response.go index 3b9a9ccd..28222b30 100644 --- a/api/ca/response.go +++ b/client/ca/response.go @@ -1,6 +1,8 @@ package ca -import "encoding/json" +import ( + "encoding/json" +) type ( Response struct { diff --git a/client/chaincode/system.go b/client/chaincode/system.go new file mode 100644 index 00000000..952ed9fb --- /dev/null +++ b/client/chaincode/system.go @@ -0,0 +1,15 @@ +package chaincode + +const ( + CSCC = `cscc` + + CSCCJoinChain string = "JoinChain" + CSCCGetConfigBlock string = "GetConfigBlock" + CSCCGetChannels string = "GetChannels" + CSCCGetConfigTree string = `GetConfigTree` // HLF Peer V1.x + CSCCGetChannelConfig string = "GetChannelConfig" // HLF Peer V2 + + + QSCC = `qscc` + LSCC = `lscc` + Lifecycle = `_lifecycle` +) diff --git a/client/chaincode/system/Makefile b/client/chaincode/system/Makefile deleted file mode 100644 index 1ac7a4b0..00000000 --- a/client/chaincode/system/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -generate: - @protoc -I=. \ - -I=../../../third_party \ - -I=../../../third_party/hyperledger/fabric-protos \ - --go_out=paths=source_relative,plugins=grpc:. \ - --grpc-gateway_out=paths=source_relative:. \ - --swagger_out=logtostderr=true:. \ - *.proto diff --git a/client/chaincode/system/chaincodes.go b/client/chaincode/system/chaincodes.go deleted file mode 100644 index fad726a1..00000000 --- a/client/chaincode/system/chaincodes.go +++ /dev/null @@ -1,8 +0,0 @@ -package system - -const ( - CSCCName = `cscc` - QSCCName = `qscc` - LSCCName = `lscc` - LifecycleName = `_lifecycle` -) diff --git a/client/chaincode/system/cscc.go b/client/chaincode/system/cscc.go deleted file mode 100644 index a981b6b0..00000000 --- a/client/chaincode/system/cscc.go +++ /dev/null @@ -1,120 +0,0 @@ -package system - -import ( - "context" - _ "embed" - "fmt" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hyperledger/fabric-protos-go/common" - "github.com/hyperledger/fabric-protos-go/peer" - - "github.com/s7techlab/hlf-sdk-go/api" - "github.com/s7techlab/hlf-sdk-go/client/tx" - hlfproto "github.com/s7techlab/hlf-sdk-go/proto" -) - -//go:embed qscc.swagger.json -var CSCCServiceSwagger []byte - -// These are function names from Invoke first parameter -const ( - JoinChain string = "JoinChain" - GetConfigBlock string = "GetConfigBlock" - GetChannels string = "GetChannels" - GetConfigTree string = `GetConfigTree` // HLF Peer V1.x - GetChannelConfig string = "GetChannelConfig" // HLF Peer V2 + -) - -type ( - CSCCService struct { - UnimplementedCSCCServiceServer - - Querier *tx.ProtoQuerier - ChannelsFetcher *CSCCChannelsFetcher - FabricVersion hlfproto.FabricVersion - } - - CSCCChannelsFetcher struct { - Querier *tx.ProtoQuerier - } -) - -func NewCSCCFromClient(client api.Core) *CSCCService { - return NewCSCC(client, hlfproto.FabricVersionIsV2(client.FabricV2())) -} - -func NewCSCC(querier api.Querier, version hlfproto.FabricVersion) *CSCCService { - return &CSCCService{ - // Channel and chaincode are fixed in queries to CSCC - Querier: tx.NewProtoQuerier(querier, ``, CSCCName), - ChannelsFetcher: NewCSCCChannelsFetcher(querier), - FabricVersion: version, - } -} - -func NewCSCCChannelsFetcher(querier api.Querier) *CSCCChannelsFetcher { - return &CSCCChannelsFetcher{ - Querier: tx.NewProtoQuerier(querier, ``, CSCCName), - } -} - -func (f *CSCCChannelsFetcher) GetChannels(ctx context.Context) (*peer.ChannelQueryResponse, error) { - res, err := f.Querier.QueryStringsProto(ctx, []string{GetChannels}, &peer.ChannelQueryResponse{}) - if err != nil { - return nil, err - } - return res.(*peer.ChannelQueryResponse), nil -} - -func (c *CSCCService) ServiceDef() ServiceDef { - return NewServiceDef( - _CSCCService_serviceDesc.ServiceName, - CSCCServiceSwagger, - &_CSCCService_serviceDesc, - c, - RegisterCSCCServiceHandlerFromEndpoint, - ) -} - -func (c *CSCCService) GetChannels(ctx context.Context, _ *empty.Empty) (*peer.ChannelQueryResponse, error) { - return c.ChannelsFetcher.GetChannels(ctx) -} - -func (c *CSCCService) JoinChain(ctx context.Context, request *JoinChainRequest) (*empty.Empty, error) { - if _, err := c.Querier.Query(ctx, JoinChain, request.GenesisBlock); err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (c *CSCCService) GetConfigBlock(ctx context.Context, request *GetConfigBlockRequest) (*common.Block, error) { - res, err := c.Querier.QueryProto(ctx, []interface{}{GetConfigBlock, request.Channel}, &common.Block{}) - if err != nil { - return nil, err - } - return res.(*common.Block), nil -} - -func (c *CSCCService) GetChannelConfig(ctx context.Context, request *GetChannelConfigRequest) (*common.Config, error) { - switch c.FabricVersion { - - case hlfproto.FabricV1: - res, err := c.Querier.QueryStringsProto(ctx, []string{GetConfigTree, request.Channel}, &peer.ConfigTree{}) - if err != nil { - return nil, err - } - return res.(*peer.ConfigTree).ChannelConfig, nil - - case hlfproto.FabricV2: - - res, err := c.Querier.QueryStringsProto(ctx, []string{GetChannelConfig, request.Channel}, &common.Config{}) - if err != nil { - return nil, err - } - return res.(*common.Config), nil - - default: - return nil, fmt.Errorf(`fabric version=%s: %w`, c.FabricVersion, hlfproto.ErrUnknownFabricVersion) - } -} diff --git a/client/chaincode/txwaiter/all.go b/client/chaincode/txwaiter/all.go index 882f3a61..9008055e 100644 --- a/client/chaincode/txwaiter/all.go +++ b/client/chaincode/txwaiter/all.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "github.com/s7techlab/hlf-sdk-go/api" + clienterr "github.com/s7techlab/hlf-sdk-go/client/errors" ) // All - need use on invoke flow for check transaction codes for each organization from endorsement policy @@ -17,7 +18,7 @@ func All(cfg *api.DoOptions) (api.TxWaiter, error) { } // make delivers for each mspID - errD := new(api.MultiError) + errD := new(clienterr.MultiError) for i := range cfg.EndorsingMspIDs { peerDeliver, err := cfg.Pool.DeliverClient(cfg.EndorsingMspIDs[i], cfg.Identity) if err != nil { @@ -66,7 +67,7 @@ func (w *allMspWaiter) Wait(ctx context.Context, channel string, txId string) er close(errS) if w.hasErr { - mErr := &api.MultiError{} + mErr := &clienterr.MultiError{} for e := range errS { if e != nil { mErr.Errors = append(mErr.Errors, e) diff --git a/client/channel.go b/client/channel.go index 1a4d7665..4c8bacae 100644 --- a/client/channel.go +++ b/client/channel.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "sync" - "time" "github.com/hyperledger/fabric-protos-go/common" "github.com/hyperledger/fabric/msp" @@ -14,9 +13,10 @@ import ( "github.com/s7techlab/hlf-sdk-go/api" "github.com/s7techlab/hlf-sdk-go/api/config" "github.com/s7techlab/hlf-sdk-go/client/chaincode" - "github.com/s7techlab/hlf-sdk-go/client/chaincode/system" + "github.com/s7techlab/hlf-sdk-go/client/grpc" "github.com/s7techlab/hlf-sdk-go/client/tx" "github.com/s7techlab/hlf-sdk-go/proto" + "github.com/s7techlab/hlf-sdk-go/service/systemcc/cscc" ) type Channel struct { @@ -83,7 +83,7 @@ func (c *Channel) Chaincode(serviceDiscCtx context.Context, ccName string) (api. if err != nil { return fmt.Errorf("initialize endorsers for MSP: %s: %w", mspID, err) } - if err = c.peerPool.Add(mspID, p, api.StrategyGRPC(5*time.Second)); err != nil { + if err = c.peerPool.Add(mspID, p, StrategyGRPC(grpc.DefaultGrpcCheckPeriod)); err != nil { return fmt.Errorf("add endorser peer to pool: %s:%w", mspID, err) } return nil @@ -136,12 +136,12 @@ func (c *Channel) Join(ctx context.Context) error { return fmt.Errorf(`no peeers for msp if=%s`, c.mspId) } - cscc := system.NewCSCC( + csccSvc := cscc.NewCSCC( // use specified peer to process join (pool can contain more than one peer) peers[0], proto.FabricVersionIsV2(c.fabricV2)) - _, err = cscc.JoinChain(ctx, &system.JoinChainRequest{ + _, err = csccSvc.JoinChain(ctx, &cscc.JoinChainRequest{ Channel: c.chanName, GenesisBlock: channelGenesis, }) diff --git a/client/channel/interface.go b/client/channel/interface.go new file mode 100644 index 00000000..9c86d4ad --- /dev/null +++ b/client/channel/interface.go @@ -0,0 +1 @@ +package channel diff --git a/client/channel/list.go b/client/channel/list.go new file mode 100644 index 00000000..2894f104 --- /dev/null +++ b/client/channel/list.go @@ -0,0 +1,29 @@ +package channel + +import ( + "context" + + "github.com/hyperledger/fabric-protos-go/peer" + + "github.com/s7techlab/hlf-sdk-go/api" + "github.com/s7techlab/hlf-sdk-go/client/chaincode" + "github.com/s7techlab/hlf-sdk-go/client/tx" +) + +type CSCCListGetter struct { + Querier *tx.ProtoQuerier +} + +func NewCSCCListGetter(querier api.Querier) *CSCCListGetter { + return &CSCCListGetter{ + Querier: tx.NewProtoQuerier(querier, ``, chaincode.CSCC), + } +} + +func (g *CSCCListGetter) GetChannels(ctx context.Context) (*peer.ChannelQueryResponse, error) { + res, err := g.Querier.QueryStringsProto(ctx, []string{chaincode.CSCCGetChannels}, &peer.ChannelQueryResponse{}) + if err != nil { + return nil, err + } + return res.(*peer.ChannelQueryResponse), nil +} diff --git a/client/core.go b/client/core.go index da08d736..8d13522a 100644 --- a/client/core.go +++ b/client/core.go @@ -11,123 +11,107 @@ import ( "github.com/s7techlab/hlf-sdk-go/api" "github.com/s7techlab/hlf-sdk-go/api/config" + "github.com/s7techlab/hlf-sdk-go/client/discovery" "github.com/s7techlab/hlf-sdk-go/client/grpc" "github.com/s7techlab/hlf-sdk-go/crypto" - "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa" - "github.com/s7techlab/hlf-sdk-go/discovery" ) // implementation of api.Core interface -var _ api.Core = (*core)(nil) - -type core struct { - ctx context.Context - logger *zap.Logger - config *config.Config - identity msp.SigningIdentity - peerPool api.PeerPool - orderer api.Orderer +var _ api.Client = (*Client)(nil) + +var ( + ErrEmptyMSPConfig = errors.New(`empty MSP config`) + ErrDiscoveryConnectionRequired = errors.New(`discovery connection required`) + ErrDiscoverySignerRequired = errors.New(`discovery signer required`) +) + +type Client struct { + ctx context.Context + config *config.Config + + defaultSigner msp.SigningIdentity // default signer for requests + + peerPool api.PeerPool + orderer api.Orderer + discoveryProvider api.DiscoveryProvider - channels map[string]api.Channel - channelMx sync.Mutex - cs api.CryptoSuite - fabricV2 bool + discoverySigner msp.SigningIdentity // signer for discovery queries + + channels map[string]api.Channel + channelMx sync.Mutex + + crypto crypto.Suite + logger *zap.Logger + fabricV2 bool } -func New(identity api.Identity, opts ...CoreOpt) (api.Core, error) { - if identity == nil { - return nil, errors.New("identity wasn't provided") - } +func New(ctx context.Context, opts ...Opt) (*Client, error) { + var err error - coreImpl := &core{ + client := &Client{ + ctx: ctx, + config: &config.Config{}, channels: make(map[string]api.Channel), } - for _, option := range opts { - if err := option(coreImpl); err != nil { + for _, opt := range opts { + if err := opt(client); err != nil { return nil, fmt.Errorf(`apply option: %w`, err) } } - if coreImpl.ctx == nil { - coreImpl.ctx = context.Background() - } - - if coreImpl.logger == nil { - coreImpl.logger = DefaultLogger + if err := applyDefaults(client); err != nil { + return nil, err } - var err error - if coreImpl.cs == nil { - coreImpl.cs, err = crypto.GetSuite(ecdsa.DefaultConfig.Type, ecdsa.DefaultConfig.Options) - if err != nil { - return nil, fmt.Errorf(`initialize crypto suite: %w`, err) - } - } - - coreImpl.identity = identity.GetSigningIdentity(coreImpl.cs) - // if peerPool is empty, set it from config - if coreImpl.peerPool == nil { - coreImpl.logger.Info("initializing peer pool") - - if coreImpl.config == nil { - return nil, api.ErrEmptyConfig - } - - coreImpl.peerPool = NewPeerPool(coreImpl.ctx, coreImpl.logger) - for _, mspConfig := range coreImpl.config.MSP { - for _, peerConfig := range mspConfig.Endorsers { - var p api.Peer - p, err = NewPeer(coreImpl.ctx, peerConfig, coreImpl.identity, coreImpl.logger) - if err != nil { - return nil, fmt.Errorf("initialize endorsers for MSP: %s: %w", mspConfig.Name, err) - } - - if err = coreImpl.peerPool.Add(mspConfig.Name, p, api.StrategyGRPC(api.DefaultGrpcCheckPeriod)); err != nil { - return nil, fmt.Errorf(`add peer to pool: %w`, err) - } - } + if client.peerPool != nil { + if err = client.initPeerPool(); err != nil { + return nil, fmt.Errorf(`init peer pool: %w`, err) } } - if coreImpl.discoveryProvider == nil && coreImpl.config != nil { - mapper := discovery.NewEndpointsMapper(coreImpl.config.EndpointsMap) + if client.discoveryProvider == nil && client.config != nil { + mapper := discovery.NewEndpointsMapper(client.config.EndpointsMap) - switch coreImpl.config.Discovery.Type { + switch client.config.Discovery.Type { case string(discovery.LocalConfigServiceDiscoveryType): - coreImpl.logger.Info("local discovery provider", zap.Reflect(`options`, coreImpl.config.Discovery.Options)) + client.logger.Info("local discovery provider", zap.Reflect(`options`, client.config.Discovery.Options)) - coreImpl.discoveryProvider, err = discovery.NewLocalConfigProvider(coreImpl.config.Discovery.Options, mapper) + client.discoveryProvider, err = discovery.NewLocalConfigProvider(client.config.Discovery.Options, mapper) if err != nil { return nil, fmt.Errorf(`initialize discovery provider: %w`, err) } case string(discovery.GossipServiceDiscoveryType): - if coreImpl.config.Discovery.Connection == nil { - return nil, fmt.Errorf(`discovery connection config wasn't provided. configure 'discovery.connection': %w`, err) + if client.config.Discovery.Connection == nil { + return nil, ErrDiscoveryConnectionRequired + } + + if client.discoverySigner == nil { + return nil, ErrDiscoverySignerRequired } - coreImpl.logger.Info("gossip discovery provider", zap.Reflect(`connection`, coreImpl.config.Discovery.Connection)) + client.logger.Info("gossip discovery provider", zap.Reflect(`connection`, client.config.Discovery.Connection)) identitySigner := func(msg []byte) ([]byte, error) { - return coreImpl.CurrentIdentity().Sign(msg) + return client.discoverySigner.Sign(msg) } - clientIdentity, err := coreImpl.CurrentIdentity().Serialize() + clientIdentity, err := client.discoverySigner.Serialize() if err != nil { - return nil, fmt.Errorf(`serialize current identity: %w`, err) + return nil, fmt.Errorf(`serialize current defaultSigner: %w`, err) } // add tls settings from mapper if they were provided - conn := mapper.MapConnection(coreImpl.config.Discovery.Connection.Host) - coreImpl.config.Discovery.Connection.Tls = conn.TlsConfig - coreImpl.config.Discovery.Connection.Host = conn.Host - - coreImpl.discoveryProvider, err = discovery.NewGossipDiscoveryProvider( - coreImpl.ctx, - *coreImpl.config.Discovery.Connection, - coreImpl.logger, + conn := mapper.MapConnection(client.config.Discovery.Connection.Host) + client.config.Discovery.Connection.Tls = conn.TlsConfig + client.config.Discovery.Connection.Host = conn.Host + + client.discoveryProvider, err = discovery.NewGossipDiscoveryProvider( + client.ctx, + *client.config.Discovery.Connection, + client.logger, identitySigner, clientIdentity, mapper, @@ -137,10 +121,10 @@ func New(identity api.Identity, opts ...CoreOpt) (api.Core, error) { } // discovery initialized, add local peers to the pool - lDiscoverer, err := coreImpl.discoveryProvider.LocalPeers(coreImpl.ctx) + lDiscoverer, err := client.discoveryProvider.LocalPeers(client.ctx) if err != nil { return nil, fmt.Errorf(`fetch local peers from discovery provider connection=%s: %w`, - coreImpl.config.Discovery.Connection.Host, err) + client.config.Discovery.Connection.Host, err) } peers := lDiscoverer.Peers() @@ -154,70 +138,110 @@ func New(identity api.Identity, opts ...CoreOpt) (api.Core, error) { Tls: lpAddresses.TlsConfig, } - p, err := NewPeer(coreImpl.ctx, peerCfg, coreImpl.identity, coreImpl.logger) + p, err := NewPeer(client.ctx, peerCfg, client.defaultSigner, client.logger) if err != nil { return nil, fmt.Errorf(`initialize endorsers for MSP: %s: %w`, mspID, err) } - if err = coreImpl.peerPool.Add(mspID, p, api.StrategyGRPC(api.DefaultGrpcCheckPeriod)); err != nil { + if err = client.peerPool.Add(mspID, p, StrategyGRPC(grpc.DefaultGrpcCheckPeriod)); err != nil { return nil, fmt.Errorf(`add peer to pool: %w`, err) } } } default: return nil, fmt.Errorf("unknown discovery type=%v. available: %v, %v", - coreImpl.config.Discovery.Type, + client.config.Discovery.Type, discovery.LocalConfigServiceDiscoveryType, discovery.GossipServiceDiscoveryType, ) } } - if coreImpl.orderer == nil && coreImpl.config != nil { - coreImpl.logger.Info("initializing orderer") - if len(coreImpl.config.Orderers) > 0 { - ordConn, err := grpc.ConnectionFromConfigs(coreImpl.ctx, coreImpl.logger, coreImpl.config.Orderers...) + if client.orderer == nil && client.config != nil { + client.logger.Info("initializing orderer") + if len(client.config.Orderers) > 0 { + ordConn, err := grpc.ConnectionFromConfigs(client.ctx, client.logger, client.config.Orderers...) if err != nil { return nil, fmt.Errorf(`initialize orderer connection: %w`, err) } - coreImpl.orderer, err = NewOrdererFromGRPC(ordConn) + client.orderer, err = NewOrdererFromGRPC(ordConn) if err != nil { return nil, fmt.Errorf(`initialize orderer: %w`, err) } } } - return coreImpl, nil + return client, nil +} + +func applyDefaults(c *Client) error { + var err error + if c.logger == nil { + c.logger = DefaultLogger + } + + if c.crypto == nil { + c.crypto, err = crypto.NewSuiteByConfig(c.config.Crypto, true) + if err != nil { + return fmt.Errorf(`crypto: %w`, err) + } + } + + return nil +} + +func (c *Client) initPeerPool() error { + c.logger.Info("initializing peer pool") + if c.config.MSP == nil { + return ErrEmptyMSPConfig + } + + c.peerPool = NewPeerPool(c.ctx, c.logger) + for _, mspConfig := range c.config.MSP { + for _, peerConfig := range mspConfig.Endorsers { + + p, err := NewPeer(c.ctx, peerConfig, c.defaultSigner, c.logger) + if err != nil { + return fmt.Errorf("initialize endorsers for MSP: %s: %w", mspConfig.Name, err) + } + + if err = c.peerPool.Add(mspConfig.Name, p, StrategyGRPC(grpc.DefaultGrpcCheckPeriod)); err != nil { + return fmt.Errorf(`add peer to pool: %w`, err) + } + } + } + + return nil } -func (c *core) CurrentIdentity() msp.SigningIdentity { - return c.identity +func (c *Client) CurrentIdentity() msp.SigningIdentity { + return c.defaultSigner } -func (c *core) CryptoSuite() api.CryptoSuite { - return c.cs +func (c *Client) CryptoSuite() crypto.Suite { + return c.crypto } -func (c *core) PeerPool() api.PeerPool { +func (c *Client) PeerPool() api.PeerPool { return c.peerPool } -func (c *core) FabricV2() bool { +func (c *Client) FabricV2() bool { return c.fabricV2 } -func (c *core) CurrentMspPeers() []api.Peer { +func (c *Client) CurrentMspPeers() []api.Peer { allPeers := c.peerPool.GetPeers() - if peers, ok := allPeers[c.identity.GetMSPIdentifier()]; !ok { + if peers, ok := allPeers[c.defaultSigner.GetMSPIdentifier()]; !ok { return []api.Peer{} } else { return peers } } -func (c *core) Channel(name string) api.Channel { +func (c *Client) Channel(name string) api.Channel { logger := c.logger.Named(`channel`).With(zap.String(`channel`, name)) c.channelMx.Lock() defer c.channelMx.Unlock() @@ -267,7 +291,7 @@ func (c *core) Channel(name string) api.Channel { ord = c.orderer } - ch = NewChannel(c.identity.GetMSPIdentifier(), name, c.peerPool, ord, c.discoveryProvider, c.identity, c.fabricV2, c.logger) + ch = NewChannel(c.defaultSigner.GetMSPIdentifier(), name, c.peerPool, ord, c.discoveryProvider, c.defaultSigner, c.fabricV2, c.logger) c.channels[name] = ch return ch } diff --git a/client/core_opts.go b/client/core_opts.go index e5b0c08c..1607c9f5 100644 --- a/client/core_opts.go +++ b/client/core_opts.go @@ -1,42 +1,56 @@ package client import ( - "context" "fmt" "io/ioutil" - "time" + "github.com/hyperledger/fabric/msp" "github.com/pkg/errors" "go.uber.org/zap" "gopkg.in/yaml.v2" "github.com/s7techlab/hlf-sdk-go/api" "github.com/s7techlab/hlf-sdk-go/api/config" + "github.com/s7techlab/hlf-sdk-go/client/grpc" "github.com/s7techlab/hlf-sdk-go/crypto" ) -// CoreOpt describes opt which will be applied to coreOptions -type CoreOpt func(c *core) error +// Opt describes opt which will be applied to coreOptions +type Opt func(c *Client) error -// WithContext allows passing custom context. Otherwise, context.Background is used -func WithContext(ctx context.Context) CoreOpt { - return func(c *core) error { - c.ctx = ctx +func WithSigner(signer msp.SigningIdentity) Opt { + return func(c *Client) error { + c.defaultSigner = signer + c.discoverySigner = signer return nil } } -// WithOrderer allows using custom instance of orderer in core -func WithOrderer(orderer api.Orderer) CoreOpt { - return func(c *core) error { +func WithDefaultSigner(signer msp.SigningIdentity) Opt { + return func(c *Client) error { + c.defaultSigner = signer + return nil + } +} + +func WithDiscoverySigner(signer msp.SigningIdentity) Opt { + return func(c *Client) error { + c.defaultSigner = signer + return nil + } +} + +// WithOrderer allows using custom instance of orderer in Client +func WithOrderer(orderer api.Orderer) Opt { + return func(c *Client) error { c.orderer = orderer return nil } } // WithConfigYaml allows passing path to YAML configuration file -func WithConfigYaml(configPath string) CoreOpt { - return func(c *core) error { +func WithConfigYaml(configPath string) Opt { + return func(c *Client) error { configBytes, err := ioutil.ReadFile(configPath) if err != nil { return errors.Wrap(err, `failed to read config file`) @@ -51,39 +65,39 @@ func WithConfigYaml(configPath string) CoreOpt { } } -// WithConfigRaw allows passing to core created config instance -func WithConfigRaw(config config.Config) CoreOpt { - return func(c *core) error { +// WithConfigRaw allows passing to Client created config instance +func WithConfigRaw(config config.Config) Opt { + return func(c *Client) error { c.config = &config return nil } } // WithLogger allows to pass custom copy of zap.Logger insteadof logger.DefaultLogger -func WithLogger(log *zap.Logger) CoreOpt { - return func(c *core) error { +func WithLogger(log *zap.Logger) Opt { + return func(c *Client) error { c.logger = log.Named(`hlf-sdk-go`) return nil } } // WithPeerPool allows adding custom peer pool -func WithPeerPool(pool api.PeerPool) CoreOpt { - return func(c *core) error { +func WithPeerPool(pool api.PeerPool) Opt { + return func(c *Client) error { c.peerPool = pool return nil } } -// WithPeers allows to init core with peers for specified mspID. -func WithPeers(mspID string, peers []config.ConnectionConfig) CoreOpt { - return func(c *core) error { +// WithPeers allows to init Client with peers for specified mspID. +func WithPeers(mspID string, peers []config.ConnectionConfig) Opt { + return func(c *Client) error { for _, p := range peers { - pp, err := NewPeer(c.ctx, p, c.identity, c.logger) + pp, err := NewPeer(c.ctx, p, c.defaultSigner, c.logger) if err != nil { return fmt.Errorf("create peer: %w", err) } - err = c.peerPool.Add(mspID, pp, api.StrategyGRPC(5*time.Second)) + err = c.peerPool.Add(mspID, pp, StrategyGRPC(grpc.DefaultGrpcCheckPeriod)) if err != nil { return fmt.Errorf("add peer to pool: %w", err) } @@ -92,21 +106,17 @@ func WithPeers(mspID string, peers []config.ConnectionConfig) CoreOpt { } } -// WithCrypto allows to init core crypto suite. -func WithCrypto(cc config.CryptoConfig) CoreOpt { - return func(c *core) error { - var err error - c.cs, err = crypto.GetSuite(cc.Type, cc.Options) - if err != nil { - return fmt.Errorf("get crypto suite: %w", err) - } +// WithCrypto allows to init Client crypto suite. +func WithCrypto(crypto crypto.Suite) Opt { + return func(c *Client) error { + c.crypto = crypto return nil } } -// WithFabricV2 toggles core to use fabric version 2. -func WithFabricV2(fabricV2 bool) CoreOpt { - return func(c *core) error { +// WithFabricV2 toggles Client to use fabric version 2. +func WithFabricV2(fabricV2 bool) Opt { + return func(c *Client) error { c.fabricV2 = fabricV2 return nil } diff --git a/client/core_public.go b/client/core_public.go index a6e5ea69..934ac407 100644 --- a/client/core_public.go +++ b/client/core_public.go @@ -15,7 +15,7 @@ import ( "github.com/s7techlab/hlf-sdk-go/client/tx" ) -func (c *core) Invoke( +func (c *Client) Invoke( ctx context.Context, channel string, ccName string, @@ -60,7 +60,7 @@ func (c *core) Invoke( return res, txID, nil } -func (c *core) Query( +func (c *Client) Query( ctx context.Context, channel string, chaincode string, @@ -80,7 +80,7 @@ func (c *core) Query( return peer.Query(ctx, channel, chaincode, args, identity, transient) } -func (c *core) Events( +func (c *Client) Events( ctx context.Context, channel string, chaincode string, @@ -103,7 +103,7 @@ func (c *core) Events( return peer.Events(ctx, channel, chaincode, identity, blockRange...) } -func (c *core) Blocks( +func (c *Client) Blocks( ctx context.Context, channel string, identity msp.SigningIdentity, diff --git a/client/crypto.go b/client/crypto.go deleted file mode 100644 index 719ce4bf..00000000 --- a/client/crypto.go +++ /dev/null @@ -1,12 +0,0 @@ -package client - -import ( - "github.com/s7techlab/hlf-sdk-go/api" - "github.com/s7techlab/hlf-sdk-go/crypto" - "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa" -) - -func DefaultCryptoSuite() api.CryptoSuite { - suite, _ := crypto.GetSuite(ecdsa.Module, ecdsa.DefaultOpts) - return suite -} diff --git a/client/deliver/seek_opt.go b/client/deliver/seek_opt.go index 7f51dbce..0ad009e6 100644 --- a/client/deliver/seek_opt.go +++ b/client/deliver/seek_opt.go @@ -17,7 +17,7 @@ type SeekOptConverter struct { Logger *zap.Logger } -func NewSeekOptConverter(channelInfo api.ChannelInfo, logger *zap.Logger) *SeekOptConverter { +func NewSeekOptConverter(channelInfo api.ChainInfoGetter, logger *zap.Logger) *SeekOptConverter { return &SeekOptConverter{ GetChannelHeight: func(ctx context.Context, channel string) (uint64, error) { channelInfo, err := channelInfo.GetChainInfo(ctx, channel) diff --git a/client/deliver/subs/tx.go b/client/deliver/subs/tx.go index 55d6ceb0..11951a92 100644 --- a/client/deliver/subs/tx.go +++ b/client/deliver/subs/tx.go @@ -6,7 +6,7 @@ import ( "github.com/hyperledger/fabric/protoutil" "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/util/txflags" + "github.com/s7techlab/hlf-sdk-go/proto/txflags" ) func NewTxSubscription(txID string) *TxSubscription { diff --git a/client/testing/block_deliverer_mock.go b/client/deliver/testing/block_deliverer_mock.go similarity index 100% rename from client/testing/block_deliverer_mock.go rename to client/deliver/testing/block_deliverer_mock.go diff --git a/discovery/discovery.go b/client/discovery/discovery.go similarity index 100% rename from discovery/discovery.go rename to client/discovery/discovery.go diff --git a/discovery/discovery_dto_models.go b/client/discovery/discovery_dto_models.go similarity index 100% rename from discovery/discovery_dto_models.go rename to client/discovery/discovery_dto_models.go diff --git a/discovery/endpoints_mapper.go b/client/discovery/endpoints_mapper.go similarity index 100% rename from discovery/endpoints_mapper.go rename to client/discovery/endpoints_mapper.go diff --git a/discovery/gossip.go b/client/discovery/gossip.go similarity index 100% rename from discovery/gossip.go rename to client/discovery/gossip.go diff --git a/discovery/gossip_discovery_service.go b/client/discovery/gossip_discovery_service.go similarity index 100% rename from discovery/gossip_discovery_service.go rename to client/discovery/gossip_discovery_service.go diff --git a/discovery/local.go b/client/discovery/local.go similarity index 100% rename from discovery/local.go rename to client/discovery/local.go diff --git a/client/errors.go b/client/errors.go new file mode 100644 index 00000000..7832317c --- /dev/null +++ b/client/errors.go @@ -0,0 +1,14 @@ +package client + +import ( + "github.com/s7techlab/hlf-sdk-go/client/errors" +) + +const ( + ErrEmptyConfig = errors.Error(`empty config`) + ErrInvalidPEMStructure = errors.Error(`invalid PEM structure`) + + ErrNoPeersForMSP = errors.Error(`no peers for MSP`) + ErrMSPNotFound = errors.Error(`MSP not found`) + ErrPeerNotReady = errors.Error(`peer not ready`) +) diff --git a/client/errors/error.go b/client/errors/error.go new file mode 100644 index 00000000..0360644e --- /dev/null +++ b/client/errors/error.go @@ -0,0 +1,30 @@ +package errors + +import ( + "fmt" +) + +// todo: remove + +type Error string + +func (e Error) Error() string { + return string(e) +} + +type ErrNoReadyPeers struct { + MspId string +} + +func (e ErrNoReadyPeers) Error() string { + return fmt.Sprintf("no ready peers for MspId: %s", e.MspId) +} + +type ErrUnexpectedHTTPStatus struct { + Status int + Body []byte +} + +func (err ErrUnexpectedHTTPStatus) Error() string { + return fmt.Sprintf("unexpected HTTP status code: %d with body %s", err.Status, string(err.Body)) +} diff --git a/client/errors/multi.go b/client/errors/multi.go new file mode 100644 index 00000000..bc3a4dd1 --- /dev/null +++ b/client/errors/multi.go @@ -0,0 +1,21 @@ +package errors + +import ( + "fmt" +) + +type MultiError struct { + Errors []error +} + +func (e *MultiError) Error() string { + errStr := "next errors occurred:\n" + for _, err := range e.Errors { + errStr += fmt.Sprintf("%s\n", err.Error()) + } + return errStr +} + +func (e *MultiError) Add(err error) { + e.Errors = append(e.Errors, err) +} diff --git a/client/grpc/grpc.go b/client/grpc/grpc.go index 6bf0fce7..88e50846 100644 --- a/client/grpc/grpc.go +++ b/client/grpc/grpc.go @@ -23,10 +23,12 @@ import ( "google.golang.org/grpc/resolver/manual" "github.com/s7techlab/hlf-sdk-go/api/config" - "github.com/s7techlab/hlf-sdk-go/opencensus/hlf" + "github.com/s7techlab/hlf-sdk-go/client/grpc/opencensus/hlf" ) var ( + DefaultGrpcCheckPeriod = 5 * time.Second + DefaultGRPCRetryConfig = &config.GRPCRetryConfig{ Max: 10, Timeout: config.Duration{Duration: 10 * time.Second}, diff --git a/opencensus/hlf/hlf.go b/client/grpc/opencensus/hlf/hlf.go similarity index 100% rename from opencensus/hlf/hlf.go rename to client/grpc/opencensus/hlf/hlf.go diff --git a/client/peer.go b/client/peer.go index 9cbf0b30..6dce33a9 100644 --- a/client/peer.go +++ b/client/peer.go @@ -16,10 +16,11 @@ import ( "github.com/s7techlab/hlf-sdk-go/api" "github.com/s7techlab/hlf-sdk-go/api/config" - "github.com/s7techlab/hlf-sdk-go/client/chaincode/system" + "github.com/s7techlab/hlf-sdk-go/client/channel" "github.com/s7techlab/hlf-sdk-go/client/deliver" grpcclient "github.com/s7techlab/hlf-sdk-go/client/grpc" "github.com/s7techlab/hlf-sdk-go/client/tx" + "github.com/s7techlab/hlf-sdk-go/service/systemcc/qscc" ) const ( @@ -202,11 +203,11 @@ func (p *peer) Events(ctx context.Context, channel string, chaincode string, ide } func (p *peer) GetChainInfo(ctx context.Context, channel string) (*common.BlockchainInfo, error) { - return system.NewQSCC(p).GetChainInfo(ctx, &system.GetChainInfoRequest{ChannelName: channel}) + return qscc.NewQSCC(p).GetChainInfo(ctx, &qscc.GetChainInfoRequest{ChannelName: channel}) } func (p *peer) GetChannels(ctx context.Context) (*fabricPeer.ChannelQueryResponse, error) { - return system.NewCSCCChannelsFetcher(p).GetChannels(ctx) + return channel.NewCSCCListGetter(p).GetChannels(ctx) } func (p *peer) Endorse(ctx context.Context, proposal *fabricPeer.SignedProposal) (*fabricPeer.ProposalResponse, error) { @@ -237,7 +238,7 @@ func (p *peer) DeliverClient(identity msp.SigningIdentity) (api.DeliverClient, e return deliver.New(fabricPeer.NewDeliverClient(p.conn), identity, p.tlsCertHash), nil } -// CurrentIdentity identity returns current signing identity used by core +// CurrentIdentity defaultSigner returns current signing defaultSigner used by Client func (p *peer) CurrentIdentity() msp.SigningIdentity { return p.identity } diff --git a/client/peer_pool.go b/client/peer_pool.go index d7dbb264..f0fd3bb2 100644 --- a/client/peer_pool.go +++ b/client/peer_pool.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "sync" + "time" "github.com/cloudflare/cfssl/log" peerproto "github.com/hyperledger/fabric-protos-go/peer" @@ -11,9 +12,11 @@ import ( "github.com/pkg/errors" "go.uber.org/zap" "google.golang.org/grpc/codes" + "google.golang.org/grpc/connectivity" "google.golang.org/grpc/status" "github.com/s7techlab/hlf-sdk-go/api" + clienterrors "github.com/s7techlab/hlf-sdk-go/client/errors" ) var ErrEndorsingMSPsRequired = errors.New(`endorsing MSPs required`) @@ -142,19 +145,19 @@ func (p *PeerPool) EndorseOnMSP(ctx context.Context, mspID string, proposal *pee p.storeMx.RUnlock() if !exists { - return nil, fmt.Errorf(`msp_id=%s: %w`, mspID, api.ErrMSPNotFound) + return nil, fmt.Errorf(`msp_id=%s: %w`, mspID, ErrMSPNotFound) } //check peers for MspId exists if len(peers) == 0 { - return nil, fmt.Errorf(`msp_id=%s: %w`, mspID, api.ErrNoPeersForMSP) + return nil, fmt.Errorf(`msp_id=%s: %w`, mspID, ErrNoPeersForMSP) } var lastError error for pos, poolPeer := range peers { if !poolPeer.ready { - p.logger.Debug(api.ErrPeerNotReady.Error(), zap.String(`uri`, poolPeer.peer.Uri())) + p.logger.Debug(ErrPeerNotReady.Error(), zap.String(`uri`, poolPeer.peer.Uri())) continue } @@ -197,7 +200,7 @@ func (p *PeerPool) EndorseOnMSP(ctx context.Context, mspID string, proposal *pee if lastError == nil { // all peers were not ready - return nil, api.ErrNoReadyPeers{MspId: mspID} + return nil, clienterrors.ErrNoReadyPeers{MspId: mspID} } return nil, lastError @@ -221,7 +224,7 @@ func (p *PeerPool) EndorseOnMSPs(ctx context.Context, mspIDs []string, proposal var errOccurred bool - mErr := new(api.MultiError) + mErr := new(clienterrors.MultiError) // collecting peer responses for i := 0; i < len(mspIDs); i++ { @@ -255,12 +258,12 @@ func (p *PeerPool) FirstReadyPeer(mspId string) (api.Peer, error) { p.storeMx.RUnlock() if !ok { - return nil, api.ErrMSPNotFound + return nil, ErrMSPNotFound } //check peers for MspId exists if len(peers) == 0 { - log.Error(api.ErrNoPeersForMSP.Error(), zap.String(`mspId`, mspId)) + log.Error(ErrNoPeersForMSP.Error(), zap.String(`mspId`, mspId)) } for _, poolPeer := range peers { @@ -269,9 +272,27 @@ func (p *PeerPool) FirstReadyPeer(mspId string) (api.Peer, error) { } } - return nil, api.ErrNoReadyPeers{MspId: mspId} + return nil, clienterrors.ErrNoReadyPeers{MspId: mspId} } func (p *PeerPool) Close() error { return nil } + +func StrategyGRPC(d time.Duration) api.PeerPoolCheckStrategy { + return func(ctx context.Context, peer api.Peer, alive chan bool) { + t := time.NewTicker(d) + for { + select { + case <-ctx.Done(): + return + case <-t.C: + if peer.Conn().GetState() == connectivity.Ready { + alive <- true + } else { + alive <- false + } + } + } + } +} diff --git a/crypto/crypto.go b/crypto/crypto.go deleted file mode 100644 index 9ce346ac..00000000 --- a/crypto/crypto.go +++ /dev/null @@ -1,43 +0,0 @@ -package crypto - -import ( - "crypto/rand" - "sync" - - "github.com/pkg/errors" - - "github.com/s7techlab/hlf-sdk-go/api" - "github.com/s7techlab/hlf-sdk-go/api/config" -) - -var ( - suiteRegistry = make(map[string]api.CryptoSuite) - suiteMx sync.Mutex - errUnknownSuite = errors.New(`unknown crypto suite (forgotten import ?)`) -) - -// Register must be called in init function in suite package (ex. see ecdsa package) -func Register(name string, cs api.CryptoSuite) { - suiteMx.Lock() - defer suiteMx.Unlock() - suiteRegistry[name] = cs -} - -func GetSuite(name string, opts config.CryptoSuiteOpts) (api.CryptoSuite, error) { - suiteMx.Lock() - defer suiteMx.Unlock() - if suite, ok := suiteRegistry[name]; ok { - return suite.Initialize(opts) - } - return nil, errUnknownSuite -} - -// RandomBytes returns slice of random bytes of presented size -func RandomBytes(length int) ([]byte, error) { - b := make([]byte, length) - _, err := rand.Read(b) - if err != nil { - return nil, err - } - return b, nil -} diff --git a/crypto/ecdsa/ecdsa.go b/crypto/ecdsa/ecdsa.go index 8ea104ab..02214736 100644 --- a/crypto/ecdsa/ecdsa.go +++ b/crypto/ecdsa/ecdsa.go @@ -8,16 +8,13 @@ import ( "crypto/sha512" "crypto/x509" "encoding/asn1" + "fmt" "hash" "math/big" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" "golang.org/x/crypto/sha3" - - "github.com/s7techlab/hlf-sdk-go/api" - "github.com/s7techlab/hlf-sdk-go/api/config" - "github.com/s7techlab/hlf-sdk-go/crypto" ) const ( @@ -37,19 +34,8 @@ const ( ) var ( - DefaultOpts = config.CryptoSuiteOpts{`curve`: `P256`, `signatureAlgorithm`: `SHA256`, `hash`: `SHA2-256`} - - DefaultConfig = config.CryptoConfig{ - Type: Module, - Options: DefaultOpts, - } -) - -func init() { - crypto.Register(Module, &ecdsaSuite{}) -} + DefaultOpts = map[string]string{`curve`: `P256`, `signatureAlgorithm`: `SHA256`, `hash`: `SHA2-256`} -var ( // precomputed curves half order values for efficiency ecCurveHalfOrders = map[elliptic.Curve]*big.Int{ elliptic.P224(): new(big.Int).Rsh(elliptic.P224().Params().N, 1), @@ -67,13 +53,34 @@ var ( errInvalidSignature = errors.New(`invalid ECDSA signature`) ) -type ecdsaOpts struct { +func New(opts map[string]string) (*Suite, error) { + var options Opts + var err error + + if err = mapstructure.Decode(opts, &options); err != nil { + return nil, fmt.Errorf(`decode ECDSA options: %w`, err) + } + + cs := &Suite{} + if cs.curve, err = getCurve(options.Curve); err != nil { + return nil, fmt.Errorf(`elliptic curve: %w`, err) + } + if cs.hasher, err = getHasher(options.Hash); err != nil { + return nil, fmt.Errorf(`hasher: %w`, err) + } + if cs.sigAlgorithm, err = getSignatureAlgorithm(options.SignatureAlgorithm); err != nil { + return nil, errors.Wrap(err, `failed to get signature algorithm`) + } + return cs, nil +} + +type Opts struct { Curve string SignatureAlgorithm string Hash string } -type ecdsaSuite struct { +type Suite struct { curve elliptic.Curve hasher func() hash.Hash sigAlgorithm x509.SignatureAlgorithm @@ -82,7 +89,7 @@ type ecdsaSignature struct { R, S *big.Int } -func (c *ecdsaSuite) Sign(msg []byte, key interface{}) ([]byte, error) { +func (c *Suite) Sign(msg []byte, key interface{}) ([]byte, error) { if privateKey, ok := key.(*ecdsa.PrivateKey); !ok { return nil, errInvalidPrivateKey } else { @@ -102,7 +109,7 @@ func (c *ecdsaSuite) Sign(msg []byte, key interface{}) ([]byte, error) { } } -func (c *ecdsaSuite) Verify(publicKey interface{}, msg, sig []byte) error { +func (c *Suite) Verify(publicKey interface{}, msg, sig []byte) error { if key, ok := publicKey.(*ecdsa.PublicKey); !ok { return errInvalidPublicKey } else { @@ -117,13 +124,13 @@ func (c *ecdsaSuite) Verify(publicKey interface{}, msg, sig []byte) error { return nil } -func (c *ecdsaSuite) Hash(data []byte) []byte { +func (c *Suite) Hash(data []byte) []byte { h := c.hasher() h.Write(data) return h.Sum(nil) } -func (c *ecdsaSuite) NewPrivateKey() (interface{}, error) { +func (c *Suite) NewPrivateKey() (interface{}, error) { if key, err := ecdsa.GenerateKey(c.curve, rand.Reader); err != nil { return nil, errors.Wrap(err, `failed to generate ECDSA private key`) } else { @@ -131,31 +138,10 @@ func (c *ecdsaSuite) NewPrivateKey() (interface{}, error) { } } -func (c *ecdsaSuite) GetSignatureAlgorithm() x509.SignatureAlgorithm { +func (c *Suite) GetSignatureAlgorithm() x509.SignatureAlgorithm { return c.sigAlgorithm } -func (c *ecdsaSuite) Initialize(opts config.CryptoSuiteOpts) (api.CryptoSuite, error) { - var options ecdsaOpts - var err error - - if err = mapstructure.Decode(opts, &options); err != nil { - return nil, errors.Wrap(err, `failed to decode ECDSA options`) - } - - cs := &ecdsaSuite{} - if cs.curve, err = getCurve(options.Curve); err != nil { - return nil, errors.Wrap(err, `failed to get elliptic curve`) - } - if cs.hasher, err = getHasher(options.Hash); err != nil { - return nil, errors.Wrap(err, `failed to get hasher`) - } - if cs.sigAlgorithm, err = getSignatureAlgorithm(options.SignatureAlgorithm); err != nil { - return nil, errors.Wrap(err, `failed to get signature algorithm`) - } - return cs, nil -} - func getCurve(curveType string) (elliptic.Curve, error) { switch curveType { case curveP256: diff --git a/api/crypto.go b/crypto/interface.go similarity index 65% rename from api/crypto.go rename to crypto/interface.go index 7cd0cba8..4f6f4be4 100644 --- a/api/crypto.go +++ b/crypto/interface.go @@ -1,13 +1,11 @@ -package api +package crypto import ( "crypto/x509" - - "github.com/s7techlab/hlf-sdk-go/api/config" ) -// CryptoSuite describes common cryptographic operations -type CryptoSuite interface { +// Suite describes common cryptographic operations +type Suite interface { // Sign is used for signing message by presented private key Sign(msg []byte, key interface{}) ([]byte, error) // Verify is used for verifying signature for presented message and public key @@ -18,6 +16,4 @@ type CryptoSuite interface { NewPrivateKey() (interface{}, error) // GetSignatureAlgorithm returns signature algorithm GetSignatureAlgorithm() x509.SignatureAlgorithm - // Initialize is used for suite instantiation using presented options - Initialize(opts config.CryptoSuiteOpts) (CryptoSuite, error) } diff --git a/crypto/random.go b/crypto/random.go new file mode 100644 index 00000000..91b91dee --- /dev/null +++ b/crypto/random.go @@ -0,0 +1,15 @@ +package crypto + +import ( + "crypto/rand" +) + +// RandomBytes returns slice of random bytes of presented size +func RandomBytes(length int) ([]byte, error) { + b := make([]byte, length) + _, err := rand.Read(b) + if err != nil { + return nil, err + } + return b, nil +} diff --git a/crypto/suite.go b/crypto/suite.go new file mode 100644 index 00000000..7f77b475 --- /dev/null +++ b/crypto/suite.go @@ -0,0 +1,46 @@ +package crypto + +import ( + "github.com/pkg/errors" + + "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa" +) + +type Config struct { + Type string `yaml:"type"` + Options map[string]string `yaml:"options"` +} + +var ( + ErrUnknown = errors.New(`unknown`) + ErrTypeRequired = errors.New(`type required`) + + DefaultConfig = &Config{ + Type: ecdsa.Module, + Options: ecdsa.DefaultOpts, + } + + DefaultSuite, _ = NewSuiteByConfig(DefaultConfig, false) +) + +func NewSuite(name string, opts map[string]string) (Suite, error) { + switch name { + case ecdsa.Module: + return ecdsa.New(opts) + + default: + return nil, ErrUnknown + } +} + +func NewSuiteByConfig(config *Config, useDefault bool) (Suite, error) { + if useDefault && config == nil { + config = DefaultConfig + } + + if config.Type == `` { + return nil, ErrTypeRequired + } + + return NewSuite(config.Type, config.Options) +} diff --git a/examples/caclient/main.go b/examples/caclient/main.go index ced49ef9..cb9f05ee 100644 --- a/examples/caclient/main.go +++ b/examples/caclient/main.go @@ -11,8 +11,9 @@ import ( "os" "time" - apiCa "github.com/s7techlab/hlf-sdk-go/api/ca" - "github.com/s7techlab/hlf-sdk-go/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca" + "github.com/s7techlab/hlf-sdk-go/client/ca/http" + _ "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa" "github.com/s7techlab/hlf-sdk-go/identity" ) @@ -38,27 +39,26 @@ func main() { log.Fatalln(`KEY_PATH env must be defined`) } - id, err := identity.NewMSPIdentity(mspId, certPath, keyPath) + signer, err := identity.NewSigningFromFile(mspId, certPath, keyPath) if err != nil { log.Fatalln(`failed to load identity:`, err) } - core, err := ca.NewCore(mspId, id, ca.WithYamlConfig(configPath)) + caClient, err := http.New(signer, http.WithYamlConfig(configPath)) if err != nil { log.Fatalln(`failed to load CA core:`, err) } - log.Println(core.CertificateList(context.Background(), apiCa.WithEnrollId(`admin`))) - log.Println(core.AffiliationList(context.Background())) + log.Println(caClient.CertificateList(context.Background(), ca.WithEnrollId(`admin`))) + log.Println(caClient.AffiliationList(context.Background())) //log.Println(core.AffiliationCreate(context.Background(), `test`)) - log.Fatalln(``) name := `yarrrr` + RandomString(2) ctx := context.Background() - log.Println(core.Register(ctx, apiCa.RegistrationRequest{Name: name, Secret: `123321`})) + log.Println(caClient.Register(ctx, ca.RegistrationRequest{Name: name, Secret: `123321`})) - log.Println(core.Enroll(ctx, name, `123321`, &x509.CertificateRequest{ + log.Println(caClient.Enroll(ctx, name, `123321`, &x509.CertificateRequest{ Subject: struct { Country, Organization, OrganizationalUnit []string Locality, Province []string diff --git a/examples/cc_call/cc_call.go b/examples/cc_call/cc_call.go index 01bcf710..a8f1fb01 100644 --- a/examples/cc_call/cc_call.go +++ b/examples/cc_call/cc_call.go @@ -9,9 +9,9 @@ import ( ) func main() { - mspId := "Org1MSP" - id, err := identity.NewMSPIdentity( - mspId, + + signer, err := identity.NewSigningFromFile( + "Org1MSP", // PROVIDE YOUR OWN PATHS "../../../../github.com/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/cert.pem", "../../../../github.com/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/02a48982a93c9a1fbf7e9702f82d14578aef9662362346ecfe8b3cde50da6799_sk", @@ -20,7 +20,8 @@ func main() { log.Fatalf("connection.invoke: %v", err) } - core, err := client.New(id, client.WithConfigYaml("./cfg.yaml")) + core, err := client.New(context.Background(), + client.WithSigner(signer), client.WithConfigYaml("./cfg.yaml")) if err != nil { log.Fatalf("create client core: %v", err) } diff --git a/examples/channel_info/blockchanin_info.go b/examples/channel_info/blockchanin_info.go index 1e328c83..886f31e5 100644 --- a/examples/channel_info/blockchanin_info.go +++ b/examples/channel_info/blockchanin_info.go @@ -9,10 +9,11 @@ import ( "github.com/golang/protobuf/ptypes/empty" "github.com/s7techlab/hlf-sdk-go/client" - "github.com/s7techlab/hlf-sdk-go/client/chaincode/system" _ "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa" "github.com/s7techlab/hlf-sdk-go/identity" "github.com/s7techlab/hlf-sdk-go/proto" + "github.com/s7techlab/hlf-sdk-go/service/systemcc/cscc" + "github.com/s7techlab/hlf-sdk-go/service/systemcc/qscc" ) func main() { @@ -20,14 +21,15 @@ func main() { mspId := "Org1MSP" configPath := "./cfg.yaml" - id, err := identity.FromCertKeyPath( + signer, err := identity.NewSigningFromFile( mspId, // PROVIDE YOUR OWN PATHS "../../../../github.com/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/cert.pem", "../../../../github.com/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/02a48982a93c9a1fbf7e9702f82d14578aef9662362346ecfe8b3cde50da6799_sk", ) - core, err := client.New(id, client.WithConfigYaml(configPath)) + core, err := client.New(context.Background(), + client.WithDefaultSigner(signer), client.WithConfigYaml(configPath)) if err != nil { log.Fatalln(`unable to initialize core:`, err) } @@ -35,7 +37,7 @@ func main() { ctx := context.Background() // get chainInfo for all joined channels - chInfo, err := system.NewCSCC(core, proto.FabricV2).GetChannels(ctx, &empty.Empty{}) + chInfo, err := cscc.NewCSCC(core, proto.FabricV2).GetChannels(ctx, &empty.Empty{}) if err != nil { log.Fatalln(`failed to fetch channel list:`, err) } @@ -43,7 +45,7 @@ func main() { fmt.Printf("Fetching info about channel: %s\n", ch.ChannelId) // get blockchain info about channel - blockchainInfo, err := system.NewQSCC(core).GetChainInfo(ctx, &system.GetChainInfoRequest{ChannelName: ch.ChannelId}) + blockchainInfo, err := qscc.NewQSCC(core).GetChainInfo(ctx, &qscc.GetChainInfoRequest{ChannelName: ch.ChannelId}) if err != nil { fmt.Println(`Failed to fetch info about channel:`, err) continue diff --git a/examples/discovery_and_transaction/main.go b/examples/discovery_and_transaction/main.go index ea4d2fe3..d65f67f4 100644 --- a/examples/discovery_and_transaction/main.go +++ b/examples/discovery_and_transaction/main.go @@ -9,15 +9,16 @@ import ( ) func main() { - mspId := "Org1MSP" + // TODO change paths to YOUR OWN - id, err := identity.NewMSPIdentity( - mspId, + signer, err := identity.NewSigningFromFile( + "Org1MSP", "/Users/bogatyr285/work/go/src/github.com/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/cert.pem", "/Users/bogatyr285/work/go/src/github.com/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/02a48982a93c9a1fbf7e9702f82d14578aef9662362346ecfe8b3cde50da6799_sk", ) - core, err := client.New(id, client.WithConfigYaml("./cfg.yaml")) + core, err := client.New(context.Background(), + client.WithDefaultSigner(signer), client.WithConfigYaml("./cfg.yaml")) if err != nil { log.Fatalf("create client core: %v", err) } diff --git a/examples/event-listener/main.go b/examples/event-listener/main.go index 5d407b9e..fe770227 100644 --- a/examples/event-listener/main.go +++ b/examples/event-listener/main.go @@ -42,7 +42,7 @@ func main() { log.Fatalln(`CHAINCODE env must be defined`) } - id, err := identity.SignerFromMSPPath(mspId, mspPath) + signer, err := identity.NewSigningFromMSPPath(mspId, mspPath) if err != nil { log.Fatalln(`Failed to load identity:`, err) @@ -50,7 +50,8 @@ func main() { l, _ := zap.NewProduction() - core, err := client.New(id, client.WithConfigYaml(configPath), client.WithLogger(l)) + core, err := client.New(context.Background(), + client.WithDefaultSigner(signer), client.WithConfigYaml(configPath), client.WithLogger(l)) if err != nil { log.Fatalln(`unable to initialize core:`, err) } diff --git a/go.mod b/go.mod index cf929c61..7582a4cc 100644 --- a/go.mod +++ b/go.mod @@ -1,43 +1,191 @@ module github.com/s7techlab/hlf-sdk-go -go 1.16 +go 1.18 require ( - github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect - github.com/Shopify/sarama v1.22.1 // indirect github.com/cloudflare/cfssl v0.0.0-20190510060611-9c027c93ba9e - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/mock v1.3.1 // indirect - github.com/golang/protobuf v1.4.3 + github.com/envoyproxy/protoc-gen-validate v1.0.2 + github.com/golang/protobuf v1.5.3 github.com/google/certificate-transparency-go v1.1.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 - github.com/grpc-ecosystem/grpc-gateway v1.11.1 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/hashicorp/vault/api v1.10.0 github.com/hyperledger/fabric v1.4.0-rc1.0.20200930182727-344fda602252 github.com/hyperledger/fabric-chaincode-go v0.0.0-20201119163726-f8ef75b17719 github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354 - github.com/mattn/go-colorable v0.1.2 // indirect - github.com/mitchellh/mapstructure v1.2.2 + github.com/mitchellh/mapstructure v1.5.0 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 - github.com/onsi/ginkgo v1.8.0 - github.com/onsi/gomega v1.9.0 - github.com/pelletier/go-toml v1.4.0 // indirect - github.com/pkg/errors v0.8.1 - github.com/spf13/afero v1.2.2 // indirect + github.com/onsi/ginkgo v1.14.0 + github.com/onsi/gomega v1.10.1 + github.com/pkg/errors v0.9.1 + github.com/stretchr/testify v1.7.1-0.20210116013205-6990a05d54c2 + go.opencensus.io v0.22.0 + go.uber.org/zap v1.14.1 + golang.org/x/crypto v0.10.0 + golang.org/x/sync v0.4.0 + google.golang.org/genproto v0.0.0-20210122163508-8081c04a3579 + google.golang.org/grpc v1.33.1 + google.golang.org/protobuf v1.30.0 + gopkg.in/yaml.v2 v2.3.0 +) + +require ( + github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/DataDog/zstd v1.4.0 // indirect + github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect + github.com/Microsoft/go-winio v0.4.12 // indirect + github.com/Microsoft/hcsshim v0.8.6 // indirect + github.com/OpenPeeDeeP/depguard v1.0.0 // indirect + github.com/Shopify/sarama v1.22.1 // indirect + github.com/VictoriaMetrics/fastcache v1.5.7 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/cenkalti/backoff/v3 v3.0.0 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect + github.com/coreos/go-semver v0.3.0 // indirect + github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a // indirect + github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/docker v17.12.0-ce-rc1.0.20190628135806-70f67c6240bb+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.4.0 // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/eapache/go-resiliency v1.2.0 // indirect + github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect + github.com/eapache/queue v1.1.0 // indirect + github.com/fatih/color v1.7.0 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/fsouza/go-dockerclient v1.4.1 // indirect + github.com/go-critic/go-critic v0.3.5-0.20190526074819-1df300866540 // indirect + github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-lintpack/lintpack v0.5.2 // indirect + github.com/go-toolsmith/astcast v1.0.0 // indirect + github.com/go-toolsmith/astcopy v1.0.0 // indirect + github.com/go-toolsmith/astequal v1.0.0 // indirect + github.com/go-toolsmith/astfmt v1.0.0 // indirect + github.com/go-toolsmith/astp v1.0.0 // indirect + github.com/go-toolsmith/strparse v1.0.0 // indirect + github.com/go-toolsmith/typep v1.0.0 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect + github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect + github.com/golang/mock v1.3.1 // indirect + github.com/golang/snappy v0.0.2 // indirect + github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect + github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect + github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect + github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 // indirect + github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c // indirect + github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect + github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee // indirect + github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98 // indirect + github.com/golangci/golangci-lint v1.17.2-0.20190910081718-bad04bb7378f // indirect + github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547 // indirect + github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc // indirect + github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217 // indirect + github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect + github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 // indirect + github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect + github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 // indirect + github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect + github.com/google/btree v1.0.0 // indirect + github.com/google/monologue v0.0.0-20190606152607-4b11a32b5934 // indirect + github.com/google/uuid v1.0.0 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 // indirect + github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.6.6 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/go-version v1.2.0 // indirect + github.com/hashicorp/golang-lru v0.5.1 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a // indirect + github.com/hyperledger/fabric-lib-go v1.0.0 // indirect + github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jonboulle/clockwork v0.1.0 // indirect + github.com/json-iterator/go v1.1.7 // indirect + github.com/kisielk/gotool v1.0.0 // indirect + github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect + github.com/magiconair/properties v1.8.1 // indirect + github.com/mattn/go-colorable v0.1.6 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-runewidth v0.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/miekg/pkcs11 v1.0.3 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663 // indirect + github.com/nxadm/tail v1.4.4 // indirect + github.com/olekukonko/tablewriter v0.0.1 // indirect + github.com/opencontainers/go-digest v1.0.0-rc1 // indirect + github.com/opencontainers/image-spec v1.0.1 // indirect + github.com/opencontainers/runc v1.0.0-rc8 // indirect + github.com/pelletier/go-toml v1.8.0 // indirect + github.com/pierrec/lz4 v2.5.0+incompatible // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.1.0 // indirect + github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect + github.com/prometheus/common v0.6.0 // indirect + github.com/prometheus/procfs v0.0.3 // indirect + github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/sirupsen/logrus v1.4.2 // indirect + github.com/soheilhy/cmux v0.1.4 // indirect + github.com/sourcegraph/go-diff v0.5.1 // indirect + github.com/spf13/afero v1.3.3 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cobra v0.0.5 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.4.0 // indirect github.com/stretchr/objx v0.2.0 // indirect - github.com/stretchr/testify v1.5.1 github.com/sykesm/zap-logfmt v0.0.3 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect github.com/tedsuo/ifrit v0.0.0-20191009134036-9a97d0632f00 // indirect - go.opencensus.io v0.22.0 - go.uber.org/zap v1.14.1 - golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect - golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 - golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect - golang.org/x/text v0.3.5 // indirect - google.golang.org/genproto v0.0.0-20210122163508-8081c04a3579 - google.golang.org/grpc v1.29.1 - google.golang.org/protobuf v1.25.0 + github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec // indirect + github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966 // indirect + github.com/ultraware/funlen v0.0.1 // indirect + github.com/urfave/cli v1.20.0 // indirect + github.com/willf/bitset v1.1.10 // indirect + github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect + go.etcd.io/bbolt v1.3.3 // indirect + go.etcd.io/etcd v3.3.13+incompatible // indirect + go.uber.org/atomic v1.6.0 // indirect + go.uber.org/multierr v1.5.0 // indirect + golang.org/x/mod v0.11.0 // indirect + golang.org/x/net v0.11.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/text v0.10.0 // indirect + golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect + golang.org/x/tools v0.10.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v2 v2.2.8 + gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect + mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect + mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34 // indirect + sigs.k8s.io/yaml v1.1.0 // indirect + sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 // indirect +) + +replace ( + github.com/golang/protobuf => github.com/golang/protobuf v1.4.1 + github.com/hyperledger/fabric => github.com/hyperledger/fabric v1.4.0-rc1.0.20210909064358-99553020d277 + go.etcd.io/etcd => go.etcd.io/etcd v0.5.0-alpha.5.0.20211015134708-72d3e382e73c + google.golang.org/grpc => google.golang.org/grpc v1.29.0 ) diff --git a/go.sum b/go.sum index 96dd44ed..53462f27 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= code.cloudfoundry.org/clock v1.0.0/go.mod h1:QD9Lzhd/ux6eNQVUDVRJX/RKTigpewimNYBi7ivZKY8= @@ -34,7 +33,9 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -42,23 +43,23 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c= +github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cfssl v0.0.0-20190510060611-9c027c93ba9e h1:ZtyhUG4s94BMUCdgvRZySr/AXYL5CDcjxhIV/83xJog= github.com/cloudflare/cfssl v0.0.0-20190510060611-9c027c93ba9e/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc h1:TP+534wVlf61smEIq1nwLLAjQVEK2EADoW3CX9AuT+8= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -73,10 +74,10 @@ github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= @@ -98,23 +99,25 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8 github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/frankban/quicktest v1.9.0 h1:jfEA+Psfr/pHsRJYPpHiNu7PGJnGctNxvTaM3K1EyXk= github.com/frankban/quicktest v1.9.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsouza/go-dockerclient v1.4.1 h1:W7wuJ3IB48WYZv/UBk9dCTIb9oX805+L9KIm65HcUYs= github.com/fsouza/go-dockerclient v1.4.1/go.mod h1:PUNHxbowDqRXfRgZqMz1OeGtbWC6VKyZvJ99hDjB0qs= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-critic/go-critic v0.3.5-0.20190526074819-1df300866540 h1:djv/qAomOVj8voCHt0M0OYwR/4vfDq1zNKSPKjJCexs= github.com/go-critic/go-critic v0.3.5-0.20190526074819-1df300866540/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA= +github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= +github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-lintpack/lintpack v0.5.2 h1:DI5mA3+eKdWeJ40nU4d6Wc26qmdG8RCi/btYq0TuRN0= github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= @@ -123,6 +126,7 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= github.com/go-toolsmith/astcopy v1.0.0 h1:OMgl1b1MEpjFQ1m5ztEO06rz5CUd3oBv9RF7+DyvdG8= @@ -146,11 +150,12 @@ github.com/go-toolsmith/typep v1.0.0 h1:zKymWyA1TRYvqYrYDrfEMZULyrhcnGY3x7LDKU2X github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -161,19 +166,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -211,7 +205,6 @@ github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1 github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= -github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -219,10 +212,10 @@ github.com/google/certificate-transparency-go v1.1.0 h1:10MlrYzh5wfkToxWI4yJzffs github.com/google/certificate-transparency-go v1.1.0/go.mod h1:i+Q7XY+ArBveOUT36jiHGfuSK1fHICIg6sUkRxPAbCs= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/monologue v0.0.0-20190606152607-4b11a32b5934 h1:0+3qDY6030dpAiEdmBqIsz3lg2SgXAvPEEq2sjm5UBk= @@ -231,24 +224,48 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/trillian v1.2.2-0.20190612132142-05461f4df60a/go.mod h1:YPmUVn5NGwgnDUgqlVyFGMTgaWlnSvH7W5p+NdOG8UA= github.com/google/trillian-examples v0.0.0-20190603134952-4e75ba15216c/go.mod h1:WgL3XZ3pA8/9cm7yxqWrZE6iZkESB2ItGxy5Fo6k2lk= +github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 h1:JVnpOZS+qxli+rgVl98ILOXVNbW+kb5wcxeGx8ShUIw= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg= github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.4.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.11.1 h1:/dBYI+n4xIL+Y9SKXQrjlKTmJJDwCSlNLRwZ5nBhIek= -github.com/grpc-ecosystem/grpc-gateway v1.11.1/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM= +github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -257,10 +274,11 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hashicorp/vault/api v1.10.0 h1:/US7sIjWN6Imp4o/Rj1Ce2Nr5bki/AXi9vAW3p2tOJQ= +github.com/hashicorp/vault/api v1.10.0/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hyperledger/fabric v1.4.0-rc1.0.20200930182727-344fda602252 h1:lQq/yygTbHWPfjFZ1VgINd1TJY7rOJ/zglcl9nE/s9Q= -github.com/hyperledger/fabric v1.4.0-rc1.0.20200930182727-344fda602252/go.mod h1:+kicKDn5xa88tOpOY/o6/7iB/RD7oOs2INzwVg2ARmM= +github.com/hyperledger/fabric v1.4.0-rc1.0.20210909064358-99553020d277 h1:GbUjXPZENyTO0Xy2szbMmDhvb8HZMLlHKKKrNMit/xI= +github.com/hyperledger/fabric v1.4.0-rc1.0.20210909064358-99553020d277/go.mod h1:RTJcHdhOrpiAqZLNkpVSoz/yaxW/Wiy7sCw/zYO4LjY= github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a h1:HgdNn3UYz8PdcZrLEk0IsSU4LRHp7yY2rgjIKcSiJaA= github.com/hyperledger/fabric-amcl v0.0.0-20200128223036-d1aa2665426a/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE= github.com/hyperledger/fabric-chaincode-go v0.0.0-20200128192331-2d899240a7ed/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc= @@ -272,7 +290,6 @@ github.com/hyperledger/fabric-lib-go v1.0.0 h1:UL1w7c9LvHZUSkIvHTDGklxFv2kTeva1Q github.com/hyperledger/fabric-lib-go v1.0.0/go.mod h1:H362nMlunurmHwkYqR5uHL2UDWbQdbfz74n8kbCFsqc= github.com/hyperledger/fabric-protos-go v0.0.0-20190919234611-2a87503ac7c9/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= -github.com/hyperledger/fabric-protos-go v0.0.0-20200506201313-25f6564b9ac4/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354 h1:6vLLEpvDbSlmUJFjg1hB5YMBpI+WgKguztlONcAFBoY= github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd h1:anPrsicrIi2ColgWTVPk+TrN42hJIWlfPHSBP9S0ZkM= @@ -300,11 +317,11 @@ github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgo github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.0.0/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -317,31 +334,34 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/matttproud/golang_protobuf_extensions v1.0.0/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3 h1:iMwmD7I5225wv84WxIG/bmxz9AXjWvTWIbM/TYHvWtw= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= -github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -355,20 +375,23 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/nbutton23/zxcvbn-go v0.0.0-20160627004424-a22cb81b2ecd/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663 h1:Ri1EhipkbhWsffPJ3IPlrb4SkTOPa2PfRXp3jchBczw= github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= @@ -379,36 +402,35 @@ github.com/opencontainers/runc v1.0.0-rc8/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rm github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= -github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= +github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.5.0+incompatible h1:MbdIZ43A//duwOjQqK3nP+up+65yraNFyX3Vp6Rwues= github.com/pierrec/lz4 v2.5.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v0.9.4/go.mod h1:oCXIBxdI62A4cR6aTRJCgetEjecSIYzOEaeAn4iYEpM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/procfs v0.0.0-20180612222113-7d6f385de8be/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -419,11 +441,15 @@ github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1: github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= @@ -443,8 +469,9 @@ github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34c github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.0/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.3.1/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= @@ -461,8 +488,8 @@ github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v0.0.0-20150908122457-1967d93db724/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/viper v1.0.2/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= +github.com/spf13/viper v1.1.1/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= @@ -473,28 +500,28 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1-0.20210116013205-6990a05d54c2 h1:oevpAKCW58ZYJe1hqfgLqg+1zXmYrQ9xf7HLUdfS+qM= +github.com/stretchr/testify v1.7.1-0.20210116013205-6990a05d54c2/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/sykesm/zap-logfmt v0.0.2/go.mod h1:TerDJT124HaO8UTpZ2wJCipJRAKQ9XONM1mzUabIh6M= github.com/sykesm/zap-logfmt v0.0.3 h1:3Wrhf7+I9JEUD8B6KPtDAr9j2jrS0/EPLy7GCE1t/+U= github.com/sykesm/zap-logfmt v0.0.3/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA= -github.com/syndtr/goleveldb v1.0.1-0.20190625010220-02440ea7a285 h1:uSDYjYejelKyceA6DiCsngFof9jAyeaSyX9XC5a1a7Q= -github.com/syndtr/goleveldb v1.0.1-0.20190625010220-02440ea7a285/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= +github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0= github.com/tedsuo/ifrit v0.0.0-20191009134036-9a97d0632f00 h1:mujcChM89zOHwgZBBNr5WZ77mBXP1yR+gLThGCYZgAg= github.com/tedsuo/ifrit v0.0.0-20191009134036-9a97d0632f00/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0= github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec h1:AmoEvWAO3nDx1MEcMzPh+GzOOIA5Znpv6++c7bePPY0= github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966 h1:j6JEOq5QWFker+d7mFQYOhjTZonQ7YkLTHm56dbn+yM= +github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ultraware/funlen v0.0.1 h1:UeC9tpM4wNWzUJfan8z9sFE4QCzjjzlCZmuJN+aOkH0= github.com/ultraware/funlen v0.0.1/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/urfave/cli v1.18.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= @@ -505,18 +532,16 @@ github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.1-etcd.7/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.2 h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/etcd v0.5.0-alpha.5.0.20181228115726-23731bf9ba55/go.mod h1:weASp41xM3dk0YHg1s/W8ecdGP5G4teSTMBPpYAaUgA= -go.etcd.io/etcd v3.3.13+incompatible h1:jCejD5EMnlGxFvcGRyEV4VGlENZc7oPQX6o0t7n3xbw= -go.etcd.io/etcd v3.3.13+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI= +go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/etcd v0.5.0-alpha.5.0.20211015134708-72d3e382e73c h1:AntSYpWALzcqs1D6ZpSPIxhpob2hFnwAfEmfr9tEhSg= +go.etcd.io/etcd v0.5.0-alpha.5.0.20211015134708-72d3e382e73c/go.mod h1:t1cqOhpjW3SEYhH7Wzlg51xzyIM2c5HMB9kvPO5k4gY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -536,32 +561,32 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -576,30 +601,34 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -609,28 +638,37 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200819091447-39769834ee22/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20170915040203-e531a2a1c15f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190121143147-24cd39ecf745/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -648,8 +686,9 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200131233409-575de47986ce/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -658,10 +697,8 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180608181217-32ee49c4dd80/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -670,30 +707,17 @@ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190605220351-eb0b1bdb6ae6/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210122163508-8081c04a3579 h1:Iwh0ba2kTgq2Q6mJiXhzrrjD7h11nEVnbMHFmp0/HsQ= google.golang.org/genproto v0.0.0-20210122163508-8081c04a3579/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/grpc v1.29.0 h1:2pJjwYOdkZ9HlN4sWRYBg9ttH5bCOlsueaM+b/oYjwo= +google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -704,7 +728,6 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -713,9 +736,12 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -730,5 +756,7 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphD mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34 h1:duVSyluuJA+u0BnkcLR01smoLrGgDTfWt5c8ODYG8fU= mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34/go.mod h1:H6SUd1XjIs+qQCyskXg5OFSrilMRUkD8ePJpHKDPaeY= +sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 h1:JPJh2pk3+X4lXAkZIk2RuE/7/FoK9maXw+TNPJhVS/c= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/identity/config/identity.go b/identity/config/identity.go index e2586714..bec5291c 100644 --- a/identity/config/identity.go +++ b/identity/config/identity.go @@ -3,7 +3,6 @@ package config import ( "errors" - "github.com/s7techlab/hlf-sdk-go/api" "github.com/s7techlab/hlf-sdk-go/identity" ) @@ -35,7 +34,7 @@ type ( } ) -func (m MSP) MustSigner() api.Identity { +func (m MSP) MustSigner() *identity.SigningIdentity { signer, err := m.Signer() if err != nil { panic(err) @@ -44,7 +43,7 @@ func (m MSP) MustSigner() api.Identity { return signer } -func (m MSP) Signer() (api.Identity, error) { +func (m MSP) Signer() (*identity.SigningIdentity, error) { mspConfig, err := m.MSP(identity.WithSkipConfig()) if err != nil { return nil, err @@ -58,7 +57,7 @@ func (m MSP) Signer() (api.Identity, error) { return signer, nil } -func (m MSP) MSP(opts ...identity.MSPOpt) (identity.MSP, error) { +func (m MSP) MSP(opts ...identity.MSPOpt) (*identity.MSP, error) { if m.ID == `` { return nil, ErrMSPIDEmpty } diff --git a/identity/deprecated.go b/identity/deprecated.go deleted file mode 100644 index 612da20d..00000000 --- a/identity/deprecated.go +++ /dev/null @@ -1,48 +0,0 @@ -package identity - -import ( - "crypto/x509" - - "github.com/s7techlab/hlf-sdk-go/api" -) - -// Deprecated: use FromCertKeyPath -func NewMSPIdentity(mspId string, certPath string, keyPath string) (api.Identity, error) { - return FromCertKeyPath(mspId, certPath, keyPath) -} - -// Deprecated: use FromBytes -func NewMSPIdentityBytes(mspId string, certBytes []byte, keyBytes []byte) (api.Identity, error) { - return FromBytes(mspId, certBytes, keyBytes) -} - -// Deprecated: use FromMSPPath -func NewMSPIdentityFromPath(mspId string, mspPath string) (api.Identity, error) { - return SignerFromMSPPath(mspId, mspPath) -} - -// Deprecated: use New -func NewMSPIdentityRaw(mspId string, cert *x509.Certificate, privateKey interface{}) (api.Identity, error) { - return New(mspId, cert, privateKey), nil -} - -// Deprecated: use MSPFromPath to create MSP -func NewMSPIdentitiesFromPath(mspID string, mspPath string) (*MSPConfig, error) { - return MSPFromPath(mspID, mspPath) -} - -// Deprecated: use New -func NewEnrollIdentity(privateKey interface{}) (api.Identity, error) { - return &identity{privateKey: privateKey}, nil -} - -// Deprecated: use SignerFromMSPPath to create identity -// LoadKeyPairFromMSP - legacy method. loads ONLY cert from signcerts dir -func LoadKeyPairFromMSP(mspPath string) (*x509.Certificate, interface{}, error) { - identity, err := SignerFromMSPPath(``, mspPath) - if err != nil { - return nil, nil, err - } - - return identity.certificate, identity.privateKey, nil -} diff --git a/identity/identity.go b/identity/identity.go index cef5bc0f..5b7e7ba6 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -4,50 +4,54 @@ import ( "crypto/x509" "encoding/pem" "fmt" - "io/ioutil" + "os" "time" "github.com/golang/protobuf/proto" mspPb "github.com/hyperledger/fabric-protos-go/msp" "github.com/hyperledger/fabric/msp" - _ "github.com/hyperledger/fabric/msp" "github.com/pkg/errors" - "github.com/s7techlab/hlf-sdk-go/api" + "github.com/s7techlab/hlf-sdk-go/crypto" +) + +var ( + ErrPEMEncodingFailed = errors.New("pem encoding failed") + + _ msp.SigningIdentity = &SigningIdentity{} + _ msp.Identity = &Identity{} ) type ( - identity struct { - privateKey interface{} - publicKey interface{} + Identity struct { certificate *x509.Certificate mspId string + cryptoSuite crypto.Suite } - signingIdentity struct { - identity *identity - cryptoSuite api.CryptoSuite + SigningIdentity struct { + *Identity + privateKey interface{} } ) -func New(mspId string, cert *x509.Certificate, privateKey interface{}) *identity { - return &identity{ +func New(mspId string, cert *x509.Certificate) *Identity { + cryptoSuite := crypto.DefaultSuite // todo: ? + + return &Identity{ mspId: mspId, - privateKey: privateKey, certificate: cert, - publicKey: cert.PublicKey, + cryptoSuite: cryptoSuite, } } -func FromBytesWithoutSigning(mspId string, certRaw []byte) (*identity, error) { - cert, err := Certificate(certRaw) - if err != nil { - return nil, fmt.Errorf(`certificate: %w`, err) +func NewSigning(mspId string, cert *x509.Certificate, privateKey interface{}) *SigningIdentity { + return &SigningIdentity{ + Identity: New(mspId, cert), + privateKey: privateKey, } - - return New(mspId, cert, nil), nil } -func FromBytes(mspId string, certRaw []byte, keyRaw []byte) (*identity, error) { +func NewSigningFromBytes(mspId string, certRaw []byte, keyRaw []byte) (*SigningIdentity, error) { cert, err := Certificate(certRaw) if err != nil { return nil, fmt.Errorf(`certificate: %w`, err) @@ -58,100 +62,83 @@ func FromBytes(mspId string, certRaw []byte, keyRaw []byte) (*identity, error) { return nil, fmt.Errorf(`key: %w`, err) } - return New(mspId, cert, key), nil + return NewSigning(mspId, cert, key), nil } -func FromCertKeyPath(mspId string, certPath string, keyPath string) (api.Identity, error) { - certPEM, err := ioutil.ReadFile(certPath) +func NewSigningFromFile(mspId string, certPath string, keyPath string) (*SigningIdentity, error) { + certPEM, err := os.ReadFile(certPath) if err != nil { return nil, fmt.Errorf(`read certificate from file=%s: %w`, certPath, err) } - keyPEM, err := ioutil.ReadFile(keyPath) + keyPEM, err := os.ReadFile(keyPath) if err != nil { return nil, fmt.Errorf(`read key from file=%s: %w`, keyPath, err) } - return FromBytes(mspId, certPEM, keyPEM) + return NewSigningFromBytes(mspId, certPEM, keyPEM) } -func SignerFromMSPPath(mspId string, mspPath string) (*identity, error) { - return FirstFromPath(mspId, SignCertsPath(mspPath), KeystorePath(mspPath)) +func NewSigningFromMSPPath(mspId string, mspPath string) (*SigningIdentity, error) { + return FirstSigningFromPath(mspId, SignCertsPath(mspPath), KeystorePath(mspPath)) } -func (i *identity) GetSigningIdentity(cs api.CryptoSuite) msp.SigningIdentity { - return &signingIdentity{ - identity: i, - cryptoSuite: cs, +func (i *Identity) SigningIdentity(privateKey interface{}) *SigningIdentity { + return &SigningIdentity{ + Identity: i, + privateKey: privateKey, } } -func (i *identity) GetMSPIdentifier() string { +func (i *Identity) GetMSPIdentifier() string { return i.mspId } -func PEMEncode(certRaw []byte) []byte { - return pem.EncodeToMemory(&pem.Block{ - Type: `CERTIFICATE`, - Bytes: certRaw, - }) -} - -func (i *identity) GetPEM() []byte { +func (i *Identity) GetPEM() []byte { return PEMEncode(i.certificate.Raw) } -func (i *identity) GetCert() *x509.Certificate { +func (i *Identity) GetCert() *x509.Certificate { return i.certificate } -func (i *identity) GetIdentifier() *msp.IdentityIdentifier { +func (i *Identity) GetIdentifier() *msp.IdentityIdentifier { return &msp.IdentityIdentifier{ Mspid: i.mspId, Id: i.certificate.Subject.CommonName, } } -func (s *signingIdentity) Anonymous() bool { +func (i *Identity) Anonymous() bool { return false } // ExpiresAt returns date of certificate expiration -func (s *signingIdentity) ExpiresAt() time.Time { - return s.identity.certificate.NotAfter -} - -func (s *signingIdentity) GetIdentifier() *msp.IdentityIdentifier { - return s.identity.GetIdentifier() +func (i *Identity) ExpiresAt() time.Time { + return i.certificate.NotAfter } -// GetMSPIdentifier returns current MspID of identity -func (s *signingIdentity) GetMSPIdentifier() string { - return s.identity.GetMSPIdentifier() -} - -func (s *signingIdentity) Validate() error { +func (i *Identity) Validate() error { // TODO return nil } -func (s *signingIdentity) GetOrganizationalUnits() []*msp.OUIdentifier { +func (i *Identity) GetOrganizationalUnits() []*msp.OUIdentifier { // TODO return nil } -func (s *signingIdentity) Verify(msg []byte, sig []byte) error { - return s.cryptoSuite.Verify(s.identity.publicKey, msg, sig) +func (i *Identity) Verify(msg []byte, sig []byte) error { + return i.cryptoSuite.Verify(i.certificate.PublicKey, msg, sig) } -func (s *signingIdentity) Serialize() ([]byte, error) { - pb := &pem.Block{Bytes: s.identity.certificate.Raw, Type: "CERTIFICATE"} - pemBytes := pem.EncodeToMemory(pb) +func (i *Identity) Serialize() ([]byte, error) { + pemBytes := PEMEncode(i.certificate.Raw) if pemBytes == nil { - return nil, errors.New("encoding of identity failed") + return nil, ErrPEMEncodingFailed } - sId := &mspPb.SerializedIdentity{Mspid: s.identity.mspId, IdBytes: pemBytes} + sId := &mspPb.SerializedIdentity{Mspid: i.mspId, IdBytes: pemBytes} idBytes, err := proto.Marshal(sId) if err != nil { return nil, err @@ -160,14 +147,21 @@ func (s *signingIdentity) Serialize() ([]byte, error) { return idBytes, nil } -func (s *signingIdentity) SatisfiesPrincipal(principal *mspPb.MSPPrincipal) error { +func (i *Identity) SatisfiesPrincipal(principal *mspPb.MSPPrincipal) error { panic("implement me") } -func (s *signingIdentity) Sign(msg []byte) ([]byte, error) { - return s.cryptoSuite.Sign(msg, s.identity.privateKey) +func (s *SigningIdentity) Sign(msg []byte) ([]byte, error) { + return s.cryptoSuite.Sign(msg, s.privateKey) } -func (s *signingIdentity) GetPublicVersion() msp.Identity { - return nil +func (s *SigningIdentity) GetPublicVersion() msp.Identity { + return s.Identity +} + +func PEMEncode(certRaw []byte) []byte { + return pem.EncodeToMemory(&pem.Block{ + Type: `CERTIFICATE`, + Bytes: certRaw, + }) } diff --git a/identity/loader.go b/identity/loader.go index 7409be9d..0bc82706 100644 --- a/identity/loader.go +++ b/identity/loader.go @@ -4,13 +4,10 @@ import ( "crypto/tls" "crypto/x509" "encoding/pem" + "errors" "fmt" "io/ioutil" "path" - - "github.com/pkg/errors" - - "github.com/s7techlab/hlf-sdk-go/api" ) var ( @@ -18,7 +15,7 @@ var ( ErrKeyNotFound = errors.New("key not found") ) -func FirstFromPath(mspID string, certDir, keyDir string) (*identity, error) { +func FirstSigningFromPath(mspID string, certDir, keyDir string) (*SigningIdentity, error) { certFile, err := readFirstFile(certDir) if err != nil { return nil, err @@ -29,11 +26,11 @@ func FirstFromPath(mspID string, certDir, keyDir string) (*identity, error) { return nil, err } - return New(mspID, cert, key), nil + return NewSigning(mspID, cert, key), nil } -func ListFromPath(mspID string, certDir, keyDir string) ([]api.Identity, error) { - var identities []api.Identity +func ListSigningFromPath(mspID string, certDir, keyDir string) ([]*SigningIdentity, error) { + var identities []*SigningIdentity certFiles, err := readFiles(certDir) if err != nil { @@ -46,7 +43,7 @@ func ListFromPath(mspID string, certDir, keyDir string) ([]api.Identity, error) return nil, err } - identities = append(identities, New(mspID, cert, key)) + identities = append(identities, NewSigning(mspID, cert, key)) } return identities, nil @@ -86,7 +83,7 @@ func Certificate(certRaw []byte) (*x509.Certificate, error) { return cert, nil } -// Key parses raw key bytes +// Key parses raw key btes func Key(keyRaw []byte) (interface{}, error) { keyPEM, _ := pem.Decode(keyRaw) if keyPEM == nil { diff --git a/identity/msp.go b/identity/msp.go index ceefd7ca..56749c04 100644 --- a/identity/msp.go +++ b/identity/msp.go @@ -10,36 +10,34 @@ import ( "github.com/hyperledger/fabric/msp" "go.uber.org/zap" "gopkg.in/yaml.v2" - - "github.com/s7techlab/hlf-sdk-go/api" ) // MSP - contains all parsed identities from msp folder // Should be used instead of single `api.Identity` which contains ONLY msp identity type ( - MSPConfig struct { + MSP struct { // identity from 'signcerts' - signer api.Identity + signer *SigningIdentity // identities from 'admincerts' - admins []api.Identity + admins []*SigningIdentity // identities from 'users' - users []api.Identity + users []*SigningIdentity - mspConfig *mspproto.FabricMSPConfig + config *mspproto.FabricMSPConfig } MSPFiles map[string][]byte - MSP interface { - GetMSPIdentifier() string - MSPConfig() *mspproto.FabricMSPConfig - - Signer() api.Identity - Admins() []api.Identity - Users() []api.Identity - AdminOrSigner() api.Identity - } + //MSP interface { + // GetMSPIdentifier() string + // MSPConfig() *mspproto.FabricMSPConfig + // + // Signer() *SigningIdentity + // Admins() []*SigningIdentity + // Users() []*SigningIdentity + // AdminOrSigner() *SigningIdentity + //} MSPOpts struct { mspPath string @@ -94,63 +92,18 @@ func FabricMSPConfigFromPath(mspID, mspDir string) (*mspproto.FabricMSPConfig, e } // MSPFromConfig created msp config from msp.FabricMSPConfig -func MSPFromConfig(fabricMspConfig *mspproto.FabricMSPConfig) (*MSPConfig, error) { - mspConfig := &MSPConfig{ - admins: nil, - signer: nil, // no signer when creating from FabricMSPConfig - users: nil, - mspConfig: fabricMspConfig, - } - return mspConfig, nil -} - -func WithSkipConfig() MSPOpt { - return func(mspOpts *MSPOpts) { - mspOpts.skipConfig = true - } -} - -func WithAdminMSPPath(adminMSPPath string) MSPOpt { - return func(mspOpts *MSPOpts) { - mspOpts.adminMSPPath = adminMSPPath - } -} - -func WithSignCertPath(signCertPath string) MSPOpt { - return func(mspOpts *MSPOpts) { - mspOpts.signCertPath = signCertPath - } -} - -func WithSignKeyPath(signKeyPath string) MSPOpt { - return func(mspOpts *MSPOpts) { - mspOpts.signKeyPath = signKeyPath - } -} - -func WithSignCert(signCert []byte) MSPOpt { - return func(mspOpts *MSPOpts) { - mspOpts.signCert = signCert - } -} - -func WithSignKey(signKey []byte) MSPOpt { - return func(mspOpts *MSPOpts) { - mspOpts.signKey = signKey - } -} - -func MustMSPFromPath(mspID, mspPath string, opts ...MSPOpt) *MSPConfig { - mspConfig, err := MSPFromPath(mspID, mspPath, opts...) - if err != nil { - panic(err) - } - - return mspConfig +func MSPFromConfig(fabricMspConfig *mspproto.FabricMSPConfig) (*MSP, error) { + mspInstance := &MSP{ + admins: nil, + signer: nil, // no signer when creating from FabricMSPConfig + users: nil, + config: fabricMspConfig, + } + return mspInstance, nil } // MSPFromPath loads msp config from filesystem -func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSPConfig, error) { +func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSP, error) { var err error mspOpts := &MSPOpts{ mspPath: mspPath, @@ -163,24 +116,10 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSPConfig, error) { if mspOpts.logger != nil { logger = mspOpts.logger } - applyDefaultMSPPaths(mspOpts) - logger.Debug(`load msp`, zap.Reflect(`config`, mspOpts)) - mspConfig := &MSPConfig{} - - if len(mspOpts.signCert) != 0 && len(mspOpts.signKey) != 0 { - mspConfig.signer, err = FromBytes(mspID, mspOpts.signCert, mspOpts.signKey) - if err != nil { - return nil, err - } - } else if mspOpts.signCertPath != "" && mspOpts.signKeyPath != "" { - mspConfig.signer, err = FromCertKeyPath(mspID, mspOpts.signCertPath, mspOpts.signKeyPath) - if err != nil { - return nil, err - } - } + mspInstance := &MSP{} // admin in separate msp path if mspOpts.adminMSPPath != `` { @@ -188,13 +127,13 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSPConfig, error) { zap.String(`admin msp path`, mspOpts.adminMSPPath), zap.String(`keystore path`, KeystorePath(mspOpts.adminMSPPath))) - mspConfig.admins, err = ListFromPath(mspID, SignCertsPath(mspOpts.adminMSPPath), KeystorePath(mspOpts.adminMSPPath)) + mspInstance.admins, err = ListSigningFromPath(mspID, SignCertsPath(mspOpts.adminMSPPath), KeystorePath(mspOpts.adminMSPPath)) if err != nil { return nil, fmt.Errorf(`read admin identity from=%s: %w`, mspOpts.adminMSPPath, err) } } else if mspOpts.adminCertsPath != `` { - mspConfig.admins, err = ListFromPath(mspID, mspOpts.adminCertsPath, mspOpts.keystorePath) + mspInstance.admins, err = ListSigningFromPath(mspID, mspOpts.adminCertsPath, mspOpts.keystorePath) } if err != nil { if !os.IsNotExist(err) { @@ -202,63 +141,60 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSPConfig, error) { } } - logger.Debug(`admin identities loaded`, zap.Int(`num`, len(mspConfig.admins))) + logger.Debug(`admin identities loaded`, zap.Int(`num`, len(mspInstance.admins))) if len(mspOpts.userPaths) > 0 { for _, userPath := range mspOpts.userPaths { - var users []api.Identity - users, err = ListFromPath(mspID, userPath, mspOpts.keystorePath) + users, err := ListSigningFromPath(mspID, userPath, mspOpts.keystorePath) // usePaths set explicit, so if dir is not exists - error occurred if err != nil { return nil, fmt.Errorf(`read users identity from=%s: %w`, userPath, err) } - mspConfig.users = append(mspConfig.users, users...) + mspInstance.users = append(mspInstance.users, users...) } - logger.Debug(`user identities loaded`, zap.Int(`num`, len(mspConfig.users))) + logger.Debug(`user identities loaded`, zap.Int(`num`, len(mspInstance.users))) } - if mspOpts.signCertsPath != `` && mspConfig.signer == nil { - mspConfig.signer, err = FirstFromPath(mspID, mspOpts.signCertsPath, mspOpts.keystorePath) + if mspOpts.signCertsPath != `` { + mspInstance.signer, err = FirstSigningFromPath(mspID, mspOpts.signCertsPath, mspOpts.keystorePath) if err != nil { return nil, fmt.Errorf(`read signer identity from=%s: %w`, mspOpts.signCertsPath, err) } } - if !mspOpts.skipConfig { - if mspConfig.mspConfig, err = FabricMSPConfigFromPath(mspID, mspOpts.mspPath); err != nil { - return nil, err - } + if mspInstance.config, err = FabricMSPConfigFromPath(mspID, mspOpts.mspPath); err != nil { + return nil, err } if mspOpts.validateCertChain { // todo: validate } - return mspConfig, nil + return mspInstance, nil } -func (m *MSPConfig) GetMSPIdentifier() string { - return m.mspConfig.GetName() +func (m *MSP) Identifier() string { + return m.config.GetName() } -func (m *MSPConfig) Signer() api.Identity { +func (m *MSP) Signer() *SigningIdentity { return m.signer } -func (m *MSPConfig) Admins() []api.Identity { +func (m *MSP) Admins() []*SigningIdentity { return m.admins } -func (m *MSPConfig) Users() []api.Identity { +func (m *MSP) Users() []*SigningIdentity { return m.users } // AdminOrSigner - returns admin identity if exists, in another case return msp. // installation, fetching cc list should happen from admin identity // if there is admin identity, use it. in another case - try with msp identity -func (m *MSPConfig) AdminOrSigner() api.Identity { +func (m *MSP) AdminOrSigner() *SigningIdentity { if len(m.admins) != 0 { return m.admins[0] } @@ -266,12 +202,12 @@ func (m *MSPConfig) AdminOrSigner() api.Identity { return m.signer } -func (m *MSPConfig) MSPConfig() *mspproto.FabricMSPConfig { - return m.mspConfig +func (m *MSP) Config() *mspproto.FabricMSPConfig { + return m.config } -func (m *MSPConfig) Serialize() (MSPFiles, error) { - return SerializeMSP(m.mspConfig) +func (m *MSP) Serialize() (MSPFiles, error) { + return SerializeMSP(m.config) } func (mc MSPFiles) Add(path string, file []byte) { diff --git a/identity/msp_opts.go b/identity/msp_opts.go new file mode 100644 index 00000000..9c201723 --- /dev/null +++ b/identity/msp_opts.go @@ -0,0 +1,37 @@ +package identity + +func WithSkipConfig() MSPOpt { + return func(mspOpts *MSPOpts) { + mspOpts.skipConfig = true + } +} + +func WithAdminMSPPath(adminMSPPath string) MSPOpt { + return func(mspOpts *MSPOpts) { + mspOpts.adminMSPPath = adminMSPPath + } +} + +func WithSignCertPath(signCertPath string) MSPOpt { + return func(mspOpts *MSPOpts) { + mspOpts.signCertPath = signCertPath + } +} + +func WithSignKeyPath(signKeyPath string) MSPOpt { + return func(mspOpts *MSPOpts) { + mspOpts.signKeyPath = signKeyPath + } +} + +func WithSignCert(signCert []byte) MSPOpt { + return func(mspOpts *MSPOpts) { + mspOpts.signCert = signCert + } +} + +func WithSignKey(signKey []byte) MSPOpt { + return func(mspOpts *MSPOpts) { + mspOpts.signKey = signKey + } +} diff --git a/identity/msp_test.go b/identity/msp_test.go index b085fba3..fdb75125 100644 --- a/identity/msp_test.go +++ b/identity/msp_test.go @@ -23,7 +23,7 @@ var _ = Describe(`Cert`, func() { Context(`Peer from path`, func() { var ( - msp *identity.MSPConfig + msp *identity.MSP err error ) @@ -33,14 +33,14 @@ var _ = Describe(`Cert`, func() { Expect(err).NotTo(HaveOccurred()) Expect(msp).NotTo(BeNil()) - Expect(msp.GetMSPIdentifier()).To(Equal(Org1MSPPeer.ID)) + Expect(msp.Identifier()).To(Equal(Org1MSPPeer.ID)) Expect(msp.Admins()).To(HaveLen(0)) Expect(msp.Signer()).NotTo(BeNil()) Expect(msp.Signer().GetPEM()).To(Equal(Org1MSPPeer.SignCert)) - mspConfig := msp.MSPConfig() + mspConfig := msp.Config() Expect(mspConfig).NotTo(BeNil()) Expect(mspConfig.RootCerts).To(HaveLen(1)) @@ -79,7 +79,7 @@ var _ = Describe(`Cert`, func() { }) }) - Context(`Peer from FabricMSPConfig`, func() { + Context(`Peer from FabricMSPCofig`, func() { It(`allow to create msp from FabricMSPConfig`, func() { msp, err := identity.MSPFromConfig(Org1MSPPeer.FabricMSPConfig()) diff --git a/observer/block_peer_common_test.go b/observer/block_peer_common_test.go index e41e1ce0..363b76ce 100644 --- a/observer/block_peer_common_test.go +++ b/observer/block_peer_common_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - sdkmocks "github.com/s7techlab/hlf-sdk-go/client/testing" + sdkmocks "github.com/s7techlab/hlf-sdk-go/client/deliver/testing" "github.com/s7techlab/hlf-sdk-go/observer" testdata "github.com/s7techlab/hlf-sdk-go/testdata/blocks" ) diff --git a/observer/block_peer_parsed_test.go b/observer/block_peer_parsed_test.go index b413586a..3f6df798 100644 --- a/observer/block_peer_parsed_test.go +++ b/observer/block_peer_parsed_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - sdkmocks "github.com/s7techlab/hlf-sdk-go/client/testing" + sdkmocks "github.com/s7techlab/hlf-sdk-go/client/deliver/testing" "github.com/s7techlab/hlf-sdk-go/observer" testdata "github.com/s7techlab/hlf-sdk-go/testdata/blocks" ) diff --git a/observer/channel_peer.go b/observer/channel_peer.go index 2fbe4a22..0fdb553e 100644 --- a/observer/channel_peer.go +++ b/observer/channel_peer.go @@ -26,8 +26,9 @@ type ( // ChannelPeer observes for peer channels ChannelPeer struct { - peerChannelsFetcher PeerChannelsFetcher - channelsMatcher *ChannelsMatcher + channelFetcher PeerChannelsFetcher + + channelsMatcher *ChannelsMatcher channels map[string]*ChannelInfo observePeriod time.Duration @@ -41,8 +42,8 @@ type ( } PeerChannelsFetcher interface { - api.ChannelsFetcher - api.ChannelInfo + api.ChannelListGetter + api.ChainInfoGetter } PeerChannels interface { @@ -88,11 +89,11 @@ func NewChannelPeer(peerChannelsFetcher PeerChannelsFetcher, opts ...ChannelPeer } channelPeer := &ChannelPeer{ - peerChannelsFetcher: peerChannelsFetcher, - channelsMatcher: channelsMatcher, - channels: make(map[string]*ChannelInfo), - observePeriod: channelPeerOpts.observePeriod, - logger: channelPeerOpts.logger, + channelFetcher: peerChannelsFetcher, + channelsMatcher: channelsMatcher, + channels: make(map[string]*ChannelInfo), + observePeriod: channelPeerOpts.observePeriod, + logger: channelPeerOpts.logger, } return channelPeer, nil @@ -148,7 +149,7 @@ func (cp *ChannelPeer) Channels() map[string]*ChannelInfo { func (cp *ChannelPeer) updateChannels(ctx context.Context) { cp.logger.Debug(`fetching channels`) - channelsInfo, err := cp.peerChannelsFetcher.GetChannels(ctx) + channelsInfo, err := cp.channelFetcher.GetChannels(ctx) if err != nil { cp.logger.Warn(`error while fetching channels`, zap.Error(err)) cp.lastError = err @@ -170,7 +171,7 @@ func (cp *ChannelPeer) updateChannels(ctx context.Context) { for _, channel := range channelsMatched { var channelInfo *common.BlockchainInfo - channelInfo, err = cp.peerChannelsFetcher.GetChainInfo(ctx, channel.Name) + channelInfo, err = cp.channelFetcher.GetChainInfo(ctx, channel.Name) if err != nil { cp.lastError = err continue diff --git a/observer/transform/kvread.go b/observer/transform/kvread.go index afa59b11..3fc28b7b 100644 --- a/observer/transform/kvread.go +++ b/observer/transform/kvread.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/hyperledger/fabric-protos-go/ledger/rwset/kvrwset" - "github.com/s7techlab/hlf-sdk-go/util" + hlfproto "github.com/s7techlab/hlf-sdk-go/proto" ) type ( @@ -45,7 +45,7 @@ func (kvread *KVRead) Transform(w *kvrwset.KVRead) error { func KVReadMatchKeyPrefix(prefixes ...string) KVReadMatch { return func(read *kvrwset.KVRead) bool { - keyPrefix, _ := util.SplitCompositeKey(read.Key) + keyPrefix, _ := hlfproto.SplitCompositeKey(read.Key) for _, prefix := range prefixes { if keyPrefix == prefix { return true @@ -78,9 +78,9 @@ func KVReadKeyObjectTypeReplaceByMap(mapping map[string]string, additionalMutato func KVReadKeyReplacer(mapping map[string]string) KVReadMutate { return func(read *kvrwset.KVRead) error { - prefix, attributes := util.SplitCompositeKey(read.Key) + prefix, attributes := hlfproto.SplitCompositeKey(read.Key) if mappedPrefix, ok := mapping[prefix]; ok { - mappedKey, err := util.CreateCompositeKey(mappedPrefix, attributes) + mappedKey, err := hlfproto.CreateCompositeKey(mappedPrefix, attributes) if err != nil { return fmt.Errorf(`create mapped composite key: %w`, err) } diff --git a/observer/transform/kvwrite.go b/observer/transform/kvwrite.go index 308853c7..305710b3 100644 --- a/observer/transform/kvwrite.go +++ b/observer/transform/kvwrite.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/hyperledger/fabric-protos-go/ledger/rwset/kvrwset" - "github.com/s7techlab/hlf-sdk-go/util" + hlfproto "github.com/s7techlab/hlf-sdk-go/proto" ) type ( @@ -44,7 +44,7 @@ func (kvwrite *KVWrite) Transform(w *kvrwset.KVWrite) error { func KVWriteMatchKeyPrefix(prefixes ...string) KVWriteMatch { return func(write *kvrwset.KVWrite) bool { - keyPrefix, _ := util.SplitCompositeKey(write.Key) + keyPrefix, _ := hlfproto.SplitCompositeKey(write.Key) for _, prefix := range prefixes { if keyPrefix == prefix { return true @@ -90,9 +90,9 @@ func KVWriteKeyObjectTypeReplaceByMap(mapping map[string]string, additionalMutat func KVWriteKeyReplacer(mapping map[string]string) KVWriteMutate { return func(write *kvrwset.KVWrite) error { - prefix, attributes := util.SplitCompositeKey(write.Key) + prefix, attributes := hlfproto.SplitCompositeKey(write.Key) if mappedPrefix, ok := mapping[prefix]; ok { - mappedKey, err := util.CreateCompositeKey(mappedPrefix, attributes) + mappedKey, err := hlfproto.CreateCompositeKey(mappedPrefix, attributes) if err != nil { return fmt.Errorf(`create mapped composite key: %w`, err) } diff --git a/proto/block.go b/proto/block.go index 099608a4..712e0ba4 100644 --- a/proto/block.go +++ b/proto/block.go @@ -13,7 +13,7 @@ import ( bft "github.com/s7techlab/hlf-sdk-go/proto/smartbft" bftcommon "github.com/s7techlab/hlf-sdk-go/proto/smartbft/common" - "github.com/s7techlab/hlf-sdk-go/util/txflags" + "github.com/s7techlab/hlf-sdk-go/proto/txflags" ) type ( diff --git a/proto/block.pb.go b/proto/block.pb.go index 644e30d5..87982742 100644 --- a/proto/block.pb.go +++ b/proto/block.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.30.0 // protoc (unknown) // source: block.proto diff --git a/proto/block_test.go b/proto/block_test.go index f71c6bfb..3e812cbe 100644 --- a/proto/block_test.go +++ b/proto/block_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - sdkmocks "github.com/s7techlab/hlf-sdk-go/client/testing" + sdkmocks "github.com/s7techlab/hlf-sdk-go/client/deliver/testing" "github.com/s7techlab/hlf-sdk-go/proto" ) diff --git a/proto/chan_config.pb.go b/proto/chan_config.pb.go index 22b7d931..846c3536 100644 --- a/proto/chan_config.pb.go +++ b/proto/chan_config.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.30.0 // protoc (unknown) // source: chan_config.proto diff --git a/proto/envelope.go b/proto/envelope.go index 4706dcc9..d4461f80 100644 --- a/proto/envelope.go +++ b/proto/envelope.go @@ -8,7 +8,7 @@ import ( "github.com/hyperledger/fabric-protos-go/peer" "github.com/hyperledger/fabric/protoutil" - "github.com/s7techlab/hlf-sdk-go/util/txflags" + "github.com/s7techlab/hlf-sdk-go/proto/txflags" ) func ParseBlockData(blockData [][]byte, txFilter txflags.ValidationFlags) (*BlockData, error) { diff --git a/util/key.go b/proto/key.go similarity index 99% rename from util/key.go rename to proto/key.go index 5c603488..13627b44 100644 --- a/util/key.go +++ b/proto/key.go @@ -1,4 +1,4 @@ -package util +package proto import ( "unicode/utf8" diff --git a/proto/smartbft/common/common.pb.go b/proto/smartbft/common/common.pb.go index 7aa76694..aa3f1cd9 100644 --- a/proto/smartbft/common/common.pb.go +++ b/proto/smartbft/common/common.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.30.0 // protoc (unknown) // source: smartbft/common/common.proto diff --git a/proto/smartbft/configuration.pb.go b/proto/smartbft/configuration.pb.go index e5beca49..cb7eb094 100644 --- a/proto/smartbft/configuration.pb.go +++ b/proto/smartbft/configuration.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.30.0 // protoc (unknown) // source: smartbft/configuration.proto diff --git a/util/txflags/validation_flags.go b/proto/txflags/validation_flags.go similarity index 100% rename from util/txflags/validation_flags.go rename to proto/txflags/validation_flags.go diff --git a/util/txflags/validation_flags_test.go b/proto/txflags/validation_flags_test.go similarity index 100% rename from util/txflags/validation_flags_test.go rename to proto/txflags/validation_flags_test.go diff --git a/util/channel.go b/service/orderer/channel.go similarity index 99% rename from util/channel.go rename to service/orderer/channel.go index e06a2c5c..279ef5b6 100644 --- a/util/channel.go +++ b/service/orderer/channel.go @@ -1,4 +1,4 @@ -package util +package orderer import ( "bytes" diff --git a/client/chaincode/system/service_def.go b/service/service.go similarity index 51% rename from client/chaincode/system/service_def.go rename to service/service.go index 1f6fdf2e..aef36bae 100644 --- a/client/chaincode/system/service_def.go +++ b/service/service.go @@ -1,4 +1,4 @@ -package system +package service import ( "context" @@ -10,25 +10,17 @@ import ( type ( RegisterHandlerFromEndpoint func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) - ServiceDef struct { + Def struct { name string swagger []byte Desc *grpc.ServiceDesc Service interface{} HandlerFromEndpointRegister RegisterHandlerFromEndpoint } - - Service interface { - Name() string - Swagger() []byte - GRPCDesc() *grpc.ServiceDesc - Impl() interface{} - GRPCGatewayRegister() func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) - } ) -func NewServiceDef(name string, swagger []byte, desc *grpc.ServiceDesc, service interface{}, registerHandler RegisterHandlerFromEndpoint) ServiceDef { - return ServiceDef{ +func NewDef(name string, swagger []byte, desc *grpc.ServiceDesc, service interface{}, registerHandler RegisterHandlerFromEndpoint) *Def { + return &Def{ name: name, swagger: swagger, Desc: desc, @@ -37,22 +29,22 @@ func NewServiceDef(name string, swagger []byte, desc *grpc.ServiceDesc, service } } -func (s ServiceDef) Name() string { +func (s *Def) Name() string { return s.name } -func (s ServiceDef) Swagger() []byte { +func (s *Def) Swagger() []byte { return s.swagger } -func (s ServiceDef) GRPCDesc() *grpc.ServiceDesc { +func (s *Def) GRPCDesc() *grpc.ServiceDesc { return s.Desc } -func (s ServiceDef) Impl() interface{} { +func (s *Def) Impl() interface{} { return s.Service } -func (s ServiceDef) GRPCGatewayRegister() func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { +func (s *Def) GRPCGatewayRegister() func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { return s.HandlerFromEndpointRegister } diff --git a/service/systemcc/cscc/cscc.go b/service/systemcc/cscc/cscc.go new file mode 100644 index 00000000..f09b3c2b --- /dev/null +++ b/service/systemcc/cscc/cscc.go @@ -0,0 +1,96 @@ +package cscc + +import ( + "context" + _ "embed" + "fmt" + + "github.com/golang/protobuf/ptypes/empty" + "github.com/hyperledger/fabric-protos-go/common" + "github.com/hyperledger/fabric-protos-go/peer" + + "github.com/s7techlab/hlf-sdk-go/api" + "github.com/s7techlab/hlf-sdk-go/client/chaincode" + "github.com/s7techlab/hlf-sdk-go/client/channel" + "github.com/s7techlab/hlf-sdk-go/client/tx" + hlfproto "github.com/s7techlab/hlf-sdk-go/proto" + "github.com/s7techlab/hlf-sdk-go/service" +) + +//go:embed cscc.swagger.json +var Swagger []byte + +type ( + Service struct { + UnimplementedCSCCServiceServer + + Querier *tx.ProtoQuerier + ChannelListGetter api.ChannelListGetter + FabricVersion hlfproto.FabricVersion + } +) + +func FromClient(client api.Client) *Service { + return NewCSCC(client, hlfproto.FabricVersionIsV2(client.FabricV2())) +} + +func NewCSCC(querier api.Querier, version hlfproto.FabricVersion) *Service { + return &Service{ + // Channel and chaincode are fixed in queries to CSCC + Querier: tx.NewProtoQuerier(querier, ``, chaincode.CSCC), + ChannelListGetter: channel.NewCSCCListGetter(querier), + FabricVersion: version, + } +} + +func (c *Service) ServiceDef() *service.Def { + return service.NewDef( + _CSCCService_serviceDesc.ServiceName, + Swagger, + &_CSCCService_serviceDesc, + c, + RegisterCSCCServiceHandlerFromEndpoint, + ) +} + +func (c *Service) GetChannels(ctx context.Context, _ *empty.Empty) (*peer.ChannelQueryResponse, error) { + return c.ChannelListGetter.GetChannels(ctx) +} + +func (c *Service) JoinChain(ctx context.Context, request *JoinChainRequest) (*empty.Empty, error) { + if _, err := c.Querier.Query(ctx, chaincode.CSCCJoinChain, request.GenesisBlock); err != nil { + return nil, err + } + return &empty.Empty{}, nil +} + +func (c *Service) GetConfigBlock(ctx context.Context, request *GetConfigBlockRequest) (*common.Block, error) { + res, err := c.Querier.QueryProto(ctx, []interface{}{chaincode.CSCCGetConfigBlock, request.Channel}, &common.Block{}) + if err != nil { + return nil, err + } + return res.(*common.Block), nil +} + +func (c *Service) GetChannelConfig(ctx context.Context, request *GetChannelConfigRequest) (*common.Config, error) { + switch c.FabricVersion { + + case hlfproto.FabricV1: + res, err := c.Querier.QueryStringsProto(ctx, []string{chaincode.CSCCGetConfigTree, request.Channel}, &peer.ConfigTree{}) + if err != nil { + return nil, err + } + return res.(*peer.ConfigTree).ChannelConfig, nil + + case hlfproto.FabricV2: + + res, err := c.Querier.QueryStringsProto(ctx, []string{chaincode.CSCCGetChannelConfig, request.Channel}, &common.Config{}) + if err != nil { + return nil, err + } + return res.(*common.Config), nil + + default: + return nil, fmt.Errorf(`fabric version=%s: %w`, c.FabricVersion, hlfproto.ErrUnknownFabricVersion) + } +} diff --git a/client/chaincode/system/cscc.pb.go b/service/systemcc/cscc/cscc.pb.go similarity index 51% rename from client/chaincode/system/cscc.pb.go rename to service/systemcc/cscc/cscc.pb.go index 3b128fcd..01e2158c 100644 --- a/client/chaincode/system/cscc.pb.go +++ b/service/systemcc/cscc/cscc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.7.1 -// source: cscc.proto +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: systemcc/cscc/cscc.proto -package system +package cscc import ( context "context" - empty "github.com/golang/protobuf/ptypes/empty" common "github.com/hyperledger/fabric-protos-go/common" peer "github.com/hyperledger/fabric-protos-go/peer" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -17,6 +16,7 @@ import ( status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -40,7 +40,7 @@ type JoinChainRequest struct { func (x *JoinChainRequest) Reset() { *x = JoinChainRequest{} if protoimpl.UnsafeEnabled { - mi := &file_cscc_proto_msgTypes[0] + mi := &file_systemcc_cscc_cscc_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -53,7 +53,7 @@ func (x *JoinChainRequest) String() string { func (*JoinChainRequest) ProtoMessage() {} func (x *JoinChainRequest) ProtoReflect() protoreflect.Message { - mi := &file_cscc_proto_msgTypes[0] + mi := &file_systemcc_cscc_cscc_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -66,7 +66,7 @@ func (x *JoinChainRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinChainRequest.ProtoReflect.Descriptor instead. func (*JoinChainRequest) Descriptor() ([]byte, []int) { - return file_cscc_proto_rawDescGZIP(), []int{0} + return file_systemcc_cscc_cscc_proto_rawDescGZIP(), []int{0} } func (x *JoinChainRequest) GetChannel() string { @@ -94,7 +94,7 @@ type GetConfigBlockRequest struct { func (x *GetConfigBlockRequest) Reset() { *x = GetConfigBlockRequest{} if protoimpl.UnsafeEnabled { - mi := &file_cscc_proto_msgTypes[1] + mi := &file_systemcc_cscc_cscc_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107,7 +107,7 @@ func (x *GetConfigBlockRequest) String() string { func (*GetConfigBlockRequest) ProtoMessage() {} func (x *GetConfigBlockRequest) ProtoReflect() protoreflect.Message { - mi := &file_cscc_proto_msgTypes[1] + mi := &file_systemcc_cscc_cscc_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120,7 +120,7 @@ func (x *GetConfigBlockRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetConfigBlockRequest.ProtoReflect.Descriptor instead. func (*GetConfigBlockRequest) Descriptor() ([]byte, []int) { - return file_cscc_proto_rawDescGZIP(), []int{1} + return file_systemcc_cscc_cscc_proto_rawDescGZIP(), []int{1} } func (x *GetConfigBlockRequest) GetChannel() string { @@ -141,7 +141,7 @@ type GetChannelConfigRequest struct { func (x *GetChannelConfigRequest) Reset() { *x = GetChannelConfigRequest{} if protoimpl.UnsafeEnabled { - mi := &file_cscc_proto_msgTypes[2] + mi := &file_systemcc_cscc_cscc_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -154,7 +154,7 @@ func (x *GetChannelConfigRequest) String() string { func (*GetChannelConfigRequest) ProtoMessage() {} func (x *GetChannelConfigRequest) ProtoReflect() protoreflect.Message { - mi := &file_cscc_proto_msgTypes[2] + mi := &file_systemcc_cscc_cscc_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -167,7 +167,7 @@ func (x *GetChannelConfigRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetChannelConfigRequest.ProtoReflect.Descriptor instead. func (*GetChannelConfigRequest) Descriptor() ([]byte, []int) { - return file_cscc_proto_rawDescGZIP(), []int{2} + return file_systemcc_cscc_cscc_proto_rawDescGZIP(), []int{2} } func (x *GetChannelConfigRequest) GetChannel() string { @@ -177,99 +177,108 @@ func (x *GetChannelConfigRequest) GetChannel() string { return "" } -var File_cscc_proto protoreflect.FileDescriptor - -var file_cscc_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x63, 0x73, 0x63, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x68, 0x6c, - 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x1a, 0x13, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x71, - 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x0a, 0x10, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x12, 0x32, 0x0a, 0x0d, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x5f, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x0c, 0x67, 0x65, 0x6e, 0x65, 0x73, - 0x69, 0x73, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x31, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x33, 0x0a, 0x17, 0x47, 0x65, - 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x32, - 0xd8, 0x03, 0x0a, 0x0b, 0x43, 0x53, 0x43, 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x71, 0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x30, 0x2e, 0x68, - 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4a, 0x6f, - 0x69, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x22, 0x0f, - 0x2f, 0x63, 0x73, 0x63, 0x63, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x3a, - 0x01, 0x2a, 0x12, 0x59, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, - 0x0c, 0x2f, 0x63, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x76, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, - 0x35, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, - 0x63, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x12, 0x82, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x37, 0x2e, 0x68, 0x6c, 0x66, - 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x63, 0x73, - 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x7d, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x20, 0x5a, 0x1e, 0x68, 0x6c, - 0x66, 0x73, 0x64, 0x6b, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, +var File_systemcc_cscc_cscc_proto protoreflect.FileDescriptor + +var file_systemcc_cscc_cscc_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x63, 0x73, 0x63, 0x63, 0x2f, + 0x63, 0x73, 0x63, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x68, 0x6c, 0x66, 0x73, + 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x63, 0x63, 0x2e, 0x63, 0x73, 0x63, 0x63, 0x1a, 0x2d, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, + 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x60, 0x0a, 0x10, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x32, 0x0a, + 0x0d, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x0c, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x22, 0x31, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x33, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x32, 0xf6, 0x03, 0x0a, 0x0b, 0x43, 0x53, + 0x43, 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a, 0x09, 0x4a, 0x6f, 0x69, + 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x2e, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, + 0x2e, 0x63, 0x73, 0x63, 0x63, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x23, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x01, 0x2a, 0x22, 0x18, 0x2f, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x63, 0x73, 0x63, 0x63, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x12, 0x62, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, + 0x12, 0x15, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x63, 0x73, 0x63, 0x63, + 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x7d, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x2e, 0x68, 0x6c, 0x66, 0x73, + 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x63, 0x63, 0x2e, 0x63, 0x73, 0x63, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x27, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, + 0x2f, 0x63, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2f, 0x7b, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x12, 0x89, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x35, 0x2e, 0x68, 0x6c, + 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x63, 0x73, 0x63, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x63, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x2f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x73, 0x37, 0x74, 0x65, 0x63, 0x68, 0x6c, 0x61, 0x62, 0x2f, 0x68, 0x6c, 0x66, 0x2d, 0x73, + 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x63, 0x73, 0x63, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_cscc_proto_rawDescOnce sync.Once - file_cscc_proto_rawDescData = file_cscc_proto_rawDesc + file_systemcc_cscc_cscc_proto_rawDescOnce sync.Once + file_systemcc_cscc_cscc_proto_rawDescData = file_systemcc_cscc_cscc_proto_rawDesc ) -func file_cscc_proto_rawDescGZIP() []byte { - file_cscc_proto_rawDescOnce.Do(func() { - file_cscc_proto_rawDescData = protoimpl.X.CompressGZIP(file_cscc_proto_rawDescData) +func file_systemcc_cscc_cscc_proto_rawDescGZIP() []byte { + file_systemcc_cscc_cscc_proto_rawDescOnce.Do(func() { + file_systemcc_cscc_cscc_proto_rawDescData = protoimpl.X.CompressGZIP(file_systemcc_cscc_cscc_proto_rawDescData) }) - return file_cscc_proto_rawDescData + return file_systemcc_cscc_cscc_proto_rawDescData } -var file_cscc_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_cscc_proto_goTypes = []interface{}{ - (*JoinChainRequest)(nil), // 0: hlfsdk.client.chaincode.system.JoinChainRequest - (*GetConfigBlockRequest)(nil), // 1: hlfsdk.client.chaincode.system.GetConfigBlockRequest - (*GetChannelConfigRequest)(nil), // 2: hlfsdk.client.chaincode.system.GetChannelConfigRequest +var file_systemcc_cscc_cscc_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_systemcc_cscc_cscc_proto_goTypes = []interface{}{ + (*JoinChainRequest)(nil), // 0: hlfsdk.service.systemcc.cscc.JoinChainRequest + (*GetConfigBlockRequest)(nil), // 1: hlfsdk.service.systemcc.cscc.GetConfigBlockRequest + (*GetChannelConfigRequest)(nil), // 2: hlfsdk.service.systemcc.cscc.GetChannelConfigRequest (*common.Block)(nil), // 3: common.Block - (*empty.Empty)(nil), // 4: google.protobuf.Empty + (*emptypb.Empty)(nil), // 4: google.protobuf.Empty (*peer.ChannelQueryResponse)(nil), // 5: protos.ChannelQueryResponse (*common.Config)(nil), // 6: common.Config } -var file_cscc_proto_depIdxs = []int32{ - 3, // 0: hlfsdk.client.chaincode.system.JoinChainRequest.genesis_block:type_name -> common.Block - 0, // 1: hlfsdk.client.chaincode.system.CSCCService.JoinChain:input_type -> hlfsdk.client.chaincode.system.JoinChainRequest - 4, // 2: hlfsdk.client.chaincode.system.CSCCService.GetChannels:input_type -> google.protobuf.Empty - 1, // 3: hlfsdk.client.chaincode.system.CSCCService.GetConfigBlock:input_type -> hlfsdk.client.chaincode.system.GetConfigBlockRequest - 2, // 4: hlfsdk.client.chaincode.system.CSCCService.GetChannelConfig:input_type -> hlfsdk.client.chaincode.system.GetChannelConfigRequest - 4, // 5: hlfsdk.client.chaincode.system.CSCCService.JoinChain:output_type -> google.protobuf.Empty - 5, // 6: hlfsdk.client.chaincode.system.CSCCService.GetChannels:output_type -> protos.ChannelQueryResponse - 3, // 7: hlfsdk.client.chaincode.system.CSCCService.GetConfigBlock:output_type -> common.Block - 6, // 8: hlfsdk.client.chaincode.system.CSCCService.GetChannelConfig:output_type -> common.Config +var file_systemcc_cscc_cscc_proto_depIdxs = []int32{ + 3, // 0: hlfsdk.service.systemcc.cscc.JoinChainRequest.genesis_block:type_name -> common.Block + 0, // 1: hlfsdk.service.systemcc.cscc.CSCCService.JoinChain:input_type -> hlfsdk.service.systemcc.cscc.JoinChainRequest + 4, // 2: hlfsdk.service.systemcc.cscc.CSCCService.GetChannels:input_type -> google.protobuf.Empty + 1, // 3: hlfsdk.service.systemcc.cscc.CSCCService.GetConfigBlock:input_type -> hlfsdk.service.systemcc.cscc.GetConfigBlockRequest + 2, // 4: hlfsdk.service.systemcc.cscc.CSCCService.GetChannelConfig:input_type -> hlfsdk.service.systemcc.cscc.GetChannelConfigRequest + 4, // 5: hlfsdk.service.systemcc.cscc.CSCCService.JoinChain:output_type -> google.protobuf.Empty + 5, // 6: hlfsdk.service.systemcc.cscc.CSCCService.GetChannels:output_type -> protos.ChannelQueryResponse + 3, // 7: hlfsdk.service.systemcc.cscc.CSCCService.GetConfigBlock:output_type -> common.Block + 6, // 8: hlfsdk.service.systemcc.cscc.CSCCService.GetChannelConfig:output_type -> common.Config 5, // [5:9] is the sub-list for method output_type 1, // [1:5] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -277,13 +286,13 @@ var file_cscc_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_cscc_proto_init() } -func file_cscc_proto_init() { - if File_cscc_proto != nil { +func init() { file_systemcc_cscc_cscc_proto_init() } +func file_systemcc_cscc_cscc_proto_init() { + if File_systemcc_cscc_cscc_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_cscc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_cscc_cscc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*JoinChainRequest); i { case 0: return &v.state @@ -295,7 +304,7 @@ func file_cscc_proto_init() { return nil } } - file_cscc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_cscc_cscc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetConfigBlockRequest); i { case 0: return &v.state @@ -307,7 +316,7 @@ func file_cscc_proto_init() { return nil } } - file_cscc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_cscc_cscc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetChannelConfigRequest); i { case 0: return &v.state @@ -324,20 +333,20 @@ func file_cscc_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cscc_proto_rawDesc, + RawDescriptor: file_systemcc_cscc_cscc_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_cscc_proto_goTypes, - DependencyIndexes: file_cscc_proto_depIdxs, - MessageInfos: file_cscc_proto_msgTypes, + GoTypes: file_systemcc_cscc_cscc_proto_goTypes, + DependencyIndexes: file_systemcc_cscc_cscc_proto_depIdxs, + MessageInfos: file_systemcc_cscc_cscc_proto_msgTypes, }.Build() - File_cscc_proto = out.File - file_cscc_proto_rawDesc = nil - file_cscc_proto_goTypes = nil - file_cscc_proto_depIdxs = nil + File_systemcc_cscc_cscc_proto = out.File + file_systemcc_cscc_cscc_proto_rawDesc = nil + file_systemcc_cscc_cscc_proto_goTypes = nil + file_systemcc_cscc_cscc_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. @@ -353,8 +362,8 @@ const _ = grpc.SupportPackageIsVersion6 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type CSCCServiceClient interface { // GetChainInfo allows joining channel using presented genesis block - JoinChain(ctx context.Context, in *JoinChainRequest, opts ...grpc.CallOption) (*empty.Empty, error) - GetChannels(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*peer.ChannelQueryResponse, error) + JoinChain(ctx context.Context, in *JoinChainRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetChannels(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*peer.ChannelQueryResponse, error) // GetConfigBlock returns genesis block of channel GetConfigBlock(ctx context.Context, in *GetConfigBlockRequest, opts ...grpc.CallOption) (*common.Block, error) // GetChannelConfig returns channel configuration @@ -369,18 +378,18 @@ func NewCSCCServiceClient(cc grpc.ClientConnInterface) CSCCServiceClient { return &cSCCServiceClient{cc} } -func (c *cSCCServiceClient) JoinChain(ctx context.Context, in *JoinChainRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.CSCCService/JoinChain", in, out, opts...) +func (c *cSCCServiceClient) JoinChain(ctx context.Context, in *JoinChainRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.cscc.CSCCService/JoinChain", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *cSCCServiceClient) GetChannels(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*peer.ChannelQueryResponse, error) { +func (c *cSCCServiceClient) GetChannels(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*peer.ChannelQueryResponse, error) { out := new(peer.ChannelQueryResponse) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.CSCCService/GetChannels", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.cscc.CSCCService/GetChannels", in, out, opts...) if err != nil { return nil, err } @@ -389,7 +398,7 @@ func (c *cSCCServiceClient) GetChannels(ctx context.Context, in *empty.Empty, op func (c *cSCCServiceClient) GetConfigBlock(ctx context.Context, in *GetConfigBlockRequest, opts ...grpc.CallOption) (*common.Block, error) { out := new(common.Block) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.CSCCService/GetConfigBlock", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.cscc.CSCCService/GetConfigBlock", in, out, opts...) if err != nil { return nil, err } @@ -398,7 +407,7 @@ func (c *cSCCServiceClient) GetConfigBlock(ctx context.Context, in *GetConfigBlo func (c *cSCCServiceClient) GetChannelConfig(ctx context.Context, in *GetChannelConfigRequest, opts ...grpc.CallOption) (*common.Config, error) { out := new(common.Config) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.CSCCService/GetChannelConfig", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.cscc.CSCCService/GetChannelConfig", in, out, opts...) if err != nil { return nil, err } @@ -408,8 +417,8 @@ func (c *cSCCServiceClient) GetChannelConfig(ctx context.Context, in *GetChannel // CSCCServiceServer is the server API for CSCCService service. type CSCCServiceServer interface { // GetChainInfo allows joining channel using presented genesis block - JoinChain(context.Context, *JoinChainRequest) (*empty.Empty, error) - GetChannels(context.Context, *empty.Empty) (*peer.ChannelQueryResponse, error) + JoinChain(context.Context, *JoinChainRequest) (*emptypb.Empty, error) + GetChannels(context.Context, *emptypb.Empty) (*peer.ChannelQueryResponse, error) // GetConfigBlock returns genesis block of channel GetConfigBlock(context.Context, *GetConfigBlockRequest) (*common.Block, error) // GetChannelConfig returns channel configuration @@ -420,10 +429,10 @@ type CSCCServiceServer interface { type UnimplementedCSCCServiceServer struct { } -func (*UnimplementedCSCCServiceServer) JoinChain(context.Context, *JoinChainRequest) (*empty.Empty, error) { +func (*UnimplementedCSCCServiceServer) JoinChain(context.Context, *JoinChainRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method JoinChain not implemented") } -func (*UnimplementedCSCCServiceServer) GetChannels(context.Context, *empty.Empty) (*peer.ChannelQueryResponse, error) { +func (*UnimplementedCSCCServiceServer) GetChannels(context.Context, *emptypb.Empty) (*peer.ChannelQueryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetChannels not implemented") } func (*UnimplementedCSCCServiceServer) GetConfigBlock(context.Context, *GetConfigBlockRequest) (*common.Block, error) { @@ -447,7 +456,7 @@ func _CSCCService_JoinChain_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.CSCCService/JoinChain", + FullMethod: "/hlfsdk.service.systemcc.cscc.CSCCService/JoinChain", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CSCCServiceServer).JoinChain(ctx, req.(*JoinChainRequest)) @@ -456,7 +465,7 @@ func _CSCCService_JoinChain_Handler(srv interface{}, ctx context.Context, dec fu } func _CSCCService_GetChannels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -465,10 +474,10 @@ func _CSCCService_GetChannels_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.CSCCService/GetChannels", + FullMethod: "/hlfsdk.service.systemcc.cscc.CSCCService/GetChannels", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CSCCServiceServer).GetChannels(ctx, req.(*empty.Empty)) + return srv.(CSCCServiceServer).GetChannels(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -483,7 +492,7 @@ func _CSCCService_GetConfigBlock_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.CSCCService/GetConfigBlock", + FullMethod: "/hlfsdk.service.systemcc.cscc.CSCCService/GetConfigBlock", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CSCCServiceServer).GetConfigBlock(ctx, req.(*GetConfigBlockRequest)) @@ -501,7 +510,7 @@ func _CSCCService_GetChannelConfig_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.CSCCService/GetChannelConfig", + FullMethod: "/hlfsdk.service.systemcc.cscc.CSCCService/GetChannelConfig", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CSCCServiceServer).GetChannelConfig(ctx, req.(*GetChannelConfigRequest)) @@ -510,7 +519,7 @@ func _CSCCService_GetChannelConfig_Handler(srv interface{}, ctx context.Context, } var _CSCCService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hlfsdk.client.chaincode.system.CSCCService", + ServiceName: "hlfsdk.service.systemcc.cscc.CSCCService", HandlerType: (*CSCCServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -531,5 +540,5 @@ var _CSCCService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cscc.proto", + Metadata: "systemcc/cscc/cscc.proto", } diff --git a/client/chaincode/system/cscc.pb.gw.go b/service/systemcc/cscc/cscc.pb.gw.go similarity index 88% rename from client/chaincode/system/cscc.pb.gw.go rename to service/systemcc/cscc/cscc.pb.gw.go index b71c4af3..1d03f05d 100644 --- a/client/chaincode/system/cscc.pb.gw.go +++ b/service/systemcc/cscc/cscc.pb.gw.go @@ -1,33 +1,38 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cscc.proto +// source: systemcc/cscc/cscc.proto /* -Package system is a reverse proxy. +Package cscc is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package system +package cscc import ( "context" "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_CSCCService_JoinChain_0(ctx context.Context, marshaler runtime.Marshaler, client CSCCServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq JoinChainRequest @@ -64,7 +69,7 @@ func local_request_CSCCService_JoinChain_0(ctx context.Context, marshaler runtim } func request_CSCCService_GetChannels_0(ctx context.Context, marshaler runtime.Marshaler, client CSCCServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.GetChannels(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -73,7 +78,7 @@ func request_CSCCService_GetChannels_0(ctx context.Context, marshaler runtime.Ma } func local_request_CSCCService_GetChannels_0(ctx context.Context, marshaler runtime.Marshaler, server CSCCServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.GetChannels(ctx, &protoReq) @@ -192,11 +197,14 @@ func local_request_CSCCService_GetChannelConfig_0(ctx context.Context, marshaler // RegisterCSCCServiceHandlerServer registers the http handlers for service CSCCService to "mux". // UnaryRPC :call CSCCServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCSCCServiceHandlerFromEndpoint instead. func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CSCCServiceServer) error { mux.Handle("POST", pattern_CSCCService_JoinChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -204,6 +212,7 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_CSCCService_JoinChain_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -217,6 +226,8 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_CSCCService_GetChannels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -224,6 +235,7 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_CSCCService_GetChannels_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -237,6 +249,8 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_CSCCService_GetConfigBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -244,6 +258,7 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_CSCCService_GetConfigBlock_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -257,6 +272,8 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_CSCCService_GetChannelConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -264,6 +281,7 @@ func RegisterCSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_CSCCService_GetChannelConfig_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -399,13 +417,13 @@ func RegisterCSCCServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( - pattern_CSCCService_JoinChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cscc", "joinchain"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_CSCCService_JoinChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"systemcc", "cscc", "joinchain"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_CSCCService_GetChannels_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cscc", "chains"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_CSCCService_GetChannels_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"systemcc", "cscc", "chains"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_CSCCService_GetConfigBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"cscc", "chains", "channel"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_CSCCService_GetConfigBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"systemcc", "cscc", "chains", "channel"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_CSCCService_GetChannelConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"cscc", "chains", "channel", "config"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_CSCCService_GetChannelConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"systemcc", "cscc", "chains", "channel", "config"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/service/systemcc/cscc/cscc.pb.validate.go b/service/systemcc/cscc/cscc.pb.validate.go new file mode 100644 index 00000000..dfc0f181 --- /dev/null +++ b/service/systemcc/cscc/cscc.pb.validate.go @@ -0,0 +1,375 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: systemcc/cscc/cscc.proto + +package cscc + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on JoinChainRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *JoinChainRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on JoinChainRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// JoinChainRequestMultiError, or nil if none found. +func (m *JoinChainRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *JoinChainRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetGenesisBlock()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, JoinChainRequestValidationError{ + field: "GenesisBlock", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, JoinChainRequestValidationError{ + field: "GenesisBlock", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetGenesisBlock()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return JoinChainRequestValidationError{ + field: "GenesisBlock", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return JoinChainRequestMultiError(errors) + } + + return nil +} + +// JoinChainRequestMultiError is an error wrapping multiple validation errors +// returned by JoinChainRequest.ValidateAll() if the designated constraints +// aren't met. +type JoinChainRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m JoinChainRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m JoinChainRequestMultiError) AllErrors() []error { return m } + +// JoinChainRequestValidationError is the validation error returned by +// JoinChainRequest.Validate if the designated constraints aren't met. +type JoinChainRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e JoinChainRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e JoinChainRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e JoinChainRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e JoinChainRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e JoinChainRequestValidationError) ErrorName() string { return "JoinChainRequestValidationError" } + +// Error satisfies the builtin error interface +func (e JoinChainRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sJoinChainRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = JoinChainRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = JoinChainRequestValidationError{} + +// Validate checks the field values on GetConfigBlockRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetConfigBlockRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetConfigBlockRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetConfigBlockRequestMultiError, or nil if none found. +func (m *GetConfigBlockRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetConfigBlockRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if len(errors) > 0 { + return GetConfigBlockRequestMultiError(errors) + } + + return nil +} + +// GetConfigBlockRequestMultiError is an error wrapping multiple validation +// errors returned by GetConfigBlockRequest.ValidateAll() if the designated +// constraints aren't met. +type GetConfigBlockRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetConfigBlockRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetConfigBlockRequestMultiError) AllErrors() []error { return m } + +// GetConfigBlockRequestValidationError is the validation error returned by +// GetConfigBlockRequest.Validate if the designated constraints aren't met. +type GetConfigBlockRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetConfigBlockRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetConfigBlockRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetConfigBlockRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetConfigBlockRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetConfigBlockRequestValidationError) ErrorName() string { + return "GetConfigBlockRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetConfigBlockRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetConfigBlockRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetConfigBlockRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetConfigBlockRequestValidationError{} + +// Validate checks the field values on GetChannelConfigRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetChannelConfigRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetChannelConfigRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetChannelConfigRequestMultiError, or nil if none found. +func (m *GetChannelConfigRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetChannelConfigRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if len(errors) > 0 { + return GetChannelConfigRequestMultiError(errors) + } + + return nil +} + +// GetChannelConfigRequestMultiError is an error wrapping multiple validation +// errors returned by GetChannelConfigRequest.ValidateAll() if the designated +// constraints aren't met. +type GetChannelConfigRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetChannelConfigRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetChannelConfigRequestMultiError) AllErrors() []error { return m } + +// GetChannelConfigRequestValidationError is the validation error returned by +// GetChannelConfigRequest.Validate if the designated constraints aren't met. +type GetChannelConfigRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetChannelConfigRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetChannelConfigRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetChannelConfigRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetChannelConfigRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetChannelConfigRequestValidationError) ErrorName() string { + return "GetChannelConfigRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetChannelConfigRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetChannelConfigRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetChannelConfigRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetChannelConfigRequestValidationError{} diff --git a/client/chaincode/system/cscc.proto b/service/systemcc/cscc/cscc.proto similarity index 68% rename from client/chaincode/system/cscc.proto rename to service/systemcc/cscc/cscc.proto index 9fa61dc0..304cd1a5 100644 --- a/client/chaincode/system/cscc.proto +++ b/service/systemcc/cscc/cscc.proto @@ -1,13 +1,13 @@ syntax = "proto3"; -package hlfsdk.client.chaincode.system; +package hlfsdk.service.systemcc.cscc; -option go_package = "hlfsdk/client/chaincode/system"; +option go_package = "github.com/s7techlab/hlf-sdk-go/service/systemcc/cscc"; -import "common/common.proto"; -import "common/configtx.proto"; -import "peer/query.proto"; +import "hyperledger/fabric-protos/common/common.proto"; +import "hyperledger/fabric-protos/common/configtx.proto"; +import "hyperledger/fabric-protos/peer/query.proto"; import "google/protobuf/empty.proto"; import "google/api/annotations.proto"; @@ -17,28 +17,28 @@ service CSCCService { // GetChainInfo allows joining channel using presented genesis block rpc JoinChain (JoinChainRequest) returns (google.protobuf.Empty) { option (google.api.http) = { - post: "/cscc/joinchain" + post: "/systemcc/cscc/joinchain" body: "*" }; } rpc GetChannels(google.protobuf.Empty) returns (protos.ChannelQueryResponse) { option (google.api.http) = { - get: "/cscc/chains" + get: "/systemcc/cscc/chains" }; } // GetConfigBlock returns genesis block of channel rpc GetConfigBlock (GetConfigBlockRequest) returns (common.Block) { option (google.api.http) = { - get: "/cscc/chains/{channel}" + get: "/systemcc/cscc/chains/{channel}" }; } // GetChannelConfig returns channel configuration rpc GetChannelConfig (GetChannelConfigRequest) returns (common.Config) { option (google.api.http) = { - get: "/cscc/chains/{channel}/config" + get: "/systemcc/cscc/chains/{channel}/config" }; } } diff --git a/client/chaincode/system/cscc.swagger.json b/service/systemcc/cscc/cscc.swagger.json similarity index 78% rename from client/chaincode/system/cscc.swagger.json rename to service/systemcc/cscc/cscc.swagger.json index 5231c03c..050248ef 100644 --- a/client/chaincode/system/cscc.swagger.json +++ b/service/systemcc/cscc/cscc.swagger.json @@ -1,13 +1,9 @@ { "swagger": "2.0", "info": { - "title": "cscc.proto", + "title": "systemcc/cscc/cscc.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], @@ -15,15 +11,21 @@ "application/json" ], "paths": { - "/cscc/chains": { + "/systemcc/cscc/chains": { "get": { - "operationId": "GetChannels", + "operationId": "CSCCService_GetChannels", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosChannelQueryResponse" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -31,16 +33,22 @@ ] } }, - "/cscc/chains/{channel}": { + "/systemcc/cscc/chains/{channel}": { "get": { "summary": "GetConfigBlock returns genesis block of channel", - "operationId": "GetConfigBlock", + "operationId": "CSCCService_GetConfigBlock", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/commonBlock" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -56,16 +64,22 @@ ] } }, - "/cscc/chains/{channel}/config": { + "/systemcc/cscc/chains/{channel}/config": { "get": { "summary": "GetChannelConfig returns channel configuration", - "operationId": "GetChannelConfig", + "operationId": "CSCCService_GetChannelConfig", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/commonConfig" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -81,16 +95,22 @@ ] } }, - "/cscc/joinchain": { + "/systemcc/cscc/joinchain": { "post": { "summary": "GetChainInfo allows joining channel using presented genesis block", - "operationId": "JoinChain", + "operationId": "CSCCService_JoinChain", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -99,7 +119,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/systemJoinChainRequest" + "$ref": "#/definitions/csccJoinChainRequest" } } ], @@ -257,6 +277,29 @@ }, "title": "Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support\nmultiple policy engines, this is typed as a oneof for now" }, + "csccJoinChainRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "genesis_block": { + "$ref": "#/definitions/commonBlock" + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, "protosChannelInfo": { "type": "object", "properties": { @@ -278,14 +321,24 @@ }, "title": "ChannelQueryResponse returns information about each channel that pertains\nto a query in lscc.go, such as GetChannels (returns all channels for a\ngiven peer)" }, - "systemJoinChainRequest": { + "runtimeError": { "type": "object", "properties": { - "channel": { + "error": { "type": "string" }, - "genesis_block": { - "$ref": "#/definitions/commonBlock" + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } } } } diff --git a/client/chaincode/system/lifecycle.go b/service/systemcc/lifecycle/lifecycle.go similarity index 63% rename from client/chaincode/system/lifecycle.go rename to service/systemcc/lifecycle/lifecycle.go index 51b4be1f..b9f38918 100644 --- a/client/chaincode/system/lifecycle.go +++ b/service/systemcc/lifecycle/lifecycle.go @@ -1,4 +1,4 @@ -package system +package lifecycle import ( "context" @@ -9,40 +9,42 @@ import ( lifecyclecc "github.com/hyperledger/fabric/core/chaincode/lifecycle" "github.com/s7techlab/hlf-sdk-go/api" + "github.com/s7techlab/hlf-sdk-go/client/chaincode" "github.com/s7techlab/hlf-sdk-go/client/tx" + "github.com/s7techlab/hlf-sdk-go/service" ) //go:embed lifecycle.swagger.json -var LifecycleServiceSwagger []byte +var Swagger []byte type ( - LifecycleService struct { + Service struct { UnimplementedLifecycleServiceServer Invoker api.Invoker } ) -func NewLifecycle(invoker api.Invoker) *LifecycleService { - return &LifecycleService{ +func NewLifecycle(invoker api.Invoker) *Service { + return &Service{ Invoker: invoker, } } -func (l *LifecycleService) ServiceDef() ServiceDef { - return NewServiceDef( +func (l *Service) ServiceDef() *service.Def { + return service.NewDef( _LifecycleService_serviceDesc.ServiceName, - LifecycleServiceSwagger, + Swagger, &_LifecycleService_serviceDesc, l, RegisterLifecycleServiceHandlerFromEndpoint, ) } -func (l *LifecycleService) QueryInstalledChaincodes(ctx context.Context, _ *empty.Empty) (*lifecycleproto.QueryInstalledChaincodesResult, error) { +func (l *Service) QueryInstalledChaincodes(ctx context.Context, _ *empty.Empty) (*lifecycleproto.QueryInstalledChaincodesResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - ``, LifecycleName, + ``, chaincode.Lifecycle, []interface{}{lifecyclecc.QueryInstalledChaincodesFuncName, []byte{}}, &lifecycleproto.QueryInstalledChaincodesResult{}) if err != nil { @@ -51,10 +53,10 @@ func (l *LifecycleService) QueryInstalledChaincodes(ctx context.Context, _ *empt return res.(*lifecycleproto.QueryInstalledChaincodesResult), nil } -func (l *LifecycleService) QueryInstalledChaincode(ctx context.Context, args *lifecycleproto.QueryInstalledChaincodeArgs) (*lifecycleproto.QueryInstalledChaincodeResult, error) { +func (l *Service) QueryInstalledChaincode(ctx context.Context, args *lifecycleproto.QueryInstalledChaincodeArgs) (*lifecycleproto.QueryInstalledChaincodeResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - ``, LifecycleName, + ``, chaincode.Lifecycle, []interface{}{lifecyclecc.QueryInstalledChaincodeFuncName, args}, &lifecycleproto.QueryInstalledChaincodeResult{}) if err != nil { @@ -63,10 +65,10 @@ func (l *LifecycleService) QueryInstalledChaincode(ctx context.Context, args *li return res.(*lifecycleproto.QueryInstalledChaincodeResult), nil } -func (l *LifecycleService) InstallChaincode(ctx context.Context, args *lifecycleproto.InstallChaincodeArgs) (*lifecycleproto.InstallChaincodeResult, error) { +func (l *Service) InstallChaincode(ctx context.Context, args *lifecycleproto.InstallChaincodeArgs) (*lifecycleproto.InstallChaincodeResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - ``, LifecycleName, + ``, chaincode.Lifecycle, []interface{}{lifecyclecc.InstallChaincodeFuncName, args}, &lifecycleproto.InstallChaincodeResult{}) if err != nil { @@ -75,7 +77,7 @@ func (l *LifecycleService) InstallChaincode(ctx context.Context, args *lifecycle return res.(*lifecycleproto.InstallChaincodeResult), nil } -func (l *LifecycleService) ApproveChaincodeDefinitionForMyOrg(ctx context.Context, +func (l *Service) ApproveChaincodeDefinitionForMyOrg(ctx context.Context, approveChaincodeDefinitionForMyOrg *ApproveChaincodeDefinitionForMyOrgRequest) (*empty.Empty, error) { // approve method should be endorsed only on local msp peer @@ -93,7 +95,7 @@ func (l *LifecycleService) ApproveChaincodeDefinitionForMyOrg(ctx context.Contex _, _, err = l.Invoker.Invoke( ctxWithEndorserSpecified, approveChaincodeDefinitionForMyOrg.Channel, - LifecycleName, + chaincode.Lifecycle, args, nil, nil, ``) if err != nil { return nil, err @@ -102,10 +104,10 @@ func (l *LifecycleService) ApproveChaincodeDefinitionForMyOrg(ctx context.Contex return nil, err } -func (l *LifecycleService) QueryApprovedChaincodeDefinition(ctx context.Context, queryApprovedChaincodeDefinition *QueryApprovedChaincodeDefinitionRequest) (*lifecycleproto.QueryApprovedChaincodeDefinitionResult, error) { +func (l *Service) QueryApprovedChaincodeDefinition(ctx context.Context, queryApprovedChaincodeDefinition *QueryApprovedChaincodeDefinitionRequest) (*lifecycleproto.QueryApprovedChaincodeDefinitionResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - queryApprovedChaincodeDefinition.Channel, LifecycleName, + queryApprovedChaincodeDefinition.Channel, chaincode.Lifecycle, []interface{}{lifecyclecc.QueryApprovedChaincodeDefinitionFuncName, queryApprovedChaincodeDefinition.Args}, &lifecycleproto.QueryApprovedChaincodeDefinitionResult{}) if err != nil { @@ -114,11 +116,11 @@ func (l *LifecycleService) QueryApprovedChaincodeDefinition(ctx context.Context, return res.(*lifecycleproto.QueryApprovedChaincodeDefinitionResult), nil } -func (l *LifecycleService) CheckCommitReadiness(ctx context.Context, checkCommitReadiness *CheckCommitReadinessRequest) ( +func (l *Service) CheckCommitReadiness(ctx context.Context, checkCommitReadiness *CheckCommitReadinessRequest) ( *lifecycleproto.CheckCommitReadinessResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - checkCommitReadiness.Channel, LifecycleName, + checkCommitReadiness.Channel, chaincode.Lifecycle, []interface{}{lifecyclecc.CheckCommitReadinessFuncName, checkCommitReadiness.Args}, &lifecycleproto.CheckCommitReadinessResult{}) if err != nil { @@ -127,10 +129,10 @@ func (l *LifecycleService) CheckCommitReadiness(ctx context.Context, checkCommit return res.(*lifecycleproto.CheckCommitReadinessResult), nil } -func (l *LifecycleService) CommitChaincodeDefinition(ctx context.Context, commitChaincodeDefinition *CommitChaincodeDefinitionRequest) (*lifecycleproto.CommitChaincodeDefinitionResult, error) { +func (l *Service) CommitChaincodeDefinition(ctx context.Context, commitChaincodeDefinition *CommitChaincodeDefinitionRequest) (*lifecycleproto.CommitChaincodeDefinitionResult, error) { res, err := tx.InvokeProto(ctx, l.Invoker, - commitChaincodeDefinition.Channel, LifecycleName, + commitChaincodeDefinition.Channel, chaincode.Lifecycle, []interface{}{lifecyclecc.CommitChaincodeDefinitionFuncName, commitChaincodeDefinition.Args}, &lifecycleproto.CommitChaincodeDefinitionResult{}) if err != nil { @@ -139,10 +141,10 @@ func (l *LifecycleService) CommitChaincodeDefinition(ctx context.Context, commit return res.(*lifecycleproto.CommitChaincodeDefinitionResult), nil } -func (l *LifecycleService) QueryChaincodeDefinition(ctx context.Context, queryChaincodeDefinition *QueryChaincodeDefinitionRequest) (*lifecycleproto.QueryChaincodeDefinitionResult, error) { +func (l *Service) QueryChaincodeDefinition(ctx context.Context, queryChaincodeDefinition *QueryChaincodeDefinitionRequest) (*lifecycleproto.QueryChaincodeDefinitionResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - queryChaincodeDefinition.Channel, LifecycleName, + queryChaincodeDefinition.Channel, chaincode.Lifecycle, []interface{}{lifecyclecc.QueryChaincodeDefinitionFuncName, queryChaincodeDefinition.Args}, &lifecycleproto.QueryChaincodeDefinitionResult{}) if err != nil { @@ -151,10 +153,10 @@ func (l *LifecycleService) QueryChaincodeDefinition(ctx context.Context, queryCh return res.(*lifecycleproto.QueryChaincodeDefinitionResult), nil } -func (l *LifecycleService) QueryChaincodeDefinitions(ctx context.Context, queryChaincodeDefinitions *QueryChaincodeDefinitionsRequest) (*lifecycleproto.QueryChaincodeDefinitionsResult, error) { +func (l *Service) QueryChaincodeDefinitions(ctx context.Context, queryChaincodeDefinitions *QueryChaincodeDefinitionsRequest) (*lifecycleproto.QueryChaincodeDefinitionsResult, error) { res, err := tx.QueryProto(ctx, l.Invoker, - queryChaincodeDefinitions.Channel, LifecycleName, + queryChaincodeDefinitions.Channel, chaincode.Lifecycle, []interface{}{lifecyclecc.QueryChaincodeDefinitionsFuncName, queryChaincodeDefinitions.Args}, &lifecycleproto.QueryChaincodeDefinitionsResult{}) if err != nil { diff --git a/client/chaincode/system/lifecycle.pb.go b/service/systemcc/lifecycle/lifecycle.pb.go similarity index 58% rename from client/chaincode/system/lifecycle.pb.go rename to service/systemcc/lifecycle/lifecycle.pb.go index a0345d4e..8a9a807d 100644 --- a/client/chaincode/system/lifecycle.pb.go +++ b/service/systemcc/lifecycle/lifecycle.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.7.1 -// source: lifecycle.proto +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: systemcc/lifecycle/lifecycle.proto -package system +package lifecycle import ( context "context" - empty "github.com/golang/protobuf/ptypes/empty" lifecycle "github.com/hyperledger/fabric-protos-go/peer/lifecycle" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -16,6 +15,7 @@ import ( status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -39,7 +39,7 @@ type ApproveChaincodeDefinitionForMyOrgRequest struct { func (x *ApproveChaincodeDefinitionForMyOrgRequest) Reset() { *x = ApproveChaincodeDefinitionForMyOrgRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lifecycle_proto_msgTypes[0] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -52,7 +52,7 @@ func (x *ApproveChaincodeDefinitionForMyOrgRequest) String() string { func (*ApproveChaincodeDefinitionForMyOrgRequest) ProtoMessage() {} func (x *ApproveChaincodeDefinitionForMyOrgRequest) ProtoReflect() protoreflect.Message { - mi := &file_lifecycle_proto_msgTypes[0] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -65,7 +65,7 @@ func (x *ApproveChaincodeDefinitionForMyOrgRequest) ProtoReflect() protoreflect. // Deprecated: Use ApproveChaincodeDefinitionForMyOrgRequest.ProtoReflect.Descriptor instead. func (*ApproveChaincodeDefinitionForMyOrgRequest) Descriptor() ([]byte, []int) { - return file_lifecycle_proto_rawDescGZIP(), []int{0} + return file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP(), []int{0} } func (x *ApproveChaincodeDefinitionForMyOrgRequest) GetChannel() string { @@ -94,7 +94,7 @@ type QueryApprovedChaincodeDefinitionRequest struct { func (x *QueryApprovedChaincodeDefinitionRequest) Reset() { *x = QueryApprovedChaincodeDefinitionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lifecycle_proto_msgTypes[1] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107,7 +107,7 @@ func (x *QueryApprovedChaincodeDefinitionRequest) String() string { func (*QueryApprovedChaincodeDefinitionRequest) ProtoMessage() {} func (x *QueryApprovedChaincodeDefinitionRequest) ProtoReflect() protoreflect.Message { - mi := &file_lifecycle_proto_msgTypes[1] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120,7 +120,7 @@ func (x *QueryApprovedChaincodeDefinitionRequest) ProtoReflect() protoreflect.Me // Deprecated: Use QueryApprovedChaincodeDefinitionRequest.ProtoReflect.Descriptor instead. func (*QueryApprovedChaincodeDefinitionRequest) Descriptor() ([]byte, []int) { - return file_lifecycle_proto_rawDescGZIP(), []int{1} + return file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP(), []int{1} } func (x *QueryApprovedChaincodeDefinitionRequest) GetChannel() string { @@ -149,7 +149,7 @@ type CheckCommitReadinessRequest struct { func (x *CheckCommitReadinessRequest) Reset() { *x = CheckCommitReadinessRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lifecycle_proto_msgTypes[2] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -162,7 +162,7 @@ func (x *CheckCommitReadinessRequest) String() string { func (*CheckCommitReadinessRequest) ProtoMessage() {} func (x *CheckCommitReadinessRequest) ProtoReflect() protoreflect.Message { - mi := &file_lifecycle_proto_msgTypes[2] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -175,7 +175,7 @@ func (x *CheckCommitReadinessRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckCommitReadinessRequest.ProtoReflect.Descriptor instead. func (*CheckCommitReadinessRequest) Descriptor() ([]byte, []int) { - return file_lifecycle_proto_rawDescGZIP(), []int{2} + return file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP(), []int{2} } func (x *CheckCommitReadinessRequest) GetChannel() string { @@ -204,7 +204,7 @@ type CommitChaincodeDefinitionRequest struct { func (x *CommitChaincodeDefinitionRequest) Reset() { *x = CommitChaincodeDefinitionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lifecycle_proto_msgTypes[3] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -217,7 +217,7 @@ func (x *CommitChaincodeDefinitionRequest) String() string { func (*CommitChaincodeDefinitionRequest) ProtoMessage() {} func (x *CommitChaincodeDefinitionRequest) ProtoReflect() protoreflect.Message { - mi := &file_lifecycle_proto_msgTypes[3] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -230,7 +230,7 @@ func (x *CommitChaincodeDefinitionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CommitChaincodeDefinitionRequest.ProtoReflect.Descriptor instead. func (*CommitChaincodeDefinitionRequest) Descriptor() ([]byte, []int) { - return file_lifecycle_proto_rawDescGZIP(), []int{3} + return file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP(), []int{3} } func (x *CommitChaincodeDefinitionRequest) GetChannel() string { @@ -259,7 +259,7 @@ type QueryChaincodeDefinitionRequest struct { func (x *QueryChaincodeDefinitionRequest) Reset() { *x = QueryChaincodeDefinitionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lifecycle_proto_msgTypes[4] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -272,7 +272,7 @@ func (x *QueryChaincodeDefinitionRequest) String() string { func (*QueryChaincodeDefinitionRequest) ProtoMessage() {} func (x *QueryChaincodeDefinitionRequest) ProtoReflect() protoreflect.Message { - mi := &file_lifecycle_proto_msgTypes[4] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -285,7 +285,7 @@ func (x *QueryChaincodeDefinitionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryChaincodeDefinitionRequest.ProtoReflect.Descriptor instead. func (*QueryChaincodeDefinitionRequest) Descriptor() ([]byte, []int) { - return file_lifecycle_proto_rawDescGZIP(), []int{4} + return file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP(), []int{4} } func (x *QueryChaincodeDefinitionRequest) GetChannel() string { @@ -314,7 +314,7 @@ type QueryChaincodeDefinitionsRequest struct { func (x *QueryChaincodeDefinitionsRequest) Reset() { *x = QueryChaincodeDefinitionsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lifecycle_proto_msgTypes[5] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -327,7 +327,7 @@ func (x *QueryChaincodeDefinitionsRequest) String() string { func (*QueryChaincodeDefinitionsRequest) ProtoMessage() {} func (x *QueryChaincodeDefinitionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_lifecycle_proto_msgTypes[5] + mi := &file_systemcc_lifecycle_lifecycle_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -340,7 +340,7 @@ func (x *QueryChaincodeDefinitionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryChaincodeDefinitionsRequest.ProtoReflect.Descriptor instead. func (*QueryChaincodeDefinitionsRequest) Descriptor() ([]byte, []int) { - return file_lifecycle_proto_rawDescGZIP(), []int{5} + return file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP(), []int{5} } func (x *QueryChaincodeDefinitionsRequest) GetChannel() string { @@ -357,190 +357,199 @@ func (x *QueryChaincodeDefinitionsRequest) GetArgs() *lifecycle.QueryChaincodeDe return nil } -var File_lifecycle_proto protoreflect.FileDescriptor - -var file_lifecycle_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x1e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x1a, 0x1e, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, - 0x65, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x01, 0x0a, - 0x29, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, +var File_systemcc_lifecycle_lifecycle_proto protoreflect.FileDescriptor + +var file_systemcc_lifecycle_lifecycle_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, + 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x23, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x69, + 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x63, 0x63, 0x1a, 0x38, 0x68, 0x79, 0x70, 0x65, 0x72, + 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, + 0x63, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, + 0x01, 0x0a, 0x29, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, + 0x4d, 0x79, 0x4f, 0x72, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x45, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x4d, 0x79, - 0x4f, 0x72, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x45, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x41, - 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, - 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x4d, 0x79, 0x4f, 0x72, - 0x67, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x27, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x4f, 0x72, 0x67, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x88, 0x01, + 0x0a, 0x27, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x12, 0x43, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2f, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, + 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x70, 0x0a, 0x1b, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x12, 0x43, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2f, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x6c, 0x12, 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7a, 0x0a, 0x20, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, + 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x3c, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, + 0x6c, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, 0x67, 0x73, - 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x70, 0x0a, 0x1b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, - 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x41, 0x72, - 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7a, 0x0a, 0x20, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x3c, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, - 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, - 0x61, 0x72, 0x67, 0x73, 0x22, 0x78, 0x0a, 0x1f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x12, 0x3b, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7a, - 0x0a, 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x3c, 0x0a, 0x04, - 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6c, 0x69, 0x66, - 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x32, 0xc4, 0x0b, 0x0a, 0x10, 0x4c, - 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x7c, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, - 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x29, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x78, 0x0a, 0x1f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x12, 0x3b, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, + 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x7a, 0x0a, 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x3c, + 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6c, + 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x32, 0x89, 0x0c, 0x0a, + 0x10, 0x4c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x7c, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, + 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x29, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, + 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, + 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, + 0x97, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, + 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x2e, 0x6c, 0x69, + 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x41, + 0x72, 0x67, 0x73, 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1d, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, - 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x97, 0x01, - 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x2e, 0x6c, 0x69, 0x66, 0x65, - 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6c, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x41, 0x72, 0x67, - 0x73, 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x2a, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x70, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x78, 0x0a, 0x10, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x69, - 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x21, 0x2e, 0x6c, - 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, - 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, - 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x3a, 0x01, - 0x2a, 0x12, 0xb1, 0x01, 0x0a, 0x22, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x46, 0x6f, 0x72, 0x4d, 0x79, 0x4f, 0x72, 0x67, 0x12, 0x49, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, - 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, - 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x4d, 0x79, 0x4f, 0x72, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x28, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x22, 0x22, 0x1d, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x72, 0x6f, - 0x76, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0xc9, 0x01, 0x0a, 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, - 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x2e, 0x68, 0x6c, 0x66, - 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x2a, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, + 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x70, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x78, 0x0a, 0x10, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x2e, + 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, + 0x6c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x21, + 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x6c, + 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x73, 0x12, 0xb6, 0x01, 0x0a, 0x22, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x4d, 0x79, 0x4f, 0x72, 0x67, 0x12, 0x4e, 0x2e, 0x68, 0x6c, 0x66, + 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x63, 0x63, + 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x4d, 0x79, + 0x4f, 0x72, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, + 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x12, 0xce, 0x01, 0x0a, + 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x4c, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x69, 0x66, 0x65, + 0x63, 0x79, 0x63, 0x6c, 0x65, 0x63, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, + 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, + 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x31, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x1e, - 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x3a, 0x01, - 0x2a, 0x12, 0xa2, 0x01, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x2e, 0x68, 0x6c, 0x66, - 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, - 0x63, 0x6c, 0x65, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, - 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x26, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, - 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2d, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, - 0x65, 0x73, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0xa7, 0x01, 0x0a, 0x19, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, - 0x6c, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x6c, 0x69, 0x66, - 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x3a, 0x01, 0x2a, - 0x12, 0xa4, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, - 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x2e, - 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, - 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, - 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x16, 0x22, 0x11, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x6f, - 0x6d, 0x6d, 0x69, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0xa7, 0x01, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, - 0x63, 0x6c, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x6c, 0x69, - 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x3a, 0x01, - 0x2a, 0x42, 0x20, 0x5a, 0x1e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2f, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x74, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, + 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x64, 0x12, 0xa7, 0x01, + 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, + 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x40, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, + 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x63, 0x63, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, + 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x6c, 0x69, 0x66, + 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2d, 0x72, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x12, 0xb7, 0x01, 0x0a, 0x19, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, + 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x63, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, + 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, + 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x12, 0xba, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, + 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, + 0x6c, 0x65, 0x63, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, + 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x6c, 0x69, 0x66, + 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0xb7, + 0x01, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x2e, 0x68, + 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x63, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, + 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x6c, 0x69, 0x66, + 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x37, 0x74, 0x65, 0x63, 0x68, 0x6c, 0x61, 0x62, + 0x2f, 0x68, 0x6c, 0x66, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x6c, 0x69, 0x66, + 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_lifecycle_proto_rawDescOnce sync.Once - file_lifecycle_proto_rawDescData = file_lifecycle_proto_rawDesc + file_systemcc_lifecycle_lifecycle_proto_rawDescOnce sync.Once + file_systemcc_lifecycle_lifecycle_proto_rawDescData = file_systemcc_lifecycle_lifecycle_proto_rawDesc ) -func file_lifecycle_proto_rawDescGZIP() []byte { - file_lifecycle_proto_rawDescOnce.Do(func() { - file_lifecycle_proto_rawDescData = protoimpl.X.CompressGZIP(file_lifecycle_proto_rawDescData) +func file_systemcc_lifecycle_lifecycle_proto_rawDescGZIP() []byte { + file_systemcc_lifecycle_lifecycle_proto_rawDescOnce.Do(func() { + file_systemcc_lifecycle_lifecycle_proto_rawDescData = protoimpl.X.CompressGZIP(file_systemcc_lifecycle_lifecycle_proto_rawDescData) }) - return file_lifecycle_proto_rawDescData + return file_systemcc_lifecycle_lifecycle_proto_rawDescData } -var file_lifecycle_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_lifecycle_proto_goTypes = []interface{}{ - (*ApproveChaincodeDefinitionForMyOrgRequest)(nil), // 0: hlfsdk.client.chaincode.system.ApproveChaincodeDefinitionForMyOrgRequest - (*QueryApprovedChaincodeDefinitionRequest)(nil), // 1: hlfsdk.client.chaincode.system.QueryApprovedChaincodeDefinitionRequest - (*CheckCommitReadinessRequest)(nil), // 2: hlfsdk.client.chaincode.system.CheckCommitReadinessRequest - (*CommitChaincodeDefinitionRequest)(nil), // 3: hlfsdk.client.chaincode.system.CommitChaincodeDefinitionRequest - (*QueryChaincodeDefinitionRequest)(nil), // 4: hlfsdk.client.chaincode.system.QueryChaincodeDefinitionRequest - (*QueryChaincodeDefinitionsRequest)(nil), // 5: hlfsdk.client.chaincode.system.QueryChaincodeDefinitionsRequest +var file_systemcc_lifecycle_lifecycle_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_systemcc_lifecycle_lifecycle_proto_goTypes = []interface{}{ + (*ApproveChaincodeDefinitionForMyOrgRequest)(nil), // 0: hlfsdk.service.systemcc.lifecyclecc.ApproveChaincodeDefinitionForMyOrgRequest + (*QueryApprovedChaincodeDefinitionRequest)(nil), // 1: hlfsdk.service.systemcc.lifecyclecc.QueryApprovedChaincodeDefinitionRequest + (*CheckCommitReadinessRequest)(nil), // 2: hlfsdk.service.systemcc.lifecyclecc.CheckCommitReadinessRequest + (*CommitChaincodeDefinitionRequest)(nil), // 3: hlfsdk.service.systemcc.lifecyclecc.CommitChaincodeDefinitionRequest + (*QueryChaincodeDefinitionRequest)(nil), // 4: hlfsdk.service.systemcc.lifecyclecc.QueryChaincodeDefinitionRequest + (*QueryChaincodeDefinitionsRequest)(nil), // 5: hlfsdk.service.systemcc.lifecyclecc.QueryChaincodeDefinitionsRequest (*lifecycle.ApproveChaincodeDefinitionForMyOrgArgs)(nil), // 6: lifecycle.ApproveChaincodeDefinitionForMyOrgArgs (*lifecycle.QueryApprovedChaincodeDefinitionArgs)(nil), // 7: lifecycle.QueryApprovedChaincodeDefinitionArgs (*lifecycle.CheckCommitReadinessArgs)(nil), // 8: lifecycle.CheckCommitReadinessArgs (*lifecycle.CommitChaincodeDefinitionArgs)(nil), // 9: lifecycle.CommitChaincodeDefinitionArgs (*lifecycle.QueryChaincodeDefinitionArgs)(nil), // 10: lifecycle.QueryChaincodeDefinitionArgs (*lifecycle.QueryChaincodeDefinitionsArgs)(nil), // 11: lifecycle.QueryChaincodeDefinitionsArgs - (*empty.Empty)(nil), // 12: google.protobuf.Empty + (*emptypb.Empty)(nil), // 12: google.protobuf.Empty (*lifecycle.QueryInstalledChaincodeArgs)(nil), // 13: lifecycle.QueryInstalledChaincodeArgs (*lifecycle.InstallChaincodeArgs)(nil), // 14: lifecycle.InstallChaincodeArgs (*lifecycle.QueryInstalledChaincodesResult)(nil), // 15: lifecycle.QueryInstalledChaincodesResult @@ -552,31 +561,31 @@ var file_lifecycle_proto_goTypes = []interface{}{ (*lifecycle.QueryChaincodeDefinitionResult)(nil), // 21: lifecycle.QueryChaincodeDefinitionResult (*lifecycle.QueryChaincodeDefinitionsResult)(nil), // 22: lifecycle.QueryChaincodeDefinitionsResult } -var file_lifecycle_proto_depIdxs = []int32{ - 6, // 0: hlfsdk.client.chaincode.system.ApproveChaincodeDefinitionForMyOrgRequest.args:type_name -> lifecycle.ApproveChaincodeDefinitionForMyOrgArgs - 7, // 1: hlfsdk.client.chaincode.system.QueryApprovedChaincodeDefinitionRequest.args:type_name -> lifecycle.QueryApprovedChaincodeDefinitionArgs - 8, // 2: hlfsdk.client.chaincode.system.CheckCommitReadinessRequest.args:type_name -> lifecycle.CheckCommitReadinessArgs - 9, // 3: hlfsdk.client.chaincode.system.CommitChaincodeDefinitionRequest.args:type_name -> lifecycle.CommitChaincodeDefinitionArgs - 10, // 4: hlfsdk.client.chaincode.system.QueryChaincodeDefinitionRequest.args:type_name -> lifecycle.QueryChaincodeDefinitionArgs - 11, // 5: hlfsdk.client.chaincode.system.QueryChaincodeDefinitionsRequest.args:type_name -> lifecycle.QueryChaincodeDefinitionsArgs - 12, // 6: hlfsdk.client.chaincode.system.LifecycleService.QueryInstalledChaincodes:input_type -> google.protobuf.Empty - 13, // 7: hlfsdk.client.chaincode.system.LifecycleService.QueryInstalledChaincode:input_type -> lifecycle.QueryInstalledChaincodeArgs - 14, // 8: hlfsdk.client.chaincode.system.LifecycleService.InstallChaincode:input_type -> lifecycle.InstallChaincodeArgs - 0, // 9: hlfsdk.client.chaincode.system.LifecycleService.ApproveChaincodeDefinitionForMyOrg:input_type -> hlfsdk.client.chaincode.system.ApproveChaincodeDefinitionForMyOrgRequest - 1, // 10: hlfsdk.client.chaincode.system.LifecycleService.QueryApprovedChaincodeDefinition:input_type -> hlfsdk.client.chaincode.system.QueryApprovedChaincodeDefinitionRequest - 2, // 11: hlfsdk.client.chaincode.system.LifecycleService.CheckCommitReadiness:input_type -> hlfsdk.client.chaincode.system.CheckCommitReadinessRequest - 3, // 12: hlfsdk.client.chaincode.system.LifecycleService.CommitChaincodeDefinition:input_type -> hlfsdk.client.chaincode.system.CommitChaincodeDefinitionRequest - 4, // 13: hlfsdk.client.chaincode.system.LifecycleService.QueryChaincodeDefinition:input_type -> hlfsdk.client.chaincode.system.QueryChaincodeDefinitionRequest - 5, // 14: hlfsdk.client.chaincode.system.LifecycleService.QueryChaincodeDefinitions:input_type -> hlfsdk.client.chaincode.system.QueryChaincodeDefinitionsRequest - 15, // 15: hlfsdk.client.chaincode.system.LifecycleService.QueryInstalledChaincodes:output_type -> lifecycle.QueryInstalledChaincodesResult - 16, // 16: hlfsdk.client.chaincode.system.LifecycleService.QueryInstalledChaincode:output_type -> lifecycle.QueryInstalledChaincodeResult - 17, // 17: hlfsdk.client.chaincode.system.LifecycleService.InstallChaincode:output_type -> lifecycle.InstallChaincodeResult - 12, // 18: hlfsdk.client.chaincode.system.LifecycleService.ApproveChaincodeDefinitionForMyOrg:output_type -> google.protobuf.Empty - 18, // 19: hlfsdk.client.chaincode.system.LifecycleService.QueryApprovedChaincodeDefinition:output_type -> lifecycle.QueryApprovedChaincodeDefinitionResult - 19, // 20: hlfsdk.client.chaincode.system.LifecycleService.CheckCommitReadiness:output_type -> lifecycle.CheckCommitReadinessResult - 20, // 21: hlfsdk.client.chaincode.system.LifecycleService.CommitChaincodeDefinition:output_type -> lifecycle.CommitChaincodeDefinitionResult - 21, // 22: hlfsdk.client.chaincode.system.LifecycleService.QueryChaincodeDefinition:output_type -> lifecycle.QueryChaincodeDefinitionResult - 22, // 23: hlfsdk.client.chaincode.system.LifecycleService.QueryChaincodeDefinitions:output_type -> lifecycle.QueryChaincodeDefinitionsResult +var file_systemcc_lifecycle_lifecycle_proto_depIdxs = []int32{ + 6, // 0: hlfsdk.service.systemcc.lifecyclecc.ApproveChaincodeDefinitionForMyOrgRequest.args:type_name -> lifecycle.ApproveChaincodeDefinitionForMyOrgArgs + 7, // 1: hlfsdk.service.systemcc.lifecyclecc.QueryApprovedChaincodeDefinitionRequest.args:type_name -> lifecycle.QueryApprovedChaincodeDefinitionArgs + 8, // 2: hlfsdk.service.systemcc.lifecyclecc.CheckCommitReadinessRequest.args:type_name -> lifecycle.CheckCommitReadinessArgs + 9, // 3: hlfsdk.service.systemcc.lifecyclecc.CommitChaincodeDefinitionRequest.args:type_name -> lifecycle.CommitChaincodeDefinitionArgs + 10, // 4: hlfsdk.service.systemcc.lifecyclecc.QueryChaincodeDefinitionRequest.args:type_name -> lifecycle.QueryChaincodeDefinitionArgs + 11, // 5: hlfsdk.service.systemcc.lifecyclecc.QueryChaincodeDefinitionsRequest.args:type_name -> lifecycle.QueryChaincodeDefinitionsArgs + 12, // 6: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryInstalledChaincodes:input_type -> google.protobuf.Empty + 13, // 7: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryInstalledChaincode:input_type -> lifecycle.QueryInstalledChaincodeArgs + 14, // 8: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.InstallChaincode:input_type -> lifecycle.InstallChaincodeArgs + 0, // 9: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.ApproveChaincodeDefinitionForMyOrg:input_type -> hlfsdk.service.systemcc.lifecyclecc.ApproveChaincodeDefinitionForMyOrgRequest + 1, // 10: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryApprovedChaincodeDefinition:input_type -> hlfsdk.service.systemcc.lifecyclecc.QueryApprovedChaincodeDefinitionRequest + 2, // 11: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.CheckCommitReadiness:input_type -> hlfsdk.service.systemcc.lifecyclecc.CheckCommitReadinessRequest + 3, // 12: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.CommitChaincodeDefinition:input_type -> hlfsdk.service.systemcc.lifecyclecc.CommitChaincodeDefinitionRequest + 4, // 13: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryChaincodeDefinition:input_type -> hlfsdk.service.systemcc.lifecyclecc.QueryChaincodeDefinitionRequest + 5, // 14: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryChaincodeDefinitions:input_type -> hlfsdk.service.systemcc.lifecyclecc.QueryChaincodeDefinitionsRequest + 15, // 15: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryInstalledChaincodes:output_type -> lifecycle.QueryInstalledChaincodesResult + 16, // 16: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryInstalledChaincode:output_type -> lifecycle.QueryInstalledChaincodeResult + 17, // 17: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.InstallChaincode:output_type -> lifecycle.InstallChaincodeResult + 12, // 18: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.ApproveChaincodeDefinitionForMyOrg:output_type -> google.protobuf.Empty + 18, // 19: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryApprovedChaincodeDefinition:output_type -> lifecycle.QueryApprovedChaincodeDefinitionResult + 19, // 20: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.CheckCommitReadiness:output_type -> lifecycle.CheckCommitReadinessResult + 20, // 21: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.CommitChaincodeDefinition:output_type -> lifecycle.CommitChaincodeDefinitionResult + 21, // 22: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryChaincodeDefinition:output_type -> lifecycle.QueryChaincodeDefinitionResult + 22, // 23: hlfsdk.service.systemcc.lifecyclecc.LifecycleService.QueryChaincodeDefinitions:output_type -> lifecycle.QueryChaincodeDefinitionsResult 15, // [15:24] is the sub-list for method output_type 6, // [6:15] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name @@ -584,13 +593,13 @@ var file_lifecycle_proto_depIdxs = []int32{ 0, // [0:6] is the sub-list for field type_name } -func init() { file_lifecycle_proto_init() } -func file_lifecycle_proto_init() { - if File_lifecycle_proto != nil { +func init() { file_systemcc_lifecycle_lifecycle_proto_init() } +func file_systemcc_lifecycle_lifecycle_proto_init() { + if File_systemcc_lifecycle_lifecycle_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_lifecycle_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lifecycle_lifecycle_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ApproveChaincodeDefinitionForMyOrgRequest); i { case 0: return &v.state @@ -602,7 +611,7 @@ func file_lifecycle_proto_init() { return nil } } - file_lifecycle_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lifecycle_lifecycle_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryApprovedChaincodeDefinitionRequest); i { case 0: return &v.state @@ -614,7 +623,7 @@ func file_lifecycle_proto_init() { return nil } } - file_lifecycle_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lifecycle_lifecycle_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckCommitReadinessRequest); i { case 0: return &v.state @@ -626,7 +635,7 @@ func file_lifecycle_proto_init() { return nil } } - file_lifecycle_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lifecycle_lifecycle_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CommitChaincodeDefinitionRequest); i { case 0: return &v.state @@ -638,7 +647,7 @@ func file_lifecycle_proto_init() { return nil } } - file_lifecycle_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lifecycle_lifecycle_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionRequest); i { case 0: return &v.state @@ -650,7 +659,7 @@ func file_lifecycle_proto_init() { return nil } } - file_lifecycle_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lifecycle_lifecycle_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionsRequest); i { case 0: return &v.state @@ -667,20 +676,20 @@ func file_lifecycle_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_lifecycle_proto_rawDesc, + RawDescriptor: file_systemcc_lifecycle_lifecycle_proto_rawDesc, NumEnums: 0, NumMessages: 6, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_lifecycle_proto_goTypes, - DependencyIndexes: file_lifecycle_proto_depIdxs, - MessageInfos: file_lifecycle_proto_msgTypes, + GoTypes: file_systemcc_lifecycle_lifecycle_proto_goTypes, + DependencyIndexes: file_systemcc_lifecycle_lifecycle_proto_depIdxs, + MessageInfos: file_systemcc_lifecycle_lifecycle_proto_msgTypes, }.Build() - File_lifecycle_proto = out.File - file_lifecycle_proto_rawDesc = nil - file_lifecycle_proto_goTypes = nil - file_lifecycle_proto_depIdxs = nil + File_systemcc_lifecycle_lifecycle_proto = out.File + file_systemcc_lifecycle_lifecycle_proto_rawDesc = nil + file_systemcc_lifecycle_lifecycle_proto_goTypes = nil + file_systemcc_lifecycle_lifecycle_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. @@ -696,13 +705,13 @@ const _ = grpc.SupportPackageIsVersion6 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type LifecycleServiceClient interface { // QueryInstalledChaincodes returns chaincode packages list installed on peer - QueryInstalledChaincodes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*lifecycle.QueryInstalledChaincodesResult, error) + QueryInstalledChaincodes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*lifecycle.QueryInstalledChaincodesResult, error) // QueryInstalledChaincode returns chaincode package installed on peer QueryInstalledChaincode(ctx context.Context, in *lifecycle.QueryInstalledChaincodeArgs, opts ...grpc.CallOption) (*lifecycle.QueryInstalledChaincodeResult, error) // InstallChaincode sets up chaincode package on peer InstallChaincode(ctx context.Context, in *lifecycle.InstallChaincodeArgs, opts ...grpc.CallOption) (*lifecycle.InstallChaincodeResult, error) // ApproveChaincodeDefinitionForMyOrg marks chaincode definition on a channel - ApproveChaincodeDefinitionForMyOrg(ctx context.Context, in *ApproveChaincodeDefinitionForMyOrgRequest, opts ...grpc.CallOption) (*empty.Empty, error) + ApproveChaincodeDefinitionForMyOrg(ctx context.Context, in *ApproveChaincodeDefinitionForMyOrgRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // QueryApprovedChaincodeDefinition returns approved chaincode definition QueryApprovedChaincodeDefinition(ctx context.Context, in *QueryApprovedChaincodeDefinitionRequest, opts ...grpc.CallOption) (*lifecycle.QueryApprovedChaincodeDefinitionResult, error) // CheckCommitReadiness returns commitments statuses of participants on chaincode definition @@ -723,9 +732,9 @@ func NewLifecycleServiceClient(cc grpc.ClientConnInterface) LifecycleServiceClie return &lifecycleServiceClient{cc} } -func (c *lifecycleServiceClient) QueryInstalledChaincodes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*lifecycle.QueryInstalledChaincodesResult, error) { +func (c *lifecycleServiceClient) QueryInstalledChaincodes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*lifecycle.QueryInstalledChaincodesResult, error) { out := new(lifecycle.QueryInstalledChaincodesResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/QueryInstalledChaincodes", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryInstalledChaincodes", in, out, opts...) if err != nil { return nil, err } @@ -734,7 +743,7 @@ func (c *lifecycleServiceClient) QueryInstalledChaincodes(ctx context.Context, i func (c *lifecycleServiceClient) QueryInstalledChaincode(ctx context.Context, in *lifecycle.QueryInstalledChaincodeArgs, opts ...grpc.CallOption) (*lifecycle.QueryInstalledChaincodeResult, error) { out := new(lifecycle.QueryInstalledChaincodeResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/QueryInstalledChaincode", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryInstalledChaincode", in, out, opts...) if err != nil { return nil, err } @@ -743,16 +752,16 @@ func (c *lifecycleServiceClient) QueryInstalledChaincode(ctx context.Context, in func (c *lifecycleServiceClient) InstallChaincode(ctx context.Context, in *lifecycle.InstallChaincodeArgs, opts ...grpc.CallOption) (*lifecycle.InstallChaincodeResult, error) { out := new(lifecycle.InstallChaincodeResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/InstallChaincode", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/InstallChaincode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *lifecycleServiceClient) ApproveChaincodeDefinitionForMyOrg(ctx context.Context, in *ApproveChaincodeDefinitionForMyOrgRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/ApproveChaincodeDefinitionForMyOrg", in, out, opts...) +func (c *lifecycleServiceClient) ApproveChaincodeDefinitionForMyOrg(ctx context.Context, in *ApproveChaincodeDefinitionForMyOrgRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/ApproveChaincodeDefinitionForMyOrg", in, out, opts...) if err != nil { return nil, err } @@ -761,7 +770,7 @@ func (c *lifecycleServiceClient) ApproveChaincodeDefinitionForMyOrg(ctx context. func (c *lifecycleServiceClient) QueryApprovedChaincodeDefinition(ctx context.Context, in *QueryApprovedChaincodeDefinitionRequest, opts ...grpc.CallOption) (*lifecycle.QueryApprovedChaincodeDefinitionResult, error) { out := new(lifecycle.QueryApprovedChaincodeDefinitionResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/QueryApprovedChaincodeDefinition", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryApprovedChaincodeDefinition", in, out, opts...) if err != nil { return nil, err } @@ -770,7 +779,7 @@ func (c *lifecycleServiceClient) QueryApprovedChaincodeDefinition(ctx context.Co func (c *lifecycleServiceClient) CheckCommitReadiness(ctx context.Context, in *CheckCommitReadinessRequest, opts ...grpc.CallOption) (*lifecycle.CheckCommitReadinessResult, error) { out := new(lifecycle.CheckCommitReadinessResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/CheckCommitReadiness", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/CheckCommitReadiness", in, out, opts...) if err != nil { return nil, err } @@ -779,7 +788,7 @@ func (c *lifecycleServiceClient) CheckCommitReadiness(ctx context.Context, in *C func (c *lifecycleServiceClient) CommitChaincodeDefinition(ctx context.Context, in *CommitChaincodeDefinitionRequest, opts ...grpc.CallOption) (*lifecycle.CommitChaincodeDefinitionResult, error) { out := new(lifecycle.CommitChaincodeDefinitionResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/CommitChaincodeDefinition", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/CommitChaincodeDefinition", in, out, opts...) if err != nil { return nil, err } @@ -788,7 +797,7 @@ func (c *lifecycleServiceClient) CommitChaincodeDefinition(ctx context.Context, func (c *lifecycleServiceClient) QueryChaincodeDefinition(ctx context.Context, in *QueryChaincodeDefinitionRequest, opts ...grpc.CallOption) (*lifecycle.QueryChaincodeDefinitionResult, error) { out := new(lifecycle.QueryChaincodeDefinitionResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/QueryChaincodeDefinition", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryChaincodeDefinition", in, out, opts...) if err != nil { return nil, err } @@ -797,7 +806,7 @@ func (c *lifecycleServiceClient) QueryChaincodeDefinition(ctx context.Context, i func (c *lifecycleServiceClient) QueryChaincodeDefinitions(ctx context.Context, in *QueryChaincodeDefinitionsRequest, opts ...grpc.CallOption) (*lifecycle.QueryChaincodeDefinitionsResult, error) { out := new(lifecycle.QueryChaincodeDefinitionsResult) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LifecycleService/QueryChaincodeDefinitions", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryChaincodeDefinitions", in, out, opts...) if err != nil { return nil, err } @@ -807,13 +816,13 @@ func (c *lifecycleServiceClient) QueryChaincodeDefinitions(ctx context.Context, // LifecycleServiceServer is the server API for LifecycleService service. type LifecycleServiceServer interface { // QueryInstalledChaincodes returns chaincode packages list installed on peer - QueryInstalledChaincodes(context.Context, *empty.Empty) (*lifecycle.QueryInstalledChaincodesResult, error) + QueryInstalledChaincodes(context.Context, *emptypb.Empty) (*lifecycle.QueryInstalledChaincodesResult, error) // QueryInstalledChaincode returns chaincode package installed on peer QueryInstalledChaincode(context.Context, *lifecycle.QueryInstalledChaincodeArgs) (*lifecycle.QueryInstalledChaincodeResult, error) // InstallChaincode sets up chaincode package on peer InstallChaincode(context.Context, *lifecycle.InstallChaincodeArgs) (*lifecycle.InstallChaincodeResult, error) // ApproveChaincodeDefinitionForMyOrg marks chaincode definition on a channel - ApproveChaincodeDefinitionForMyOrg(context.Context, *ApproveChaincodeDefinitionForMyOrgRequest) (*empty.Empty, error) + ApproveChaincodeDefinitionForMyOrg(context.Context, *ApproveChaincodeDefinitionForMyOrgRequest) (*emptypb.Empty, error) // QueryApprovedChaincodeDefinition returns approved chaincode definition QueryApprovedChaincodeDefinition(context.Context, *QueryApprovedChaincodeDefinitionRequest) (*lifecycle.QueryApprovedChaincodeDefinitionResult, error) // CheckCommitReadiness returns commitments statuses of participants on chaincode definition @@ -830,7 +839,7 @@ type LifecycleServiceServer interface { type UnimplementedLifecycleServiceServer struct { } -func (*UnimplementedLifecycleServiceServer) QueryInstalledChaincodes(context.Context, *empty.Empty) (*lifecycle.QueryInstalledChaincodesResult, error) { +func (*UnimplementedLifecycleServiceServer) QueryInstalledChaincodes(context.Context, *emptypb.Empty) (*lifecycle.QueryInstalledChaincodesResult, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryInstalledChaincodes not implemented") } func (*UnimplementedLifecycleServiceServer) QueryInstalledChaincode(context.Context, *lifecycle.QueryInstalledChaincodeArgs) (*lifecycle.QueryInstalledChaincodeResult, error) { @@ -839,7 +848,7 @@ func (*UnimplementedLifecycleServiceServer) QueryInstalledChaincode(context.Cont func (*UnimplementedLifecycleServiceServer) InstallChaincode(context.Context, *lifecycle.InstallChaincodeArgs) (*lifecycle.InstallChaincodeResult, error) { return nil, status.Errorf(codes.Unimplemented, "method InstallChaincode not implemented") } -func (*UnimplementedLifecycleServiceServer) ApproveChaincodeDefinitionForMyOrg(context.Context, *ApproveChaincodeDefinitionForMyOrgRequest) (*empty.Empty, error) { +func (*UnimplementedLifecycleServiceServer) ApproveChaincodeDefinitionForMyOrg(context.Context, *ApproveChaincodeDefinitionForMyOrgRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ApproveChaincodeDefinitionForMyOrg not implemented") } func (*UnimplementedLifecycleServiceServer) QueryApprovedChaincodeDefinition(context.Context, *QueryApprovedChaincodeDefinitionRequest) (*lifecycle.QueryApprovedChaincodeDefinitionResult, error) { @@ -863,7 +872,7 @@ func RegisterLifecycleServiceServer(s *grpc.Server, srv LifecycleServiceServer) } func _LifecycleService_QueryInstalledChaincodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -872,10 +881,10 @@ func _LifecycleService_QueryInstalledChaincodes_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/QueryInstalledChaincodes", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryInstalledChaincodes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LifecycleServiceServer).QueryInstalledChaincodes(ctx, req.(*empty.Empty)) + return srv.(LifecycleServiceServer).QueryInstalledChaincodes(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -890,7 +899,7 @@ func _LifecycleService_QueryInstalledChaincode_Handler(srv interface{}, ctx cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/QueryInstalledChaincode", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryInstalledChaincode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).QueryInstalledChaincode(ctx, req.(*lifecycle.QueryInstalledChaincodeArgs)) @@ -908,7 +917,7 @@ func _LifecycleService_InstallChaincode_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/InstallChaincode", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/InstallChaincode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).InstallChaincode(ctx, req.(*lifecycle.InstallChaincodeArgs)) @@ -926,7 +935,7 @@ func _LifecycleService_ApproveChaincodeDefinitionForMyOrg_Handler(srv interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/ApproveChaincodeDefinitionForMyOrg", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/ApproveChaincodeDefinitionForMyOrg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).ApproveChaincodeDefinitionForMyOrg(ctx, req.(*ApproveChaincodeDefinitionForMyOrgRequest)) @@ -944,7 +953,7 @@ func _LifecycleService_QueryApprovedChaincodeDefinition_Handler(srv interface{}, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/QueryApprovedChaincodeDefinition", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryApprovedChaincodeDefinition", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).QueryApprovedChaincodeDefinition(ctx, req.(*QueryApprovedChaincodeDefinitionRequest)) @@ -962,7 +971,7 @@ func _LifecycleService_CheckCommitReadiness_Handler(srv interface{}, ctx context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/CheckCommitReadiness", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/CheckCommitReadiness", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).CheckCommitReadiness(ctx, req.(*CheckCommitReadinessRequest)) @@ -980,7 +989,7 @@ func _LifecycleService_CommitChaincodeDefinition_Handler(srv interface{}, ctx co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/CommitChaincodeDefinition", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/CommitChaincodeDefinition", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).CommitChaincodeDefinition(ctx, req.(*CommitChaincodeDefinitionRequest)) @@ -998,7 +1007,7 @@ func _LifecycleService_QueryChaincodeDefinition_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/QueryChaincodeDefinition", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryChaincodeDefinition", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).QueryChaincodeDefinition(ctx, req.(*QueryChaincodeDefinitionRequest)) @@ -1016,7 +1025,7 @@ func _LifecycleService_QueryChaincodeDefinitions_Handler(srv interface{}, ctx co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LifecycleService/QueryChaincodeDefinitions", + FullMethod: "/hlfsdk.service.systemcc.lifecyclecc.LifecycleService/QueryChaincodeDefinitions", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LifecycleServiceServer).QueryChaincodeDefinitions(ctx, req.(*QueryChaincodeDefinitionsRequest)) @@ -1025,7 +1034,7 @@ func _LifecycleService_QueryChaincodeDefinitions_Handler(srv interface{}, ctx co } var _LifecycleService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hlfsdk.client.chaincode.system.LifecycleService", + ServiceName: "hlfsdk.service.systemcc.lifecyclecc.LifecycleService", HandlerType: (*LifecycleServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1066,5 +1075,5 @@ var _LifecycleService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "lifecycle.proto", + Metadata: "systemcc/lifecycle/lifecycle.proto", } diff --git a/client/chaincode/system/lifecycle.pb.gw.go b/service/systemcc/lifecycle/lifecycle.pb.gw.go similarity index 91% rename from client/chaincode/system/lifecycle.pb.gw.go rename to service/systemcc/lifecycle/lifecycle.pb.gw.go index 13684312..abad9b92 100644 --- a/client/chaincode/system/lifecycle.pb.gw.go +++ b/service/systemcc/lifecycle/lifecycle.pb.gw.go @@ -1,37 +1,42 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: lifecycle.proto +// source: systemcc/lifecycle/lifecycle.proto /* -Package system is a reverse proxy. +Package lifecycle is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package system +package lifecycle import ( "context" "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "github.com/hyperledger/fabric-protos-go/peer/lifecycle" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_LifecycleService_QueryInstalledChaincodes_0(ctx context.Context, marshaler runtime.Marshaler, client LifecycleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.QueryInstalledChaincodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -40,7 +45,7 @@ func request_LifecycleService_QueryInstalledChaincodes_0(ctx context.Context, ma } func local_request_LifecycleService_QueryInstalledChaincodes_0(ctx context.Context, marshaler runtime.Marshaler, server LifecycleServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.QueryInstalledChaincodes(ctx, &protoReq) @@ -343,11 +348,14 @@ func local_request_LifecycleService_QueryChaincodeDefinitions_0(ctx context.Cont // RegisterLifecycleServiceHandlerServer registers the http handlers for service LifecycleService to "mux". // UnaryRPC :call LifecycleServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLifecycleServiceHandlerFromEndpoint instead. func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LifecycleServiceServer) error { mux.Handle("GET", pattern_LifecycleService_QueryInstalledChaincodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -355,6 +363,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_QueryInstalledChaincodes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -368,6 +377,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("GET", pattern_LifecycleService_QueryInstalledChaincode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -375,6 +386,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_QueryInstalledChaincode_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -388,6 +400,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_InstallChaincode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -395,6 +409,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_InstallChaincode_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -408,6 +423,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_ApproveChaincodeDefinitionForMyOrg_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -415,6 +432,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_ApproveChaincodeDefinitionForMyOrg_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -428,6 +446,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_QueryApprovedChaincodeDefinition_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -435,6 +455,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_QueryApprovedChaincodeDefinition_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -448,6 +469,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_CheckCommitReadiness_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -455,6 +478,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_CheckCommitReadiness_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -468,6 +492,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_CommitChaincodeDefinition_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -475,6 +501,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_CommitChaincodeDefinition_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -488,6 +515,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_QueryChaincodeDefinition_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -495,6 +524,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_QueryChaincodeDefinition_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -508,6 +538,8 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser mux.Handle("POST", pattern_LifecycleService_QueryChaincodeDefinitions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -515,6 +547,7 @@ func RegisterLifecycleServiceHandlerServer(ctx context.Context, mux *runtime.Ser return } resp, md, err := local_request_LifecycleService_QueryChaincodeDefinitions_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -762,11 +795,11 @@ var ( pattern_LifecycleService_CheckCommitReadiness_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"lifecycle", "commit-readiness"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_LifecycleService_CommitChaincodeDefinition_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"lifecycle", "commit"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_LifecycleService_CommitChaincodeDefinition_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"lifecycle", "chaincodes", "commit"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_LifecycleService_QueryChaincodeDefinition_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"lifecycle", "commit"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_LifecycleService_QueryChaincodeDefinition_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"lifecycle", "chaincodes", "commit-check"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_LifecycleService_QueryChaincodeDefinitions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"lifecycle", "commit"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_LifecycleService_QueryChaincodeDefinitions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"lifecycle", "chaincode", "commits"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/service/systemcc/lifecycle/lifecycle.pb.validate.go b/service/systemcc/lifecycle/lifecycle.pb.validate.go new file mode 100644 index 00000000..cde82fe6 --- /dev/null +++ b/service/systemcc/lifecycle/lifecycle.pb.validate.go @@ -0,0 +1,850 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: systemcc/lifecycle/lifecycle.proto + +package lifecycle + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on +// ApproveChaincodeDefinitionForMyOrgRequest with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ApproveChaincodeDefinitionForMyOrgRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on +// ApproveChaincodeDefinitionForMyOrgRequest with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in +// ApproveChaincodeDefinitionForMyOrgRequestMultiError, or nil if none found. +func (m *ApproveChaincodeDefinitionForMyOrgRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ApproveChaincodeDefinitionForMyOrgRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetArgs()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ApproveChaincodeDefinitionForMyOrgRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ApproveChaincodeDefinitionForMyOrgRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetArgs()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ApproveChaincodeDefinitionForMyOrgRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return ApproveChaincodeDefinitionForMyOrgRequestMultiError(errors) + } + + return nil +} + +// ApproveChaincodeDefinitionForMyOrgRequestMultiError is an error wrapping +// multiple validation errors returned by +// ApproveChaincodeDefinitionForMyOrgRequest.ValidateAll() if the designated +// constraints aren't met. +type ApproveChaincodeDefinitionForMyOrgRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ApproveChaincodeDefinitionForMyOrgRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ApproveChaincodeDefinitionForMyOrgRequestMultiError) AllErrors() []error { return m } + +// ApproveChaincodeDefinitionForMyOrgRequestValidationError is the validation +// error returned by ApproveChaincodeDefinitionForMyOrgRequest.Validate if the +// designated constraints aren't met. +type ApproveChaincodeDefinitionForMyOrgRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApproveChaincodeDefinitionForMyOrgRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApproveChaincodeDefinitionForMyOrgRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApproveChaincodeDefinitionForMyOrgRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApproveChaincodeDefinitionForMyOrgRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApproveChaincodeDefinitionForMyOrgRequestValidationError) ErrorName() string { + return "ApproveChaincodeDefinitionForMyOrgRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ApproveChaincodeDefinitionForMyOrgRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sApproveChaincodeDefinitionForMyOrgRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApproveChaincodeDefinitionForMyOrgRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApproveChaincodeDefinitionForMyOrgRequestValidationError{} + +// Validate checks the field values on QueryApprovedChaincodeDefinitionRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, the first error encountered is returned, or nil if +// there are no violations. +func (m *QueryApprovedChaincodeDefinitionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on +// QueryApprovedChaincodeDefinitionRequest with the rules defined in the proto +// definition for this message. If any rules are violated, the result is a +// list of violation errors wrapped in +// QueryApprovedChaincodeDefinitionRequestMultiError, or nil if none found. +func (m *QueryApprovedChaincodeDefinitionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *QueryApprovedChaincodeDefinitionRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetArgs()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, QueryApprovedChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, QueryApprovedChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetArgs()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return QueryApprovedChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return QueryApprovedChaincodeDefinitionRequestMultiError(errors) + } + + return nil +} + +// QueryApprovedChaincodeDefinitionRequestMultiError is an error wrapping +// multiple validation errors returned by +// QueryApprovedChaincodeDefinitionRequest.ValidateAll() if the designated +// constraints aren't met. +type QueryApprovedChaincodeDefinitionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m QueryApprovedChaincodeDefinitionRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m QueryApprovedChaincodeDefinitionRequestMultiError) AllErrors() []error { return m } + +// QueryApprovedChaincodeDefinitionRequestValidationError is the validation +// error returned by QueryApprovedChaincodeDefinitionRequest.Validate if the +// designated constraints aren't met. +type QueryApprovedChaincodeDefinitionRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e QueryApprovedChaincodeDefinitionRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e QueryApprovedChaincodeDefinitionRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e QueryApprovedChaincodeDefinitionRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e QueryApprovedChaincodeDefinitionRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e QueryApprovedChaincodeDefinitionRequestValidationError) ErrorName() string { + return "QueryApprovedChaincodeDefinitionRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e QueryApprovedChaincodeDefinitionRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sQueryApprovedChaincodeDefinitionRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = QueryApprovedChaincodeDefinitionRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = QueryApprovedChaincodeDefinitionRequestValidationError{} + +// Validate checks the field values on CheckCommitReadinessRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CheckCommitReadinessRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CheckCommitReadinessRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CheckCommitReadinessRequestMultiError, or nil if none found. +func (m *CheckCommitReadinessRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CheckCommitReadinessRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetArgs()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CheckCommitReadinessRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CheckCommitReadinessRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetArgs()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CheckCommitReadinessRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return CheckCommitReadinessRequestMultiError(errors) + } + + return nil +} + +// CheckCommitReadinessRequestMultiError is an error wrapping multiple +// validation errors returned by CheckCommitReadinessRequest.ValidateAll() if +// the designated constraints aren't met. +type CheckCommitReadinessRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CheckCommitReadinessRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CheckCommitReadinessRequestMultiError) AllErrors() []error { return m } + +// CheckCommitReadinessRequestValidationError is the validation error returned +// by CheckCommitReadinessRequest.Validate if the designated constraints +// aren't met. +type CheckCommitReadinessRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CheckCommitReadinessRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CheckCommitReadinessRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CheckCommitReadinessRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CheckCommitReadinessRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CheckCommitReadinessRequestValidationError) ErrorName() string { + return "CheckCommitReadinessRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CheckCommitReadinessRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCheckCommitReadinessRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CheckCommitReadinessRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CheckCommitReadinessRequestValidationError{} + +// Validate checks the field values on CommitChaincodeDefinitionRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, the first error encountered is returned, or nil if there are +// no violations. +func (m *CommitChaincodeDefinitionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CommitChaincodeDefinitionRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, the result is a list of violation errors wrapped in +// CommitChaincodeDefinitionRequestMultiError, or nil if none found. +func (m *CommitChaincodeDefinitionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CommitChaincodeDefinitionRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetArgs()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CommitChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CommitChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetArgs()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommitChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return CommitChaincodeDefinitionRequestMultiError(errors) + } + + return nil +} + +// CommitChaincodeDefinitionRequestMultiError is an error wrapping multiple +// validation errors returned by +// CommitChaincodeDefinitionRequest.ValidateAll() if the designated +// constraints aren't met. +type CommitChaincodeDefinitionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CommitChaincodeDefinitionRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CommitChaincodeDefinitionRequestMultiError) AllErrors() []error { return m } + +// CommitChaincodeDefinitionRequestValidationError is the validation error +// returned by CommitChaincodeDefinitionRequest.Validate if the designated +// constraints aren't met. +type CommitChaincodeDefinitionRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CommitChaincodeDefinitionRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CommitChaincodeDefinitionRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CommitChaincodeDefinitionRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CommitChaincodeDefinitionRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CommitChaincodeDefinitionRequestValidationError) ErrorName() string { + return "CommitChaincodeDefinitionRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CommitChaincodeDefinitionRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCommitChaincodeDefinitionRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CommitChaincodeDefinitionRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CommitChaincodeDefinitionRequestValidationError{} + +// Validate checks the field values on QueryChaincodeDefinitionRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *QueryChaincodeDefinitionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on QueryChaincodeDefinitionRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, the result is a list of violation errors wrapped in +// QueryChaincodeDefinitionRequestMultiError, or nil if none found. +func (m *QueryChaincodeDefinitionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *QueryChaincodeDefinitionRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetArgs()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, QueryChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, QueryChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetArgs()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return QueryChaincodeDefinitionRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return QueryChaincodeDefinitionRequestMultiError(errors) + } + + return nil +} + +// QueryChaincodeDefinitionRequestMultiError is an error wrapping multiple +// validation errors returned by QueryChaincodeDefinitionRequest.ValidateAll() +// if the designated constraints aren't met. +type QueryChaincodeDefinitionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m QueryChaincodeDefinitionRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m QueryChaincodeDefinitionRequestMultiError) AllErrors() []error { return m } + +// QueryChaincodeDefinitionRequestValidationError is the validation error +// returned by QueryChaincodeDefinitionRequest.Validate if the designated +// constraints aren't met. +type QueryChaincodeDefinitionRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e QueryChaincodeDefinitionRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e QueryChaincodeDefinitionRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e QueryChaincodeDefinitionRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e QueryChaincodeDefinitionRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e QueryChaincodeDefinitionRequestValidationError) ErrorName() string { + return "QueryChaincodeDefinitionRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e QueryChaincodeDefinitionRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sQueryChaincodeDefinitionRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = QueryChaincodeDefinitionRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = QueryChaincodeDefinitionRequestValidationError{} + +// Validate checks the field values on QueryChaincodeDefinitionsRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, the first error encountered is returned, or nil if there are +// no violations. +func (m *QueryChaincodeDefinitionsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on QueryChaincodeDefinitionsRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, the result is a list of violation errors wrapped in +// QueryChaincodeDefinitionsRequestMultiError, or nil if none found. +func (m *QueryChaincodeDefinitionsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *QueryChaincodeDefinitionsRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetArgs()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, QueryChaincodeDefinitionsRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, QueryChaincodeDefinitionsRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetArgs()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return QueryChaincodeDefinitionsRequestValidationError{ + field: "Args", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return QueryChaincodeDefinitionsRequestMultiError(errors) + } + + return nil +} + +// QueryChaincodeDefinitionsRequestMultiError is an error wrapping multiple +// validation errors returned by +// QueryChaincodeDefinitionsRequest.ValidateAll() if the designated +// constraints aren't met. +type QueryChaincodeDefinitionsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m QueryChaincodeDefinitionsRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m QueryChaincodeDefinitionsRequestMultiError) AllErrors() []error { return m } + +// QueryChaincodeDefinitionsRequestValidationError is the validation error +// returned by QueryChaincodeDefinitionsRequest.Validate if the designated +// constraints aren't met. +type QueryChaincodeDefinitionsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e QueryChaincodeDefinitionsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e QueryChaincodeDefinitionsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e QueryChaincodeDefinitionsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e QueryChaincodeDefinitionsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e QueryChaincodeDefinitionsRequestValidationError) ErrorName() string { + return "QueryChaincodeDefinitionsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e QueryChaincodeDefinitionsRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sQueryChaincodeDefinitionsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = QueryChaincodeDefinitionsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = QueryChaincodeDefinitionsRequestValidationError{} diff --git a/client/chaincode/system/lifecycle.proto b/service/systemcc/lifecycle/lifecycle.proto similarity index 94% rename from client/chaincode/system/lifecycle.proto rename to service/systemcc/lifecycle/lifecycle.proto index 11ecdbcc..5b2b1727 100644 --- a/client/chaincode/system/lifecycle.proto +++ b/service/systemcc/lifecycle/lifecycle.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package hlfsdk.client.chaincode.system; +package hlfsdk.service.systemcc.lifecyclecc; -option go_package = "hlfsdk/client/chaincode/system"; +option go_package = "github.com/s7techlab/hlf-sdk-go/service/systemcc/lifecycle"; -import "peer/lifecycle/lifecycle.proto"; +import "hyperledger/fabric-protos/peer/lifecycle/lifecycle.proto"; import "google/protobuf/empty.proto"; import "google/api/annotations.proto"; diff --git a/client/chaincode/system/lifecycle.swagger.json b/service/systemcc/lifecycle/lifecycle.swagger.json similarity index 82% rename from client/chaincode/system/lifecycle.swagger.json rename to service/systemcc/lifecycle/lifecycle.swagger.json index f5a69007..6e020214 100644 --- a/client/chaincode/system/lifecycle.swagger.json +++ b/service/systemcc/lifecycle/lifecycle.swagger.json @@ -1,13 +1,9 @@ { "swagger": "2.0", "info": { - "title": "lifecycle.proto", + "title": "systemcc/lifecycle/lifecycle.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], @@ -15,16 +11,55 @@ "application/json" ], "paths": { + "/lifecycle/chaincode/commits": { + "post": { + "summary": "QueryChaincodeDefinitions returns chaincode definitions committed on the channel", + "operationId": "LifecycleService_QueryChaincodeDefinitions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionsResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lifecycleccQueryChaincodeDefinitionsRequest" + } + } + ], + "tags": [ + "LifecycleService" + ] + } + }, "/lifecycle/chaincodes": { "get": { "summary": "QueryInstalledChaincodes returns chaincode packages list installed on peer", - "operationId": "QueryInstalledChaincodes", + "operationId": "LifecycleService_QueryInstalledChaincodes", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/lifecycleQueryInstalledChaincodesResult" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -33,13 +68,19 @@ }, "post": { "summary": "InstallChaincode sets up chaincode package on peer", - "operationId": "InstallChaincode", + "operationId": "LifecycleService_InstallChaincode", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/lifecycleInstallChaincodeResult" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -60,13 +101,19 @@ "/lifecycle/chaincodes/approve": { "post": { "summary": "ApproveChaincodeDefinitionForMyOrg marks chaincode definition on a channel", - "operationId": "ApproveChaincodeDefinitionForMyOrg", + "operationId": "LifecycleService_ApproveChaincodeDefinitionForMyOrg", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -75,7 +122,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/systemApproveChaincodeDefinitionForMyOrgRequest" + "$ref": "#/definitions/lifecycleccApproveChaincodeDefinitionForMyOrgRequest" } } ], @@ -87,13 +134,19 @@ "/lifecycle/chaincodes/approved": { "post": { "summary": "QueryApprovedChaincodeDefinition returns approved chaincode definition", - "operationId": "QueryApprovedChaincodeDefinition", + "operationId": "LifecycleService_QueryApprovedChaincodeDefinition", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/lifecycleQueryApprovedChaincodeDefinitionResult" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -102,7 +155,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/systemQueryApprovedChaincodeDefinitionRequest" + "$ref": "#/definitions/lifecycleccQueryApprovedChaincodeDefinitionRequest" } } ], @@ -111,24 +164,32 @@ ] } }, - "/lifecycle/chaincodes/{package_id}": { - "get": { - "summary": "QueryInstalledChaincode returns chaincode package installed on peer", - "operationId": "QueryInstalledChaincode", + "/lifecycle/chaincodes/commit": { + "post": { + "summary": "CommitChaincodeDefinition the chaincode definition on the channel", + "operationId": "LifecycleService_CommitChaincodeDefinition", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/lifecycleQueryInstalledChaincodeResult" + "$ref": "#/definitions/lifecycleCommitChaincodeDefinitionResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" } } }, "parameters": [ { - "name": "package_id", - "in": "path", + "name": "body", + "in": "body", "required": true, - "type": "string" + "schema": { + "$ref": "#/definitions/lifecycleccCommitChaincodeDefinitionRequest" + } } ], "tags": [ @@ -136,15 +197,21 @@ ] } }, - "/lifecycle/commit": { + "/lifecycle/chaincodes/commit-check": { "post": { - "summary": "QueryChaincodeDefinitions returns chaincode definitions committed on the channel", - "operationId": "QueryChaincodeDefinitions", + "summary": "QueryChaincodeDefinition returns chaincode definition committed on the channel", + "operationId": "LifecycleService_QueryChaincodeDefinition", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionsResult" + "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" } } }, @@ -154,7 +221,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/systemQueryChaincodeDefinitionsRequest" + "$ref": "#/definitions/lifecycleccQueryChaincodeDefinitionRequest" } } ], @@ -163,16 +230,53 @@ ] } }, + "/lifecycle/chaincodes/{package_id}": { + "get": { + "summary": "QueryInstalledChaincode returns chaincode package installed on peer", + "operationId": "LifecycleService_QueryInstalledChaincode", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lifecycleQueryInstalledChaincodeResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "package_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "LifecycleService" + ] + } + }, "/lifecycle/commit-readiness": { "post": { "summary": "CheckCommitReadiness returns commitments statuses of participants on chaincode definition", - "operationId": "CheckCommitReadiness", + "operationId": "LifecycleService_CheckCommitReadiness", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/lifecycleCheckCommitReadinessResult" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -181,7 +285,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/systemCheckCommitReadinessRequest" + "$ref": "#/definitions/lifecycleccCheckCommitReadinessRequest" } } ], @@ -242,8 +346,7 @@ "$ref": "#/definitions/protosCollectionConfigPackage" }, "init_required": { - "type": "boolean", - "format": "boolean" + "type": "boolean" } } }, @@ -353,8 +456,7 @@ "$ref": "#/definitions/protosCollectionConfigPackage" }, "init_required": { - "type": "boolean", - "format": "boolean" + "type": "boolean" }, "source": { "$ref": "#/definitions/lifecycleChaincodeSource" @@ -400,8 +502,7 @@ "$ref": "#/definitions/protosCollectionConfigPackage" }, "init_required": { - "type": "boolean", - "format": "boolean" + "type": "boolean" } }, "description": "CheckCommitReadinessArgs is the message used as arguments to\n`_lifecycle.CheckCommitReadiness`." @@ -412,8 +513,7 @@ "approvals": { "type": "object", "additionalProperties": { - "type": "boolean", - "format": "boolean" + "type": "boolean" } } }, @@ -446,8 +546,7 @@ "$ref": "#/definitions/protosCollectionConfigPackage" }, "init_required": { - "type": "boolean", - "format": "boolean" + "type": "boolean" } }, "description": "CommitChaincodeDefinitionArgs is the message used as arguments to\n`_lifecycle.CommitChaincodeDefinition`." @@ -515,8 +614,7 @@ "$ref": "#/definitions/protosCollectionConfigPackage" }, "init_required": { - "type": "boolean", - "format": "boolean" + "type": "boolean" }, "source": { "$ref": "#/definitions/lifecycleChaincodeSource" @@ -557,14 +655,12 @@ "$ref": "#/definitions/protosCollectionConfigPackage" }, "init_required": { - "type": "boolean", - "format": "boolean" + "type": "boolean" }, "approvals": { "type": "object", "additionalProperties": { - "type": "boolean", - "format": "boolean" + "type": "boolean" } } }, @@ -660,6 +756,84 @@ } } }, + "lifecycleccApproveChaincodeDefinitionForMyOrgRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "args": { + "$ref": "#/definitions/lifecycleApproveChaincodeDefinitionForMyOrgArgs" + } + } + }, + "lifecycleccCheckCommitReadinessRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "args": { + "$ref": "#/definitions/lifecycleCheckCommitReadinessArgs" + } + } + }, + "lifecycleccCommitChaincodeDefinitionRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "args": { + "$ref": "#/definitions/lifecycleCommitChaincodeDefinitionArgs" + } + } + }, + "lifecycleccQueryApprovedChaincodeDefinitionRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "args": { + "$ref": "#/definitions/lifecycleQueryApprovedChaincodeDefinitionArgs" + } + } + }, + "lifecycleccQueryChaincodeDefinitionRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "args": { + "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionArgs" + } + } + }, + "lifecycleccQueryChaincodeDefinitionsRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "args": { + "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionsArgs" + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, "protosApplicationPolicy": { "type": "object", "properties": { @@ -733,12 +907,10 @@ }, "member_only_read": { "type": "boolean", - "format": "boolean", "title": "The member only read access denotes whether only collection member clients\ncan read the private data (if set to true), or even non members can\nread the data (if set to false, for example if you want to implement more granular\naccess logic in the chaincode)" }, "member_only_write": { "type": "boolean", - "format": "boolean", "title": "The member only write access denotes whether only collection member clients\ncan write the private data (if set to true), or even non members can\nwrite the data (if set to false, for example if you want to implement more granular\naccess logic in the chaincode)" }, "endorsement_policy": { @@ -748,69 +920,24 @@ }, "description": "StaticCollectionConfig constitutes the configuration parameters of a\nstatic collection object. Static collections are collections that are\nknown at chaincode instantiation time, and that cannot be changed.\nDynamic collections are deferred." }, - "systemApproveChaincodeDefinitionForMyOrgRequest": { + "runtimeError": { "type": "object", "properties": { - "channel": { + "error": { "type": "string" }, - "args": { - "$ref": "#/definitions/lifecycleApproveChaincodeDefinitionForMyOrgArgs" - } - } - }, - "systemCheckCommitReadinessRequest": { - "type": "object", - "properties": { - "channel": { - "type": "string" - }, - "args": { - "$ref": "#/definitions/lifecycleCheckCommitReadinessArgs" - } - } - }, - "systemCommitChaincodeDefinitionRequest": { - "type": "object", - "properties": { - "channel": { - "type": "string" - }, - "args": { - "$ref": "#/definitions/lifecycleCommitChaincodeDefinitionArgs" - } - } - }, - "systemQueryApprovedChaincodeDefinitionRequest": { - "type": "object", - "properties": { - "channel": { - "type": "string" - }, - "args": { - "$ref": "#/definitions/lifecycleQueryApprovedChaincodeDefinitionArgs" - } - } - }, - "systemQueryChaincodeDefinitionRequest": { - "type": "object", - "properties": { - "channel": { - "type": "string" + "code": { + "type": "integer", + "format": "int32" }, - "args": { - "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionArgs" - } - } - }, - "systemQueryChaincodeDefinitionsRequest": { - "type": "object", - "properties": { - "channel": { + "message": { "type": "string" }, - "args": { - "$ref": "#/definitions/lifecycleQueryChaincodeDefinitionsArgs" + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } } } } diff --git a/client/chaincode/system/lscc.go b/service/systemcc/lscc/lscc.go similarity index 86% rename from client/chaincode/system/lscc.go rename to service/systemcc/lscc/lscc.go index bcb21a5a..43fde5fb 100644 --- a/client/chaincode/system/lscc.go +++ b/service/systemcc/lscc/lscc.go @@ -1,4 +1,4 @@ -package system +package lscc import ( "context" @@ -10,11 +10,13 @@ import ( lsccPkg "github.com/hyperledger/fabric/core/scc/lscc" "github.com/s7techlab/hlf-sdk-go/api" + "github.com/s7techlab/hlf-sdk-go/client/chaincode" "github.com/s7techlab/hlf-sdk-go/client/tx" + "github.com/s7techlab/hlf-sdk-go/service" ) //go:embed lscc.swagger.json -var LSCCServiceSwagger []byte +var Swagger []byte type ( LSCCService struct { @@ -30,10 +32,10 @@ func NewLSCC(invoker api.Invoker) *LSCCService { } } -func (l *LSCCService) ServiceDef() ServiceDef { - return NewServiceDef( +func (l *LSCCService) ServiceDef() *service.Def { + return service.NewDef( _LSCCService_serviceDesc.ServiceName, - LSCCServiceSwagger, + Swagger, &_LSCCService_serviceDesc, l, RegisterLSCCServiceHandlerFromEndpoint, @@ -43,7 +45,7 @@ func (l *LSCCService) ServiceDef() ServiceDef { func (l *LSCCService) GetChaincodeData(ctx context.Context, getChaincodeData *GetChaincodeDataRequest) (*peer.ChaincodeData, error) { res, err := tx.QueryStringsProto(ctx, l.Invoker, - getChaincodeData.Channel, LSCCName, + getChaincodeData.Channel, chaincode.LSCC, []string{lsccPkg.GETCCDATA, getChaincodeData.Channel, getChaincodeData.Chaincode}, &peer.ChaincodeData{}) if err != nil { @@ -55,7 +57,7 @@ func (l *LSCCService) GetChaincodeData(ctx context.Context, getChaincodeData *Ge func (l *LSCCService) GetInstalledChaincodes(ctx context.Context, _ *empty.Empty) (*peer.ChaincodeQueryResponse, error) { res, err := tx.QueryStringsProto(ctx, l.Invoker, - ``, LSCCName, + ``, chaincode.LSCC, []string{lsccPkg.GETINSTALLEDCHAINCODES}, &peer.ChaincodeQueryResponse{}) if err != nil { @@ -66,7 +68,7 @@ func (l *LSCCService) GetInstalledChaincodes(ctx context.Context, _ *empty.Empty func (l *LSCCService) GetChaincodes(ctx context.Context, getChaincodes *GetChaincodesRequest) (*peer.ChaincodeQueryResponse, error) { res, err := tx.QueryStringsProto(ctx, l.Invoker, - getChaincodes.Channel, LSCCName, + getChaincodes.Channel, chaincode.LSCC, []string{lsccPkg.GETCHAINCODES}, &peer.ChaincodeQueryResponse{}) if err != nil { @@ -78,7 +80,7 @@ func (l *LSCCService) GetChaincodes(ctx context.Context, getChaincodes *GetChain func (l *LSCCService) GetDeploymentSpec(ctx context.Context, getDeploymentSpec *GetDeploymentSpecRequest) (*peer.ChaincodeDeploymentSpec, error) { res, err := tx.QueryStringsProto(ctx, l.Invoker, - getDeploymentSpec.Channel, LSCCName, + getDeploymentSpec.Channel, chaincode.LSCC, []string{lsccPkg.GETDEPSPEC, getDeploymentSpec.Channel, getDeploymentSpec.Chaincode}, &peer.ChaincodeDeploymentSpec{}) if err != nil { @@ -89,7 +91,7 @@ func (l *LSCCService) GetDeploymentSpec(ctx context.Context, getDeploymentSpec * func (l *LSCCService) Install(ctx context.Context, spec *peer.ChaincodeDeploymentSpec) (*empty.Empty, error) { _, err := tx.QueryProto(ctx, l.Invoker, - ``, LSCCName, + ``, chaincode.LSCC, []interface{}{lsccPkg.INSTALL, spec}, &peer.ChaincodeDeploymentSpec{}) @@ -130,6 +132,6 @@ func (l *LSCCService) Deploy(ctx context.Context, deploy *DeployRequest) (respon return nil, fmt.Errorf(`args: %w`, err) } // Invoke here (with broadcast to orderer) - res, _, err := l.Invoker.Invoke(ctx, deploy.Channel, LSCCName, argsBytes, nil, deploy.Transient, ``) + res, _, err := l.Invoker.Invoke(ctx, deploy.Channel, chaincode.LSCC, argsBytes, nil, deploy.Transient, ``) return res, err } diff --git a/client/chaincode/system/lscc.pb.go b/service/systemcc/lscc/lscc.pb.go similarity index 52% rename from client/chaincode/system/lscc.pb.go rename to service/systemcc/lscc/lscc.pb.go index a5d5b8e8..e96569eb 100644 --- a/client/chaincode/system/lscc.pb.go +++ b/service/systemcc/lscc/lscc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.7.1 -// source: lscc.proto +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: systemcc/lscc/lscc.proto -package system +package lscc import ( context "context" - empty "github.com/golang/protobuf/ptypes/empty" common "github.com/hyperledger/fabric-protos-go/common" peer "github.com/hyperledger/fabric-protos-go/peer" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -17,6 +16,7 @@ import ( status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -40,7 +40,7 @@ type GetChaincodeDataRequest struct { func (x *GetChaincodeDataRequest) Reset() { *x = GetChaincodeDataRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lscc_proto_msgTypes[0] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -53,7 +53,7 @@ func (x *GetChaincodeDataRequest) String() string { func (*GetChaincodeDataRequest) ProtoMessage() {} func (x *GetChaincodeDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_lscc_proto_msgTypes[0] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -66,7 +66,7 @@ func (x *GetChaincodeDataRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetChaincodeDataRequest.ProtoReflect.Descriptor instead. func (*GetChaincodeDataRequest) Descriptor() ([]byte, []int) { - return file_lscc_proto_rawDescGZIP(), []int{0} + return file_systemcc_lscc_lscc_proto_rawDescGZIP(), []int{0} } func (x *GetChaincodeDataRequest) GetChannel() string { @@ -94,7 +94,7 @@ type GetChaincodesRequest struct { func (x *GetChaincodesRequest) Reset() { *x = GetChaincodesRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lscc_proto_msgTypes[1] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107,7 +107,7 @@ func (x *GetChaincodesRequest) String() string { func (*GetChaincodesRequest) ProtoMessage() {} func (x *GetChaincodesRequest) ProtoReflect() protoreflect.Message { - mi := &file_lscc_proto_msgTypes[1] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120,7 +120,7 @@ func (x *GetChaincodesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetChaincodesRequest.ProtoReflect.Descriptor instead. func (*GetChaincodesRequest) Descriptor() ([]byte, []int) { - return file_lscc_proto_rawDescGZIP(), []int{1} + return file_systemcc_lscc_lscc_proto_rawDescGZIP(), []int{1} } func (x *GetChaincodesRequest) GetChannel() string { @@ -142,7 +142,7 @@ type GetDeploymentSpecRequest struct { func (x *GetDeploymentSpecRequest) Reset() { *x = GetDeploymentSpecRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lscc_proto_msgTypes[2] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -155,7 +155,7 @@ func (x *GetDeploymentSpecRequest) String() string { func (*GetDeploymentSpecRequest) ProtoMessage() {} func (x *GetDeploymentSpecRequest) ProtoReflect() protoreflect.Message { - mi := &file_lscc_proto_msgTypes[2] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -168,7 +168,7 @@ func (x *GetDeploymentSpecRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetDeploymentSpecRequest.ProtoReflect.Descriptor instead. func (*GetDeploymentSpecRequest) Descriptor() ([]byte, []int) { - return file_lscc_proto_rawDescGZIP(), []int{2} + return file_systemcc_lscc_lscc_proto_rawDescGZIP(), []int{2} } func (x *GetDeploymentSpecRequest) GetChannel() string { @@ -202,7 +202,7 @@ type DeployRequest struct { func (x *DeployRequest) Reset() { *x = DeployRequest{} if protoimpl.UnsafeEnabled { - mi := &file_lscc_proto_msgTypes[3] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -215,7 +215,7 @@ func (x *DeployRequest) String() string { func (*DeployRequest) ProtoMessage() {} func (x *DeployRequest) ProtoReflect() protoreflect.Message { - mi := &file_lscc_proto_msgTypes[3] + mi := &file_systemcc_lscc_lscc_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -228,7 +228,7 @@ func (x *DeployRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeployRequest.ProtoReflect.Descriptor instead. func (*DeployRequest) Descriptor() ([]byte, []int) { - return file_lscc_proto_rawDescGZIP(), []int{3} + return file_systemcc_lscc_lscc_proto_rawDescGZIP(), []int{3} } func (x *DeployRequest) GetChannel() string { @@ -280,163 +280,173 @@ func (x *DeployRequest) GetTransient() map[string][]byte { return nil } -var File_lscc_proto protoreflect.FileDescriptor - -var file_lscc_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x6c, 0x73, 0x63, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x68, 0x6c, - 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x1a, 0x17, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x70, 0x65, - 0x65, 0x72, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, - 0x70, 0x65, 0x65, 0x72, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x51, 0x0a, - 0x17, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, - 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x22, 0x30, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x22, 0x52, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x22, 0xbc, 0x03, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x12, 0x48, 0x0a, 0x0f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x52, 0x0e, 0x64, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x12, 0x37, 0x0a, 0x06, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x06, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x45, 0x53, 0x43, 0x43, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x45, 0x53, 0x43, 0x43, 0x12, 0x12, 0x0a, 0x04, 0x56, 0x53, 0x43, - 0x43, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x56, 0x53, 0x43, 0x43, 0x12, 0x4c, 0x0a, - 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5a, 0x0a, 0x09, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, - 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x69, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x3c, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x69, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x9e, 0x06, 0x0a, 0x0b, 0x4c, 0x53, 0x43, 0x43, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x92, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x37, 0x2e, 0x68, 0x6c, 0x66, - 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x28, 0x12, 0x26, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, - 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x2f, 0x7b, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x7d, 0x12, 0x6a, 0x0a, 0x16, 0x47, 0x65, - 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, - 0x6f, 0x64, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x89, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x34, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, - 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, - 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x7d, 0x12, 0xae, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x12, 0x38, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, - 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, - 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, - 0x70, 0x65, 0x63, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x6c, 0x73, - 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x7d, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2d, 0x73, - 0x70, 0x65, 0x63, 0x12, 0x5f, 0x0a, 0x07, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x12, 0x1f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, - 0x65, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, - 0x10, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x70, 0x0a, 0x06, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x12, 0x2d, - 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x20, 0x5a, 0x1e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, - 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, - 0x65, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_systemcc_lscc_lscc_proto protoreflect.FileDescriptor + +var file_systemcc_lscc_lscc_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, + 0x6c, 0x73, 0x63, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x68, 0x6c, 0x66, 0x73, + 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x73, 0x63, 0x63, 0x1a, 0x31, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2f, 0x68, 0x79, 0x70, + 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x68, 0x79, + 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, + 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x36, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x51, 0x0a, 0x17, 0x47, + 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x30, + 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x22, 0x52, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x53, 0x70, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x22, 0xba, 0x03, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x12, 0x48, 0x0a, 0x0f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x73, + 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x52, 0x0e, 0x64, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x12, 0x37, 0x0a, 0x06, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x06, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x45, 0x53, 0x43, 0x43, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x45, 0x53, 0x43, 0x43, 0x12, 0x12, 0x0a, 0x04, 0x56, 0x53, 0x43, 0x43, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x56, 0x53, 0x43, 0x43, 0x12, 0x4c, 0x0a, 0x11, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x58, 0x0a, 0x09, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x68, + 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x73, 0x63, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, + 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, + 0x65, 0x6e, 0x74, 0x1a, 0x3c, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x65, 0x6e, 0x74, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x32, 0x96, 0x06, 0x0a, 0x0b, 0x4c, 0x53, 0x43, 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x90, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, + 0x2e, 0x6c, 0x73, 0x63, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x44, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x6c, + 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x7b, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x7d, 0x12, 0x6a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, + 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, + 0x12, 0x87, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x73, 0x12, 0x32, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x73, 0x63, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, + 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, + 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x12, 0xac, 0x01, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, + 0x12, 0x36, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, 0x73, 0x63, 0x63, 0x2e, + 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, + 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x38, 0x12, 0x36, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x2f, 0x7b, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x7d, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x2d, 0x73, 0x70, 0x65, 0x63, 0x12, 0x5f, 0x0a, 0x07, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6c, 0x6c, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x53, 0x70, 0x65, 0x63, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x6e, 0x0a, 0x06, 0x44, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x12, 0x2b, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x6c, + 0x73, 0x63, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x22, 0x1a, + 0x2f, 0x6c, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, + 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x7d, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x37, 0x74, 0x65, 0x63, 0x68, 0x6c, + 0x61, 0x62, 0x2f, 0x68, 0x6c, 0x66, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x6c, + 0x73, 0x63, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_lscc_proto_rawDescOnce sync.Once - file_lscc_proto_rawDescData = file_lscc_proto_rawDesc + file_systemcc_lscc_lscc_proto_rawDescOnce sync.Once + file_systemcc_lscc_lscc_proto_rawDescData = file_systemcc_lscc_lscc_proto_rawDesc ) -func file_lscc_proto_rawDescGZIP() []byte { - file_lscc_proto_rawDescOnce.Do(func() { - file_lscc_proto_rawDescData = protoimpl.X.CompressGZIP(file_lscc_proto_rawDescData) +func file_systemcc_lscc_lscc_proto_rawDescGZIP() []byte { + file_systemcc_lscc_lscc_proto_rawDescOnce.Do(func() { + file_systemcc_lscc_lscc_proto_rawDescData = protoimpl.X.CompressGZIP(file_systemcc_lscc_lscc_proto_rawDescData) }) - return file_lscc_proto_rawDescData + return file_systemcc_lscc_lscc_proto_rawDescData } -var file_lscc_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_lscc_proto_goTypes = []interface{}{ - (*GetChaincodeDataRequest)(nil), // 0: hlfsdk.client.chaincode.system.GetChaincodeDataRequest - (*GetChaincodesRequest)(nil), // 1: hlfsdk.client.chaincode.system.GetChaincodesRequest - (*GetDeploymentSpecRequest)(nil), // 2: hlfsdk.client.chaincode.system.GetDeploymentSpecRequest - (*DeployRequest)(nil), // 3: hlfsdk.client.chaincode.system.DeployRequest - nil, // 4: hlfsdk.client.chaincode.system.DeployRequest.TransientEntry +var file_systemcc_lscc_lscc_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_systemcc_lscc_lscc_proto_goTypes = []interface{}{ + (*GetChaincodeDataRequest)(nil), // 0: hlfsdk.service.systemcc.lscc.GetChaincodeDataRequest + (*GetChaincodesRequest)(nil), // 1: hlfsdk.service.systemcc.lscc.GetChaincodesRequest + (*GetDeploymentSpecRequest)(nil), // 2: hlfsdk.service.systemcc.lscc.GetDeploymentSpecRequest + (*DeployRequest)(nil), // 3: hlfsdk.service.systemcc.lscc.DeployRequest + nil, // 4: hlfsdk.service.systemcc.lscc.DeployRequest.TransientEntry (*peer.ChaincodeDeploymentSpec)(nil), // 5: protos.ChaincodeDeploymentSpec (*common.SignaturePolicyEnvelope)(nil), // 6: common.SignaturePolicyEnvelope (*common.CollectionConfigPackage)(nil), // 7: common.CollectionConfigPackage - (*empty.Empty)(nil), // 8: google.protobuf.Empty + (*emptypb.Empty)(nil), // 8: google.protobuf.Empty (*peer.ChaincodeData)(nil), // 9: protos.ChaincodeData (*peer.ChaincodeQueryResponse)(nil), // 10: protos.ChaincodeQueryResponse (*peer.Response)(nil), // 11: protos.Response } -var file_lscc_proto_depIdxs = []int32{ - 5, // 0: hlfsdk.client.chaincode.system.DeployRequest.deployment_spec:type_name -> protos.ChaincodeDeploymentSpec - 6, // 1: hlfsdk.client.chaincode.system.DeployRequest.policy:type_name -> common.SignaturePolicyEnvelope - 7, // 2: hlfsdk.client.chaincode.system.DeployRequest.collection_config:type_name -> common.CollectionConfigPackage - 4, // 3: hlfsdk.client.chaincode.system.DeployRequest.transient:type_name -> hlfsdk.client.chaincode.system.DeployRequest.TransientEntry - 0, // 4: hlfsdk.client.chaincode.system.LSCCService.GetChaincodeData:input_type -> hlfsdk.client.chaincode.system.GetChaincodeDataRequest - 8, // 5: hlfsdk.client.chaincode.system.LSCCService.GetInstalledChaincodes:input_type -> google.protobuf.Empty - 1, // 6: hlfsdk.client.chaincode.system.LSCCService.GetChaincodes:input_type -> hlfsdk.client.chaincode.system.GetChaincodesRequest - 2, // 7: hlfsdk.client.chaincode.system.LSCCService.GetDeploymentSpec:input_type -> hlfsdk.client.chaincode.system.GetDeploymentSpecRequest - 5, // 8: hlfsdk.client.chaincode.system.LSCCService.Install:input_type -> protos.ChaincodeDeploymentSpec - 3, // 9: hlfsdk.client.chaincode.system.LSCCService.Deploy:input_type -> hlfsdk.client.chaincode.system.DeployRequest - 9, // 10: hlfsdk.client.chaincode.system.LSCCService.GetChaincodeData:output_type -> protos.ChaincodeData - 10, // 11: hlfsdk.client.chaincode.system.LSCCService.GetInstalledChaincodes:output_type -> protos.ChaincodeQueryResponse - 10, // 12: hlfsdk.client.chaincode.system.LSCCService.GetChaincodes:output_type -> protos.ChaincodeQueryResponse - 5, // 13: hlfsdk.client.chaincode.system.LSCCService.GetDeploymentSpec:output_type -> protos.ChaincodeDeploymentSpec - 8, // 14: hlfsdk.client.chaincode.system.LSCCService.Install:output_type -> google.protobuf.Empty - 11, // 15: hlfsdk.client.chaincode.system.LSCCService.Deploy:output_type -> protos.Response +var file_systemcc_lscc_lscc_proto_depIdxs = []int32{ + 5, // 0: hlfsdk.service.systemcc.lscc.DeployRequest.deployment_spec:type_name -> protos.ChaincodeDeploymentSpec + 6, // 1: hlfsdk.service.systemcc.lscc.DeployRequest.policy:type_name -> common.SignaturePolicyEnvelope + 7, // 2: hlfsdk.service.systemcc.lscc.DeployRequest.collection_config:type_name -> common.CollectionConfigPackage + 4, // 3: hlfsdk.service.systemcc.lscc.DeployRequest.transient:type_name -> hlfsdk.service.systemcc.lscc.DeployRequest.TransientEntry + 0, // 4: hlfsdk.service.systemcc.lscc.LSCCService.GetChaincodeData:input_type -> hlfsdk.service.systemcc.lscc.GetChaincodeDataRequest + 8, // 5: hlfsdk.service.systemcc.lscc.LSCCService.GetInstalledChaincodes:input_type -> google.protobuf.Empty + 1, // 6: hlfsdk.service.systemcc.lscc.LSCCService.GetChaincodes:input_type -> hlfsdk.service.systemcc.lscc.GetChaincodesRequest + 2, // 7: hlfsdk.service.systemcc.lscc.LSCCService.GetDeploymentSpec:input_type -> hlfsdk.service.systemcc.lscc.GetDeploymentSpecRequest + 5, // 8: hlfsdk.service.systemcc.lscc.LSCCService.Install:input_type -> protos.ChaincodeDeploymentSpec + 3, // 9: hlfsdk.service.systemcc.lscc.LSCCService.Deploy:input_type -> hlfsdk.service.systemcc.lscc.DeployRequest + 9, // 10: hlfsdk.service.systemcc.lscc.LSCCService.GetChaincodeData:output_type -> protos.ChaincodeData + 10, // 11: hlfsdk.service.systemcc.lscc.LSCCService.GetInstalledChaincodes:output_type -> protos.ChaincodeQueryResponse + 10, // 12: hlfsdk.service.systemcc.lscc.LSCCService.GetChaincodes:output_type -> protos.ChaincodeQueryResponse + 5, // 13: hlfsdk.service.systemcc.lscc.LSCCService.GetDeploymentSpec:output_type -> protos.ChaincodeDeploymentSpec + 8, // 14: hlfsdk.service.systemcc.lscc.LSCCService.Install:output_type -> google.protobuf.Empty + 11, // 15: hlfsdk.service.systemcc.lscc.LSCCService.Deploy:output_type -> protos.Response 10, // [10:16] is the sub-list for method output_type 4, // [4:10] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name @@ -444,13 +454,13 @@ var file_lscc_proto_depIdxs = []int32{ 0, // [0:4] is the sub-list for field type_name } -func init() { file_lscc_proto_init() } -func file_lscc_proto_init() { - if File_lscc_proto != nil { +func init() { file_systemcc_lscc_lscc_proto_init() } +func file_systemcc_lscc_lscc_proto_init() { + if File_systemcc_lscc_lscc_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_lscc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lscc_lscc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetChaincodeDataRequest); i { case 0: return &v.state @@ -462,7 +472,7 @@ func file_lscc_proto_init() { return nil } } - file_lscc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lscc_lscc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetChaincodesRequest); i { case 0: return &v.state @@ -474,7 +484,7 @@ func file_lscc_proto_init() { return nil } } - file_lscc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lscc_lscc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetDeploymentSpecRequest); i { case 0: return &v.state @@ -486,7 +496,7 @@ func file_lscc_proto_init() { return nil } } - file_lscc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_lscc_lscc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeployRequest); i { case 0: return &v.state @@ -503,20 +513,20 @@ func file_lscc_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_lscc_proto_rawDesc, + RawDescriptor: file_systemcc_lscc_lscc_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_lscc_proto_goTypes, - DependencyIndexes: file_lscc_proto_depIdxs, - MessageInfos: file_lscc_proto_msgTypes, + GoTypes: file_systemcc_lscc_lscc_proto_goTypes, + DependencyIndexes: file_systemcc_lscc_lscc_proto_depIdxs, + MessageInfos: file_systemcc_lscc_lscc_proto_msgTypes, }.Build() - File_lscc_proto = out.File - file_lscc_proto_rawDesc = nil - file_lscc_proto_goTypes = nil - file_lscc_proto_depIdxs = nil + File_systemcc_lscc_lscc_proto = out.File + file_systemcc_lscc_lscc_proto_rawDesc = nil + file_systemcc_lscc_lscc_proto_goTypes = nil + file_systemcc_lscc_lscc_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. @@ -534,13 +544,13 @@ type LSCCServiceClient interface { // GetChaincodeData returns information about instantiated chaincode on target channel GetChaincodeData(ctx context.Context, in *GetChaincodeDataRequest, opts ...grpc.CallOption) (*peer.ChaincodeData, error) // GetInstalledChaincodes returns list of installed chaincodes on peer - GetInstalledChaincodes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*peer.ChaincodeQueryResponse, error) + GetInstalledChaincodes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*peer.ChaincodeQueryResponse, error) // GetChaincodes returns list of instantiated chaincodes on channel GetChaincodes(ctx context.Context, in *GetChaincodesRequest, opts ...grpc.CallOption) (*peer.ChaincodeQueryResponse, error) // GetDeploymentSpec returns spec for installed chaincode GetDeploymentSpec(ctx context.Context, in *GetDeploymentSpecRequest, opts ...grpc.CallOption) (*peer.ChaincodeDeploymentSpec, error) // Install allows installing chaincode using deployment specification - Install(ctx context.Context, in *peer.ChaincodeDeploymentSpec, opts ...grpc.CallOption) (*empty.Empty, error) + Install(ctx context.Context, in *peer.ChaincodeDeploymentSpec, opts ...grpc.CallOption) (*emptypb.Empty, error) // Deploy allows instantiating or upgrade chaincode if instantiated // Currently, deploy method is not canonical as lscc implementation, but currently we need to get full proposal, and it's response to broadcast to orderer Deploy(ctx context.Context, in *DeployRequest, opts ...grpc.CallOption) (*peer.Response, error) @@ -556,16 +566,16 @@ func NewLSCCServiceClient(cc grpc.ClientConnInterface) LSCCServiceClient { func (c *lSCCServiceClient) GetChaincodeData(ctx context.Context, in *GetChaincodeDataRequest, opts ...grpc.CallOption) (*peer.ChaincodeData, error) { out := new(peer.ChaincodeData) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LSCCService/GetChaincodeData", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lscc.LSCCService/GetChaincodeData", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *lSCCServiceClient) GetInstalledChaincodes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*peer.ChaincodeQueryResponse, error) { +func (c *lSCCServiceClient) GetInstalledChaincodes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*peer.ChaincodeQueryResponse, error) { out := new(peer.ChaincodeQueryResponse) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LSCCService/GetInstalledChaincodes", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lscc.LSCCService/GetInstalledChaincodes", in, out, opts...) if err != nil { return nil, err } @@ -574,7 +584,7 @@ func (c *lSCCServiceClient) GetInstalledChaincodes(ctx context.Context, in *empt func (c *lSCCServiceClient) GetChaincodes(ctx context.Context, in *GetChaincodesRequest, opts ...grpc.CallOption) (*peer.ChaincodeQueryResponse, error) { out := new(peer.ChaincodeQueryResponse) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LSCCService/GetChaincodes", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lscc.LSCCService/GetChaincodes", in, out, opts...) if err != nil { return nil, err } @@ -583,16 +593,16 @@ func (c *lSCCServiceClient) GetChaincodes(ctx context.Context, in *GetChaincodes func (c *lSCCServiceClient) GetDeploymentSpec(ctx context.Context, in *GetDeploymentSpecRequest, opts ...grpc.CallOption) (*peer.ChaincodeDeploymentSpec, error) { out := new(peer.ChaincodeDeploymentSpec) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LSCCService/GetDeploymentSpec", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lscc.LSCCService/GetDeploymentSpec", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *lSCCServiceClient) Install(ctx context.Context, in *peer.ChaincodeDeploymentSpec, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LSCCService/Install", in, out, opts...) +func (c *lSCCServiceClient) Install(ctx context.Context, in *peer.ChaincodeDeploymentSpec, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lscc.LSCCService/Install", in, out, opts...) if err != nil { return nil, err } @@ -601,7 +611,7 @@ func (c *lSCCServiceClient) Install(ctx context.Context, in *peer.ChaincodeDeplo func (c *lSCCServiceClient) Deploy(ctx context.Context, in *DeployRequest, opts ...grpc.CallOption) (*peer.Response, error) { out := new(peer.Response) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.LSCCService/Deploy", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.lscc.LSCCService/Deploy", in, out, opts...) if err != nil { return nil, err } @@ -613,13 +623,13 @@ type LSCCServiceServer interface { // GetChaincodeData returns information about instantiated chaincode on target channel GetChaincodeData(context.Context, *GetChaincodeDataRequest) (*peer.ChaincodeData, error) // GetInstalledChaincodes returns list of installed chaincodes on peer - GetInstalledChaincodes(context.Context, *empty.Empty) (*peer.ChaincodeQueryResponse, error) + GetInstalledChaincodes(context.Context, *emptypb.Empty) (*peer.ChaincodeQueryResponse, error) // GetChaincodes returns list of instantiated chaincodes on channel GetChaincodes(context.Context, *GetChaincodesRequest) (*peer.ChaincodeQueryResponse, error) // GetDeploymentSpec returns spec for installed chaincode GetDeploymentSpec(context.Context, *GetDeploymentSpecRequest) (*peer.ChaincodeDeploymentSpec, error) // Install allows installing chaincode using deployment specification - Install(context.Context, *peer.ChaincodeDeploymentSpec) (*empty.Empty, error) + Install(context.Context, *peer.ChaincodeDeploymentSpec) (*emptypb.Empty, error) // Deploy allows instantiating or upgrade chaincode if instantiated // Currently, deploy method is not canonical as lscc implementation, but currently we need to get full proposal, and it's response to broadcast to orderer Deploy(context.Context, *DeployRequest) (*peer.Response, error) @@ -632,7 +642,7 @@ type UnimplementedLSCCServiceServer struct { func (*UnimplementedLSCCServiceServer) GetChaincodeData(context.Context, *GetChaincodeDataRequest) (*peer.ChaincodeData, error) { return nil, status.Errorf(codes.Unimplemented, "method GetChaincodeData not implemented") } -func (*UnimplementedLSCCServiceServer) GetInstalledChaincodes(context.Context, *empty.Empty) (*peer.ChaincodeQueryResponse, error) { +func (*UnimplementedLSCCServiceServer) GetInstalledChaincodes(context.Context, *emptypb.Empty) (*peer.ChaincodeQueryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetInstalledChaincodes not implemented") } func (*UnimplementedLSCCServiceServer) GetChaincodes(context.Context, *GetChaincodesRequest) (*peer.ChaincodeQueryResponse, error) { @@ -641,7 +651,7 @@ func (*UnimplementedLSCCServiceServer) GetChaincodes(context.Context, *GetChainc func (*UnimplementedLSCCServiceServer) GetDeploymentSpec(context.Context, *GetDeploymentSpecRequest) (*peer.ChaincodeDeploymentSpec, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDeploymentSpec not implemented") } -func (*UnimplementedLSCCServiceServer) Install(context.Context, *peer.ChaincodeDeploymentSpec) (*empty.Empty, error) { +func (*UnimplementedLSCCServiceServer) Install(context.Context, *peer.ChaincodeDeploymentSpec) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Install not implemented") } func (*UnimplementedLSCCServiceServer) Deploy(context.Context, *DeployRequest) (*peer.Response, error) { @@ -662,7 +672,7 @@ func _LSCCService_GetChaincodeData_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LSCCService/GetChaincodeData", + FullMethod: "/hlfsdk.service.systemcc.lscc.LSCCService/GetChaincodeData", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LSCCServiceServer).GetChaincodeData(ctx, req.(*GetChaincodeDataRequest)) @@ -671,7 +681,7 @@ func _LSCCService_GetChaincodeData_Handler(srv interface{}, ctx context.Context, } func _LSCCService_GetInstalledChaincodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -680,10 +690,10 @@ func _LSCCService_GetInstalledChaincodes_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LSCCService/GetInstalledChaincodes", + FullMethod: "/hlfsdk.service.systemcc.lscc.LSCCService/GetInstalledChaincodes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LSCCServiceServer).GetInstalledChaincodes(ctx, req.(*empty.Empty)) + return srv.(LSCCServiceServer).GetInstalledChaincodes(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -698,7 +708,7 @@ func _LSCCService_GetChaincodes_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LSCCService/GetChaincodes", + FullMethod: "/hlfsdk.service.systemcc.lscc.LSCCService/GetChaincodes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LSCCServiceServer).GetChaincodes(ctx, req.(*GetChaincodesRequest)) @@ -716,7 +726,7 @@ func _LSCCService_GetDeploymentSpec_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LSCCService/GetDeploymentSpec", + FullMethod: "/hlfsdk.service.systemcc.lscc.LSCCService/GetDeploymentSpec", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LSCCServiceServer).GetDeploymentSpec(ctx, req.(*GetDeploymentSpecRequest)) @@ -734,7 +744,7 @@ func _LSCCService_Install_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LSCCService/Install", + FullMethod: "/hlfsdk.service.systemcc.lscc.LSCCService/Install", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LSCCServiceServer).Install(ctx, req.(*peer.ChaincodeDeploymentSpec)) @@ -752,7 +762,7 @@ func _LSCCService_Deploy_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.LSCCService/Deploy", + FullMethod: "/hlfsdk.service.systemcc.lscc.LSCCService/Deploy", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LSCCServiceServer).Deploy(ctx, req.(*DeployRequest)) @@ -761,7 +771,7 @@ func _LSCCService_Deploy_Handler(srv interface{}, ctx context.Context, dec func( } var _LSCCService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hlfsdk.client.chaincode.system.LSCCService", + ServiceName: "hlfsdk.service.systemcc.lscc.LSCCService", HandlerType: (*LSCCServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -790,5 +800,5 @@ var _LSCCService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "lscc.proto", + Metadata: "systemcc/lscc/lscc.proto", } diff --git a/client/chaincode/system/lscc.pb.gw.go b/service/systemcc/lscc/lscc.pb.gw.go similarity index 92% rename from client/chaincode/system/lscc.pb.gw.go rename to service/systemcc/lscc/lscc.pb.gw.go index 539e861a..78fdd94b 100644 --- a/client/chaincode/system/lscc.pb.gw.go +++ b/service/systemcc/lscc/lscc.pb.gw.go @@ -1,34 +1,39 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: lscc.proto +// source: systemcc/lscc/lscc.proto /* -Package system is a reverse proxy. +Package lscc is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package system +package lscc import ( "context" "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "github.com/hyperledger/fabric-protos-go/peer" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_LSCCService_GetChaincodeData_0(ctx context.Context, marshaler runtime.Marshaler, client LSCCServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetChaincodeDataRequest @@ -107,7 +112,7 @@ func local_request_LSCCService_GetChaincodeData_0(ctx context.Context, marshaler } func request_LSCCService_GetInstalledChaincodes_0(ctx context.Context, marshaler runtime.Marshaler, client LSCCServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.GetInstalledChaincodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -116,7 +121,7 @@ func request_LSCCService_GetInstalledChaincodes_0(ctx context.Context, marshaler } func local_request_LSCCService_GetInstalledChaincodes_0(ctx context.Context, marshaler runtime.Marshaler, server LSCCServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.GetInstalledChaincodes(ctx, &protoReq) @@ -361,11 +366,14 @@ func local_request_LSCCService_Deploy_0(ctx context.Context, marshaler runtime.M // RegisterLSCCServiceHandlerServer registers the http handlers for service LSCCService to "mux". // UnaryRPC :call LSCCServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLSCCServiceHandlerFromEndpoint instead. func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LSCCServiceServer) error { mux.Handle("GET", pattern_LSCCService_GetChaincodeData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -373,6 +381,7 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_LSCCService_GetChaincodeData_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -386,6 +395,8 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_LSCCService_GetInstalledChaincodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -393,6 +404,7 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_LSCCService_GetInstalledChaincodes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -406,6 +418,8 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_LSCCService_GetChaincodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -413,6 +427,7 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_LSCCService_GetChaincodes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -426,6 +441,8 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_LSCCService_GetDeploymentSpec_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -433,6 +450,7 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_LSCCService_GetDeploymentSpec_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -446,6 +464,8 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("POST", pattern_LSCCService_Install_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -453,6 +473,7 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_LSCCService_Install_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -466,6 +487,8 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("POST", pattern_LSCCService_Deploy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -473,6 +496,7 @@ func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_LSCCService_Deploy_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/service/systemcc/lscc/lscc.pb.validate.go b/service/systemcc/lscc/lscc.pb.validate.go new file mode 100644 index 00000000..f0f21ee7 --- /dev/null +++ b/service/systemcc/lscc/lscc.pb.validate.go @@ -0,0 +1,547 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: systemcc/lscc/lscc.proto + +package lscc + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on GetChaincodeDataRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetChaincodeDataRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetChaincodeDataRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetChaincodeDataRequestMultiError, or nil if none found. +func (m *GetChaincodeDataRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetChaincodeDataRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + // no validation rules for Chaincode + + if len(errors) > 0 { + return GetChaincodeDataRequestMultiError(errors) + } + + return nil +} + +// GetChaincodeDataRequestMultiError is an error wrapping multiple validation +// errors returned by GetChaincodeDataRequest.ValidateAll() if the designated +// constraints aren't met. +type GetChaincodeDataRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetChaincodeDataRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetChaincodeDataRequestMultiError) AllErrors() []error { return m } + +// GetChaincodeDataRequestValidationError is the validation error returned by +// GetChaincodeDataRequest.Validate if the designated constraints aren't met. +type GetChaincodeDataRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetChaincodeDataRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetChaincodeDataRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetChaincodeDataRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetChaincodeDataRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetChaincodeDataRequestValidationError) ErrorName() string { + return "GetChaincodeDataRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetChaincodeDataRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetChaincodeDataRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetChaincodeDataRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetChaincodeDataRequestValidationError{} + +// Validate checks the field values on GetChaincodesRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetChaincodesRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetChaincodesRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetChaincodesRequestMultiError, or nil if none found. +func (m *GetChaincodesRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetChaincodesRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if len(errors) > 0 { + return GetChaincodesRequestMultiError(errors) + } + + return nil +} + +// GetChaincodesRequestMultiError is an error wrapping multiple validation +// errors returned by GetChaincodesRequest.ValidateAll() if the designated +// constraints aren't met. +type GetChaincodesRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetChaincodesRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetChaincodesRequestMultiError) AllErrors() []error { return m } + +// GetChaincodesRequestValidationError is the validation error returned by +// GetChaincodesRequest.Validate if the designated constraints aren't met. +type GetChaincodesRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetChaincodesRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetChaincodesRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetChaincodesRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetChaincodesRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetChaincodesRequestValidationError) ErrorName() string { + return "GetChaincodesRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetChaincodesRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetChaincodesRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetChaincodesRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetChaincodesRequestValidationError{} + +// Validate checks the field values on GetDeploymentSpecRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetDeploymentSpecRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetDeploymentSpecRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetDeploymentSpecRequestMultiError, or nil if none found. +func (m *GetDeploymentSpecRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetDeploymentSpecRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + // no validation rules for Chaincode + + if len(errors) > 0 { + return GetDeploymentSpecRequestMultiError(errors) + } + + return nil +} + +// GetDeploymentSpecRequestMultiError is an error wrapping multiple validation +// errors returned by GetDeploymentSpecRequest.ValidateAll() if the designated +// constraints aren't met. +type GetDeploymentSpecRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetDeploymentSpecRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetDeploymentSpecRequestMultiError) AllErrors() []error { return m } + +// GetDeploymentSpecRequestValidationError is the validation error returned by +// GetDeploymentSpecRequest.Validate if the designated constraints aren't met. +type GetDeploymentSpecRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetDeploymentSpecRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetDeploymentSpecRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetDeploymentSpecRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetDeploymentSpecRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetDeploymentSpecRequestValidationError) ErrorName() string { + return "GetDeploymentSpecRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetDeploymentSpecRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetDeploymentSpecRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetDeploymentSpecRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetDeploymentSpecRequestValidationError{} + +// Validate checks the field values on DeployRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *DeployRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeployRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in DeployRequestMultiError, or +// nil if none found. +func (m *DeployRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeployRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Channel + + if all { + switch v := interface{}(m.GetDeploymentSpec()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeployRequestValidationError{ + field: "DeploymentSpec", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeployRequestValidationError{ + field: "DeploymentSpec", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetDeploymentSpec()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DeployRequestValidationError{ + field: "DeploymentSpec", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetPolicy()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeployRequestValidationError{ + field: "Policy", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeployRequestValidationError{ + field: "Policy", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPolicy()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DeployRequestValidationError{ + field: "Policy", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for ESCC + + // no validation rules for VSCC + + if all { + switch v := interface{}(m.GetCollectionConfig()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeployRequestValidationError{ + field: "CollectionConfig", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeployRequestValidationError{ + field: "CollectionConfig", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCollectionConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DeployRequestValidationError{ + field: "CollectionConfig", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for Transient + + if len(errors) > 0 { + return DeployRequestMultiError(errors) + } + + return nil +} + +// DeployRequestMultiError is an error wrapping multiple validation errors +// returned by DeployRequest.ValidateAll() if the designated constraints +// aren't met. +type DeployRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeployRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeployRequestMultiError) AllErrors() []error { return m } + +// DeployRequestValidationError is the validation error returned by +// DeployRequest.Validate if the designated constraints aren't met. +type DeployRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeployRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeployRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeployRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeployRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeployRequestValidationError) ErrorName() string { return "DeployRequestValidationError" } + +// Error satisfies the builtin error interface +func (e DeployRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeployRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeployRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeployRequestValidationError{} diff --git a/client/chaincode/system/lscc.proto b/service/systemcc/lscc/lscc.proto similarity index 85% rename from client/chaincode/system/lscc.proto rename to service/systemcc/lscc/lscc.proto index 5609de93..182c298e 100644 --- a/client/chaincode/system/lscc.proto +++ b/service/systemcc/lscc/lscc.proto @@ -1,15 +1,15 @@ syntax = "proto3"; -package hlfsdk.client.chaincode.system; +package hlfsdk.service.systemcc.lscc; -option go_package = "hlfsdk/client/chaincode/system"; +option go_package = "github.com/s7techlab/hlf-sdk-go/service/systemcc/lscc"; -import "common/collection.proto"; -import "common/policies.proto"; -import "peer/query.proto"; -import "peer/chaincode.proto"; +import "hyperledger/fabric-protos/common/collection.proto"; +import "hyperledger/fabric-protos/common/policies.proto"; +import "hyperledger/fabric-protos/peer/query.proto"; +import "hyperledger/fabric-protos/peer/chaincode.proto"; //import "peer/proposal.proto"; -import "peer/proposal_response.proto"; +import "hyperledger/fabric-protos/peer/proposal_response.proto"; import "google/protobuf/empty.proto"; diff --git a/client/chaincode/system/lscc.swagger.json b/service/systemcc/lscc/lscc.swagger.json similarity index 90% rename from client/chaincode/system/lscc.swagger.json rename to service/systemcc/lscc/lscc.swagger.json index 878e1ae3..a1af88ef 100644 --- a/client/chaincode/system/lscc.swagger.json +++ b/service/systemcc/lscc/lscc.swagger.json @@ -1,13 +1,9 @@ { "swagger": "2.0", "info": { - "title": "lscc.proto", + "title": "systemcc/lscc/lscc.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], @@ -18,13 +14,19 @@ "/lscc/chaincodes": { "get": { "summary": "GetInstalledChaincodes returns list of installed chaincodes on peer", - "operationId": "GetInstalledChaincodes", + "operationId": "LSCCService_GetInstalledChaincodes", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosChaincodeQueryResponse" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -33,13 +35,19 @@ }, "post": { "summary": "Install allows installing chaincode using deployment specification", - "operationId": "Install", + "operationId": "LSCCService_Install", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -60,13 +68,19 @@ "/lscc/chaincodes/{channel}": { "get": { "summary": "GetChaincodes returns list of instantiated chaincodes on channel", - "operationId": "GetChaincodes", + "operationId": "LSCCService_GetChaincodes", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosChaincodeQueryResponse" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -83,13 +97,19 @@ }, "post": { "summary": "Deploy allows instantiating or upgrade chaincode if instantiated\nCurrently, deploy method is not canonical as lscc implementation, but currently we need to get full proposal, and it's response to broadcast to orderer", - "operationId": "Deploy", + "operationId": "LSCCService_Deploy", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosResponse" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -104,7 +124,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/systemDeployRequest" + "$ref": "#/definitions/lsccDeployRequest" } } ], @@ -116,13 +136,19 @@ "/lscc/chaincodes/{channel}/{chaincode}": { "get": { "summary": "GetChaincodeData returns information about instantiated chaincode on target channel", - "operationId": "GetChaincodeData", + "operationId": "LSCCService_GetChaincodeData", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosChaincodeData" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -147,13 +173,19 @@ "/lscc/chaincodes/{channel}/{chaincode}/deployment-spec": { "get": { "summary": "GetDeploymentSpec returns spec for installed chaincode", - "operationId": "GetDeploymentSpec", + "operationId": "LSCCService_GetDeploymentSpec", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosChaincodeDeploymentSpec" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -324,12 +356,10 @@ }, "member_only_read": { "type": "boolean", - "format": "boolean", "title": "The member only read access denotes whether only collection member clients\ncan read the private data (if set to true), or even non members can\nread the data (if set to false, for example if you want to implement more granular\naccess logic in the chaincode)" }, "member_only_write": { "type": "boolean", - "format": "boolean", "title": "The member only write access denotes whether only collection member clients\ncan write the private data (if set to true), or even non members can\nwrite the data (if set to false, for example if you want to implement more granular\naccess logic in the chaincode)" }, "endorsement_policy": { @@ -339,6 +369,48 @@ }, "description": "StaticCollectionConfig constitutes the configuration parameters of a\nstatic collection object. Static collections are collections that are\nknown at chaincode instantiation time, and that cannot be changed.\nDynamic collections are deferred." }, + "lsccDeployRequest": { + "type": "object", + "properties": { + "channel": { + "type": "string" + }, + "deployment_spec": { + "$ref": "#/definitions/protosChaincodeDeploymentSpec" + }, + "policy": { + "$ref": "#/definitions/commonSignaturePolicyEnvelope" + }, + "ESCC": { + "type": "string" + }, + "VSCC": { + "type": "string" + }, + "collection_config": { + "$ref": "#/definitions/commonCollectionConfigPackage" + }, + "transient": { + "type": "object", + "additionalProperties": { + "type": "string", + "format": "byte" + } + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, "protosChaincodeData": { "type": "object", "properties": { @@ -462,7 +534,6 @@ }, "is_init": { "type": "boolean", - "format": "boolean", "description": "is_init is used for the application to signal that an invocation is to be routed\nto the legacy 'Init' function for compatibility with chaincodes which handled\nInit in the old way. New applications should manage their initialized state\nthemselves." } }, @@ -530,32 +601,23 @@ }, "description": "A response with a representation similar to an HTTP response that can\nbe used within another message." }, - "systemDeployRequest": { + "runtimeError": { "type": "object", "properties": { - "channel": { + "error": { "type": "string" }, - "deployment_spec": { - "$ref": "#/definitions/protosChaincodeDeploymentSpec" - }, - "policy": { - "$ref": "#/definitions/commonSignaturePolicyEnvelope" - }, - "ESCC": { - "type": "string" + "code": { + "type": "integer", + "format": "int32" }, - "VSCC": { + "message": { "type": "string" }, - "collection_config": { - "$ref": "#/definitions/commonCollectionConfigPackage" - }, - "transient": { - "type": "object", - "additionalProperties": { - "type": "string", - "format": "byte" + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" } } } diff --git a/client/chaincode/system/qscc.go b/service/systemcc/qscc/qscc.go similarity index 89% rename from client/chaincode/system/qscc.go rename to service/systemcc/qscc/qscc.go index 22e9a9c6..63a2e305 100644 --- a/client/chaincode/system/qscc.go +++ b/service/systemcc/qscc/qscc.go @@ -1,4 +1,4 @@ -package system +package qscc import ( "context" @@ -10,11 +10,13 @@ import ( qscccore "github.com/hyperledger/fabric/core/scc/qscc" "github.com/s7techlab/hlf-sdk-go/api" + "github.com/s7techlab/hlf-sdk-go/client/chaincode" "github.com/s7techlab/hlf-sdk-go/client/tx" + "github.com/s7techlab/hlf-sdk-go/service" ) //go:embed qscc.swagger.json -var QSCCServiceSwagger []byte +var Swagger []byte type QSCCService struct { UnimplementedQSCCServiceServer @@ -23,14 +25,14 @@ type QSCCService struct { func NewQSCC(querier api.Querier) *QSCCService { return &QSCCService{ - Querier: tx.NewProtoQuerier(querier, ``, QSCCName), + Querier: tx.NewProtoQuerier(querier, ``, chaincode.QSCC), } } -func (q *QSCCService) ServiceDef() ServiceDef { - return NewServiceDef( +func (q *QSCCService) ServiceDef() *service.Def { + return service.NewDef( _QSCCService_serviceDesc.ServiceName, - QSCCServiceSwagger, + Swagger, &_QSCCService_serviceDesc, q, RegisterQSCCServiceHandlerFromEndpoint, diff --git a/client/chaincode/system/qscc.pb.go b/service/systemcc/qscc/qscc.pb.go similarity index 59% rename from client/chaincode/system/qscc.pb.go rename to service/systemcc/qscc/qscc.pb.go index 712e4052..6ab9e89b 100644 --- a/client/chaincode/system/qscc.pb.go +++ b/service/systemcc/qscc/qscc.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.7.1 -// source: qscc.proto +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: systemcc/qscc/qscc.proto -package system +package qscc import ( context "context" @@ -38,7 +38,7 @@ type GetChainInfoRequest struct { func (x *GetChainInfoRequest) Reset() { *x = GetChainInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_qscc_proto_msgTypes[0] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -51,7 +51,7 @@ func (x *GetChainInfoRequest) String() string { func (*GetChainInfoRequest) ProtoMessage() {} func (x *GetChainInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_qscc_proto_msgTypes[0] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -64,7 +64,7 @@ func (x *GetChainInfoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetChainInfoRequest.ProtoReflect.Descriptor instead. func (*GetChainInfoRequest) Descriptor() ([]byte, []int) { - return file_qscc_proto_rawDescGZIP(), []int{0} + return file_systemcc_qscc_qscc_proto_rawDescGZIP(), []int{0} } func (x *GetChainInfoRequest) GetChannelName() string { @@ -86,7 +86,7 @@ type GetBlockByNumberRequest struct { func (x *GetBlockByNumberRequest) Reset() { *x = GetBlockByNumberRequest{} if protoimpl.UnsafeEnabled { - mi := &file_qscc_proto_msgTypes[1] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99,7 +99,7 @@ func (x *GetBlockByNumberRequest) String() string { func (*GetBlockByNumberRequest) ProtoMessage() {} func (x *GetBlockByNumberRequest) ProtoReflect() protoreflect.Message { - mi := &file_qscc_proto_msgTypes[1] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112,7 +112,7 @@ func (x *GetBlockByNumberRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetBlockByNumberRequest.ProtoReflect.Descriptor instead. func (*GetBlockByNumberRequest) Descriptor() ([]byte, []int) { - return file_qscc_proto_rawDescGZIP(), []int{1} + return file_systemcc_qscc_qscc_proto_rawDescGZIP(), []int{1} } func (x *GetBlockByNumberRequest) GetChannelName() string { @@ -141,7 +141,7 @@ type GetBlockByHashRequest struct { func (x *GetBlockByHashRequest) Reset() { *x = GetBlockByHashRequest{} if protoimpl.UnsafeEnabled { - mi := &file_qscc_proto_msgTypes[2] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -154,7 +154,7 @@ func (x *GetBlockByHashRequest) String() string { func (*GetBlockByHashRequest) ProtoMessage() {} func (x *GetBlockByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_qscc_proto_msgTypes[2] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -167,7 +167,7 @@ func (x *GetBlockByHashRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetBlockByHashRequest.ProtoReflect.Descriptor instead. func (*GetBlockByHashRequest) Descriptor() ([]byte, []int) { - return file_qscc_proto_rawDescGZIP(), []int{2} + return file_systemcc_qscc_qscc_proto_rawDescGZIP(), []int{2} } func (x *GetBlockByHashRequest) GetChannelName() string { @@ -196,7 +196,7 @@ type GetTransactionByIDRequest struct { func (x *GetTransactionByIDRequest) Reset() { *x = GetTransactionByIDRequest{} if protoimpl.UnsafeEnabled { - mi := &file_qscc_proto_msgTypes[3] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -209,7 +209,7 @@ func (x *GetTransactionByIDRequest) String() string { func (*GetTransactionByIDRequest) ProtoMessage() {} func (x *GetTransactionByIDRequest) ProtoReflect() protoreflect.Message { - mi := &file_qscc_proto_msgTypes[3] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -222,7 +222,7 @@ func (x *GetTransactionByIDRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetTransactionByIDRequest.ProtoReflect.Descriptor instead. func (*GetTransactionByIDRequest) Descriptor() ([]byte, []int) { - return file_qscc_proto_rawDescGZIP(), []int{3} + return file_systemcc_qscc_qscc_proto_rawDescGZIP(), []int{3} } func (x *GetTransactionByIDRequest) GetChannelName() string { @@ -251,7 +251,7 @@ type GetBlockByTxIDRequest struct { func (x *GetBlockByTxIDRequest) Reset() { *x = GetBlockByTxIDRequest{} if protoimpl.UnsafeEnabled { - mi := &file_qscc_proto_msgTypes[4] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -264,7 +264,7 @@ func (x *GetBlockByTxIDRequest) String() string { func (*GetBlockByTxIDRequest) ProtoMessage() {} func (x *GetBlockByTxIDRequest) ProtoReflect() protoreflect.Message { - mi := &file_qscc_proto_msgTypes[4] + mi := &file_systemcc_qscc_qscc_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -277,7 +277,7 @@ func (x *GetBlockByTxIDRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetBlockByTxIDRequest.ProtoReflect.Descriptor instead. func (*GetBlockByTxIDRequest) Descriptor() ([]byte, []int) { - return file_qscc_proto_rawDescGZIP(), []int{4} + return file_systemcc_qscc_qscc_proto_rawDescGZIP(), []int{4} } func (x *GetBlockByTxIDRequest) GetChannelName() string { @@ -294,128 +294,134 @@ func (x *GetBlockByTxIDRequest) GetTxId() string { return "" } -var File_qscc_proto protoreflect.FileDescriptor - -var file_qscc_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x71, 0x73, 0x63, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x68, 0x6c, - 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x1a, 0x13, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x13, - 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x5f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x59, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, - 0x73, 0x68, 0x22, 0x53, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x21, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x22, 0x4f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x54, 0x78, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x32, 0xd4, 0x05, 0x0a, 0x0b, 0x51, 0x53, 0x43, - 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, - 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, - 0x71, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x8d, 0x01, 0x0a, 0x10, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x37, - 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, - 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, +var File_systemcc_qscc_qscc_proto protoreflect.FileDescriptor + +var file_systemcc_qscc_qscc_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2f, 0x71, 0x73, 0x63, 0x63, 0x2f, + 0x71, 0x73, 0x63, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x68, 0x6c, 0x66, 0x73, + 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x63, 0x63, 0x2e, 0x71, 0x73, 0x63, 0x63, 0x1a, 0x2d, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x65, 0x64, 0x67, 0x65, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2d, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, + 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x30, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, + 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, + 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x22, 0x5f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x22, 0x59, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, + 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, + 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x53, 0x0a, 0x19, + 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, + 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x13, 0x0a, 0x05, + 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x49, + 0x64, 0x22, 0x4f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x54, + 0x78, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x13, 0x0a, + 0x05, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, + 0x49, 0x64, 0x32, 0xca, 0x05, 0x0a, 0x0b, 0x51, 0x53, 0x43, 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x7d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x31, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x71, 0x73, 0x63, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x22, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x71, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x7d, 0x12, 0x8b, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x35, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, + 0x2e, 0x71, 0x73, 0x63, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x31, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x71, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, + 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x7d, 0x12, + 0x8c, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x33, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x71, 0x73, 0x63, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, + 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x71, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, 0x35, 0x2e, 0x68, - 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x71, 0x73, 0x63, - 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x62, 0x79, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x7b, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x7d, 0x12, 0x89, 0x01, 0x0a, 0x0e, 0x47, - 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x54, 0x78, 0x49, 0x44, 0x12, 0x35, 0x2e, - 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, - 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x54, 0x78, 0x49, 0x44, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x71, 0x73, - 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x62, 0x79, 0x74, 0x78, 0x69, 0x64, 0x2f, 0x7b, - 0x74, 0x78, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x96, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x49, 0x44, 0x12, 0x39, 0x2e, - 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, + 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x62, 0x79, 0x68, 0x61, 0x73, + 0x68, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x7d, 0x12, 0x87, + 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x54, 0x78, 0x49, + 0x44, 0x12, 0x33, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x71, 0x73, 0x63, 0x63, + 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x54, 0x78, 0x49, 0x44, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, + 0x71, 0x73, 0x63, 0x63, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x62, 0x79, 0x74, 0x78, 0x69, 0x64, + 0x2f, 0x7b, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x49, 0x44, 0x12, + 0x37, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x63, 0x63, 0x2e, 0x71, 0x73, 0x63, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, 0x2f, 0x71, 0x73, 0x63, 0x63, 0x2f, 0x74, 0x78, 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x7b, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x7d, 0x42, - 0x20, 0x5a, 0x1e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x37, + 0x74, 0x65, 0x63, 0x68, 0x6c, 0x61, 0x62, 0x2f, 0x68, 0x6c, 0x66, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x63, 0x63, 0x2f, 0x71, 0x73, 0x63, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_qscc_proto_rawDescOnce sync.Once - file_qscc_proto_rawDescData = file_qscc_proto_rawDesc + file_systemcc_qscc_qscc_proto_rawDescOnce sync.Once + file_systemcc_qscc_qscc_proto_rawDescData = file_systemcc_qscc_qscc_proto_rawDesc ) -func file_qscc_proto_rawDescGZIP() []byte { - file_qscc_proto_rawDescOnce.Do(func() { - file_qscc_proto_rawDescData = protoimpl.X.CompressGZIP(file_qscc_proto_rawDescData) +func file_systemcc_qscc_qscc_proto_rawDescGZIP() []byte { + file_systemcc_qscc_qscc_proto_rawDescOnce.Do(func() { + file_systemcc_qscc_qscc_proto_rawDescData = protoimpl.X.CompressGZIP(file_systemcc_qscc_qscc_proto_rawDescData) }) - return file_qscc_proto_rawDescData + return file_systemcc_qscc_qscc_proto_rawDescData } -var file_qscc_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_qscc_proto_goTypes = []interface{}{ - (*GetChainInfoRequest)(nil), // 0: hlfsdk.client.chaincode.system.GetChainInfoRequest - (*GetBlockByNumberRequest)(nil), // 1: hlfsdk.client.chaincode.system.GetBlockByNumberRequest - (*GetBlockByHashRequest)(nil), // 2: hlfsdk.client.chaincode.system.GetBlockByHashRequest - (*GetTransactionByIDRequest)(nil), // 3: hlfsdk.client.chaincode.system.GetTransactionByIDRequest - (*GetBlockByTxIDRequest)(nil), // 4: hlfsdk.client.chaincode.system.GetBlockByTxIDRequest +var file_systemcc_qscc_qscc_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_systemcc_qscc_qscc_proto_goTypes = []interface{}{ + (*GetChainInfoRequest)(nil), // 0: hlfsdk.service.systemcc.qscc.GetChainInfoRequest + (*GetBlockByNumberRequest)(nil), // 1: hlfsdk.service.systemcc.qscc.GetBlockByNumberRequest + (*GetBlockByHashRequest)(nil), // 2: hlfsdk.service.systemcc.qscc.GetBlockByHashRequest + (*GetTransactionByIDRequest)(nil), // 3: hlfsdk.service.systemcc.qscc.GetTransactionByIDRequest + (*GetBlockByTxIDRequest)(nil), // 4: hlfsdk.service.systemcc.qscc.GetBlockByTxIDRequest (*common.BlockchainInfo)(nil), // 5: common.BlockchainInfo (*common.Block)(nil), // 6: common.Block (*peer.ProcessedTransaction)(nil), // 7: protos.ProcessedTransaction } -var file_qscc_proto_depIdxs = []int32{ - 0, // 0: hlfsdk.client.chaincode.system.QSCCService.GetChainInfo:input_type -> hlfsdk.client.chaincode.system.GetChainInfoRequest - 1, // 1: hlfsdk.client.chaincode.system.QSCCService.GetBlockByNumber:input_type -> hlfsdk.client.chaincode.system.GetBlockByNumberRequest - 2, // 2: hlfsdk.client.chaincode.system.QSCCService.GetBlockByHash:input_type -> hlfsdk.client.chaincode.system.GetBlockByHashRequest - 4, // 3: hlfsdk.client.chaincode.system.QSCCService.GetBlockByTxID:input_type -> hlfsdk.client.chaincode.system.GetBlockByTxIDRequest - 3, // 4: hlfsdk.client.chaincode.system.QSCCService.GetTransactionByID:input_type -> hlfsdk.client.chaincode.system.GetTransactionByIDRequest - 5, // 5: hlfsdk.client.chaincode.system.QSCCService.GetChainInfo:output_type -> common.BlockchainInfo - 6, // 6: hlfsdk.client.chaincode.system.QSCCService.GetBlockByNumber:output_type -> common.Block - 6, // 7: hlfsdk.client.chaincode.system.QSCCService.GetBlockByHash:output_type -> common.Block - 6, // 8: hlfsdk.client.chaincode.system.QSCCService.GetBlockByTxID:output_type -> common.Block - 7, // 9: hlfsdk.client.chaincode.system.QSCCService.GetTransactionByID:output_type -> protos.ProcessedTransaction +var file_systemcc_qscc_qscc_proto_depIdxs = []int32{ + 0, // 0: hlfsdk.service.systemcc.qscc.QSCCService.GetChainInfo:input_type -> hlfsdk.service.systemcc.qscc.GetChainInfoRequest + 1, // 1: hlfsdk.service.systemcc.qscc.QSCCService.GetBlockByNumber:input_type -> hlfsdk.service.systemcc.qscc.GetBlockByNumberRequest + 2, // 2: hlfsdk.service.systemcc.qscc.QSCCService.GetBlockByHash:input_type -> hlfsdk.service.systemcc.qscc.GetBlockByHashRequest + 4, // 3: hlfsdk.service.systemcc.qscc.QSCCService.GetBlockByTxID:input_type -> hlfsdk.service.systemcc.qscc.GetBlockByTxIDRequest + 3, // 4: hlfsdk.service.systemcc.qscc.QSCCService.GetTransactionByID:input_type -> hlfsdk.service.systemcc.qscc.GetTransactionByIDRequest + 5, // 5: hlfsdk.service.systemcc.qscc.QSCCService.GetChainInfo:output_type -> common.BlockchainInfo + 6, // 6: hlfsdk.service.systemcc.qscc.QSCCService.GetBlockByNumber:output_type -> common.Block + 6, // 7: hlfsdk.service.systemcc.qscc.QSCCService.GetBlockByHash:output_type -> common.Block + 6, // 8: hlfsdk.service.systemcc.qscc.QSCCService.GetBlockByTxID:output_type -> common.Block + 7, // 9: hlfsdk.service.systemcc.qscc.QSCCService.GetTransactionByID:output_type -> protos.ProcessedTransaction 5, // [5:10] is the sub-list for method output_type 0, // [0:5] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -423,13 +429,13 @@ var file_qscc_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_qscc_proto_init() } -func file_qscc_proto_init() { - if File_qscc_proto != nil { +func init() { file_systemcc_qscc_qscc_proto_init() } +func file_systemcc_qscc_qscc_proto_init() { + if File_systemcc_qscc_qscc_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_qscc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_qscc_qscc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetChainInfoRequest); i { case 0: return &v.state @@ -441,7 +447,7 @@ func file_qscc_proto_init() { return nil } } - file_qscc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_qscc_qscc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetBlockByNumberRequest); i { case 0: return &v.state @@ -453,7 +459,7 @@ func file_qscc_proto_init() { return nil } } - file_qscc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_qscc_qscc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetBlockByHashRequest); i { case 0: return &v.state @@ -465,7 +471,7 @@ func file_qscc_proto_init() { return nil } } - file_qscc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_qscc_qscc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetTransactionByIDRequest); i { case 0: return &v.state @@ -477,7 +483,7 @@ func file_qscc_proto_init() { return nil } } - file_qscc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_systemcc_qscc_qscc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetBlockByTxIDRequest); i { case 0: return &v.state @@ -494,20 +500,20 @@ func file_qscc_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_qscc_proto_rawDesc, + RawDescriptor: file_systemcc_qscc_qscc_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_qscc_proto_goTypes, - DependencyIndexes: file_qscc_proto_depIdxs, - MessageInfos: file_qscc_proto_msgTypes, + GoTypes: file_systemcc_qscc_qscc_proto_goTypes, + DependencyIndexes: file_systemcc_qscc_qscc_proto_depIdxs, + MessageInfos: file_systemcc_qscc_qscc_proto_msgTypes, }.Build() - File_qscc_proto = out.File - file_qscc_proto_rawDesc = nil - file_qscc_proto_goTypes = nil - file_qscc_proto_depIdxs = nil + File_systemcc_qscc_qscc_proto = out.File + file_systemcc_qscc_qscc_proto_rawDesc = nil + file_systemcc_qscc_qscc_proto_goTypes = nil + file_systemcc_qscc_qscc_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. @@ -544,7 +550,7 @@ func NewQSCCServiceClient(cc grpc.ClientConnInterface) QSCCServiceClient { func (c *qSCCServiceClient) GetChainInfo(ctx context.Context, in *GetChainInfoRequest, opts ...grpc.CallOption) (*common.BlockchainInfo, error) { out := new(common.BlockchainInfo) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.QSCCService/GetChainInfo", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.qscc.QSCCService/GetChainInfo", in, out, opts...) if err != nil { return nil, err } @@ -553,7 +559,7 @@ func (c *qSCCServiceClient) GetChainInfo(ctx context.Context, in *GetChainInfoRe func (c *qSCCServiceClient) GetBlockByNumber(ctx context.Context, in *GetBlockByNumberRequest, opts ...grpc.CallOption) (*common.Block, error) { out := new(common.Block) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.QSCCService/GetBlockByNumber", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.qscc.QSCCService/GetBlockByNumber", in, out, opts...) if err != nil { return nil, err } @@ -562,7 +568,7 @@ func (c *qSCCServiceClient) GetBlockByNumber(ctx context.Context, in *GetBlockBy func (c *qSCCServiceClient) GetBlockByHash(ctx context.Context, in *GetBlockByHashRequest, opts ...grpc.CallOption) (*common.Block, error) { out := new(common.Block) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.QSCCService/GetBlockByHash", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.qscc.QSCCService/GetBlockByHash", in, out, opts...) if err != nil { return nil, err } @@ -571,7 +577,7 @@ func (c *qSCCServiceClient) GetBlockByHash(ctx context.Context, in *GetBlockByHa func (c *qSCCServiceClient) GetBlockByTxID(ctx context.Context, in *GetBlockByTxIDRequest, opts ...grpc.CallOption) (*common.Block, error) { out := new(common.Block) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.QSCCService/GetBlockByTxID", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.qscc.QSCCService/GetBlockByTxID", in, out, opts...) if err != nil { return nil, err } @@ -580,7 +586,7 @@ func (c *qSCCServiceClient) GetBlockByTxID(ctx context.Context, in *GetBlockByTx func (c *qSCCServiceClient) GetTransactionByID(ctx context.Context, in *GetTransactionByIDRequest, opts ...grpc.CallOption) (*peer.ProcessedTransaction, error) { out := new(peer.ProcessedTransaction) - err := c.cc.Invoke(ctx, "/hlfsdk.client.chaincode.system.QSCCService/GetTransactionByID", in, out, opts...) + err := c.cc.Invoke(ctx, "/hlfsdk.service.systemcc.qscc.QSCCService/GetTransactionByID", in, out, opts...) if err != nil { return nil, err } @@ -635,7 +641,7 @@ func _QSCCService_GetChainInfo_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.QSCCService/GetChainInfo", + FullMethod: "/hlfsdk.service.systemcc.qscc.QSCCService/GetChainInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QSCCServiceServer).GetChainInfo(ctx, req.(*GetChainInfoRequest)) @@ -653,7 +659,7 @@ func _QSCCService_GetBlockByNumber_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.QSCCService/GetBlockByNumber", + FullMethod: "/hlfsdk.service.systemcc.qscc.QSCCService/GetBlockByNumber", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QSCCServiceServer).GetBlockByNumber(ctx, req.(*GetBlockByNumberRequest)) @@ -671,7 +677,7 @@ func _QSCCService_GetBlockByHash_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.QSCCService/GetBlockByHash", + FullMethod: "/hlfsdk.service.systemcc.qscc.QSCCService/GetBlockByHash", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QSCCServiceServer).GetBlockByHash(ctx, req.(*GetBlockByHashRequest)) @@ -689,7 +695,7 @@ func _QSCCService_GetBlockByTxID_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.QSCCService/GetBlockByTxID", + FullMethod: "/hlfsdk.service.systemcc.qscc.QSCCService/GetBlockByTxID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QSCCServiceServer).GetBlockByTxID(ctx, req.(*GetBlockByTxIDRequest)) @@ -707,7 +713,7 @@ func _QSCCService_GetTransactionByID_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hlfsdk.client.chaincode.system.QSCCService/GetTransactionByID", + FullMethod: "/hlfsdk.service.systemcc.qscc.QSCCService/GetTransactionByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QSCCServiceServer).GetTransactionByID(ctx, req.(*GetTransactionByIDRequest)) @@ -716,7 +722,7 @@ func _QSCCService_GetTransactionByID_Handler(srv interface{}, ctx context.Contex } var _QSCCService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hlfsdk.client.chaincode.system.QSCCService", + ServiceName: "hlfsdk.service.systemcc.qscc.QSCCService", HandlerType: (*QSCCServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -741,5 +747,5 @@ var _QSCCService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "qscc.proto", + Metadata: "systemcc/qscc/qscc.proto", } diff --git a/client/chaincode/system/qscc.pb.gw.go b/service/systemcc/qscc/qscc.pb.gw.go similarity index 93% rename from client/chaincode/system/qscc.pb.gw.go rename to service/systemcc/qscc/qscc.pb.gw.go index a3ea0380..7c9370a8 100644 --- a/client/chaincode/system/qscc.pb.gw.go +++ b/service/systemcc/qscc/qscc.pb.gw.go @@ -1,32 +1,37 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: qscc.proto +// source: systemcc/qscc/qscc.proto /* -Package system is a reverse proxy. +Package qscc is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package system +package qscc import ( "context" "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_QSCCService_GetChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QSCCServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetChainInfoRequest @@ -389,11 +394,14 @@ func local_request_QSCCService_GetTransactionByID_0(ctx context.Context, marshal // RegisterQSCCServiceHandlerServer registers the http handlers for service QSCCService to "mux". // UnaryRPC :call QSCCServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQSCCServiceHandlerFromEndpoint instead. func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QSCCServiceServer) error { mux.Handle("GET", pattern_QSCCService_GetChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -401,6 +409,7 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_QSCCService_GetChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -414,6 +423,8 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_QSCCService_GetBlockByNumber_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -421,6 +432,7 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_QSCCService_GetBlockByNumber_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -434,6 +446,8 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_QSCCService_GetBlockByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -441,6 +455,7 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_QSCCService_GetBlockByHash_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -454,6 +469,8 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_QSCCService_GetBlockByTxID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -461,6 +478,7 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_QSCCService_GetBlockByTxID_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -474,6 +492,8 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_QSCCService_GetTransactionByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -481,6 +501,7 @@ func RegisterQSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } resp, md, err := local_request_QSCCService_GetTransactionByID_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/service/systemcc/qscc/qscc.pb.validate.go b/service/systemcc/qscc/qscc.pb.validate.go new file mode 100644 index 00000000..57e3651d --- /dev/null +++ b/service/systemcc/qscc/qscc.pb.validate.go @@ -0,0 +1,564 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: systemcc/qscc/qscc.proto + +package qscc + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on GetChainInfoRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetChainInfoRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetChainInfoRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetChainInfoRequestMultiError, or nil if none found. +func (m *GetChainInfoRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetChainInfoRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ChannelName + + if len(errors) > 0 { + return GetChainInfoRequestMultiError(errors) + } + + return nil +} + +// GetChainInfoRequestMultiError is an error wrapping multiple validation +// errors returned by GetChainInfoRequest.ValidateAll() if the designated +// constraints aren't met. +type GetChainInfoRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetChainInfoRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetChainInfoRequestMultiError) AllErrors() []error { return m } + +// GetChainInfoRequestValidationError is the validation error returned by +// GetChainInfoRequest.Validate if the designated constraints aren't met. +type GetChainInfoRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetChainInfoRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetChainInfoRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetChainInfoRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetChainInfoRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetChainInfoRequestValidationError) ErrorName() string { + return "GetChainInfoRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetChainInfoRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetChainInfoRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetChainInfoRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetChainInfoRequestValidationError{} + +// Validate checks the field values on GetBlockByNumberRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetBlockByNumberRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetBlockByNumberRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetBlockByNumberRequestMultiError, or nil if none found. +func (m *GetBlockByNumberRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetBlockByNumberRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ChannelName + + // no validation rules for BlockNumber + + if len(errors) > 0 { + return GetBlockByNumberRequestMultiError(errors) + } + + return nil +} + +// GetBlockByNumberRequestMultiError is an error wrapping multiple validation +// errors returned by GetBlockByNumberRequest.ValidateAll() if the designated +// constraints aren't met. +type GetBlockByNumberRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetBlockByNumberRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetBlockByNumberRequestMultiError) AllErrors() []error { return m } + +// GetBlockByNumberRequestValidationError is the validation error returned by +// GetBlockByNumberRequest.Validate if the designated constraints aren't met. +type GetBlockByNumberRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetBlockByNumberRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetBlockByNumberRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetBlockByNumberRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetBlockByNumberRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetBlockByNumberRequestValidationError) ErrorName() string { + return "GetBlockByNumberRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetBlockByNumberRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetBlockByNumberRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetBlockByNumberRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetBlockByNumberRequestValidationError{} + +// Validate checks the field values on GetBlockByHashRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetBlockByHashRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetBlockByHashRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetBlockByHashRequestMultiError, or nil if none found. +func (m *GetBlockByHashRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetBlockByHashRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ChannelName + + // no validation rules for BlockHash + + if len(errors) > 0 { + return GetBlockByHashRequestMultiError(errors) + } + + return nil +} + +// GetBlockByHashRequestMultiError is an error wrapping multiple validation +// errors returned by GetBlockByHashRequest.ValidateAll() if the designated +// constraints aren't met. +type GetBlockByHashRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetBlockByHashRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetBlockByHashRequestMultiError) AllErrors() []error { return m } + +// GetBlockByHashRequestValidationError is the validation error returned by +// GetBlockByHashRequest.Validate if the designated constraints aren't met. +type GetBlockByHashRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetBlockByHashRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetBlockByHashRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetBlockByHashRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetBlockByHashRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetBlockByHashRequestValidationError) ErrorName() string { + return "GetBlockByHashRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetBlockByHashRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetBlockByHashRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetBlockByHashRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetBlockByHashRequestValidationError{} + +// Validate checks the field values on GetTransactionByIDRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetTransactionByIDRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetTransactionByIDRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetTransactionByIDRequestMultiError, or nil if none found. +func (m *GetTransactionByIDRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetTransactionByIDRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ChannelName + + // no validation rules for TxId + + if len(errors) > 0 { + return GetTransactionByIDRequestMultiError(errors) + } + + return nil +} + +// GetTransactionByIDRequestMultiError is an error wrapping multiple validation +// errors returned by GetTransactionByIDRequest.ValidateAll() if the +// designated constraints aren't met. +type GetTransactionByIDRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetTransactionByIDRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetTransactionByIDRequestMultiError) AllErrors() []error { return m } + +// GetTransactionByIDRequestValidationError is the validation error returned by +// GetTransactionByIDRequest.Validate if the designated constraints aren't met. +type GetTransactionByIDRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetTransactionByIDRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetTransactionByIDRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetTransactionByIDRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetTransactionByIDRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetTransactionByIDRequestValidationError) ErrorName() string { + return "GetTransactionByIDRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetTransactionByIDRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetTransactionByIDRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetTransactionByIDRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetTransactionByIDRequestValidationError{} + +// Validate checks the field values on GetBlockByTxIDRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetBlockByTxIDRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetBlockByTxIDRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetBlockByTxIDRequestMultiError, or nil if none found. +func (m *GetBlockByTxIDRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetBlockByTxIDRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ChannelName + + // no validation rules for TxId + + if len(errors) > 0 { + return GetBlockByTxIDRequestMultiError(errors) + } + + return nil +} + +// GetBlockByTxIDRequestMultiError is an error wrapping multiple validation +// errors returned by GetBlockByTxIDRequest.ValidateAll() if the designated +// constraints aren't met. +type GetBlockByTxIDRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetBlockByTxIDRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetBlockByTxIDRequestMultiError) AllErrors() []error { return m } + +// GetBlockByTxIDRequestValidationError is the validation error returned by +// GetBlockByTxIDRequest.Validate if the designated constraints aren't met. +type GetBlockByTxIDRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetBlockByTxIDRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetBlockByTxIDRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetBlockByTxIDRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetBlockByTxIDRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetBlockByTxIDRequestValidationError) ErrorName() string { + return "GetBlockByTxIDRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetBlockByTxIDRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetBlockByTxIDRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetBlockByTxIDRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetBlockByTxIDRequestValidationError{} diff --git a/client/chaincode/system/qscc.proto b/service/systemcc/qscc/qscc.proto similarity index 85% rename from client/chaincode/system/qscc.proto rename to service/systemcc/qscc/qscc.proto index 859a1f37..e237ec87 100644 --- a/client/chaincode/system/qscc.proto +++ b/service/systemcc/qscc/qscc.proto @@ -1,12 +1,13 @@ syntax = "proto3"; -package hlfsdk.client.chaincode.system; +package hlfsdk.service.systemcc.qscc; -option go_package = "hlfsdk/client/chaincode/system"; +option go_package = "github.com/s7techlab/hlf-sdk-go/service/systemcc/qscc"; -import "common/ledger.proto"; -import "common/common.proto"; -import "peer/transaction.proto"; + +import "hyperledger/fabric-protos/common/ledger.proto"; +import "hyperledger/fabric-protos/common/common.proto"; +import "hyperledger/fabric-protos/peer/transaction.proto"; import "google/api/annotations.proto"; diff --git a/client/chaincode/system/qscc.swagger.json b/service/systemcc/qscc/qscc.swagger.json similarity index 81% rename from client/chaincode/system/qscc.swagger.json rename to service/systemcc/qscc/qscc.swagger.json index 691d0c04..c9f9b753 100644 --- a/client/chaincode/system/qscc.swagger.json +++ b/service/systemcc/qscc/qscc.swagger.json @@ -1,13 +1,9 @@ { "swagger": "2.0", "info": { - "title": "qscc.proto", + "title": "systemcc/qscc/qscc.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], @@ -18,13 +14,19 @@ "/qscc/chain/{channel_name}": { "get": { "summary": "GetChainInfo allows getting common info about channel blockchain", - "operationId": "GetChainInfo", + "operationId": "QSCCService_GetChainInfo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/commonBlockchainInfo" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -43,13 +45,19 @@ "/qscc/chain/{channel_name}/byhash/{block_hash}": { "get": { "summary": "GetBlockByHash allows getting block by hash", - "operationId": "GetBlockByHash", + "operationId": "QSCCService_GetBlockByHash", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/commonBlock" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -75,13 +83,19 @@ "/qscc/chain/{channel_name}/bytxid/{tx_id}": { "get": { "summary": "GetBlockByTxID allows getting block by transaction", - "operationId": "GetBlockByTxID", + "operationId": "QSCCService_GetBlockByTxID", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/commonBlock" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -106,13 +120,19 @@ "/qscc/chain/{channel_name}/{block_number}": { "get": { "summary": "GetBlockByNumber allows getting block by number", - "operationId": "GetBlockByNumber", + "operationId": "QSCCService_GetBlockByNumber", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/commonBlock" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -138,13 +158,19 @@ "/qscc/tx/{channel_name}/{tx_id}": { "get": { "summary": "GetTransactionByID allows getting transaction by id", - "operationId": "GetTransactionByID", + "operationId": "QSCCService_GetTransactionByID", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/protosProcessedTransaction" } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -273,6 +299,18 @@ }, "title": "Envelope wraps a Payload with a signature so that the message may be authenticated" }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, "protosProcessedTransaction": { "type": "object", "properties": { @@ -287,6 +325,27 @@ } }, "description": "ProcessedTransaction wraps an Envelope that includes a transaction along with an indication\nof whether the transaction was validated or invalidated by committing peer.\nThe use case is that GetTransactionByID API needs to retrieve the transaction Envelope\nfrom block storage, and return it to a client, and indicate whether the transaction\nwas validated or invalidated by committing peer. So that the originally submitted\ntransaction Envelope is not modified, the ProcessedTransaction wrapper is returned." + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/service/wallet/store.go b/service/wallet/store.go new file mode 100644 index 00000000..cfe2bab7 --- /dev/null +++ b/service/wallet/store.go @@ -0,0 +1,10 @@ +package wallet + +type ( + Store interface { + Get(label string) (*IdentityInWallet, error) + Set(identity *IdentityInWallet) error + List() (labels []string, err error) + Delete(label string) error + } +) diff --git a/service/wallet/store/file/store.go b/service/wallet/store/file/store.go new file mode 100644 index 00000000..ebbece6e --- /dev/null +++ b/service/wallet/store/file/store.go @@ -0,0 +1,103 @@ +package file + +import ( + "encoding/json" + "errors" + "fmt" + "os" + + wallet2 "github.com/s7techlab/hlf-sdk-go/service/wallet" +) + +var ( + ErrDirectoryNotExists = errors.New(`directory not exists`) +) + +type ( + FilesystemStore struct { + baseDir string + } +) + +func New(baseDir string) (*FilesystemStore, error) { + if baseDir == `` { + return nil, fmt.Errorf(`dir= : %w`, ErrDirectoryNotExists) + } + + if _, err := os.Stat(baseDir); os.IsNotExist(err) { + return nil, fmt.Errorf(`dir= %s: %w`, baseDir, ErrDirectoryNotExists) + } + + if baseDir[len(baseDir)-1:] != `/` { + baseDir = baseDir + `/` + } + + return &FilesystemStore{baseDir: baseDir}, nil +} + +func (f *FilesystemStore) labelToFilename(label string) string { + return f.baseDir + label + `.json` +} + +func (f *FilesystemStore) filenameToLabel(filename string) string { + if len(filename) < 6 { + return `` + } + + if filename[len(filename)-5:] != `.json` { + return `` + } + return filename[0 : len(filename)-5] +} + +func (f *FilesystemStore) Get(label string) (*wallet2.IdentityInWallet, error) { + if _, err := os.Stat(f.labelToFilename(label)); os.IsNotExist(err) { + return nil, wallet2.ErrIdentityNotFound + } + + bb, err := os.ReadFile(f.labelToFilename(label)) + if err != nil { + return nil, err + } + + identity := new(wallet2.IdentityInWallet) + + if err = json.Unmarshal(bb, identity); err != nil { + return nil, err + } + + return identity, nil +} + +func (f *FilesystemStore) Set(identity *wallet2.IdentityInWallet) error { + bb, err := json.Marshal(identity) + if err != nil { + return err + } + + return os.WriteFile(f.labelToFilename(identity.Label), bb, 0600) +} + +func (f *FilesystemStore) List() ([]string, error) { + var labels []string + + files, err := os.ReadDir(f.baseDir) + if err != nil { + return nil, fmt.Errorf(`reading %s: %w`, f.baseDir, err) + } + + for _, file := range files { + if label := f.filenameToLabel(file.Name()); label != `` { + labels = append(labels, label) + } + } + return labels, nil +} + +func (f *FilesystemStore) Delete(label string) error { + if _, err := os.Stat(f.labelToFilename(label)); os.IsNotExist(err) { + return wallet2.ErrIdentityNotFound + } + + return os.Remove(f.labelToFilename(label)) +} diff --git a/service/wallet/store/memory/store.go b/service/wallet/store/memory/store.go new file mode 100644 index 00000000..084eae13 --- /dev/null +++ b/service/wallet/store/memory/store.go @@ -0,0 +1,46 @@ +package memory + +import ( + wallet2 "github.com/s7techlab/hlf-sdk-go/service/wallet" +) + +type ( + MemoryStore struct { + identities map[string]*wallet2.IdentityInWallet + } +) + +func New() *MemoryStore { + return &MemoryStore{ + identities: make(map[string]*wallet2.IdentityInWallet), + } +} + +func (ms *MemoryStore) Get(label string) (*wallet2.IdentityInWallet, error) { + id, exists := ms.identities[label] + if !exists { + return nil, wallet2.ErrIdentityNotFound + } + + return id, nil +} + +func (ms *MemoryStore) Set(identity *wallet2.IdentityInWallet) error { + ms.identities[identity.Label] = identity + return nil +} + +func (ms *MemoryStore) List() ([]string, error) { + var labels []string + + for l := range ms.identities { + labels = append(labels, l) + } + + return labels, nil +} + +func (ms *MemoryStore) Delete(label string) error { + delete(ms.identities, label) + return nil +} diff --git a/service/wallet/store/vault/store.go b/service/wallet/store/vault/store.go new file mode 100644 index 00000000..3f072cc3 --- /dev/null +++ b/service/wallet/store/vault/store.go @@ -0,0 +1,153 @@ +package vault + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "path" + + "github.com/hashicorp/vault/api" + + "github.com/s7techlab/hlf-sdk-go/service/wallet" +) + +type ( + Store struct { + client *api.Client + prefix string + } + + getData struct { + Data struct { + IdentityInWallet *wallet.IdentityInWallet `json:"data"` + } `json:"data"` + } + + setData struct { + IdentityInWallet *wallet.IdentityInWallet `json:"data"` + } + + listData struct { + Data struct { + Labels []string `json:"keys"` + } `json:"data"` + } +) + +const ( + defaultPrefix = "/v1/secret/data" + defaultListPrefix = "/v1/secret/metadata" + methodList = "LIST" +) + +func NewVault(connection string) (*Store, error) { + parsedURL, err := url.Parse(connection) + if err != nil { + return nil, err + } + + c, err := api.NewClient(&api.Config{ + Address: parsedURL.Scheme + `://` + parsedURL.Host, + }) + if err != nil { + return nil, err + } + c.SetToken(parsedURL.User.Username()) + + return &Store{client: c, prefix: parsedURL.Path}, nil +} + +func (s *Store) Get(label string) (*wallet.IdentityInWallet, error) { + req := s.client.NewRequest(http.MethodGet, path.Join(defaultPrefix, s.prefix, label)) + + res, err := s.client.RawRequest(req) + if err != nil { + + if res != nil && res.StatusCode == http.StatusNotFound { + return nil, fmt.Errorf(`%s: %w`, err, wallet.ErrIdentityNotFound) + } + + return nil, fmt.Errorf("make request: %w", err) + } + + defer func() { _ = res.Body.Close() }() + + if res.StatusCode != http.StatusOK { + return nil, fmt.Errorf("unexpected response status code=%d", res.StatusCode) + } + + data := new(getData) + + err = res.DecodeJSON(&data) + if err != nil { + return nil, fmt.Errorf("decode response data: %w", err) + } + + return data.Data.IdentityInWallet, nil +} + +func (s *Store) Set(identity *wallet.IdentityInWallet) error { + req := s.client.NewRequest(http.MethodPost, path.Join(defaultPrefix, s.prefix, identity.Label)) + + err := req.SetJSONBody(setData{ + IdentityInWallet: identity, + }) + if err != nil { + return fmt.Errorf("set request JSON body: %w", err) + } + + res, err := s.client.RawRequest(req) + if err != nil { + return fmt.Errorf("make request: %w", err) + } + + if !(res.StatusCode == http.StatusNoContent || res.StatusCode == http.StatusOK) { + return fmt.Errorf("unexpected status code: %d", res.StatusCode) + } + + defer func() { _ = res.Body.Close() }() + return nil +} + +func (s *Store) List() ([]string, error) { + req := s.client.NewRequest(methodList, path.Join(defaultListPrefix, s.prefix)) + + res, err := s.client.RawRequest(req) + if err != nil { + return nil, fmt.Errorf("make request: %w", err) + } + + defer func() { _ = res.Body.Close() }() + + if res.StatusCode != http.StatusOK { + return nil, fmt.Errorf("unexpected status code: %d", res.StatusCode) + } + + var data listData + + err = json.NewDecoder(res.Body).Decode(&data) + if err != nil { + return nil, fmt.Errorf("decode labels: %w", err) + } + + return data.Data.Labels, nil +} + +func (s *Store) Delete(label string) error { + req := s.client.NewRequest(http.MethodDelete, path.Join(defaultPrefix, s.prefix, label)) + res, err := s.client.RawRequest(req) + if err != nil { + return fmt.Errorf("delete request: %w", err) + } + + defer func() { _ = res.Body.Close() }() + + if res.StatusCode != http.StatusNoContent { + body, _ := ioutil.ReadAll(res.Body) + return fmt.Errorf("delete request result: %d, %s", res.StatusCode, string(body)) + } + + return nil +} diff --git a/service/wallet/store/vault/store_test.go b/service/wallet/store/vault/store_test.go new file mode 100644 index 00000000..b19f4e7b --- /dev/null +++ b/service/wallet/store/vault/store_test.go @@ -0,0 +1,242 @@ +// // +build unit +package vault_test + +// +//import ( +// . "github.com/onsi/ginkgo" +// . "github.com/onsi/gomega" +// +// "errors" +// "net/http" +// "os" +// "time" +// +// "github.com/hashicorp/vault/api" +// "github.com/ory/dockertest/v3" +// "github.com/ory/dockertest/v3/docker" +// +// "b2bchain.tech/pkg/hlf/wallet" +//) +// +//const ( +// vaultToken = "root" +//) +// +//var ( +// _, gitlabCIEnv = os.LookupEnv(`CI`) +// vaultAddress string +// pool *dockertest.Pool +// vault *dockertest.Resource +//) +// +//var _ = BeforeSuite(func(done Done) { +// +// if gitlabCIEnv { +// vaultAddress = os.Getenv("VAULT_ADDR") +// close(done) +// return +// } +// +// By("creating dockertest pool") +// +// var err error +// +// pool, err = dockertest.NewPool("") +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("running vault in dockertest pool") +// +// opts := dockertest.RunOptions{ +// Repository: "vault", +// Tag: "latest", +// Env: []string{ +// "VAULT_DEV_ROOT_TOKEN_ID=" + vaultToken, +// }, +// ExposedPorts: []string{"8200"}, +// PortBindings: map[docker.Port][]docker.PortBinding{ +// "8200": { +// {HostIP: "127.0.0.1", HostPort: "8200"}, +// }, +// }, +// } +// +// vault, err = pool.RunWithOptions(&opts) +// Expect(err).ShouldNot(HaveOccurred()) +// +// vaultAddress = "http://127.0.0.1:8200" +// +// // wait vault docker to start +// time.Sleep(time.Second) +// +// close(done) +// +//}, 100) +// +//var _ = AfterSuite(func() { +// if !gitlabCIEnv && vault != nil { +// By("purging vault from dockertest pool") +// err := pool.Purge(vault) +// Expect(err).ShouldNot(HaveOccurred()) +// } +//}) +// +//var _ = Describe("StoreHashicorpVault", func() { +// Context("Get", func() { +// It("should return right IdentityInWallet", func() { +// +// By("creating vault API client") +// +// c, err := api.NewClient(&api.Config{ +// Address: vaultAddress, +// }) +// Expect(err).ShouldNot(HaveOccurred()) +// +// c.SetToken("root") +// +// By("preparing POST request") +// +// req := c.NewRequest(http.MethodPost, "/v1/secret/data/foo/bar") +// +// expV := &wallet.IdentityInWallet{ +// Label: "bar", +// MspId: "test_mspid", +// Cert: []byte("test_cert"), +// Key: []byte("test_key"), +// WithPassword: false, +// } +// +// err = req.SetJSONBody(map[string]interface{}{"data": expV}) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("making POST request") +// +// res, err := c.RawRequest(req) +// Expect(err).ShouldNot(HaveOccurred()) +// if !(res.StatusCode == http.StatusOK || res.StatusCode == http.StatusNoContent) { +// Fail("unexpected response status code") +// } +// +// By("creating HashicorpVaultStore") +// +// s, err := wallet.NewVaultStore(vaultAddress, "/foo", vaultToken) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("getting IdentityInWallet") +// +// gotV, err := s.Get("bar") +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("comparing got IdentityInWallet with expected") +// +// Expect(gotV).Should(Equal(expV)) +// }) +// }) +// +// Context("Set", func() { +// It("should successfully set IdentityInWallet", func() { +// +// By("creating HashicorpVaultStore") +// +// s, err := wallet.NewVaultStore(vaultAddress, "/foo2", vaultToken) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("setting expected IdentityInWallet") +// +// expV := &wallet.IdentityInWallet{ +// Label: "bar", +// MspId: "test_mspid_bar", +// Cert: []byte("test_cert_bar"), +// Key: []byte("test_key_bar"), +// WithPassword: false, +// } +// +// err = s.Set(expV) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("getting IdentityInWallet") +// +// gotV, err := s.Get("bar") +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("comparing got IdentityInWallet with expected") +// +// Expect(gotV).Should(Equal(expV)) +// }) +// }) +// Context("List", func() { +// It("should successfully list labels", func() { +// +// By("creating HashicorpVaultStore") +// +// s, err := wallet.NewVaultStore(vaultAddress, "/foo3", vaultToken) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("setting IdentityInWallet with label `bar`") +// +// err = s.Set(&wallet.IdentityInWallet{ +// Label: "bar", +// MspId: "test_mspid_bar", +// Cert: []byte("test_cert_bar"), +// Key: []byte("test_key_bar"), +// WithPassword: false, +// }) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("setting IdentityInWallet with label `bar2`") +// +// err = s.Set(&wallet.IdentityInWallet{ +// Label: "bar2", +// MspId: "test_mspid_bar2", +// Cert: []byte("test_cert_bar2"), +// Key: []byte("test_key_bar2"), +// WithPassword: false, +// }) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("listing labels") +// +// gotLabels, err := s.List() +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("comparing got labels with expected") +// +// expLabels := []string{ +// "bar", +// "bar2", +// } +// +// Expect(gotLabels).Should(Equal(expLabels)) +// }) +// }) +// +// Context("Delete", func() { +// It("should successfully delete", func() { +// +// By("creating HashicorpVaultStore") +// +// s, err := wallet.NewVaultStore(vaultAddress, "/foo4", vaultToken) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("setting IdentityInWallet with label `bar`") +// +// err = s.Set(&wallet.IdentityInWallet{ +// Label: "bar", +// MspId: "test_mspid_bar", +// Cert: []byte("test_cert_bar"), +// Key: []byte("test_key_bar"), +// WithPassword: false, +// }) +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("Deleting") +// +// err = s.Delete("bar") +// Expect(err).ShouldNot(HaveOccurred()) +// +// By("comparing got labels with expected") +// +// _, err = s.Get("bar") +// Expect(errors.Is(err, wallet.ErrIdentityNotFound)).To(BeTrue()) +// }) +// }) +//}) diff --git a/service/wallet/wallet.go b/service/wallet/wallet.go new file mode 100644 index 00000000..66c9adc3 --- /dev/null +++ b/service/wallet/wallet.go @@ -0,0 +1,196 @@ +package wallet + +import ( + "context" + "crypto/rand" + "crypto/x509" + _ "embed" + "encoding/pem" + "errors" + "fmt" + "regexp" + + empty "google.golang.org/protobuf/types/known/emptypb" + + "github.com/s7techlab/hlf-sdk-go/service" +) + +var ( + //go:embed wallet.swagger.json + Swagger []byte +) +var ( + ErrEmptyLabel = errors.New(`empty label`) + ErrInvalidCharInLabel = errors.New(`invalid char in label`) + ErrIdentityNotFound = errors.New(`identity not found`) + + DisallowedCharsInLabel, _ = regexp.Compile("[^A-Za-z0-9_-]+") +) + +type ( + Wallet struct { + store Store + } +) + +func New(store Store) *Wallet { + return &Wallet{ + store: store, + } +} + +func (w *Wallet) ServiceDef() *service.Def { + return service.NewDef( + `wallet`, Swagger, &_WalletService_serviceDesc, w, RegisterWalletServiceHandlerFromEndpoint) +} + +func ValidateLabel(label string) error { + if label == `` { + return ErrEmptyLabel + } + + if DisallowedCharsInLabel.Match([]byte(label)) { + return ErrInvalidCharInLabel + } + + return nil +} + +func (w *Wallet) IdentityGet(_ context.Context, lbl *IdentityLabel) (*IdentityInWallet, error) { + if err := ValidateLabel(lbl.Label); err != nil { + return nil, err + } + + id, err := w.store.Get(lbl.Label) + if err != nil { + return nil, fmt.Errorf(`label = %s: %w`, lbl.Label, err) + } + + return id, nil +} + +func (w *Wallet) IdentityGetText(ctx context.Context, lbl *IdentityLabel) (*IdentityInWalletText, error) { + id, err := w.IdentityGet(ctx, lbl) + if err != nil { + return nil, err + } + + //var content string + //cert, err := x509util.CertificateFromPEM(id.Cert) + // + //if err != nil { + // content = err.Error() + //} else { + // content = x509util.CertificateToString(cert) + //} + + return &IdentityInWalletText{ + Label: id.Label, + MspId: id.MspId, + Role: id.Role, + Cert: string(id.Cert), + //CertContent: content, + Key: string(id.Key), + WithPassword: id.WithPassword, + }, nil +} + +func (w *Wallet) IdentitySet(ctx context.Context, identity *Identity) (*IdentityInWallet, error) { + if err := ValidateLabel(identity.Label); err != nil { + return nil, err + } + + identityInWallet := &IdentityInWallet{ + Label: identity.Label, + MspId: identity.MspId, + Role: identity.Role, + Cert: identity.Cert, + Key: identity.Key, + WithPassword: false, + } + + if err := w.store.Set(identityInWallet); err != nil { + return nil, err + } + + return identityInWallet, nil +} + +func (w *Wallet) IdentitySetWithPassword(_ context.Context, identity *IdentityWithPassword) (*IdentityInWallet, error) { + encryptedPemBlock, err := x509.EncryptPEMBlock(rand.Reader, `EC PRIVATE KEY`, identity.Key, + []byte(identity.Password), x509.PEMCipherAES256) + if err != nil { + return nil, fmt.Errorf("encrypt pem block: %w", err) + } + + encryptedKey := pem.EncodeToMemory(encryptedPemBlock) + + identityInWallet := &IdentityInWallet{ + Label: identity.Label, + MspId: identity.MspId, + Role: identity.Role, + Cert: identity.Cert, + Key: encryptedKey, + WithPassword: true, + } + + if err := w.store.Set(identityInWallet); err != nil { + return nil, fmt.Errorf("set in store: %w", err) + } + + return identityInWallet, nil +} + +func (w *Wallet) IdentityGetWithPassword(_ context.Context, identity *IdentityPassword) (*IdentityInWallet, error) { + if err := ValidateLabel(identity.Label); err != nil { + return nil, err + } + + identityInWallet, err := w.store.Get(identity.Label) + if err != nil { + return nil, fmt.Errorf(`label = %s: %w`, identity.Label, err) + } + + if !identityInWallet.WithPassword { + return nil, fmt.Errorf("identity is without password") + } + + pemBlock, _ := pem.Decode(identityInWallet.Key) + if pemBlock == nil { + return nil, fmt.Errorf("pem decode key: %w", err) + } + + decryptedKey, err := x509.DecryptPEMBlock(pemBlock, []byte(identity.Password)) + if err != nil { + return nil, fmt.Errorf("decrypt pem block: %w", err) + } + + identityInWallet.Key = decryptedKey + identityInWallet.WithPassword = false + + return identityInWallet, nil +} + +func (w *Wallet) IdentityList(context.Context, *empty.Empty) (*IdentityLabels, error) { + labels, err := w.store.List() + if err != nil { + return nil, err + } + + return &IdentityLabels{ + Labels: labels, + }, nil +} + +func (w *Wallet) IdentityDelete(ctx context.Context, label *IdentityLabel) (*IdentityInWallet, error) { + id, err := w.IdentityGet(ctx, label) + if err != nil { + return nil, err + } + + if err = w.store.Delete(label.Label); err != nil { + return nil, err + } + + return id, nil +} diff --git a/service/wallet/wallet.pb.go b/service/wallet/wallet.pb.go new file mode 100644 index 00000000..3e443db3 --- /dev/null +++ b/service/wallet/wallet.pb.go @@ -0,0 +1,1119 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: wallet/wallet.proto + +// Wallet - identity + +package wallet + +import ( + context "context" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Identity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + MspId string `protobuf:"bytes,2,opt,name=msp_id,json=mspId,proto3" json:"msp_id,omitempty"` + Role string `protobuf:"bytes,5,opt,name=role,proto3" json:"role,omitempty"` + Cert []byte `protobuf:"bytes,3,opt,name=cert,proto3" json:"cert,omitempty"` + Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *Identity) Reset() { + *x = Identity{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Identity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Identity) ProtoMessage() {} + +func (x *Identity) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Identity.ProtoReflect.Descriptor instead. +func (*Identity) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{0} +} + +func (x *Identity) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Identity) GetMspId() string { + if x != nil { + return x.MspId + } + return "" +} + +func (x *Identity) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *Identity) GetCert() []byte { + if x != nil { + return x.Cert + } + return nil +} + +func (x *Identity) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type IdentityWithPassword struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + MspId string `protobuf:"bytes,2,opt,name=msp_id,json=mspId,proto3" json:"msp_id,omitempty"` + Role string `protobuf:"bytes,6,opt,name=role,proto3" json:"role,omitempty"` + Cert []byte `protobuf:"bytes,3,opt,name=cert,proto3" json:"cert,omitempty"` + Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` + Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *IdentityWithPassword) Reset() { + *x = IdentityWithPassword{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityWithPassword) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityWithPassword) ProtoMessage() {} + +func (x *IdentityWithPassword) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityWithPassword.ProtoReflect.Descriptor instead. +func (*IdentityWithPassword) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{1} +} + +func (x *IdentityWithPassword) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *IdentityWithPassword) GetMspId() string { + if x != nil { + return x.MspId + } + return "" +} + +func (x *IdentityWithPassword) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *IdentityWithPassword) GetCert() []byte { + if x != nil { + return x.Cert + } + return nil +} + +func (x *IdentityWithPassword) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *IdentityWithPassword) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type IdentityPassword struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *IdentityPassword) Reset() { + *x = IdentityPassword{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityPassword) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityPassword) ProtoMessage() {} + +func (x *IdentityPassword) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityPassword.ProtoReflect.Descriptor instead. +func (*IdentityPassword) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{2} +} + +func (x *IdentityPassword) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *IdentityPassword) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type IdentityInWallet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + MspId string `protobuf:"bytes,2,opt,name=msp_id,json=mspId,proto3" json:"msp_id,omitempty"` + Role string `protobuf:"bytes,6,opt,name=role,proto3" json:"role,omitempty"` + Cert []byte `protobuf:"bytes,3,opt,name=cert,proto3" json:"cert,omitempty"` + Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` + WithPassword bool `protobuf:"varint,5,opt,name=with_password,json=withPassword,proto3" json:"with_password,omitempty"` +} + +func (x *IdentityInWallet) Reset() { + *x = IdentityInWallet{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityInWallet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityInWallet) ProtoMessage() {} + +func (x *IdentityInWallet) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityInWallet.ProtoReflect.Descriptor instead. +func (*IdentityInWallet) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{3} +} + +func (x *IdentityInWallet) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *IdentityInWallet) GetMspId() string { + if x != nil { + return x.MspId + } + return "" +} + +func (x *IdentityInWallet) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *IdentityInWallet) GetCert() []byte { + if x != nil { + return x.Cert + } + return nil +} + +func (x *IdentityInWallet) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *IdentityInWallet) GetWithPassword() bool { + if x != nil { + return x.WithPassword + } + return false +} + +type IdentityInWalletText struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + MspId string `protobuf:"bytes,2,opt,name=msp_id,json=mspId,proto3" json:"msp_id,omitempty"` + Role string `protobuf:"bytes,7,opt,name=role,proto3" json:"role,omitempty"` + Cert string `protobuf:"bytes,3,opt,name=cert,proto3" json:"cert,omitempty"` + CertContent string `protobuf:"bytes,4,opt,name=cert_content,json=certContent,proto3" json:"cert_content,omitempty"` + Key string `protobuf:"bytes,5,opt,name=key,proto3" json:"key,omitempty"` + WithPassword bool `protobuf:"varint,6,opt,name=with_password,json=withPassword,proto3" json:"with_password,omitempty"` +} + +func (x *IdentityInWalletText) Reset() { + *x = IdentityInWalletText{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityInWalletText) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityInWalletText) ProtoMessage() {} + +func (x *IdentityInWalletText) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityInWalletText.ProtoReflect.Descriptor instead. +func (*IdentityInWalletText) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{4} +} + +func (x *IdentityInWalletText) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *IdentityInWalletText) GetMspId() string { + if x != nil { + return x.MspId + } + return "" +} + +func (x *IdentityInWalletText) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *IdentityInWalletText) GetCert() string { + if x != nil { + return x.Cert + } + return "" +} + +func (x *IdentityInWalletText) GetCertContent() string { + if x != nil { + return x.CertContent + } + return "" +} + +func (x *IdentityInWalletText) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *IdentityInWalletText) GetWithPassword() bool { + if x != nil { + return x.WithPassword + } + return false +} + +type IdentityLabel struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` +} + +func (x *IdentityLabel) Reset() { + *x = IdentityLabel{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityLabel) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityLabel) ProtoMessage() {} + +func (x *IdentityLabel) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityLabel.ProtoReflect.Descriptor instead. +func (*IdentityLabel) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{5} +} + +func (x *IdentityLabel) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +type IdentityLabels struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Labels []string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` +} + +func (x *IdentityLabels) Reset() { + *x = IdentityLabels{} + if protoimpl.UnsafeEnabled { + mi := &file_wallet_wallet_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityLabels) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityLabels) ProtoMessage() {} + +func (x *IdentityLabels) ProtoReflect() protoreflect.Message { + mi := &file_wallet_wallet_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityLabels.ProtoReflect.Descriptor instead. +func (*IdentityLabels) Descriptor() ([]byte, []int) { + return file_wallet_wallet_proto_rawDescGZIP(), []int{6} +} + +func (x *IdentityLabels) GetLabels() []string { + if x != nil { + return x.Labels + } + return nil +} + +var File_wallet_wallet_proto protoreflect.FileDescriptor + +var file_wallet_wallet_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, + 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x01, 0x0a, 0x08, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x06, 0x6d, 0x73, 0x70, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x05, 0x6d, 0x73, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x65, + 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x65, 0x72, 0x74, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x22, 0xab, 0x01, 0x0a, 0x14, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x57, 0x69, 0x74, + 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x05, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x06, 0x6d, 0x73, 0x70, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x05, 0x6d, 0x73, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x65, 0x72, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x56, + 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x12, 0x23, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xb0, 0x01, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x49, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x06, 0x6d, 0x73, + 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x05, 0x6d, 0x73, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, + 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x65, + 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x77, 0x69, 0x74, + 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xd7, 0x01, 0x0a, 0x14, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x65, + 0x78, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x12, 0x1e, 0x0a, 0x06, 0x6d, 0x73, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x6d, 0x73, 0x70, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x65, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x65, 0x72, + 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x63, 0x65, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, + 0x0a, 0x0d, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x77, 0x69, 0x74, 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x22, 0x25, 0x0a, 0x0d, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x28, 0x0a, 0x0e, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x16, 0x0a, 0x06, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, + 0x62, 0x65, 0x6c, 0x73, 0x32, 0xf3, 0x06, 0x0a, 0x0d, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x74, 0x0a, 0x0b, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x47, 0x65, 0x74, 0x12, 0x1e, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, + 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x1a, 0x21, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, + 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x49, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, + 0x12, 0x1a, 0x2f, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x7d, 0x12, 0x81, 0x01, 0x0a, + 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x54, 0x65, 0x78, 0x74, + 0x12, 0x1e, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, + 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x1a, 0x25, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, + 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x57, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x54, 0x65, 0x78, 0x74, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, + 0x1f, 0x2f, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x7d, 0x2f, 0x74, 0x65, 0x78, 0x74, + 0x12, 0x6a, 0x0a, 0x0b, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x53, 0x65, 0x74, 0x12, + 0x19, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x21, 0x2e, 0x68, 0x6c, 0x66, + 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x22, 0x1d, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x1a, 0x12, 0x2f, 0x77, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x8f, 0x01, 0x0a, + 0x17, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x53, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x25, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, + 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x57, 0x69, 0x74, 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x1a, + 0x21, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x57, 0x61, 0x6c, 0x6c, + 0x65, 0x74, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x1a, 0x1f, 0x2f, + 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, + 0x73, 0x2f, 0x77, 0x69, 0x74, 0x68, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x8b, + 0x01, 0x0a, 0x17, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x57, 0x69, + 0x74, 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x21, 0x2e, 0x68, 0x6c, 0x66, + 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x1a, 0x21, 0x2e, + 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, + 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x77, 0x61, + 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2f, + 0x77, 0x69, 0x74, 0x68, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x63, 0x0a, 0x0c, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1f, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, + 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, + 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, + 0x73, 0x12, 0x77, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, + 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4c, 0x61, + 0x62, 0x65, 0x6c, 0x1a, 0x21, 0x2e, 0x68, 0x6c, 0x66, 0x73, 0x64, 0x6b, 0x67, 0x6f, 0x2e, 0x77, + 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, + 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, + 0x2f, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x2f, 0x7b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x7d, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x37, 0x74, 0x65, 0x63, 0x68, 0x6c, + 0x61, 0x62, 0x2f, 0x68, 0x6c, 0x66, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x77, 0x61, + 0x6c, 0x6c, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_wallet_wallet_proto_rawDescOnce sync.Once + file_wallet_wallet_proto_rawDescData = file_wallet_wallet_proto_rawDesc +) + +func file_wallet_wallet_proto_rawDescGZIP() []byte { + file_wallet_wallet_proto_rawDescOnce.Do(func() { + file_wallet_wallet_proto_rawDescData = protoimpl.X.CompressGZIP(file_wallet_wallet_proto_rawDescData) + }) + return file_wallet_wallet_proto_rawDescData +} + +var file_wallet_wallet_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_wallet_wallet_proto_goTypes = []interface{}{ + (*Identity)(nil), // 0: hlfsdkgo.wallet.Identity + (*IdentityWithPassword)(nil), // 1: hlfsdkgo.wallet.IdentityWithPassword + (*IdentityPassword)(nil), // 2: hlfsdkgo.wallet.IdentityPassword + (*IdentityInWallet)(nil), // 3: hlfsdkgo.wallet.IdentityInWallet + (*IdentityInWalletText)(nil), // 4: hlfsdkgo.wallet.IdentityInWalletText + (*IdentityLabel)(nil), // 5: hlfsdkgo.wallet.IdentityLabel + (*IdentityLabels)(nil), // 6: hlfsdkgo.wallet.IdentityLabels + (*emptypb.Empty)(nil), // 7: google.protobuf.Empty +} +var file_wallet_wallet_proto_depIdxs = []int32{ + 5, // 0: hlfsdkgo.wallet.WalletService.IdentityGet:input_type -> hlfsdkgo.wallet.IdentityLabel + 5, // 1: hlfsdkgo.wallet.WalletService.IdentityGetText:input_type -> hlfsdkgo.wallet.IdentityLabel + 0, // 2: hlfsdkgo.wallet.WalletService.IdentitySet:input_type -> hlfsdkgo.wallet.Identity + 1, // 3: hlfsdkgo.wallet.WalletService.IdentitySetWithPassword:input_type -> hlfsdkgo.wallet.IdentityWithPassword + 2, // 4: hlfsdkgo.wallet.WalletService.IdentityGetWithPassword:input_type -> hlfsdkgo.wallet.IdentityPassword + 7, // 5: hlfsdkgo.wallet.WalletService.IdentityList:input_type -> google.protobuf.Empty + 5, // 6: hlfsdkgo.wallet.WalletService.IdentityDelete:input_type -> hlfsdkgo.wallet.IdentityLabel + 3, // 7: hlfsdkgo.wallet.WalletService.IdentityGet:output_type -> hlfsdkgo.wallet.IdentityInWallet + 4, // 8: hlfsdkgo.wallet.WalletService.IdentityGetText:output_type -> hlfsdkgo.wallet.IdentityInWalletText + 3, // 9: hlfsdkgo.wallet.WalletService.IdentitySet:output_type -> hlfsdkgo.wallet.IdentityInWallet + 3, // 10: hlfsdkgo.wallet.WalletService.IdentitySetWithPassword:output_type -> hlfsdkgo.wallet.IdentityInWallet + 3, // 11: hlfsdkgo.wallet.WalletService.IdentityGetWithPassword:output_type -> hlfsdkgo.wallet.IdentityInWallet + 6, // 12: hlfsdkgo.wallet.WalletService.IdentityList:output_type -> hlfsdkgo.wallet.IdentityLabels + 3, // 13: hlfsdkgo.wallet.WalletService.IdentityDelete:output_type -> hlfsdkgo.wallet.IdentityInWallet + 7, // [7:14] is the sub-list for method output_type + 0, // [0:7] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_wallet_wallet_proto_init() } +func file_wallet_wallet_proto_init() { + if File_wallet_wallet_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_wallet_wallet_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Identity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wallet_wallet_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityWithPassword); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wallet_wallet_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityPassword); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wallet_wallet_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityInWallet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wallet_wallet_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityInWalletText); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wallet_wallet_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityLabel); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wallet_wallet_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityLabels); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_wallet_wallet_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_wallet_wallet_proto_goTypes, + DependencyIndexes: file_wallet_wallet_proto_depIdxs, + MessageInfos: file_wallet_wallet_proto_msgTypes, + }.Build() + File_wallet_wallet_proto = out.File + file_wallet_wallet_proto_rawDesc = nil + file_wallet_wallet_proto_goTypes = nil + file_wallet_wallet_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// WalletServiceClient is the client API for WalletService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type WalletServiceClient interface { + // Получить identity + IdentityGet(ctx context.Context, in *IdentityLabel, opts ...grpc.CallOption) (*IdentityInWallet, error) + // Получить identity в виде текста + IdentityGetText(ctx context.Context, in *IdentityLabel, opts ...grpc.CallOption) (*IdentityInWalletText, error) + // Записать identity + IdentitySet(ctx context.Context, in *Identity, opts ...grpc.CallOption) (*IdentityInWallet, error) + // Записать identity в зашифрованном виде + IdentitySetWithPassword(ctx context.Context, in *IdentityWithPassword, opts ...grpc.CallOption) (*IdentityInWallet, error) + // Получить identity из зашифрованного вида + IdentityGetWithPassword(ctx context.Context, in *IdentityPassword, opts ...grpc.CallOption) (*IdentityInWallet, error) + // Список identity + IdentityList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*IdentityLabels, error) + // Удалить identity + IdentityDelete(ctx context.Context, in *IdentityLabel, opts ...grpc.CallOption) (*IdentityInWallet, error) +} + +type walletServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWalletServiceClient(cc grpc.ClientConnInterface) WalletServiceClient { + return &walletServiceClient{cc} +} + +func (c *walletServiceClient) IdentityGet(ctx context.Context, in *IdentityLabel, opts ...grpc.CallOption) (*IdentityInWallet, error) { + out := new(IdentityInWallet) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentityGet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) IdentityGetText(ctx context.Context, in *IdentityLabel, opts ...grpc.CallOption) (*IdentityInWalletText, error) { + out := new(IdentityInWalletText) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentityGetText", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) IdentitySet(ctx context.Context, in *Identity, opts ...grpc.CallOption) (*IdentityInWallet, error) { + out := new(IdentityInWallet) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentitySet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) IdentitySetWithPassword(ctx context.Context, in *IdentityWithPassword, opts ...grpc.CallOption) (*IdentityInWallet, error) { + out := new(IdentityInWallet) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentitySetWithPassword", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) IdentityGetWithPassword(ctx context.Context, in *IdentityPassword, opts ...grpc.CallOption) (*IdentityInWallet, error) { + out := new(IdentityInWallet) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentityGetWithPassword", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) IdentityList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*IdentityLabels, error) { + out := new(IdentityLabels) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentityList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) IdentityDelete(ctx context.Context, in *IdentityLabel, opts ...grpc.CallOption) (*IdentityInWallet, error) { + out := new(IdentityInWallet) + err := c.cc.Invoke(ctx, "/hlfsdkgo.wallet.WalletService/IdentityDelete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WalletServiceServer is the server API for WalletService service. +type WalletServiceServer interface { + // Получить identity + IdentityGet(context.Context, *IdentityLabel) (*IdentityInWallet, error) + // Получить identity в виде текста + IdentityGetText(context.Context, *IdentityLabel) (*IdentityInWalletText, error) + // Записать identity + IdentitySet(context.Context, *Identity) (*IdentityInWallet, error) + // Записать identity в зашифрованном виде + IdentitySetWithPassword(context.Context, *IdentityWithPassword) (*IdentityInWallet, error) + // Получить identity из зашифрованного вида + IdentityGetWithPassword(context.Context, *IdentityPassword) (*IdentityInWallet, error) + // Список identity + IdentityList(context.Context, *emptypb.Empty) (*IdentityLabels, error) + // Удалить identity + IdentityDelete(context.Context, *IdentityLabel) (*IdentityInWallet, error) +} + +// UnimplementedWalletServiceServer can be embedded to have forward compatible implementations. +type UnimplementedWalletServiceServer struct { +} + +func (*UnimplementedWalletServiceServer) IdentityGet(context.Context, *IdentityLabel) (*IdentityInWallet, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentityGet not implemented") +} +func (*UnimplementedWalletServiceServer) IdentityGetText(context.Context, *IdentityLabel) (*IdentityInWalletText, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentityGetText not implemented") +} +func (*UnimplementedWalletServiceServer) IdentitySet(context.Context, *Identity) (*IdentityInWallet, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentitySet not implemented") +} +func (*UnimplementedWalletServiceServer) IdentitySetWithPassword(context.Context, *IdentityWithPassword) (*IdentityInWallet, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentitySetWithPassword not implemented") +} +func (*UnimplementedWalletServiceServer) IdentityGetWithPassword(context.Context, *IdentityPassword) (*IdentityInWallet, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentityGetWithPassword not implemented") +} +func (*UnimplementedWalletServiceServer) IdentityList(context.Context, *emptypb.Empty) (*IdentityLabels, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentityList not implemented") +} +func (*UnimplementedWalletServiceServer) IdentityDelete(context.Context, *IdentityLabel) (*IdentityInWallet, error) { + return nil, status.Errorf(codes.Unimplemented, "method IdentityDelete not implemented") +} + +func RegisterWalletServiceServer(s *grpc.Server, srv WalletServiceServer) { + s.RegisterService(&_WalletService_serviceDesc, srv) +} + +func _WalletService_IdentityGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdentityLabel) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentityGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentityGet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentityGet(ctx, req.(*IdentityLabel)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_IdentityGetText_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdentityLabel) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentityGetText(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentityGetText", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentityGetText(ctx, req.(*IdentityLabel)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_IdentitySet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Identity) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentitySet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentitySet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentitySet(ctx, req.(*Identity)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_IdentitySetWithPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdentityWithPassword) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentitySetWithPassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentitySetWithPassword", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentitySetWithPassword(ctx, req.(*IdentityWithPassword)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_IdentityGetWithPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdentityPassword) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentityGetWithPassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentityGetWithPassword", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentityGetWithPassword(ctx, req.(*IdentityPassword)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_IdentityList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentityList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentityList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentityList(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_IdentityDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IdentityLabel) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).IdentityDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hlfsdkgo.wallet.WalletService/IdentityDelete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).IdentityDelete(ctx, req.(*IdentityLabel)) + } + return interceptor(ctx, in, info, handler) +} + +var _WalletService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hlfsdkgo.wallet.WalletService", + HandlerType: (*WalletServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "IdentityGet", + Handler: _WalletService_IdentityGet_Handler, + }, + { + MethodName: "IdentityGetText", + Handler: _WalletService_IdentityGetText_Handler, + }, + { + MethodName: "IdentitySet", + Handler: _WalletService_IdentitySet_Handler, + }, + { + MethodName: "IdentitySetWithPassword", + Handler: _WalletService_IdentitySetWithPassword_Handler, + }, + { + MethodName: "IdentityGetWithPassword", + Handler: _WalletService_IdentityGetWithPassword_Handler, + }, + { + MethodName: "IdentityList", + Handler: _WalletService_IdentityList_Handler, + }, + { + MethodName: "IdentityDelete", + Handler: _WalletService_IdentityDelete_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "wallet/wallet.proto", +} diff --git a/service/wallet/wallet.pb.gw.go b/service/wallet/wallet.pb.gw.go new file mode 100644 index 00000000..50efc13f --- /dev/null +++ b/service/wallet/wallet.pb.gw.go @@ -0,0 +1,700 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: wallet/wallet.proto + +/* +Package wallet is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package wallet + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_WalletService_IdentityGet_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityLabel + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["label"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label") + } + + protoReq.Label, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label", err) + } + + msg, err := client.IdentityGet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentityGet_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityLabel + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["label"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label") + } + + protoReq.Label, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label", err) + } + + msg, err := server.IdentityGet(ctx, &protoReq) + return msg, metadata, err + +} + +func request_WalletService_IdentityGetText_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityLabel + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["label"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label") + } + + protoReq.Label, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label", err) + } + + msg, err := client.IdentityGetText(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentityGetText_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityLabel + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["label"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label") + } + + protoReq.Label, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label", err) + } + + msg, err := server.IdentityGetText(ctx, &protoReq) + return msg, metadata, err + +} + +func request_WalletService_IdentitySet_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Identity + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.IdentitySet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentitySet_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Identity + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.IdentitySet(ctx, &protoReq) + return msg, metadata, err + +} + +func request_WalletService_IdentitySetWithPassword_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityWithPassword + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.IdentitySetWithPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentitySetWithPassword_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityWithPassword + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.IdentitySetWithPassword(ctx, &protoReq) + return msg, metadata, err + +} + +func request_WalletService_IdentityGetWithPassword_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityPassword + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.IdentityGetWithPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentityGetWithPassword_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityPassword + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.IdentityGetWithPassword(ctx, &protoReq) + return msg, metadata, err + +} + +func request_WalletService_IdentityList_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := client.IdentityList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentityList_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := server.IdentityList(ctx, &protoReq) + return msg, metadata, err + +} + +func request_WalletService_IdentityDelete_0(ctx context.Context, marshaler runtime.Marshaler, client WalletServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityLabel + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["label"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label") + } + + protoReq.Label, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label", err) + } + + msg, err := client.IdentityDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_WalletService_IdentityDelete_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq IdentityLabel + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["label"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "label") + } + + protoReq.Label, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "label", err) + } + + msg, err := server.IdentityDelete(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterWalletServiceHandlerServer registers the http handlers for service WalletService to "mux". +// UnaryRPC :call WalletServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWalletServiceHandlerFromEndpoint instead. +func RegisterWalletServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WalletServiceServer) error { + + mux.Handle("GET", pattern_WalletService_IdentityGet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentityGet_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityGet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_WalletService_IdentityGetText_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentityGetText_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityGetText_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_WalletService_IdentitySet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentitySet_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentitySet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_WalletService_IdentitySetWithPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentitySetWithPassword_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentitySetWithPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WalletService_IdentityGetWithPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentityGetWithPassword_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityGetWithPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_WalletService_IdentityList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentityList_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_WalletService_IdentityDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WalletService_IdentityDelete_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterWalletServiceHandlerFromEndpoint is same as RegisterWalletServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterWalletServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterWalletServiceHandler(ctx, mux, conn) +} + +// RegisterWalletServiceHandler registers the http handlers for service WalletService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterWalletServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterWalletServiceHandlerClient(ctx, mux, NewWalletServiceClient(conn)) +} + +// RegisterWalletServiceHandlerClient registers the http handlers for service WalletService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WalletServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WalletServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "WalletServiceClient" to call the correct interceptors. +func RegisterWalletServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WalletServiceClient) error { + + mux.Handle("GET", pattern_WalletService_IdentityGet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentityGet_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityGet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_WalletService_IdentityGetText_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentityGetText_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityGetText_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_WalletService_IdentitySet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentitySet_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentitySet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_WalletService_IdentitySetWithPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentitySetWithPassword_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentitySetWithPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WalletService_IdentityGetWithPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentityGetWithPassword_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityGetWithPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_WalletService_IdentityList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentityList_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_WalletService_IdentityDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WalletService_IdentityDelete_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WalletService_IdentityDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_WalletService_IdentityGet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"wallet", "identities", "label"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_WalletService_IdentityGetText_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"wallet", "identities", "label", "text"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_WalletService_IdentitySet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"wallet", "identities"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_WalletService_IdentitySetWithPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"wallet", "identities", "withpassword"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_WalletService_IdentityGetWithPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"wallet", "identities", "withpassword"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_WalletService_IdentityList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"wallet", "identities"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_WalletService_IdentityDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"wallet", "identities", "label"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_WalletService_IdentityGet_0 = runtime.ForwardResponseMessage + + forward_WalletService_IdentityGetText_0 = runtime.ForwardResponseMessage + + forward_WalletService_IdentitySet_0 = runtime.ForwardResponseMessage + + forward_WalletService_IdentitySetWithPassword_0 = runtime.ForwardResponseMessage + + forward_WalletService_IdentityGetWithPassword_0 = runtime.ForwardResponseMessage + + forward_WalletService_IdentityList_0 = runtime.ForwardResponseMessage + + forward_WalletService_IdentityDelete_0 = runtime.ForwardResponseMessage +) diff --git a/service/wallet/wallet.pb.validate.go b/service/wallet/wallet.pb.validate.go new file mode 100644 index 00000000..56a8bcb2 --- /dev/null +++ b/service/wallet/wallet.pb.validate.go @@ -0,0 +1,883 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: wallet/wallet.proto + +package wallet + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on Identity with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Identity) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Identity with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in IdentityMultiError, or nil +// if none found. +func (m *Identity) ValidateAll() error { + return m.validate(true) +} + +func (m *Identity) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetLabel()) < 1 { + err := IdentityValidationError{ + field: "Label", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetMspId()) < 1 { + err := IdentityValidationError{ + field: "MspId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Role + + // no validation rules for Cert + + // no validation rules for Key + + if len(errors) > 0 { + return IdentityMultiError(errors) + } + + return nil +} + +// IdentityMultiError is an error wrapping multiple validation errors returned +// by Identity.ValidateAll() if the designated constraints aren't met. +type IdentityMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityMultiError) AllErrors() []error { return m } + +// IdentityValidationError is the validation error returned by +// Identity.Validate if the designated constraints aren't met. +type IdentityValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityValidationError) ErrorName() string { return "IdentityValidationError" } + +// Error satisfies the builtin error interface +func (e IdentityValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentity.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityValidationError{} + +// Validate checks the field values on IdentityWithPassword with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *IdentityWithPassword) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on IdentityWithPassword with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// IdentityWithPasswordMultiError, or nil if none found. +func (m *IdentityWithPassword) ValidateAll() error { + return m.validate(true) +} + +func (m *IdentityWithPassword) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetLabel()) < 1 { + err := IdentityWithPasswordValidationError{ + field: "Label", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetMspId()) < 1 { + err := IdentityWithPasswordValidationError{ + field: "MspId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Role + + // no validation rules for Cert + + // no validation rules for Key + + // no validation rules for Password + + if len(errors) > 0 { + return IdentityWithPasswordMultiError(errors) + } + + return nil +} + +// IdentityWithPasswordMultiError is an error wrapping multiple validation +// errors returned by IdentityWithPassword.ValidateAll() if the designated +// constraints aren't met. +type IdentityWithPasswordMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityWithPasswordMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityWithPasswordMultiError) AllErrors() []error { return m } + +// IdentityWithPasswordValidationError is the validation error returned by +// IdentityWithPassword.Validate if the designated constraints aren't met. +type IdentityWithPasswordValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityWithPasswordValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityWithPasswordValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityWithPasswordValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityWithPasswordValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityWithPasswordValidationError) ErrorName() string { + return "IdentityWithPasswordValidationError" +} + +// Error satisfies the builtin error interface +func (e IdentityWithPasswordValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentityWithPassword.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityWithPasswordValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityWithPasswordValidationError{} + +// Validate checks the field values on IdentityPassword with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *IdentityPassword) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on IdentityPassword with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// IdentityPasswordMultiError, or nil if none found. +func (m *IdentityPassword) ValidateAll() error { + return m.validate(true) +} + +func (m *IdentityPassword) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetLabel()) < 1 { + err := IdentityPasswordValidationError{ + field: "Label", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetPassword()) < 1 { + err := IdentityPasswordValidationError{ + field: "Password", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return IdentityPasswordMultiError(errors) + } + + return nil +} + +// IdentityPasswordMultiError is an error wrapping multiple validation errors +// returned by IdentityPassword.ValidateAll() if the designated constraints +// aren't met. +type IdentityPasswordMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityPasswordMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityPasswordMultiError) AllErrors() []error { return m } + +// IdentityPasswordValidationError is the validation error returned by +// IdentityPassword.Validate if the designated constraints aren't met. +type IdentityPasswordValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityPasswordValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityPasswordValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityPasswordValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityPasswordValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityPasswordValidationError) ErrorName() string { return "IdentityPasswordValidationError" } + +// Error satisfies the builtin error interface +func (e IdentityPasswordValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentityPassword.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityPasswordValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityPasswordValidationError{} + +// Validate checks the field values on IdentityInWallet with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *IdentityInWallet) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on IdentityInWallet with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// IdentityInWalletMultiError, or nil if none found. +func (m *IdentityInWallet) ValidateAll() error { + return m.validate(true) +} + +func (m *IdentityInWallet) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetLabel()) < 1 { + err := IdentityInWalletValidationError{ + field: "Label", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetMspId()) < 1 { + err := IdentityInWalletValidationError{ + field: "MspId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Role + + // no validation rules for Cert + + // no validation rules for Key + + // no validation rules for WithPassword + + if len(errors) > 0 { + return IdentityInWalletMultiError(errors) + } + + return nil +} + +// IdentityInWalletMultiError is an error wrapping multiple validation errors +// returned by IdentityInWallet.ValidateAll() if the designated constraints +// aren't met. +type IdentityInWalletMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityInWalletMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityInWalletMultiError) AllErrors() []error { return m } + +// IdentityInWalletValidationError is the validation error returned by +// IdentityInWallet.Validate if the designated constraints aren't met. +type IdentityInWalletValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityInWalletValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityInWalletValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityInWalletValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityInWalletValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityInWalletValidationError) ErrorName() string { return "IdentityInWalletValidationError" } + +// Error satisfies the builtin error interface +func (e IdentityInWalletValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentityInWallet.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityInWalletValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityInWalletValidationError{} + +// Validate checks the field values on IdentityInWalletText with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *IdentityInWalletText) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on IdentityInWalletText with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// IdentityInWalletTextMultiError, or nil if none found. +func (m *IdentityInWalletText) ValidateAll() error { + return m.validate(true) +} + +func (m *IdentityInWalletText) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetLabel()) < 1 { + err := IdentityInWalletTextValidationError{ + field: "Label", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetMspId()) < 1 { + err := IdentityInWalletTextValidationError{ + field: "MspId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Role + + // no validation rules for Cert + + // no validation rules for CertContent + + // no validation rules for Key + + // no validation rules for WithPassword + + if len(errors) > 0 { + return IdentityInWalletTextMultiError(errors) + } + + return nil +} + +// IdentityInWalletTextMultiError is an error wrapping multiple validation +// errors returned by IdentityInWalletText.ValidateAll() if the designated +// constraints aren't met. +type IdentityInWalletTextMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityInWalletTextMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityInWalletTextMultiError) AllErrors() []error { return m } + +// IdentityInWalletTextValidationError is the validation error returned by +// IdentityInWalletText.Validate if the designated constraints aren't met. +type IdentityInWalletTextValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityInWalletTextValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityInWalletTextValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityInWalletTextValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityInWalletTextValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityInWalletTextValidationError) ErrorName() string { + return "IdentityInWalletTextValidationError" +} + +// Error satisfies the builtin error interface +func (e IdentityInWalletTextValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentityInWalletText.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityInWalletTextValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityInWalletTextValidationError{} + +// Validate checks the field values on IdentityLabel with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *IdentityLabel) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on IdentityLabel with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in IdentityLabelMultiError, or +// nil if none found. +func (m *IdentityLabel) ValidateAll() error { + return m.validate(true) +} + +func (m *IdentityLabel) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Label + + if len(errors) > 0 { + return IdentityLabelMultiError(errors) + } + + return nil +} + +// IdentityLabelMultiError is an error wrapping multiple validation errors +// returned by IdentityLabel.ValidateAll() if the designated constraints +// aren't met. +type IdentityLabelMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityLabelMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityLabelMultiError) AllErrors() []error { return m } + +// IdentityLabelValidationError is the validation error returned by +// IdentityLabel.Validate if the designated constraints aren't met. +type IdentityLabelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityLabelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityLabelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityLabelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityLabelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityLabelValidationError) ErrorName() string { return "IdentityLabelValidationError" } + +// Error satisfies the builtin error interface +func (e IdentityLabelValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentityLabel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityLabelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityLabelValidationError{} + +// Validate checks the field values on IdentityLabels with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *IdentityLabels) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on IdentityLabels with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in IdentityLabelsMultiError, +// or nil if none found. +func (m *IdentityLabels) ValidateAll() error { + return m.validate(true) +} + +func (m *IdentityLabels) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return IdentityLabelsMultiError(errors) + } + + return nil +} + +// IdentityLabelsMultiError is an error wrapping multiple validation errors +// returned by IdentityLabels.ValidateAll() if the designated constraints +// aren't met. +type IdentityLabelsMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IdentityLabelsMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IdentityLabelsMultiError) AllErrors() []error { return m } + +// IdentityLabelsValidationError is the validation error returned by +// IdentityLabels.Validate if the designated constraints aren't met. +type IdentityLabelsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IdentityLabelsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IdentityLabelsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IdentityLabelsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IdentityLabelsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IdentityLabelsValidationError) ErrorName() string { return "IdentityLabelsValidationError" } + +// Error satisfies the builtin error interface +func (e IdentityLabelsValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIdentityLabels.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IdentityLabelsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IdentityLabelsValidationError{} diff --git a/service/wallet/wallet.proto b/service/wallet/wallet.proto new file mode 100644 index 00000000..e0b667b9 --- /dev/null +++ b/service/wallet/wallet.proto @@ -0,0 +1,121 @@ +syntax = "proto3"; + +// Wallet - identity +package hlfsdkgo.wallet; + +option go_package = "github.com/s7techlab/hlf-sdk-go/wallet"; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "validate/validate.proto"; + +service WalletService { + + // Получить identity + rpc IdentityGet (IdentityLabel) returns (IdentityInWallet) { + option (google.api.http) = { + get: "/wallet/identities/{label}" + }; + } + + // Получить identity в виде текста + rpc IdentityGetText (IdentityLabel) returns (IdentityInWalletText) { + option (google.api.http) = { + get: "/wallet/identities/{label}/text" + }; + } + + // Записать identity + rpc IdentitySet (Identity) returns (IdentityInWallet) { + option (google.api.http) = { + put: "/wallet/identities" + body: "*" + }; + } + + // Записать identity в зашифрованном виде + rpc IdentitySetWithPassword (IdentityWithPassword) returns (IdentityInWallet) { + option (google.api.http) = { + put: "/wallet/identities/withpassword" + body: "*" + }; + } + + // todo: implement + // rpc IdentityAuthCheck (IdentityPassword) returns (IdentityInWallet) { + // option (google.api.http) = { + // post: "/identity/auth-check" + // }; + // } + + // Получить identity из зашифрованного вида + rpc IdentityGetWithPassword (IdentityPassword) returns (IdentityInWallet) { + option (google.api.http) = { + post: "/wallet/identities/withpassword" + body: "*" + }; + } + + // Список identity + rpc IdentityList (google.protobuf.Empty) returns (IdentityLabels) { + option (google.api.http) = { + get: "/wallet/identities" + }; + } + + // Удалить identity + rpc IdentityDelete (IdentityLabel) returns (IdentityInWallet) { + option (google.api.http) = { + delete: "/wallet/identities/{label}" + }; + } +} + +message Identity { + string label = 1 [(validate.rules).string.min_len = 1]; + string msp_id = 2 [(validate.rules).string.min_len = 1]; + string role = 5; + bytes cert = 3; + bytes key = 4; +} + +message IdentityWithPassword { + string label = 1 [(validate.rules).string.min_len = 1]; + string msp_id = 2 [(validate.rules).string.min_len = 1]; + string role = 6; + bytes cert = 3; + bytes key = 4; + string password = 5; +} + +message IdentityPassword { + string label = 1 [(validate.rules).string.min_len = 1]; + string password = 2 [(validate.rules).string.min_len = 1]; +} + +message IdentityInWallet { + string label = 1 [(validate.rules).string.min_len = 1]; + string msp_id = 2 [(validate.rules).string.min_len = 1]; + string role = 6; + bytes cert = 3; + bytes key = 4; + bool with_password = 5; +} + +message IdentityInWalletText { + string label = 1 [(validate.rules).string.min_len = 1]; + string msp_id = 2 [(validate.rules).string.min_len = 1]; + string role = 7; + string cert = 3; + string cert_content = 4; + string key = 5; + bool with_password = 6; +} + +message IdentityLabel { + string label = 1; +} + +message IdentityLabels { + repeated string labels = 1; +} \ No newline at end of file diff --git a/service/wallet/wallet.swagger.json b/service/wallet/wallet.swagger.json new file mode 100644 index 00000000..85683f31 --- /dev/null +++ b/service/wallet/wallet.swagger.json @@ -0,0 +1,379 @@ +{ + "swagger": "2.0", + "info": { + "title": "Wallet - identity", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/wallet/identities": { + "get": { + "summary": "Список identity", + "operationId": "WalletService_IdentityList", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityLabels" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "tags": [ + "WalletService" + ] + }, + "put": { + "summary": "Записать identity", + "operationId": "WalletService_IdentitySet", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityInWallet" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/walletIdentity" + } + } + ], + "tags": [ + "WalletService" + ] + } + }, + "/wallet/identities/withpassword": { + "post": { + "summary": "Получить identity из зашифрованного вида", + "operationId": "WalletService_IdentityGetWithPassword", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityInWallet" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/walletIdentityPassword" + } + } + ], + "tags": [ + "WalletService" + ] + }, + "put": { + "summary": "Записать identity в зашифрованном виде", + "operationId": "WalletService_IdentitySetWithPassword", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityInWallet" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/walletIdentityWithPassword" + } + } + ], + "tags": [ + "WalletService" + ] + } + }, + "/wallet/identities/{label}": { + "get": { + "summary": "Получить identity", + "operationId": "WalletService_IdentityGet", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityInWallet" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "label", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "WalletService" + ] + }, + "delete": { + "summary": "Удалить identity", + "operationId": "WalletService_IdentityDelete", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityInWallet" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "label", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "WalletService" + ] + } + }, + "/wallet/identities/{label}/text": { + "get": { + "summary": "Получить identity в виде текста", + "operationId": "WalletService_IdentityGetText", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/walletIdentityInWalletText" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "label", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "WalletService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "walletIdentity": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "msp_id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "cert": { + "type": "string", + "format": "byte" + }, + "key": { + "type": "string", + "format": "byte" + } + } + }, + "walletIdentityInWallet": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "msp_id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "cert": { + "type": "string", + "format": "byte" + }, + "key": { + "type": "string", + "format": "byte" + }, + "with_password": { + "type": "boolean" + } + } + }, + "walletIdentityInWalletText": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "msp_id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "cert": { + "type": "string" + }, + "cert_content": { + "type": "string" + }, + "key": { + "type": "string" + }, + "with_password": { + "type": "boolean" + } + } + }, + "walletIdentityLabels": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "walletIdentityPassword": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "walletIdentityWithPassword": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "msp_id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "cert": { + "type": "string", + "format": "byte" + }, + "key": { + "type": "string", + "format": "byte" + }, + "password": { + "type": "string" + } + } + } + } +} diff --git a/third_party/hyperledger/fabric-protos/common/collection.proto b/third_party/hyperledger/fabric-protos/common/collection.proto index a09e815f..832f9c4f 100644 --- a/third_party/hyperledger/fabric-protos/common/collection.proto +++ b/third_party/hyperledger/fabric-protos/common/collection.proto @@ -9,7 +9,7 @@ option java_package = "org.hyperledger.fabric.protos.common"; package common; -import "common/policies.proto"; +import "hyperledger/fabric-protos/common/policies.proto"; // CollectionConfigPackage represents an array of CollectionConfig // messages; the extra struct is required because repeated oneof is diff --git a/third_party/hyperledger/fabric-protos/common/configtx.proto b/third_party/hyperledger/fabric-protos/common/configtx.proto index f60e1548..6d6e09d2 100644 --- a/third_party/hyperledger/fabric-protos/common/configtx.proto +++ b/third_party/hyperledger/fabric-protos/common/configtx.proto @@ -9,8 +9,8 @@ option java_package = "org.hyperledger.fabric.protos.common"; package common; -import "common/common.proto"; -import "common/policies.proto"; +import "hyperledger/fabric-protos/common/common.proto"; +import "hyperledger/fabric-protos/common/policies.proto"; // ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency // on previous configuration transactions. diff --git a/third_party/hyperledger/fabric-protos/peer/collection.proto b/third_party/hyperledger/fabric-protos/peer/collection.proto index dad26d81..9f3f269d 100644 --- a/third_party/hyperledger/fabric-protos/peer/collection.proto +++ b/third_party/hyperledger/fabric-protos/peer/collection.proto @@ -9,8 +9,8 @@ option java_package = "org.hyperledger.fabric.protos.peer"; package protos; -import "common/policies.proto"; -import "peer/policy.proto"; +import "hyperledger/fabric-protos/common/policies.proto"; +import "hyperledger/fabric-protos/peer/policy.proto"; // CollectionConfigPackage represents an array of CollectionConfig // messages; the extra struct is required because repeated oneof is diff --git a/third_party/hyperledger/fabric-protos/peer/lifecycle/lifecycle.proto b/third_party/hyperledger/fabric-protos/peer/lifecycle/lifecycle.proto index f1889be7..52c3d172 100644 --- a/third_party/hyperledger/fabric-protos/peer/lifecycle/lifecycle.proto +++ b/third_party/hyperledger/fabric-protos/peer/lifecycle/lifecycle.proto @@ -9,7 +9,7 @@ option go_package = "github.com/hyperledger/fabric-protos-go/peer/lifecycle"; package lifecycle; -import "peer/collection.proto"; +import "hyperledger/fabric-protos/peer/collection.proto"; // InstallChaincodeArgs is the message used as the argument to // '_lifecycle.InstallChaincode'. diff --git a/third_party/hyperledger/fabric-protos/peer/policy.proto b/third_party/hyperledger/fabric-protos/peer/policy.proto index 1f67451a..86643094 100644 --- a/third_party/hyperledger/fabric-protos/peer/policy.proto +++ b/third_party/hyperledger/fabric-protos/peer/policy.proto @@ -9,7 +9,7 @@ option java_package = "org.hyperledger.fabric.protos.peer"; package protos; -import "common/policies.proto"; +import "hyperledger/fabric-protos/common/policies.proto"; // ApplicationPolicy captures the diffenrent policy types that // are set and evaluted at the application level. diff --git a/third_party/validate/validate.proto b/third_party/validate/validate.proto new file mode 100644 index 00000000..705d382a --- /dev/null +++ b/third_party/validate/validate.proto @@ -0,0 +1,862 @@ +syntax = "proto2"; +package validate; + +option go_package = "github.com/envoyproxy/protoc-gen-validate/validate"; +option java_package = "io.envoyproxy.pgv.validate"; + +import "google/protobuf/descriptor.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// Validation rules applied at the message level +extend google.protobuf.MessageOptions { + // Disabled nullifies any validation rules for this message, including any + // message fields associated with it that do support validation. + optional bool disabled = 1071; + // Ignore skips generation of validation methods for this message. + optional bool ignored = 1072; +} + +// Validation rules applied at the oneof level +extend google.protobuf.OneofOptions { + // Required ensures that exactly one the field options in a oneof is set; + // validation fails if no fields in the oneof are set. + optional bool required = 1071; +} + +// Validation rules applied at the field level +extend google.protobuf.FieldOptions { + // Rules specify the validations to be performed on this field. By default, + // no validation is performed against a field. + optional FieldRules rules = 1071; +} + +// FieldRules encapsulates the rules for each type of field. Depending on the +// field, the correct set should be used to ensure proper validations. +message FieldRules { + optional MessageRules message = 17; + oneof type { + // Scalar Field Types + FloatRules float = 1; + DoubleRules double = 2; + Int32Rules int32 = 3; + Int64Rules int64 = 4; + UInt32Rules uint32 = 5; + UInt64Rules uint64 = 6; + SInt32Rules sint32 = 7; + SInt64Rules sint64 = 8; + Fixed32Rules fixed32 = 9; + Fixed64Rules fixed64 = 10; + SFixed32Rules sfixed32 = 11; + SFixed64Rules sfixed64 = 12; + BoolRules bool = 13; + StringRules string = 14; + BytesRules bytes = 15; + + // Complex Field Types + EnumRules enum = 16; + RepeatedRules repeated = 18; + MapRules map = 19; + + // Well-Known Field Types + AnyRules any = 20; + DurationRules duration = 21; + TimestampRules timestamp = 22; + } +} + +// FloatRules describes the constraints applied to `float` values +message FloatRules { + // Const specifies that this field must be exactly the specified value + optional float const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional float lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional float lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional float gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional float gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated float in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated float not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// DoubleRules describes the constraints applied to `double` values +message DoubleRules { + // Const specifies that this field must be exactly the specified value + optional double const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional double lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional double lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional double gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional double gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated double in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated double not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Int32Rules describes the constraints applied to `int32` values +message Int32Rules { + // Const specifies that this field must be exactly the specified value + optional int32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional int32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional int32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional int32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional int32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated int32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Int64Rules describes the constraints applied to `int64` values +message Int64Rules { + // Const specifies that this field must be exactly the specified value + optional int64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional int64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional int64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional int64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional int64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated int64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// UInt32Rules describes the constraints applied to `uint32` values +message UInt32Rules { + // Const specifies that this field must be exactly the specified value + optional uint32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional uint32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional uint32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional uint32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional uint32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated uint32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated uint32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// UInt64Rules describes the constraints applied to `uint64` values +message UInt64Rules { + // Const specifies that this field must be exactly the specified value + optional uint64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional uint64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional uint64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional uint64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional uint64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated uint64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated uint64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SInt32Rules describes the constraints applied to `sint32` values +message SInt32Rules { + // Const specifies that this field must be exactly the specified value + optional sint32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sint32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sint32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sint32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sint32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sint32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sint32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SInt64Rules describes the constraints applied to `sint64` values +message SInt64Rules { + // Const specifies that this field must be exactly the specified value + optional sint64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sint64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sint64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sint64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sint64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sint64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sint64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Fixed32Rules describes the constraints applied to `fixed32` values +message Fixed32Rules { + // Const specifies that this field must be exactly the specified value + optional fixed32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional fixed32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional fixed32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional fixed32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional fixed32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated fixed32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated fixed32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Fixed64Rules describes the constraints applied to `fixed64` values +message Fixed64Rules { + // Const specifies that this field must be exactly the specified value + optional fixed64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional fixed64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional fixed64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional fixed64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional fixed64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated fixed64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated fixed64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SFixed32Rules describes the constraints applied to `sfixed32` values +message SFixed32Rules { + // Const specifies that this field must be exactly the specified value + optional sfixed32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sfixed32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sfixed32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sfixed32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sfixed32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sfixed32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sfixed32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SFixed64Rules describes the constraints applied to `sfixed64` values +message SFixed64Rules { + // Const specifies that this field must be exactly the specified value + optional sfixed64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sfixed64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sfixed64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sfixed64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sfixed64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sfixed64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sfixed64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// BoolRules describes the constraints applied to `bool` values +message BoolRules { + // Const specifies that this field must be exactly the specified value + optional bool const = 1; +} + +// StringRules describe the constraints applied to `string` values +message StringRules { + // Const specifies that this field must be exactly the specified value + optional string const = 1; + + // Len specifies that this field must be the specified number of + // characters (Unicode code points). Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 len = 19; + + // MinLen specifies that this field must be the specified number of + // characters (Unicode code points) at a minimum. Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 min_len = 2; + + // MaxLen specifies that this field must be the specified number of + // characters (Unicode code points) at a maximum. Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 max_len = 3; + + // LenBytes specifies that this field must be the specified number of bytes + optional uint64 len_bytes = 20; + + // MinBytes specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 min_bytes = 4; + + // MaxBytes specifies that this field must be the specified number of bytes + // at a maximum + optional uint64 max_bytes = 5; + + // Pattern specifes that this field must match against the specified + // regular expression (RE2 syntax). The included expression should elide + // any delimiters. + optional string pattern = 6; + + // Prefix specifies that this field must have the specified substring at + // the beginning of the string. + optional string prefix = 7; + + // Suffix specifies that this field must have the specified substring at + // the end of the string. + optional string suffix = 8; + + // Contains specifies that this field must have the specified substring + // anywhere in the string. + optional string contains = 9; + + // NotContains specifies that this field cannot have the specified substring + // anywhere in the string. + optional string not_contains = 23; + + // In specifies that this field must be equal to one of the specified + // values + repeated string in = 10; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated string not_in = 11; + + // WellKnown rules provide advanced constraints against common string + // patterns + oneof well_known { + // Email specifies that the field must be a valid email address as + // defined by RFC 5322 + bool email = 12; + + // Hostname specifies that the field must be a valid hostname as + // defined by RFC 1034. This constraint does not support + // internationalized domain names (IDNs). + bool hostname = 13; + + // Ip specifies that the field must be a valid IP (v4 or v6) address. + // Valid IPv6 addresses should not include surrounding square brackets. + bool ip = 14; + + // Ipv4 specifies that the field must be a valid IPv4 address. + bool ipv4 = 15; + + // Ipv6 specifies that the field must be a valid IPv6 address. Valid + // IPv6 addresses should not include surrounding square brackets. + bool ipv6 = 16; + + // Uri specifies that the field must be a valid, absolute URI as defined + // by RFC 3986 + bool uri = 17; + + // UriRef specifies that the field must be a valid URI as defined by RFC + // 3986 and may be relative or absolute. + bool uri_ref = 18; + + // Address specifies that the field must be either a valid hostname as + // defined by RFC 1034 (which does not support internationalized domain + // names or IDNs), or it can be a valid IP (v4 or v6). + bool address = 21; + + // Uuid specifies that the field must be a valid UUID as defined by + // RFC 4122 + bool uuid = 22; + + // WellKnownRegex specifies a common well known pattern defined as a regex. + KnownRegex well_known_regex = 24; + } + + // This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable + // strict header validation. + // By default, this is true, and HTTP header validations are RFC-compliant. + // Setting to false will enable a looser validations that only disallows + // \r\n\0 characters, which can be used to bypass header matching rules. + optional bool strict = 25 [default = true]; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 26; +} + +// WellKnownRegex contain some well-known patterns. +enum KnownRegex { + UNKNOWN = 0; + + // HTTP header name as defined by RFC 7230. + HTTP_HEADER_NAME = 1; + + // HTTP header value as defined by RFC 7230. + HTTP_HEADER_VALUE = 2; +} + +// BytesRules describe the constraints applied to `bytes` values +message BytesRules { + // Const specifies that this field must be exactly the specified value + optional bytes const = 1; + + // Len specifies that this field must be the specified number of bytes + optional uint64 len = 13; + + // MinLen specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 min_len = 2; + + // MaxLen specifies that this field must be the specified number of bytes + // at a maximum + optional uint64 max_len = 3; + + // Pattern specifes that this field must match against the specified + // regular expression (RE2 syntax). The included expression should elide + // any delimiters. + optional string pattern = 4; + + // Prefix specifies that this field must have the specified bytes at the + // beginning of the string. + optional bytes prefix = 5; + + // Suffix specifies that this field must have the specified bytes at the + // end of the string. + optional bytes suffix = 6; + + // Contains specifies that this field must have the specified bytes + // anywhere in the string. + optional bytes contains = 7; + + // In specifies that this field must be equal to one of the specified + // values + repeated bytes in = 8; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated bytes not_in = 9; + + // WellKnown rules provide advanced constraints against common byte + // patterns + oneof well_known { + // Ip specifies that the field must be a valid IP (v4 or v6) address in + // byte format + bool ip = 10; + + // Ipv4 specifies that the field must be a valid IPv4 address in byte + // format + bool ipv4 = 11; + + // Ipv6 specifies that the field must be a valid IPv6 address in byte + // format + bool ipv6 = 12; + } + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 14; +} + +// EnumRules describe the constraints applied to enum values +message EnumRules { + // Const specifies that this field must be exactly the specified value + optional int32 const = 1; + + // DefinedOnly specifies that this field must be only one of the defined + // values for this enum, failing on any undefined value. + optional bool defined_only = 2; + + // In specifies that this field must be equal to one of the specified + // values + repeated int32 in = 3; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int32 not_in = 4; +} + +// MessageRules describe the constraints applied to embedded message values. +// For message-type fields, validation is performed recursively. +message MessageRules { + // Skip specifies that the validation rules of this field should not be + // evaluated + optional bool skip = 1; + + // Required specifies that this field must be set + optional bool required = 2; +} + +// RepeatedRules describe the constraints applied to `repeated` values +message RepeatedRules { + // MinItems specifies that this field must have the specified number of + // items at a minimum + optional uint64 min_items = 1; + + // MaxItems specifies that this field must have the specified number of + // items at a maximum + optional uint64 max_items = 2; + + // Unique specifies that all elements in this field must be unique. This + // contraint is only applicable to scalar and enum types (messages are not + // supported). + optional bool unique = 3; + + // Items specifies the contraints to be applied to each item in the field. + // Repeated message fields will still execute validation against each item + // unless skip is specified here. + optional FieldRules items = 4; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 5; +} + +// MapRules describe the constraints applied to `map` values +message MapRules { + // MinPairs specifies that this field must have the specified number of + // KVs at a minimum + optional uint64 min_pairs = 1; + + // MaxPairs specifies that this field must have the specified number of + // KVs at a maximum + optional uint64 max_pairs = 2; + + // NoSparse specifies values in this field cannot be unset. This only + // applies to map's with message value types. + optional bool no_sparse = 3; + + // Keys specifies the constraints to be applied to each key in the field. + optional FieldRules keys = 4; + + // Values specifies the constraints to be applied to the value of each key + // in the field. Message values will still have their validations evaluated + // unless skip is specified here. + optional FieldRules values = 5; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 6; +} + +// AnyRules describe constraints applied exclusively to the +// `google.protobuf.Any` well-known type +message AnyRules { + // Required specifies that this field must be set + optional bool required = 1; + + // In specifies that this field's `type_url` must be equal to one of the + // specified values. + repeated string in = 2; + + // NotIn specifies that this field's `type_url` must not be equal to any of + // the specified values. + repeated string not_in = 3; +} + +// DurationRules describe the constraints applied exclusively to the +// `google.protobuf.Duration` well-known type +message DurationRules { + // Required specifies that this field must be set + optional bool required = 1; + + // Const specifies that this field must be exactly the specified value + optional google.protobuf.Duration const = 2; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional google.protobuf.Duration lt = 3; + + // Lt specifies that this field must be less than the specified value, + // inclusive + optional google.protobuf.Duration lte = 4; + + // Gt specifies that this field must be greater than the specified value, + // exclusive + optional google.protobuf.Duration gt = 5; + + // Gte specifies that this field must be greater than the specified value, + // inclusive + optional google.protobuf.Duration gte = 6; + + // In specifies that this field must be equal to one of the specified + // values + repeated google.protobuf.Duration in = 7; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated google.protobuf.Duration not_in = 8; +} + +// TimestampRules describe the constraints applied exclusively to the +// `google.protobuf.Timestamp` well-known type +message TimestampRules { + // Required specifies that this field must be set + optional bool required = 1; + + // Const specifies that this field must be exactly the specified value + optional google.protobuf.Timestamp const = 2; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional google.protobuf.Timestamp lt = 3; + + // Lte specifies that this field must be less than the specified value, + // inclusive + optional google.protobuf.Timestamp lte = 4; + + // Gt specifies that this field must be greater than the specified value, + // exclusive + optional google.protobuf.Timestamp gt = 5; + + // Gte specifies that this field must be greater than the specified value, + // inclusive + optional google.protobuf.Timestamp gte = 6; + + // LtNow specifies that this must be less than the current time. LtNow + // can only be used with the Within rule. + optional bool lt_now = 7; + + // GtNow specifies that this must be greater than the current time. GtNow + // can only be used with the Within rule. + optional bool gt_now = 8; + + // Within specifies that this field must be within this duration of the + // current time. This constraint can be used alone or with the LtNow and + // GtNow rules. + optional google.protobuf.Duration within = 9; +}