diff --git a/app/app.go b/app/app.go index f012f04f8..6bd659d9b 100644 --- a/app/app.go +++ b/app/app.go @@ -686,6 +686,13 @@ func New( }, ) + app.UpgradeKeeper.SetUpgradeHandler( + "v1.4.4", + func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }, + ) + return app } diff --git a/deployment/persistent_chains/testnet-2.0/testnet-2.0-csa-endpoints.md b/deployment/persistent_chains/testnet-2.0/testnet-2.0-csa-endpoints.md index 4f4e74bdc..6a2cd2d87 100644 --- a/deployment/persistent_chains/testnet-2.0/testnet-2.0-csa-endpoints.md +++ b/deployment/persistent_chains/testnet-2.0/testnet-2.0-csa-endpoints.md @@ -1,6 +1,6 @@ # Testnet 2.0 CSA public endpoints -- `REST` - +[//]: # (- `REST` - ) - `RPC` - - `gRPC` - on.test-net.dcl.csa-iot.org:8443 - `Seed Node` - 100.25.175.140:26656 diff --git a/docs/design/noc-root-cert-design.md b/docs/design/noc-root-cert-design.md index 9becdb691..00d6f1879 100644 --- a/docs/design/noc-root-cert-design.md +++ b/docs/design/noc-root-cert-design.md @@ -96,7 +96,7 @@ Retrieve NOC root certificates associated with a specific VID. - CLI Command: - `dcld query pki get_noc_x509_root_certs --vid=` - REST API: - - GET `/dcl/pki/noc-root-certificates/{vid}` + - GET `/dcl/pki/noc-vid-root-certificates/{vid}` ### GET_ALL_NOC_X509_ROOT_CERTS diff --git a/docs/pool-upgrade-how-to.md b/docs/pool-upgrade-how-to.md index e50e8081a..3cc7f1ee6 100644 --- a/docs/pool-upgrade-how-to.md +++ b/docs/pool-upgrade-how-to.md @@ -60,7 +60,7 @@ One of the trustees proposes the upgrade using the following steps: ``` Please note, that it must be called against the `dcld` binary, not the platform archive itself. So, for Ubuntu, either take a `dcld` binary from the root folder of the release, or extract it from ` dcld.ubuntu.tar.gz`. - 2. Sends [`ProposeUpgrade`](./transactions.md#propose_upgrade) transaction + 2. Sends [`ProposeUpgrade`](transactions.md#propose_upgrade) transaction with the name of the new upgrade handler, the chosen ledger height and the info containing URLs of the new application version binaries for supported platforms with the calculated checksums. @@ -92,7 +92,7 @@ Each of them uses the following steps to accomplish this: ``` Please note, that it must be called against the `dcld` binary, not the platform archive itself. So, for Ubuntu, either take a `dcld` binary from the root folder of the release, or extract it from ` dcld.ubuntu.tar.gz`. -2. Sends [`ApproveUpgrade`](./transactions.md#approve_upgrade) transaction +2. Sends [`ApproveUpgrade`](transactions.md#approve_upgrade) transaction with the name of the proposed upgrade. For example: diff --git a/docs/pool-upgrade.md b/docs/pool-upgrade.md index 7bce8d0a1..019c7159b 100644 --- a/docs/pool-upgrade.md +++ b/docs/pool-upgrade.md @@ -27,10 +27,10 @@ Any upgrade plan has the following fields: ## Workflow Initially an upgrade plan is proposed by one of trustees using -[propose-upgrade](./transactions.md#propose_upgrade) command. Then the proposed +[propose-upgrade](transactions.md) command. Then the proposed upgrade plan has to be approved by the majority of trustees (2/3 including the trustee who has proposed it) using -[approve-upgrade](./transactions.md#approve_upgrade) command. When the necessary +[approve-upgrade](transactions.md#approve_upgrade) command. When the necessary count of approvals is gathered, the upgrade plan turns into the approved state and is actually scheduled. @@ -81,5 +81,5 @@ checksum when the URL is provided in the specified format. If the downloaded file checksum does not equal to the checksum provided in the URL, `go-getter` reports that checksums did not match. To view `Info` field value of an upgrade plan, just execute an appropriate query command from `dclupgrade` or `upgrade` -module. See [Upgrade CLI commands reference](./transactions.md#upgrade) for +module. See [Upgrade CLI commands reference](transactions.md#upgrade) for details. diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 373441d73..67182da64 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -9234,17 +9234,17 @@ paths: format: int64 tags: - Query - /dcl/pki/certificates: + /dcl/pki/all-certificates: get: - summary: Queries a list of ApprovedCertificates items. - operationId: ApprovedCertificatesAll + summary: Queries a list of Certificates items. + operationId: CertificatesAll responses: '200': description: A successful response. schema: type: object properties: - approvedCertificates: + certificates: type: array items: type: object @@ -9319,8 +9319,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -9430,70 +9435,19 @@ paths: in: query required: false type: boolean - - name: subjectKeyId - in: query - required: false - type: string - tags: - - Query - /dcl/pki/certificates/{subject}: - get: - summary: Queries a ApprovedCertificatesBySubject by index. - operationId: ApprovedCertificatesBySubject - responses: - '200': - description: A successful response. - schema: - type: object - properties: - approvedCertificatesBySubject: - type: object - properties: - subject: - type: string - subjectKeyIds: - type: array - items: - type: string - schemaVersion: - type: integer - format: int64 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: subject - in: path - required: true - type: string tags: - Query - /dcl/pki/certificates/{subject}/{subjectKeyId}: + /dcl/pki/all-certificates/{subject}/{subjectKeyId}: get: - summary: Queries a ApprovedCertificates by index. - operationId: ApprovedCertificates + summary: Queries a Certificates by index. + operationId: Certificates responses: '200': description: A successful response. schema: type: object properties: - approvedCertificates: + certificates: type: object properties: subject: @@ -9566,8 +9520,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -9603,207 +9562,25 @@ paths: type: string tags: - Query - /dcl/pki/child-certificates/{issuer}/{authorityKeyId}: + /dcl/pki/certificates: get: - summary: Queries a ChildCertificates by index. - operationId: ChildCertificates + summary: Queries a list of ApprovedCertificates items. + operationId: ApprovedCertificatesAll responses: '200': description: A successful response. schema: type: object properties: - childCertificates: - type: object - properties: - issuer: - type: string - authorityKeyId: - type: string - certIds: - type: array - items: - type: object - properties: - subject: - type: string - subjectKeyId: - type: string - schemaVersion: - type: integer - format: int64 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: + approvedCertificates: type: array items: type: object properties: - '@type': + subject: type: string - additionalProperties: {} - parameters: - - name: issuer - in: path - required: true - type: string - - name: authorityKeyId - in: path - required: true - type: string - tags: - - Query - /dcl/pki/noc-certificates/{vid}/{subjectKeyId}: - get: - summary: Queries a NocCertificatesByVidAndSkid by index. - operationId: NocCertificatesByVidAndSkid - responses: - '200': - description: A successful response. - schema: - type: object - properties: - nocCertificatesByVidAndSkid: - type: object - properties: - vid: - type: integer - format: int32 - subjectKeyId: - type: string - certs: - type: array - items: - type: object - properties: - pemCert: - type: string - serialNumber: - type: string - issuer: - type: string - authorityKeyId: - type: string - rootSubject: - type: string - rootSubjectKeyId: - type: string - isRoot: - type: boolean - owner: - type: string - subject: - type: string - subjectKeyId: - type: string - approvals: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, - 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - subjectAsText: - type: string - rejects: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, - 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - vid: - type: integer - format: int32 - isNoc: - type: boolean - schemaVersion: - type: integer - format: int64 - tq: - type: number - format: float - schemaVersion: - type: integer - format: int64 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': + subjectKeyId: type: string - additionalProperties: {} - parameters: - - name: vid - in: path - required: true - type: integer - format: int32 - - name: subjectKeyId - in: path - required: true - type: string - tags: - - Query - /dcl/pki/noc-ica-certificates: - get: - summary: Queries a list of NocIcaCertificates items. - operationId: NocIcaCertificatesAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - nocIcaCertificates: - type: array - items: - type: object - properties: - vid: - type: integer - format: int32 certs: type: array items: @@ -9870,8 +9647,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -9981,24 +9763,76 @@ paths: in: query required: false type: boolean + - name: subjectKeyId + in: query + required: false + type: string tags: - Query - /dcl/pki/noc-ica-certificates/{vid}: + /dcl/pki/certificates/{subject}: get: - summary: Queries a NocIcaCertificates by index. - operationId: NocIcaCertificates + summary: Queries a ApprovedCertificatesBySubject by index. + operationId: ApprovedCertificatesBySubject responses: '200': description: A successful response. schema: type: object properties: - nocIcaCertificates: + approvedCertificatesBySubject: type: object properties: - vid: + subject: + type: string + subjectKeyIds: + type: array + items: + type: string + schemaVersion: type: integer - format: int32 + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: subject + in: path + required: true + type: string + tags: + - Query + /dcl/pki/certificates/{subject}/{subjectKeyId}: + get: + summary: Queries a ApprovedCertificates by index. + operationId: ApprovedCertificates + responses: + '200': + description: A successful response. + schema: + type: object + properties: + approvedCertificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string certs: type: array items: @@ -10065,8 +9899,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -10092,31 +9931,93 @@ paths: type: string additionalProperties: {} parameters: - - name: vid + - name: subject in: path required: true - type: integer - format: int32 + type: string + - name: subjectKeyId + in: path + required: true + type: string tags: - Query - /dcl/pki/noc-root-certificates: + /dcl/pki/child-certificates/{issuer}/{authorityKeyId}: get: - summary: Queries a list of NocRootCertificates items. - operationId: NocRootCertificatesAll + summary: Queries a ChildCertificates by index. + operationId: ChildCertificates responses: '200': description: A successful response. schema: type: object properties: - nocRootCertificates: + childCertificates: + type: object + properties: + issuer: + type: string + authorityKeyId: + type: string + certIds: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + schemaVersion: + type: integer + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: type: array items: type: object properties: - vid: - type: integer - format: int32 + '@type': + type: string + additionalProperties: {} + parameters: + - name: issuer + in: path + required: true + type: string + - name: authorityKeyId + in: path + required: true + type: string + tags: + - Query + /dcl/pki/noc-certificates: + get: + summary: Queries a list of NocCertificates items. + operationId: NocCertificatesAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocCertificates: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string certs: type: array items: @@ -10183,11 +10084,19 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 + tq: + type: number + format: float schemaVersion: type: integer format: int64 @@ -10294,24 +10203,76 @@ paths: in: query required: false type: boolean + - name: subjectKeyId + in: query + required: false + type: string tags: - Query - /dcl/pki/noc-root-certificates/{vid}: + /dcl/pki/all-noc-certificates/{subject}: get: - summary: Queries a NocRootCertificates by index. - operationId: NocRootCertificates + summary: Queries a NocCertificatesBySubject by index. + operationId: NocCertificatesBySubject responses: '200': description: A successful response. schema: type: object properties: - nocRootCertificates: + nocCertificatesBySubject: type: object properties: - vid: + subject: + type: string + subjectKeyIds: + type: array + items: + type: string + schemaVersion: type: integer - format: int32 + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: subject + in: path + required: true + type: string + tags: + - Query + /dcl/pki/all-noc-certificates/{subject}/{subjectKeyId}: + get: + summary: Queries a NocCertificates by index. + operationId: NocCertificates + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocCertificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string certs: type: array items: @@ -10378,11 +10339,19 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 + tq: + type: number + format: float schemaVersion: type: integer format: int64 @@ -10405,59 +10374,1088 @@ paths: type: string additionalProperties: {} parameters: - - name: vid + - name: subject in: path required: true - type: integer - format: int32 + type: string + - name: subjectKeyId + in: path + required: true + type: string tags: - Query - /dcl/pki/proposed-certificates: + /dcl/pki/noc-vid-certificates/{vid}/{subjectKeyId}: get: - summary: Queries a list of ProposedCertificate items. - operationId: ProposedCertificateAll + summary: Queries a NocCertificatesByVidAndSkid by index. + operationId: NocCertificatesByVidAndSkid responses: '200': description: A successful response. schema: type: object properties: - proposedCertificate: - type: array - items: - type: object - properties: - subject: - type: string - subjectKeyId: - type: string - pemCert: - type: string - serialNumber: - type: string - owner: - type: string - approvals: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, - 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - subjectAsText: - type: string - rejects: + nocCertificatesByVidAndSkid: + type: object + properties: + vid: + type: integer + format: int32 + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float + schemaVersion: + type: integer + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: vid + in: path + required: true + type: integer + format: int32 + - name: subjectKeyId + in: path + required: true + type: string + tags: + - Query + /dcl/pki/noc-ica-certificates: + get: + summary: Queries a list of NocIcaCertificates items. + operationId: NocIcaCertificatesAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocIcaCertificates: + type: array + items: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /dcl/pki/noc-vid-ica-certificates/{vid}: + get: + summary: Queries a NocIcaCertificates by index. + operationId: NocIcaCertificates + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocIcaCertificates: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: vid + in: path + required: true + type: integer + format: int32 + tags: + - Query + /dcl/pki/noc-root-certificates: + get: + summary: Queries a list of NocRootCertificates items. + operationId: NocRootCertificatesAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocRootCertificates: + type: array + items: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /dcl/pki/noc-vid-root-certificates/{vid}: + get: + summary: Queries a NocRootCertificates by index. + operationId: NocRootCertificates + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocRootCertificates: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: vid + in: path + required: true + type: integer + format: int32 + tags: + - Query + /dcl/pki/proposed-certificates: + get: + summary: Queries a list of ProposedCertificate items. + operationId: ProposedCertificateAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposedCertificate: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + pemCert: + type: string + serialNumber: + type: string + owner: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certSchemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /dcl/pki/proposed-certificates/{subject}/{subjectKeyId}: + get: + summary: Queries a ProposedCertificate by index. + operationId: ProposedCertificate + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposedCertificate: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + pemCert: + type: string + serialNumber: + type: string + owner: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certSchemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: subject + in: path + required: true + type: string + - name: subjectKeyId + in: path + required: true + type: string + tags: + - Query + /dcl/pki/proposed-revocation-certificates: + get: + summary: Queries a list of ProposedCertificateRevocation items. + operationId: ProposedCertificateRevocationAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposedCertificateRevocation: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + approvals: type: array items: type: object @@ -10475,12 +11473,12 @@ paths: schemaVersion: type: integer format: int64 - vid: - type: integer - format: int32 - certSchemaVersion: - type: integer - format: int64 + subjectAsText: + type: string + serialNumber: + type: string + revokeChild: + type: boolean schemaVersion: type: integer format: int64 @@ -10589,29 +11587,23 @@ paths: type: boolean tags: - Query - /dcl/pki/proposed-certificates/{subject}/{subjectKeyId}: + /dcl/pki/proposed-revocation-certificates/{subject}/{subjectKeyId}: get: - summary: Queries a ProposedCertificate by index. - operationId: ProposedCertificate + summary: Queries a ProposedCertificateRevocation by index. + operationId: ProposedCertificateRevocation responses: '200': description: A successful response. schema: type: object properties: - proposedCertificate: + proposedCertificateRevocation: type: object properties: subject: type: string subjectKeyId: type: string - pemCert: - type: string - serialNumber: - type: string - owner: - type: string approvals: type: array items: @@ -10632,30 +11624,10 @@ paths: format: int64 subjectAsText: type: string - rejects: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, 1970 - UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - vid: - type: integer - format: int32 - certSchemaVersion: - type: integer - format: int64 + serialNumber: + type: string + revokeChild: + type: boolean schemaVersion: type: integer format: int64 @@ -10686,19 +11658,23 @@ paths: in: path required: true type: string + - name: serialNumber + in: query + required: false + type: string tags: - Query - /dcl/pki/proposed-revocation-certificates: + /dcl/pki/rejected-certificates: get: - summary: Queries a list of ProposedCertificateRevocation items. - operationId: ProposedCertificateRevocationAll + summary: Queries a list of RejectedCertificate items. + operationId: RejectedCertificateAll responses: '200': description: A successful response. schema: type: object properties: - proposedCertificateRevocation: + rejectedCertificate: type: array items: type: object @@ -10707,30 +11683,82 @@ paths: type: string subjectKeyId: type: string - approvals: + certs: type: array items: type: object properties: - address: + pemCert: type: string - time: + serialNumber: type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, - 1970 UTC - info: + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 - subjectAsText: - type: string - serialNumber: - type: string - revokeChild: - type: boolean schemaVersion: type: integer format: int64 @@ -10839,47 +11867,99 @@ paths: type: boolean tags: - Query - /dcl/pki/proposed-revocation-certificates/{subject}/{subjectKeyId}: + /dcl/pki/rejected-certificates/{subject}/{subjectKeyId}: get: - summary: Queries a ProposedCertificateRevocation by index. - operationId: ProposedCertificateRevocation + summary: Queries a RejectedCertificate by index. + operationId: RejectedCertificate responses: '200': description: A successful response. schema: type: object properties: - proposedCertificateRevocation: + rejectedCertificate: type: object properties: subject: type: string subjectKeyId: type: string - approvals: + certs: type: array items: type: object properties: - address: + pemCert: type: string - time: + serialNumber: type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, 1970 - UTC - info: + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 - subjectAsText: - type: string - serialNumber: - type: string - revokeChild: - type: boolean schemaVersion: type: integer format: int64 @@ -10910,105 +11990,55 @@ paths: in: path required: true type: string - - name: serialNumber - in: query - required: false - type: string tags: - Query - /dcl/pki/rejected-certificates: + /dcl/pki/revocation-points: get: - summary: Queries a list of RejectedCertificate items. - operationId: RejectedCertificateAll + summary: Queries a list of PkiRevocationDistributionPoint items. + operationId: PkiRevocationDistributionPointAll responses: '200': description: A successful response. schema: type: object properties: - rejectedCertificate: + PkiRevocationDistributionPoint: type: array items: type: object properties: - subject: + vid: + type: integer + format: int32 + label: type: string - subjectKeyId: + issuerSubjectKeyID: type: string - certs: - type: array - items: - type: object - properties: - pemCert: - type: string - serialNumber: - type: string - issuer: - type: string - authorityKeyId: - type: string - rootSubject: - type: string - rootSubjectKeyId: - type: string - isRoot: - type: boolean - owner: - type: string - subject: - type: string - subjectKeyId: - type: string - approvals: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January - 1, 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - subjectAsText: - type: string - rejects: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January - 1, 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - vid: - type: integer - format: int32 - isNoc: - type: boolean - schemaVersion: - type: integer - format: int64 + pid: + type: integer + format: int32 + isPAA: + type: boolean + crlSignerCertificate: + type: string + dataURL: + type: string + dataFileSize: + type: string + format: uint64 + dataDigest: + type: string + dataDigestType: + type: integer + format: int64 + revocationType: + type: integer + format: int64 schemaVersion: type: integer format: int64 + crlSignerDelegator: + type: string pagination: type: object properties: @@ -11114,97 +12144,131 @@ paths: type: boolean tags: - Query - /dcl/pki/rejected-certificates/{subject}/{subjectKeyId}: + /dcl/pki/revocation-points/{issuerSubjectKeyID}: get: - summary: Queries a RejectedCertificate by index. - operationId: RejectedCertificate + summary: Queries a PkiRevocationDistributionPointsByIssuerSubjectKeyID by index. + operationId: PkiRevocationDistributionPointsByIssuerSubjectKeyID responses: '200': description: A successful response. schema: type: object properties: - rejectedCertificate: + pkiRevocationDistributionPointsByIssuerSubjectKeyID: type: object properties: - subject: - type: string - subjectKeyId: + issuerSubjectKeyID: type: string - certs: + points: type: array items: type: object properties: - pemCert: - type: string - serialNumber: - type: string - issuer: - type: string - authorityKeyId: - type: string - rootSubject: + vid: + type: integer + format: int32 + label: type: string - rootSubjectKeyId: + issuerSubjectKeyID: type: string - isRoot: + pid: + type: integer + format: int32 + isPAA: type: boolean - owner: + crlSignerCertificate: type: string - subject: + dataURL: type: string - subjectKeyId: + dataFileSize: type: string - approvals: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, - 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - subjectAsText: + format: uint64 + dataDigest: type: string - rejects: - type: array - items: - type: object - properties: - address: - type: string - time: - type: string - format: int64 - title: >- - number of nanoseconds elapsed since January 1, - 1970 UTC - info: - type: string - schemaVersion: - type: integer - format: int64 - vid: + dataDigestType: type: integer - format: int32 - isNoc: - type: boolean + format: int64 + revocationType: + type: integer + format: int64 schemaVersion: type: integer format: int64 + crlSignerDelegator: + type: string + schemaVersion: + type: integer + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: issuerSubjectKeyID + in: path + required: true + type: string + tags: + - Query + /dcl/pki/revocation-points/{issuerSubjectKeyID}/{vid}/{label}: + get: + summary: Queries a PkiRevocationDistributionPoint by index. + operationId: PkiRevocationDistributionPoint + responses: + '200': + description: A successful response. + schema: + type: object + properties: + PkiRevocationDistributionPoint: + type: object + properties: + vid: + type: integer + format: int32 + label: + type: string + issuerSubjectKeyID: + type: string + pid: + type: integer + format: int32 + isPAA: + type: boolean + crlSignerCertificate: + type: string + dataURL: + type: string + dataFileSize: + type: string + format: uint64 + dataDigest: + type: string + dataDigestType: + type: integer + format: int64 + revocationType: + type: integer + format: int64 schemaVersion: type: integer format: int64 + crlSignerDelegator: + type: string default: description: An unexpected error response. schema: @@ -11224,63 +12288,119 @@ paths: type: string additionalProperties: {} parameters: - - name: subject + - name: issuerSubjectKeyID in: path required: true type: string - - name: subjectKeyId + - name: vid + in: path + required: true + type: integer + format: int32 + - name: label in: path required: true type: string tags: - Query - /dcl/pki/revocation-points: + /dcl/pki/revoked-certificates: get: - summary: Queries a list of PkiRevocationDistributionPoint items. - operationId: PkiRevocationDistributionPointAll + summary: Queries a list of RevokedCertificates items. + operationId: RevokedCertificatesAll responses: '200': description: A successful response. schema: type: object properties: - PkiRevocationDistributionPoint: + revokedCertificates: type: array items: type: object properties: - vid: - type: integer - format: int32 - label: - type: string - issuerSubjectKeyID: - type: string - pid: - type: integer - format: int32 - isPAA: - type: boolean - crlSignerCertificate: - type: string - dataURL: - type: string - dataFileSize: + subject: type: string - format: uint64 - dataDigest: + subjectKeyId: type: string - dataDigestType: - type: integer - format: int64 - revocationType: - type: integer - format: int64 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January + 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 schemaVersion: type: integer format: int64 - crlSignerDelegator: - type: string pagination: type: object properties: @@ -11386,58 +12506,99 @@ paths: type: boolean tags: - Query - /dcl/pki/revocation-points/{issuerSubjectKeyID}: + /dcl/pki/revoked-certificates/{subject}/{subjectKeyId}: get: - summary: Queries a PkiRevocationDistributionPointsByIssuerSubjectKeyID by index. - operationId: PkiRevocationDistributionPointsByIssuerSubjectKeyID + summary: Queries a RevokedCertificates by index. + operationId: RevokedCertificates responses: '200': description: A successful response. schema: type: object properties: - pkiRevocationDistributionPointsByIssuerSubjectKeyID: + revokedCertificates: type: object properties: - issuerSubjectKeyID: + subject: type: string - points: + subjectKeyId: + type: string + certs: type: array items: type: object properties: - vid: - type: integer - format: int32 - label: - type: string - issuerSubjectKeyID: - type: string - pid: - type: integer - format: int32 - isPAA: - type: boolean - crlSignerCertificate: - type: string - dataURL: - type: string - dataFileSize: - type: string - format: uint64 - dataDigest: - type: string - dataDigestType: - type: integer - format: int64 - revocationType: - type: integer - format: int64 - schemaVersion: - type: integer - format: int64 - crlSignerDelegator: + pemCert: type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, + 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 schemaVersion: type: integer format: int64 @@ -11460,102 +12621,27 @@ paths: type: string additionalProperties: {} parameters: - - name: issuerSubjectKeyID - in: path - required: true - type: string - tags: - - Query - /dcl/pki/revocation-points/{issuerSubjectKeyID}/{vid}/{label}: - get: - summary: Queries a PkiRevocationDistributionPoint by index. - operationId: PkiRevocationDistributionPoint - responses: - '200': - description: A successful response. - schema: - type: object - properties: - PkiRevocationDistributionPoint: - type: object - properties: - vid: - type: integer - format: int32 - label: - type: string - issuerSubjectKeyID: - type: string - pid: - type: integer - format: int32 - isPAA: - type: boolean - crlSignerCertificate: - type: string - dataURL: - type: string - dataFileSize: - type: string - format: uint64 - dataDigest: - type: string - dataDigestType: - type: integer - format: int64 - revocationType: - type: integer - format: int64 - schemaVersion: - type: integer - format: int64 - crlSignerDelegator: - type: string - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: issuerSubjectKeyID + - name: subject in: path required: true type: string - - name: vid - in: path - required: true - type: integer - format: int32 - - name: label + - name: subjectKeyId in: path required: true type: string tags: - Query - /dcl/pki/revoked-certificates: + /dcl/pki/revoked-noc-ica-certificates: get: - summary: Queries a list of RevokedCertificates items. - operationId: RevokedCertificatesAll + summary: Queries a list of RevokedNocIcaCertificates items. + operationId: RevokedNocIcaCertificatesAll responses: '200': description: A successful response. schema: type: object properties: - revokedCertificates: + revokedNocIcaCertificates: type: array items: type: object @@ -11630,8 +12716,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -11743,17 +12834,17 @@ paths: type: boolean tags: - Query - /dcl/pki/revoked-certificates/{subject}/{subjectKeyId}: + /dcl/pki/revoked-noc-ica-certificates/{subject}/{subjectKeyId}: get: - summary: Queries a RevokedCertificates by index. - operationId: RevokedCertificates + summary: Queries a RevokedNocIcaCertificates by index. + operationId: RevokedNocIcaCertificates responses: '200': description: A successful response. schema: type: object properties: - revokedCertificates: + revokedNocIcaCertificates: type: object properties: subject: @@ -11826,8 +12917,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -11948,8 +13044,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -12144,8 +13245,13 @@ paths: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -22730,7 +23836,7 @@ definitions: schemaVersion: type: integer format: int64 - zigbeealliance.distributedcomplianceledger.pki.ApprovedCertificates: + zigbeealliance.distributedcomplianceledger.pki.AllCertificates: type: object properties: subject: @@ -22799,8 +23905,95 @@ definitions: vid: type: integer format: int32 - isNoc: + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + zigbeealliance.distributedcomplianceledger.pki.ApprovedCertificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -22894,8 +24087,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -22906,6 +24104,13 @@ definitions: type: string subjectKeyId: type: string + zigbeealliance.distributedcomplianceledger.pki.CertificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI zigbeealliance.distributedcomplianceledger.pki.ChildCertificates: type: object properties: @@ -22925,17 +24130,114 @@ definitions: schemaVersion: type: integer format: int64 - zigbeealliance.distributedcomplianceledger.pki.Grant: + zigbeealliance.distributedcomplianceledger.pki.Grant: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + zigbeealliance.distributedcomplianceledger.pki.NocCertificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float + schemaVersion: + type: integer + format: int64 + zigbeealliance.distributedcomplianceledger.pki.NocCertificatesBySubject: type: object properties: - address: - type: string - time: - type: string - format: int64 - title: number of nanoseconds elapsed since January 1, 1970 UTC - info: + subject: type: string + subjectKeyIds: + type: array + items: + type: string schemaVersion: type: integer format: int64 @@ -23009,8 +24311,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -23088,8 +24395,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -23164,8 +24476,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -23418,8 +24735,130 @@ definitions: vid: type: integer format: int32 - isNoc: + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + zigbeealliance.distributedcomplianceledger.pki.QueryAllCertificatesResponse: + type: object + properties: + certificates: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -23529,8 +24968,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -23640,8 +25084,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -23890,10 +25339,127 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - zigbeealliance.distributedcomplianceledger.pki.QueryAllRejectedCertificatesResponse: + zigbeealliance.distributedcomplianceledger.pki.QueryAllRejectedCertificatesResponse: + type: object + properties: + rejectedCertificate: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedCertificatesResponse: type: object properties: - rejectedCertificate: + revokedCertificates: type: array items: type: object @@ -23968,8 +25534,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24002,10 +25573,10 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedCertificatesResponse: + zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocIcaCertificatesResponse: type: object properties: - revokedCertificates: + revokedNocIcaCertificates: type: array items: type: object @@ -24080,8 +25651,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24192,8 +25768,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24317,8 +25898,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24343,6 +25929,95 @@ definitions: schemaVersion: type: integer format: int64 + zigbeealliance.distributedcomplianceledger.pki.QueryGetCertificatesResponse: + type: object + properties: + certificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 zigbeealliance.distributedcomplianceledger.pki.QueryGetChildCertificatesResponse: type: object properties: @@ -24365,6 +26040,21 @@ definitions: schemaVersion: type: integer format: int64 + zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesBySubjectResponse: + type: object + properties: + nocCertificatesBySubject: + type: object + properties: + subject: + type: string + subjectKeyIds: + type: array + items: + type: string + schemaVersion: + type: integer + format: int64 zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesByVidAndSkidResponse: type: object properties: @@ -24442,8 +26132,105 @@ definitions: vid: type: integer format: int32 - isNoc: + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float + schemaVersion: + type: integer + format: int64 + zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesResponse: + type: object + properties: + nocCertificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24528,8 +26315,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24611,8 +26403,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -24781,28 +26578,117 @@ definitions: properties: address: type: string - time: + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + serialNumber: + type: string + revokeChild: + type: boolean + schemaVersion: + type: integer + format: int64 + zigbeealliance.distributedcomplianceledger.pki.QueryGetRejectedCertificatesResponse: + type: object + properties: + rejectedCertificate: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: type: string - format: int64 - title: number of nanoseconds elapsed since January 1, 1970 UTC - info: + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 - subjectAsText: - type: string - serialNumber: - type: string - revokeChild: - type: boolean schemaVersion: type: integer format: int64 - zigbeealliance.distributedcomplianceledger.pki.QueryGetRejectedCertificatesResponse: + zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedCertificatesResponse: type: object properties: - rejectedCertificate: + revokedCertificates: type: object properties: subject: @@ -24875,18 +26761,23 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 schemaVersion: type: integer format: int64 - zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedCertificatesResponse: + zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocIcaCertificatesResponse: type: object properties: - revokedCertificates: + revokedNocIcaCertificates: type: object properties: subject: @@ -24959,8 +26850,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -25043,8 +26939,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -25069,6 +26970,126 @@ definitions: schemaVersion: type: integer format: int64 + zigbeealliance.distributedcomplianceledger.pki.QueryNocCertificatesResponse: + type: object + properties: + nocCertificates: + type: array + items: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: >- + number of nanoseconds elapsed since January 1, 1970 + UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float + schemaVersion: + type: integer + format: int64 + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } zigbeealliance.distributedcomplianceledger.pki.RejectedCertificate: type: object properties: @@ -25138,8 +27159,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -25215,8 +27241,95 @@ definitions: vid: type: integer format: int32 - isNoc: + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI + schemaVersion: + type: integer + format: int64 + schemaVersion: + type: integer + format: int64 + zigbeealliance.distributedcomplianceledger.pki.RevokedNocIcaCertificates: + type: object + properties: + subject: + type: string + subjectKeyId: + type: string + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + title: number of nanoseconds elapsed since January 1, 1970 UTC + info: + type: string + schemaVersion: + type: integer + format: int64 + vid: + type: integer + format: int32 + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 @@ -25292,8 +27405,13 @@ definitions: vid: type: integer format: int32 - isNoc: - type: boolean + certificateType: + type: string + enum: + - DeviceAttestationPKI + - OperationalPKI + - VIDSignerPKI + default: DeviceAttestationPKI schemaVersion: type: integer format: int64 diff --git a/docs/transactions.md b/docs/transactions.md index 4504d31db..8498259bf 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -99,7 +99,7 @@ Please make sure that TLS is enabled in gRPC, REST or Light Client Proxy for sec - Tendermint RPC supports state proofs. Tendermint's Light Client library can be used to verify the state proofs. So, if Light Client API is used, then it's possible to communicate with non-trusted nodes. - Please note, that multi-value queries don't have state proofs support and should be sent to trusted nodes only. - - Refer to [this doc](./cometbft-rpc.md) to see how to [subscribe](./cometbft-rpc.md#subscribe) to a Tendermint WebSocket based events and/or [query](./cometbft-rpc.md#querying-application-components) an application components. + - Refer to [this doc](cometbft-rpc.md) to see how to [subscribe](cometbft-rpc.md#subscribe) to a Tendermint WebSocket based events and/or [query](cometbft-rpc.md#querying-application-components) an application components. `NotFound` (404 code) is returned if an entry is not found on the ledger. @@ -897,7 +897,11 @@ The PAA certificate is not active until sufficient number of Trustees approve it - subject_key_id: `string` - proposed certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB`. - info: `optional(string)` - information/notes for the approval. Can contain up to 4096 characters. - time: `optional(int64)` - proposal time (number of nanoseconds elapsed since January 1, 1970 UTC). This field cannot be specified using a CLI command and will use the current time by default. -- In State: `pki/ApprovedCertificates/value//`. +- In State: + - `pki/AllCertificates/value//`. + - `pki/ApprovedCertificates/value//`. + - `pki/ApprovedCertificatesBySubject/value/` + - `pki/ApprovedCertificatesBySubjectKeyId/value/`. - Number of required approvals: - greater than or equal 2/3 of Trustees (proposal by a Trustee is also counted as an approval) - CLI command: @@ -940,7 +944,7 @@ The certificate is not reject until sufficient number of Trustees reject it. Proposes revocation of the given PAA (self-signed root certificate) by a Trustee. Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_cert) query. +Revoked certificates can be retrieved by using the [GET_REVOKED_DA_CERT](#get_revoked_da_cert) query. If a Revocation Distribution Point needs to be published (such as RFC5280 Certificate Revocation List), please use [ADD_REVOCATION_DISTRIBUTION_POINT](#add_revocation_distribution_point). @@ -974,7 +978,7 @@ then the certificate will be in a pending state until sufficient number of other Approves the revocation of the given PAA (self-signed root certificate) by a Trustee. Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_cert) query. +Revoked certificates can be retrieved by using the [GET_REVOKED_DA_CERT](#get_revoked_da_cert) query. If a Revocation Distribution Point needs to be published (such as RFC5280 Certificate Revocation List), please use [ADD_REVOCATION_DISTRIBUTION_POINT](#add_revocation_distribution_point). @@ -1148,7 +1152,7 @@ Adds a PAI (intermediate certificate) signed by a chain of certificates which mu Revokes the given PAI (intermediate certificate). Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_cert) query. +Revoked certificates can be retrieved by using the [GET_REVOKED_DA_CERT](#get_revoked_da_cert) query. To entirely remove a PAI certificate, please use [REMOVE_PAI](#remove_pai). If a Revocation Distribution Point needs to be published (such as RFC5280 Certificate Revocation List), please use [ADD_REVOCATION_DISTRIBUTION_POINT](#add_revocation_distribution_point). @@ -1191,6 +1195,107 @@ PAA (self-signed root certificate) can not be removed this way. - Validation: - a PAI Certificate with the provided `subject` and `subject_key_id` must exist in the ledger. +#### GET_DA_CERT + +**Status: Implemented** + +Gets a DA certificate by the given subject and subject key ID attributes. This query works for all types of DA certificates (PAA, PAI). +Revoked certificates are not returned. +Use [GET_REVOKED_DA_CERT](#get_revoked_da_cert) to get a revoked certificate. + +- Parameters: + - subject: `string` - certificates's `Subject` is base64 encoded subject DER sequence bytes + - subject_key_id: `string` - certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` +- CLI command: + - `dcld query pki x509-cert --subject= --subject-key-id=` +- REST API: + - GET `/dcl/pki/certificates/{subject}/{subject_key_id}` + +#### GET_REVOKED_DA_CERT + +**Status: Implemented** + +Gets a revoked DA certificate by the given subject and subject key ID attributes. This query works for all types of DA certificates (PAA, PAI). + +Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. +If a Revocation Distribution Point (such as RFC5280 Certificate Revocation List) published to the ledger needs to be queried, please use [GET_PKI_REVOCATION_DISTRIBUTION_POINT](#get_pki_revocation_distribution_point). + +- Parameters: + - subject: `string` - certificates's `Subject` is base64 encoded subject DER sequence bytes + - subject_key_id: `string` - certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` +- CLI command: + - `dcld query pki revoked-x509-cert --subject= --subject-key-id=` +- REST API: + - GET `/dcl/pki/revoked-certificates/{subject}/{subject_key_id}` + +#### GET_DA_CERTS_BY_SKID + +**Status: Implemented** + +Gets all DA certificates by the given subject key ID attribute. This query works for all types of DA certificates (PAA, PAI). + +Revoked certificates are not returned. +Use [GET_ALL_REVOKED_DA_CERTS](#get_all_revoked_da_cert) to get a revoked certificate. + +- Parameters: + - subject_key_id: `string` - certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` +- CLI command: + - `dcld query pki x509-cert --subject-key-id=` +- REST API: + - GET `/dcl/pki/certificates?subjectKeyId={subjectKeyId}` + +#### GET_DA_CERTS_BY_SUBJECT + +**Status: Implemented** + +Gets all DA certificates associated with a subject. This query works for all types of DA certificates (PAA, PAI). + +Revoked certificates are not returned. +Use [GET_ALL_REVOKED_DA_CERTS](#get_all_revoked_da_certs) to get a list of all revoked certificates. + +- Parameters: + - subject: `string` - certificates's `Subject` is base64 encoded subject DER sequence bytes +- CLI command: + - `dcld query pki all-subject-x509-certs --subject=` +- REST API: + - GET `/dcl/pki/certificates/{subject}` + +#### GET_ALL_DA_CERTS + +**Status: Implemented** + +Gets all DA certificates. This query works for all types of DA certificates (PAA, PAI). + +Revoked certificates are not returned. +Use [GET_ALL_REVOKED_DA_CERTS](#get_all_revoked_da_certs) to get a list of all revoked certificates. + +Should be sent to trusted nodes only. + +- Parameters: + - Common pagination parameters (see [pagination-params](#common-pagination-parameters)) +- CLI command: + - `dcld query pki all-x509-certs` +- REST API: + - GET `/dcl/pki/certificates` + +#### GET_ALL_REVOKED_DA_CERTS + +**Status: Implemented** + +Gets all revoked DA certificates. This query works for all types of DA certificates (PAA, PAI). + +Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. +If a Revocation Distribution Point (such as RFC5280 Certificate Revocation List) published to the ledger needs to be queried, please use [GET_PKI_REVOCATION_DISTRIBUTION_POINT](#get_pki_revocation_distribution_point). + +Should be sent to trusted nodes only. + +- Parameters: + - Common pagination parameters (see [pagination-params](#common-pagination-parameters)) +- CLI command: + - `dcld query pki all-revoked-x509-certs` +- REST API: + - GET `/dcl/pki/revoked-certificates` + #### GET_PKI_REVOCATION_DISTRIBUTION_POINT **Status: Implemented** @@ -1373,10 +1478,12 @@ This transaction adds a NOC root certificate (RCAC) owned by the Vendor. - cert: `string` - The NOC Root Certificate (RCAC), encoded in X.509v3 PEM format. Can be a PEM string or a file path. - schemaVersion: `optional(uint16)` - Certificate's schema version to support backward/forward compatability. Should be equal to 0 (default 0) - In State: - - `pki/ApprovedCertificates/value//` - - `pki/ApprovedCertificatesBySubject/value/` - - `pki/ApprovedCertificatesBySubjectKeyID/value/` + - `pki/AllCertificates/value//` + - `pki/NocCertificates/value//` - `pki/NocRootCertificates/value/` + - `pki/NocCertificatesBySubject/value/` + - `pki/NocCertificatesBySubjectKeyId/value/` + - `pki/NocCertificatesByVidAndSkid/value//` - CLI Command: - `dcld tx pki add-noc-x509-root-cert --certificate= --from=` - Validation: @@ -1394,10 +1501,10 @@ This transaction adds a NOC root certificate (RCAC) owned by the Vendor. **Status: Implemented** This transaction revokes a NOC root certificate (RCAC) owned by the Vendor. -Revoked NOC root certificates (RCACs) can be re-added using the [ADD_NOC_ROOT](#add_noc_root-(rcac)) transaction. +Revoked NOC root certificates (RCACs) can be re-added using the [ADD_NOC_ROOT](#add_noc_root-rcac) transaction. Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_cert) query. +Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_noc_root-rcac) query. - Who can send: Vendor account - Vid field associated with the corresponding NOC root certificate (RCAC) on the ledger must be equal to the Vendor account's VID. @@ -1409,7 +1516,6 @@ Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revok - info: `optional(string)` - information/notes for the revocation. Can contain up to 4096 characters. - time: `optional(int64)` - revocation time (number of nanoseconds elapsed since January 1, 1970 UTC). This field cannot be specified using a CLI command and will use the current time by default. - In State: - - `pki/RevokedCertificates/value//` - `pki/RevokedNocRootCertificates/value//` - CLI command: - `dcld tx pki revoke-noc-x509-root-cert --subject= --subject-key-id= --serial-number= --info= --time= --revoke-child= --from=` @@ -1421,7 +1527,7 @@ Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revok **Status: Implemented** This transaction completely removes the given NOC root certificate (RCAC) owned by the Vendor from the ledger. -Removed NOC root certificates (RCACs) can be re-added using the [ADD_NOC_ROOT](#add_noc_root-(rcac)) transaction. +Removed NOC root certificates (RCACs) can be re-added using the [ADD_NOC_ROOT](#add_noc_root-rcac) transaction. - Who can send: Vendor account - Vid field associated with the corresponding NOC certificate on the ledger must be equal to the Vendor account's VID. @@ -1434,8 +1540,6 @@ Removed NOC root certificates (RCACs) can be re-added using the [ADD_NOC_ROOT](# - CLI command: - `dcld tx pki remove-noc-x509-root-cert --subject= --subject-key-id= --from=` - - #### ADD_NOC_ICA (ICAC) **Status: Implemented** @@ -1460,10 +1564,12 @@ already present on the ledger. - cert: `string` - The NOC non-root Certificate, encoded in X.509v3 PEM format. Can be a PEM string or a file path. - certificate-schema-version: `optional(uint16)` - Certificate's schema version to support backward/forward compatability(default 0) - In State: - - `pki/ApprovedCertificates/value//` - - `pki/ApprovedCertificatesBySubject/value/` - - `pki/ApprovedCertificatesBySubjectKeyID/value/` + - `pki/AllCertificates/value//` + - `pki/NocCertificates/value//` - `pki/NocIcaCertificates/value/` + - `pki/NocCertificatesBySubject/value/` + - `pki/NocCertificatesBySubjectKeyID/value/` + - `pki/NocCertificatesByVidAndSkid/value//` - `pki/ChildCertificates/value//` - CLI Command: - `dcld tx pki add-noc-x509-ica-cert --certificate= --from=` @@ -1473,10 +1579,10 @@ already present on the ledger. **Status: Implemented** This transaction revokes a NOC ICA certificate (ICAC) owned by the Vendor. -Revoked NOC ICA certificates (ICACs) can be re-added using the [ADD_NOC_ICA](#add_noc_ica-(icac)) transaction. +Revoked NOC ICA certificates (ICACs) can be re-added using the [ADD_NOC_ICA](#add_noc_ica-icac) transaction. Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_cert) query. +Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revoked_noc_ica-icac) query. - Who can send: Vendor account - Vid field associated with the corresponding NOC certificate on the ledger must be equal to the Vendor account's VID. @@ -1499,7 +1605,7 @@ Revoked certificates can be retrieved by using the [GET_REVOKED_CERT](#get_revok **Status: Implemented** This transaction completely removes the given NOC ICA (ICAC) owned by the Vendor from the ledger. -Removed NOC ICA certificates (ICACs) can be re-added using the [ADD_NOC_ICA](#add_noc_ica-(icac)) transaction. +Removed NOC ICA certificates (ICACs) can be re-added using the [ADD_NOC_ICA](#add_noc_ica-icac) transaction. - Who can send: Vendor account - Vid field associated with the corresponding NOC certificate on the ledger must be equal to the Vendor account's VID. @@ -1512,6 +1618,22 @@ Removed NOC ICA certificates (ICACs) can be re-added using the [ADD_NOC_ICA](#ad - CLI command: - `dcld tx pki remove-noc-x509-ica-cert --subject= --subject-key-id= --from=` +#### GET_NOC_CERT + +**Status: Implemented** + +Gets a NOC certificate by the given subject and subject key ID attributes. This query works for all types of Noc certificates (NOC_ROOT, NOC_ICA). +Revoked certificates are not returned. +Use [GET_REVOKED_ROOT_ICA](#get_revoked_noc_root-rcac) to get a revoked root certificate. +Use [GET_REVOKED_NOC_ICA](#get_revoked_noc_ica-icac) to get a revoked ica certificate. + +- Parameters: + - subject: `string` - certificate's `Subject` is base64 encoded subject DER sequence bytes + - subject_key_id: `string` - certificate's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` +- CLI command: + - `dcld query pki noc-x509-cert --subject= --subject-key-id=` +- REST API: + - GET `/dcl/pki/all-noc-certificates/{subject}/{subject_key_id}` #### GET_NOC_ROOT_BY_VID (RCACs) @@ -1520,7 +1642,7 @@ Removed NOC ICA certificates (ICACs) can be re-added using the [ADD_NOC_ICA](#ad Retrieve NOC root certificates (RCACs) associated with a specific VID. Revoked NOC root certificates (RCACs) are not returned. -Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-(rcacs)) to get a list of all revoked NOC root certificates (RCACs). +Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-rcacs) to get a list of all revoked NOC root certificates (RCACs). - Who can send: Any account - Parameters: @@ -1528,7 +1650,7 @@ Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-(rcacs)) to get a list - CLI Command: - `dcld query pki noc-x509-root-certs --vid=` - REST API: - - GET `/dcl/pki/noc-root-certificates/{vid}` + - GET `/dcl/pki/noc-vid-root-certificates/{vid}` #### GET_NOC_BY_VID_AND_SKID (RCACs/ICACs) @@ -1538,8 +1660,8 @@ Retrieve NOC (Root/ICA) certificates (RCACs/ICACs) associated with a specific VI This request also returns the Trust Quotient (TQ) value of the certificate Revoked NOC certificates are not returned. -Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-(rcacs)) to get a list of all revoked NOC root certificates. -Use [GET_ALL_REVOKED_CERT](#get_all_revoked_certs) to get a list of all revoked certificates (including ICACs). +Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-rcacs) to get a list of all revoked NOC root certificates. +Use [GET_ALL_REVOKED_NOC_ICA](#get_all_revoked_noc_ica-icacs) to get a list of all revoked NOC ica certificates. - Who can send: Any account - Parameters: @@ -1548,7 +1670,7 @@ Use [GET_ALL_REVOKED_CERT](#get_all_revoked_certs) to get a list of all revoked - CLI Command: - `dcld query pki noc-x509-certs --vid= --subject-key-id=` - REST API: - - GET `/dcl/pki/noc-certificates/{vid}/{subject_key_id}` + - GET `/dcl/pki/noc-vid-certificates/{vid}/{subject_key_id}` #### GET_NOC_ICA_BY_VID (ICACs) @@ -1565,7 +1687,24 @@ Use [GET_ALL_REVOKED_CERT](#get_all_revoked_certs) to get a list of all revoked - CLI Command: - `dcld query pki noc-x509-ica-certs --vid=` - REST API: - - GET `/dcl/pki/noc-ica-certificates/{vid}` + - GET `/dcl/pki/noc-vid-ica-certificates/{vid}` + +#### GET_NOC_CERTS_BY_SUBJECT + +**Status: Implemented** + +Gets all NOC certificates associated with a subject. This query works for both types of certificates (NOC_ROOT, NOC_ICA). + +Revoked certificates are not returned. +Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-rcacs) to get a list of all revoked NOC root certificates. +Use [GET_ALL_REVOKED_NOC_ICA](#get_all_revoked_noc_ica-icacs) to get a list of all revoked NOC ica certificates. + +- Parameters: + - subject: `string` - certificate's `Subject` is base64 encoded subject DER sequence bytes +- CLI command: + - `dcld query pki all-noc-subject-x509-certs --subject=` +- REST API: + - GET `/dcl/pki/all-noc-certificates/{subject}` #### GET_REVOKED_NOC_ROOT (RCAC) @@ -1583,6 +1722,40 @@ Revocation works as a soft-delete, meaning that the certificates are not entirel - REST API: - GET `/dcl/pki/revoked-noc-root-certificates/{subject}/{subject_key_id}` +#### GET_REVOKED_NOC_ICA (ICAC) + +**Status: Implemented** + +Gets a revoked NOC ica certificate (ICAC) by the given subject and subject key ID attributes. + +Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. + +- Parameters: + - subject: `string` - Base64 encoded subject DER sequence bytes of the certificate. + - subject_key_id: `string` - Certificate's `Subject Key Id` in hex string format, e.g., `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB`. +- CLI command: + - `dcld query pki revoked-noc-x509-ica-cert --subject= --subject-key-id=` +- REST API: + - GET `/dcl/pki/revoked-noc-ica-certificates/{subject}/{subject_key_id}` + +#### GET_ALL_NOC (RCACs/ICACs) + +**Status: Implemented** + +Retrieve a list of all of NOC certificates (RCACs of ICACs). + +Revoked NOC certificates (RCACs and ICACs) are not returned. +Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_ica-icacs) to get a list of all revoked NOC root certificates (RCACs). +Use [GET_ALL_REVOKED_NOC_ICA](#get_all_revoked_noc_ica-icacs) to get a list of all revoked NOC ica certificates (ICACs). + +- Who can send: Any account +- Parameters: + - Common pagination parameters +- CLI Command: + - `dcld query pki all-noc-x509-certs` +- REST API: + - GET `/dcl/pki/noc-certificates` + #### GET_ALL_NOC_ROOT (RCACs) **Status: Implemented** @@ -1590,7 +1763,7 @@ Revocation works as a soft-delete, meaning that the certificates are not entirel Retrieve a list of all of NOC root certificates (RCACs). Revoked NOC root certificates (RCACs) are not returned. -Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-(rcacs)) to get a list of all revoked NOC root certificates (RCACs). +Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-rcacs) to get a list of all revoked NOC root certificates (RCACs). - Who can send: Any account - Parameters: @@ -1607,7 +1780,7 @@ Use [GET_ALL_REVOKED_NOC_ROOT](#get_all_revoked_noc_root-(rcacs)) to get a list Retrieve a list of all of NOC ICA certificates (ICACs). Revoked certificates are not returned. -Use [GET_ALL_REVOKED_CERT](#get_all_revoked_certs) to get a list of all revoked certificates. +Use [GET_ALL_REVOKED_NOC_ICA](#get_all_revoked_noc_ica-icacs) to get a list of all revoked certificates. - Who can send: Any account - Parameters: @@ -1631,72 +1804,77 @@ Revocation works as a soft-delete, meaning that the certificates are not entirel - REST API: - GET `/dcl/pki/revoked-noc-root-certificates` -### Common +#### GET_ALL_REVOKED_NOC_ICA (ICACs) -#### GET_CERT +Gets all revoked NOC ica certificates (ICACs). -**Status: Implemented** - -Gets a certificate by the given subject and subject key ID attributes. This query works for all types of certificates (PAA, PAI, NOC_ROOT, NOC_ICA). -Revoked certificates are not returned. -Use [GET_REVOKED_CERT](#get_revoked_cert) to get a revoked certificate. +Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. +- Who can send: Any account - Parameters: - - subject: `string` - certificates's `Subject` is base64 encoded subject DER sequence bytes - - subject_key_id: `string` - certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` + - Common pagination parameters - CLI command: - - `dcld query pki x509-cert --subject= --subject-key-id=` + - `dcld query pki all-revoked-noc-x509-ica-certs` - REST API: - - GET `/dcl/pki/certificates/{subject}/{subject_key_id}` + - GET `/dcl/pki/revoked-noc-ica-certificates` -#### GET_REVOKED_CERT +### All Certificates (DA, NOC) -**Status: Implemented** +#### GET_CERT -Gets a revoked certificate by the given subject and subject key ID attributes. This query works for all types of certificates (PAA, PAI, NOC_ROOT, NOC_ICA). +**Status: Implemented** -Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -If a Revocation Distribution Point (such as RFC5280 Certificate Revocation List) published to the ledger needs to be queried, please use [GET_PKI_REVOCATION_DISTRIBUTION_POINT](#get_pki_revocation_distribution_point). +Gets a certificate by the given subject and subject key ID attributes. This query works for all types of certificates (PAA, PAI, RCAC, ICAC). +Revoked certificates are not returned. +Use [GET_REVOKED_DA_CERT](#get_revoked_da_cert) to get a revoked DA certificate. +Use [GET_REVOKED_NOC_ROOT_CERT](#get_revoked_noc_root-rcac) to get a revoked Noc Root certificate. +Use [GET_REVOKED_NOC_ICA_CERT](#get_revoked_noc_ica-icac) to get a revoked Noc ICA certificate. - Parameters: - subject: `string` - certificates's `Subject` is base64 encoded subject DER sequence bytes - subject_key_id: `string` - certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` - CLI command: - - `dcld query pki revoked-x509-cert --subject= --subject-key-id=` + - `dcld query pki cert --subject= --subject-key-id=` - REST API: - - GET `/dcl/pki/revoked-certificates/{subject}/{subject_key_id}` + - GET `/dcl/pki/all-certificates/{subject}/{subject_key_id}` -#### GET_CERTS_BY_SKID +#### GET_ALL_CERTS **Status: Implemented** -Gets all certificates by the given subject key ID attribute. This query works for all types of certificates (PAA, PAI, NOC_ROOT, NOC_ICA). +Gets all certificates. This query works for all types of certificates (PAA, PAI, RCAC, ICAC). Revoked certificates are not returned. -Use `GET_ALL_REVOKED_CERTS` to get a list of all revoked certificates. +Use [GET_ALL_REVOKED_DA_CERTS](#get_all_revoked_da_certs) to get a list of all revoked DA certificates. +Use [GET_ALL_REVOKED_NOC_ROOT_CERTS](#get_all_revoked_noc_root-rcacs) to get a list of all revoked Noc Root certificates. +Use [GET_ALL_REVOKED_NOC_ICA_CERTS](#get_all_revoked_noc_ica-icacs) to get a list of all revoked Noc ICA certificates. + +Should be sent to trusted nodes only. - Parameters: - - subject_key_id: `string` - certificates's `Subject Key Id` in hex string format, e.g: `5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB` + - Common pagination parameters (see [pagination-params](#common-pagination-parameters)) - CLI command: - - `dcld query pki x509-cert --subject-key-id=` + - `dcld query pki all-certs` - REST API: - - GET `/dcl/pki/certificates?subjectKeyId={subjectKeyId}` + - GET `/dcl/pki/all-certificates` #### GET_CERTS_BY_SUBJECT **Status: Implemented** -Gets all certificates associated with a subject. This query works for all types of certificates (PAA, PAI, NOC_ROOT, NOC_ICA). +Gets all certificates associated with a subject. This query works for all types of certificates (PAA, PAI, RCAC, ICAC). Revoked certificates are not returned. -Use [GET_ALL_REVOKED_CERTS](#get_all_revoked_certs) to get a list of all revoked certificates. +Use [GET_ALL_REVOKED_DA_CERTS](#get_all_revoked_da_certs) to get a list of all revoked DA certificates. +Use [GET_ALL_REVOKED_NOC_ROOT_CERTS](#get_all_revoked_noc_root-rcacs) to get a list of all revoked Noc Root certificates. +Use [GET_ALL_REVOKED_NOC_ICA_CERTS](#get_all_revoked_noc_ica-icacs) to get a list of all revoked Noc ICA certificates. - Parameters: - subject: `string` - certificates's `Subject` is base64 encoded subject DER sequence bytes - CLI command: - - `dcld query pki all-subject-x509-certs --subject=` + - `dcld query pki all-subject-certs --subject=` - REST API: - - GET `/dcl/pki/certificates/{subject}` + - GET `/dcl/pki/all-certificates/{subject}` #### GET_CHILD_CERTS @@ -1713,42 +1891,6 @@ Revoked certificates are not returned. - REST API: - GET `/dcl/pki/child-certificates/{subject}/{subject_key_id}` -#### GET_ALL_CERTS - -**Status: Implemented** - -Gets all certificates. This query works for all types of certificates (PAA, PAI, NOC_ROOT, NOC_ICA). - -Revoked certificates are not returned. -Use [GET_ALL_REVOKED_CERTS](#get_all_revoked_certs) to get a list of all revoked certificates. - -Should be sent to trusted nodes only. - -- Parameters: - - Common pagination parameters (see [pagination-params](#common-pagination-parameters)) -- CLI command: - - `dcld query pki all-x509-certs` -- REST API: - - GET `/dcl/pki/certificates` - -#### GET_ALL_REVOKED_CERTS - -**Status: Implemented** - -Gets all revoked certificates. This query works for all types of certificates (PAA, PAI, NOC_ROOT, NOC_ICA). - -Revocation works as a soft-delete, meaning that the certificates are not entirely removed but moved from the approved list to the revoked list. -If a Revocation Distribution Point (such as RFC5280 Certificate Revocation List) published to the ledger needs to be queried, please use [GET_PKI_REVOCATION_DISTRIBUTION_POINT](#get_pki_revocation_distribution_point). - -Should be sent to trusted nodes only. - -- Parameters: - - Common pagination parameters (see [pagination-params](#common-pagination-parameters)) -- CLI command: - - `dcld query pki all-revoked-x509-certs` -- REST API: - - GET `/dcl/pki/revoked-certificates` - ## AUTH ### PROPOSE_ADD_ACCOUNT diff --git a/go.mod b/go.mod index 67be9cc33..817c06e4d 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.14.0 github.com/stretchr/testify v1.8.4 + golang.org/x/tools v0.6.0 google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 google.golang.org/grpc v1.60.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 @@ -206,7 +207,6 @@ require ( golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.6.0 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect diff --git a/integration_tests/cli/pki-add-vendor-x509-certificates.sh b/integration_tests/cli/pki-add-vendor-x509-certificates.sh index 00c08a70b..4400d027e 100755 --- a/integration_tests/cli/pki-add-vendor-x509-certificates.sh +++ b/integration_tests/cli/pki-add-vendor-x509-certificates.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh diff --git a/integration_tests/cli/pki-assign-vid.sh b/integration_tests/cli/pki-assign-vid.sh index e765c95c6..06d909679 100755 --- a/integration_tests/cli/pki-assign-vid.sh +++ b/integration_tests/cli/pki-assign-vid.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh diff --git a/integration_tests/cli/pki-combine-certs.sh b/integration_tests/cli/pki-combine-certs.sh new file mode 100755 index 000000000..23fa96e5a --- /dev/null +++ b/integration_tests/cli/pki-combine-certs.sh @@ -0,0 +1,388 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +source integration_tests/cli/common.sh + +# DA +da_root_path="integration_tests/constants/root_cert" +da_root_subject="MDQxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApzb21lLXN0YXRlMRAwDgYDVQQKDAdyb290LWNh" +da_root_subject_key_id="5A:88:0E:6C:36:53:D0:7F:B0:89:71:A3:F4:73:79:09:30:E6:2B:DB" + +da_intermediate_path="integration_tests/constants/intermediate_cert" +da_intermediate_subject="MDwxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApzb21lLXN0YXRlMRgwFgYDVQQKDA9pbnRlcm1lZGlhdGUtY2E=" +da_intermediate_subject_key_id="4E:3B:73:F4:70:4D:C2:98:0D:DB:C8:5A:5F:02:3B:BF:86:25:56:2B" + +da_leaf_path="integration_tests/constants/leaf_cert" +da_leaf_subject="MDExCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApzb21lLXN0YXRlMQ0wCwYDVQQKDARsZWFm" +da_leaf_subject_key_id="30:F4:65:75:14:20:B2:AF:3D:14:71:17:AC:49:90:93:3E:24:A0:1F" + +# NOC +noc_root_path="integration_tests/constants/noc_root_cert_1" +noc_root_subject="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ==" +noc_root_subject_key_id="44:EB:4C:62:6B:25:48:CD:A2:B3:1C:87:41:5A:08:E7:2B:B9:83:26" + +noc_intermediate_path="integration_tests/constants/noc_cert_1" +noc_intermediate_subject="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMQ==" +noc_intermediate_subject_key_id="02:72:6E:BC:BB:EF:D6:BD:8D:9B:42:AE:D4:3C:C0:55:5F:66:3A:B3" + +noc_leaf_path="integration_tests/constants/noc_leaf_cert_1" +noc_leaf_subject="MIGBMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRMwEQYDVQQDDApOT0MtbGVhZi0x" +noc_leaf_subject_key_id="77:1F:DB:C4:4C:B1:29:7E:3C:EB:3E:D8:2A:38:0B:63:06:07:00:01" + +# Accounts +trustee_account="jack" +second_trustee_account="alice" + +vid_in_hex_format=0x6006 +vid=24582 + +vendor_account=vendor_account_$vid_in_hex_format +echo "Create Vendor account - $vendor_account" +create_new_vendor_account $vendor_account $vid_in_hex_format + +vid_2_in_hex_format=0x125D +vid_2=4701 + +test_divider + +# Body + +echo "1. QUERY Certificates (EMPTY)" + +test_divider + +echo "Request all approved DA certificates must be empty" +result=$(dcld query pki all-x509-certs) +echo $result | jq +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request all NOC certificates must be empty" +result=$(dcld query pki all-noc-x509-certs) +echo $result | jq +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +test_divider + +echo "Request approved DA certificate must be empty" +result=$(dcld query pki x509-cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request NOC Root certificate must be empty" +result=$(dcld query pki noc-x509-cert --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +test_divider + +echo "Request proposed DA Root certificate must be empty" +result=$(dcld query pki proposed-x509-root-cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request all proposed DA Root certificates must be empty" +result=$(dcld query pki all-proposed-x509-root-certs) +check_response "$result" "\[\]" +echo $result | jq +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +test_divider + +echo "Request all revoked DA certificates must be empty" +result=$(dcld query pki all-revoked-x509-certs) +echo $result | jq +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request all revoked NOC Root certificates must be empty" +result=$(dcld query pki all-revoked-noc-x509-root-certs) +echo $result | jq +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +echo "Request all revoked NOC ICA certificates must be empty" +result=$(dcld query pki all-revoked-noc-x509-ica-certs) +echo $result | jq +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" + +echo "Request revoked DA certificate must be empty" +result=$(dcld query pki revoked-x509-cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request revoked NOC Root certificate must be empty" +result=$(dcld query pki revoked-noc-x509-root-cert --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +echo "Request revoked NOC ICA certificate must be empty" +result=$(dcld query pki revoked-noc-x509-ica-cert --subject="$noc_intermediate_subject" --subject-key-id="$noc_intermediate_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" + +test_divider + +echo "Request all DA certificates by subject must be empty" +result=$(dcld query pki all-subject-x509-certs --subject="$da_root_subject") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"$da_root_subject\"" + +echo "Request all NOC certificates by subject must be empty" +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_subject") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"$noc_root_subject\"" + +test_divider + +echo "Request all child certificates for DA root must be empty" +result=$(dcld query pki all-child-x509-certs --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"$da_root_subject_key_id\"" + +echo "Request all child certificates for NOC root must be empty" +result=$(dcld query pki all-child-x509-certs --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"$noc_root_subject_key_id\"" + +test_divider + +echo "2. ADD Certificates" + +test_divider + +echo "$trustee_account (Trustee) propose DA Root certificate" +cert_schema_version_0=0 +result=$(echo "$passphrase" | dcld tx pki propose-add-x509-root-cert --certificate="$da_root_path" --schemaVersion=$cert_schema_version_0 --from $trustee_account --vid $vid --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$second_trustee_account (Second Trustee) approves DA Root certificate" +result=$(echo "$passphrase" | dcld tx pki approve-add-x509-root-cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id" --from $second_trustee_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$vendor_account adds DA Intermediate certificate" +result=$(echo "$passphrase" | dcld tx pki add-x509-cert --certificate="$da_intermediate_path" --schemaVersion=$cert_schema_version_0 --from $vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$vendor_account add DA Leaf certificate" +result=$(echo "$passphrase" | dcld tx pki add-x509-cert --certificate="$da_leaf_path" --from $vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$vendor_account add NOC Root certificate" +cert_schema_version_0=0 +result=$(echo "$passphrase" | dcld tx pki add-noc-x509-root-cert --certificate="$noc_root_path" --schemaVersion=$cert_schema_version_0 --from $vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$vendor_account adds NOC Intermediate certificate" +result=$(echo "$passphrase" | dcld tx pki add-noc-x509-ica-cert --certificate="$noc_intermediate_path" --from $vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$vendor_account adds NOC Leaf certificate" +result=$(echo "$passphrase" | dcld tx pki add-noc-x509-ica-cert --certificate="$noc_leaf_path" --from $vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "3. QUERY Certificates (PRESENT)" + +test_divider + +echo "Request all certificates" +result=$(dcld query pki all-certs) +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$da_leaf_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$noc_leaf_subject_key_id\"" + +echo "Request all approved DA certificates" +result=$(dcld query pki all-x509-certs) +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$da_leaf_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_leaf_subject_key_id\"" + +echo "Request all NOC certificates" +result=$(dcld query pki all-noc-x509-certs) +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" +check_response "$result" "\"subjectKeyId\": \"$noc_leaf_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_leaf_subject_key_id\"" + +test_divider + +echo "Request DA certificate using global command" +result=$(dcld query pki cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request NOC certificate using global command" +result=$(dcld query pki cert --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +echo "Request DA certificate" +result=$(dcld query pki x509-cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +echo "Request NOC certificate using DA command (must be empty)" +result=$(dcld query pki x509-cert --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +echo "Request NOC Root certificate" +result=$(dcld query pki noc-x509-cert --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$noc_root_subject_key_id\"" + +echo "Request DA certificate using NOC command (must be empty)" +result=$(dcld query pki noc-x509-cert --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_subject_key_id\"" + +test_divider + +echo "Request DA certificates by subject using global command" +result=$(dcld query pki all-subject-certs --subject=$da_root_subject) +echo $result | jq +check_response "$result" "\"$da_root_subject\"" +check_response "$result" "\"$da_root_subject_key_id\"" + +echo "Request NOC certificates by subject using global command" +result=$(dcld query pki all-subject-certs --subject=$noc_root_subject) +echo $result | jq +check_response "$result" "\"$noc_root_subject\"" +check_response "$result" "\"$noc_root_subject_key_id\"" + +echo "Request all DA certificates by subject must be empty" +result=$(dcld query pki all-subject-x509-certs --subject="$da_root_subject") +echo $result | jq +check_response "$result" "\"$da_root_subject\"" + +echo "Request all NOC certificates by subject using DA command (must be empty)" +result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_subject") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"$noc_root_subject\"" + +echo "Request all NOC certificates by subject" +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_subject") +echo $result | jq +check_response "$result" "\"$noc_root_subject\"" + +echo "Request all DA certificates by subject using NOC command (must be empty)" +result=$(dcld query pki all-noc-subject-x509-certs --subject="$da_root_subject") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"$da_root_subject\"" + +test_divider + +echo "Request all child certificates for DA root" +result=$(dcld query pki all-child-x509-certs --subject="$da_root_subject" --subject-key-id="$da_root_subject_key_id") +echo $result | jq +check_response "$result" "\"$da_root_subject\"" +check_response "$result" "\"$da_root_subject_key_id\"" + +echo "Request all child certificates for NOC root" +result=$(dcld query pki all-child-x509-certs --subject="$noc_root_subject" --subject-key-id="$noc_root_subject_key_id") +echo $result | jq +check_response "$result" "\"$noc_root_subject\"" +check_response "$result" "\"$noc_root_subject_key_id\"" + +test_divider + +echo "4. Revoke Certificates" + +test_divider + +echo "$vendor_account revoke an intermediate DA certificate" +result=$(echo "$passphrase" | dcld tx pki revoke-x509-cert --subject="$da_intermediate_subject" --subject-key-id="$da_intermediate_subject_key_id" --from=$vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "$vendor_account revoke an intermediate NOC certificate" +result=$(echo "$passphrase" | dcld tx pki revoke-noc-x509-ica-cert --subject="$noc_intermediate_subject" --subject-key-id="$noc_intermediate_subject_key_id" --from=$vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Request all revoked DA certificates" +result=$(dcld query pki all-revoked-x509-certs) +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" + +echo "Request all revoked NOC ICA certificates must be empty" +result=$(dcld query pki all-revoked-noc-x509-ica-certs) +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" + +echo "Request revoked DA certificate " +result=$(dcld query pki revoked-x509-cert --subject="$da_intermediate_subject" --subject-key-id="$da_intermediate_subject_key_id") +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" + +echo "Request revoked NOC certificate using DA command (must be empty)" +result=$(dcld query pki revoked-x509-cert --subject="$noc_intermediate_subject" --subject-key-id="$noc_intermediate_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" + +echo "Request revoked NOC ICA certificate" +result=$(dcld query pki revoked-noc-x509-ica-cert --subject="$noc_intermediate_subject" --subject-key-id="$noc_intermediate_subject_key_id") +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$noc_intermediate_subject_key_id\"" + +echo "Request revoked DA certificate using NOC command (must be empty)" +result=$(dcld query pki revoked-noc-x509-ica-cert --subject="$da_intermediate_subject" --subject-key-id="$da_intermediate_subject_key_id") +echo $result | jq +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_intermediate_subject_key_id\"" + +test_divider + +echo "PASS" \ No newline at end of file diff --git a/integration_tests/cli/pki-noc-certs.sh b/integration_tests/cli/pki-noc-certs.sh index 35a9be1ba..c929e27f7 100755 --- a/integration_tests/cli/pki-noc-certs.sh +++ b/integration_tests/cli/pki-noc-certs.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh @@ -116,7 +131,7 @@ echo $result | jq test_divider echo "Request approved certificate must be empty" -result=$(dcld query pki x509-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -127,7 +142,7 @@ echo $result | jq test_divider echo "Request all certificates by subject must be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_cert_1_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_cert_1_subject") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -136,7 +151,7 @@ echo $result | jq test_divider echo "Request all certificates by subjectKeyId must be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -235,8 +250,17 @@ check_response "$result" "\"vid\": $vid_2" test_divider -echo "Request NOC root certificate by Subject and SubjectKeyID" -result=$(dcld query pki x509-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") +echo "Request NOC root certificate by Subject and SubjectKeyID (using noc-x509-cert command)" +result=$(dcld query pki noc-x509-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") +echo $result | jq +check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +check_response "$result" "\"subjectAsText\": \"$noc_root_cert_1_subject_as_text\"" +check_response "$result" "\"approvals\": \\[\\]" + +echo "Request NOC root certificate by Subject and SubjectKeyID (using cert command)" +result=$(dcld query pki cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") echo $result | jq check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -246,8 +270,8 @@ check_response "$result" "\"approvals\": \\[\\]" test_divider -echo "Request NOC root certificate by Subject" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_cert_1_subject") +echo "Request NOC root certificate by Subject " +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_cert_1_subject") echo $result | jq check_response "$result" "\"$noc_root_cert_1_subject\"" check_response "$result" "\"$noc_root_cert_1_subject_key_id\"" @@ -255,7 +279,7 @@ check_response "$result" "\"$noc_root_cert_1_subject_key_id\"" test_divider echo "Request NOC root certificate by SubjectKeyID" -result=$(dcld query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") echo $result | jq check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -315,9 +339,18 @@ check_response "$result" "\"schemaVersion\": $cert_schema_version_0" check_response "$result" "\"schemaVersion\": $cert_schema_version_0" check_response "$result" "\"schemaVersion\": $schema_version_0" - -echo "Request all approved certificates" +echo "Request all approved certificates (Must be empty)" result=$(dcld query pki all-x509-certs) +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +response_does_not_contain "$result" "\"subject\": \"$noc_cert_1_subject\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" + +echo "Request all Noc certificates" +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" @@ -367,17 +400,6 @@ result=$(echo "$passphrase" | dcld tx pki revoke-noc-x509-root-cert --subject="$ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" -echo "Request all revoked certificates should contain two root certificates only" -result=$(dcld query pki all-revoked-x509-certs) -echo $result | jq -check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" -check_response "$result" "\"schemaVersion\": $schema_version_0" -response_does_not_contain "$result" "\"subject\": \"$noc_cert_1_subject\"" -response_does_not_contain "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" - echo "Request all revoked noc root certificates should contain two root certificates" result=$(dcld query pki all-revoked-noc-x509-root-certs) echo $result | jq @@ -438,13 +460,13 @@ check_response "$result" "\"tq\": 1" echo $result | jq echo "Request all certificates by subject must be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_cert_1_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_cert_1_subject") response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" echo $result | jq echo "Request all certificates by subjectKeyId must be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -463,8 +485,8 @@ check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_cert_1_copy_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_leaf_cert_1_serial_number\"" -echo "Request all approved certificates should not contain revoked NOC root certificates" -result=$(dcld query pki all-x509-certs) +echo "Request all noc certificates should not contain revoked NOC root certificates" +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" @@ -493,12 +515,8 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all revoked certificates should not contain leaf certificate" -result=$(dcld query pki all-revoked-x509-certs) +result=$(dcld query pki all-revoked-noc-x509-ica-certs) echo $result | jq -check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number" @@ -514,13 +532,13 @@ response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_leaf_cert_1_subject_key_id\"" echo "Request all certificates by subject must be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_cert_1_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_cert_1_subject") response_does_not_contain "$result" "\"subject\": \"$noc_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" echo $result | jq echo "Request all certificates by subjectKeyId must be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_cert_1_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" @@ -548,7 +566,7 @@ check_response "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_leaf_cert_1_subject_key_id\"" echo "Request all approved certificates should not contain revoked NOC certificates" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_leaf_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_leaf_cert_1_serial_number\"" @@ -560,3 +578,7 @@ response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subjec response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" echo $result | jq + +test_divider + +echo "PASS" \ No newline at end of file diff --git a/integration_tests/cli/pki-noc-revocation-with-revoking-child.sh b/integration_tests/cli/pki-noc-revocation-with-revoking-child.sh index 0dee1607e..87ee93182 100755 --- a/integration_tests/cli/pki-noc-revocation-with-revoking-child.sh +++ b/integration_tests/cli/pki-noc-revocation-with-revoking-child.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh @@ -87,28 +102,24 @@ result=$(echo "$passphrase" | dcld tx pki revoke-noc-x509-root-cert --subject="$ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" -echo "Request all revoked certificates should contain two root, one intermediate and one leaf certificates" -result=$(dcld query pki all-revoked-x509-certs) +echo "Request all revoked NOC root certificates should contain two root certificates" +result=$(dcld query pki all-revoked-noc-x509-root-certs) echo $result | jq check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" + +echo "Request all revoked NOC ica certificates should contain one intermediate and one leaf certificates" +result=$(dcld query pki all-revoked-noc-x509-ica-certs) +echo $result | jq check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" check_response "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" check_response "$result" "\"subjectKeyId\": \"$noc_leaf_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_leaf_cert_1_serial_number\"" -echo "Request all revoked NOC root certificates should contain two root certificates" -result=$(dcld query pki all-revoked-noc-x509-root-certs) -echo $result | jq -check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" - echo "Request revoked NOC root certificate by subject and subjectKeyId should contain two root certificates" result=$(dcld query pki revoked-noc-x509-root-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") echo $result | jq @@ -135,14 +146,14 @@ response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_s echo $result | jq echo "Request all certificates by NOC root certificate's subject should be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_cert_1_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_cert_1_subject") check_response "$result" "Not Found" response_does_not_contain "$result" "\"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"$noc_root_cert_1_subject_key_id\"" echo $result | jq echo "Request all certificates by NOC root certificate's subjectKeyId should be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -228,7 +239,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all revoked certificates should two intermediate and one leaf certificates" -result=$(dcld query pki all-revoked-x509-certs) +result=$(dcld query pki all-revoked-noc-x509-ica-certs) echo $result | jq check_response "$result" "\"subject\": \"$noc_cert_2_subject\"" check_response "$result" "\"subject\": \"$noc_leaf_cert_2_subject\"" @@ -242,14 +253,14 @@ response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subjec response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_2_serial_number\"" echo "Request all certificates by NOC certificate's subject should be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_cert_2_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_cert_2_subject") check_response "$result" "Not Found" response_does_not_contain "$result" "\"$noc_cert_1_subject\"" response_does_not_contain "$result" "\"$noc_cert_1_subject_key_id\"" echo $result | jq echo "Request all certificates by NOC certificate's subjectKeyId should be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_cert_2_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_cert_2_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_cert_2_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" @@ -265,8 +276,8 @@ response_does_not_contain "$result" "\"subject\": \"$noc_leaf_cert_2_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_leaf_cert_2_subject_key_id\"" -echo "Request all approved certificates should not contain intermediate and leaf certificates" -result=$(dcld query pki all-x509-certs) +echo "Request all noc certificates should not contain intermediate and leaf certificates" +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_root_cert_2_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_2_serial_number\"" diff --git a/integration_tests/cli/pki-noc-revocation-with-serial-number.sh b/integration_tests/cli/pki-noc-revocation-with-serial-number.sh index ae4c43f8b..f9d1983f0 100755 --- a/integration_tests/cli/pki-noc-revocation-with-serial-number.sh +++ b/integration_tests/cli/pki-noc-revocation-with-serial-number.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh @@ -100,16 +115,6 @@ result=$(echo "$passphrase" | dcld tx pki revoke-noc-x509-root-cert --subject="$ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" -echo "Request all revoked certificates should contain root certificate with serialNumber=$noc_root_cert_1_serial_number" -result=$(dcld query pki all-revoked-x509-certs) -echo $result | jq -check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" -response_does_not_contain "$result" "\"subject\": \"$noc_cert_1_subject\"" -response_does_not_contain "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" - echo "Request all revoked NOC root certificates should contain root certificate with serialNumber=$noc_root_cert_1_serial_number" result=$(dcld query pki all-revoked-noc-x509-root-certs) echo $result | jq @@ -152,13 +157,13 @@ response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial echo $result | jq echo "Request all certificates by subject should not be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_cert_1_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_cert_1_subject") check_response "$result" "\"$noc_root_cert_1_subject\"" check_response "$result" "\"$noc_root_cert_1_subject_key_id\"" echo $result | jq echo "Request all certificates by subjectKeyId should contain only one root certificate with serialNumber=$noc_root_cert_1_copy_serial_number" -result=$(dcld query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" @@ -177,7 +182,7 @@ check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_leaf_cert_1_serial_number\"" echo "Request all approved certificates should not contain revoked NOC root certificate" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" check_response "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" @@ -197,28 +202,24 @@ result=$(echo "$passphrase" | dcld tx pki revoke-noc-x509-root-cert --subject="$ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" -echo "Request all revoked certificates should contain two root, one intermediate and one leaf certificates" -result=$(dcld query pki all-revoked-x509-certs) +echo "Request all revoked NOC root certificates should contain two root certificates" +result=$(dcld query pki all-revoked-noc-x509-root-certs) echo $result | jq check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" + +echo "Request all revoked NOC root certificates should contain one intermediate and one leaf certificates" +result=$(dcld query pki all-revoked-noc-x509-ica-certs) +echo $result | jq check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" check_response "$result" "\"subject\": \"$noc_leaf_cert_1_subject\"" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" check_response "$result" "\"subjectKeyId\": \"$noc_leaf_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_leaf_cert_1_serial_number\"" -echo "Request all revoked NOC root certificates should contain two root certificates" -result=$(dcld query pki all-revoked-noc-x509-root-certs) -echo $result | jq -check_response "$result" "\"subject\": \"$noc_root_cert_1_subject" -check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" - echo "Request revoked NOC root certificate by subject and subjectKeyId should contain two root certificates" result=$(dcld query pki revoked-noc-x509-root-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") echo $result | jq @@ -227,14 +228,6 @@ check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" -echo "Request all x509 root revoked certificates should not contain revoked NOC root certificates" -result=$(dcld query pki all-revoked-x509-root-certs) -response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" -response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" -response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" -response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" -echo $result | jq - echo "Request NOC root certificate by VID = $vid should be empty" result=$(dcld query pki noc-x509-root-certs --vid="$vid") check_response "$result" "Not Found" @@ -245,14 +238,14 @@ response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_s echo $result | jq echo "Request all certificates by subject should be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_root_cert_1_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_root_cert_1_subject") check_response "$result" "Not Found" response_does_not_contain "$result" "\"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"$noc_root_cert_1_subject_key_id\"" echo $result | jq echo "Request all certificates by subjectKeyId should be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" @@ -273,7 +266,7 @@ response_does_not_contain "$result" "\"serialNumber\": \"$noc_cert_1_serial_numb response_does_not_contain "$result" "\"serialNumber\": \"$noc_leaf_cert_1_serial_number\"" echo "Request all approved certificates should be empty" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\[\]" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" response_does_not_contain "$result" "\"subject\": \"$noc_cert_1_subject\"" @@ -333,8 +326,8 @@ result=$(echo "$passphrase" | dcld tx pki revoke-noc-x509-ica-cert --subject="$n result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" -echo "Request all revoked certificates should contain one intermediate certificate only" -result=$(dcld query pki all-revoked-x509-certs) +echo "Request all revoked noc ica certificates should contain one intermediate certificate only" +result=$(dcld query pki all-revoked-noc-x509-ica-certs) echo $result | jq check_response "$result" "\"subject\": \"$noc_cert_2_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" @@ -345,13 +338,13 @@ response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_leaf_cert_2_subjec response_does_not_contain "$result" "\"serialNumber\": \"$noc_leaf_cert_2_serial_number\"" echo "Request all certificates by NOC certificate's subject should not be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_cert_2_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_cert_2_subject") check_response "$result" "\"$noc_cert_2_subject\"" check_response "$result" "\"$noc_cert_2_subject_key_id\"" echo $result | jq echo "Request all certificates by NOC certificate's subjectKeyId should not be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_cert_2_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_cert_2_subject_key_id") check_response "$result" "\"subject\": \"$noc_cert_2_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_cert_2_copy_serial_number\"" @@ -369,7 +362,7 @@ check_response "$result" "\"serialNumber\": \"$noc_cert_2_copy_serial_number\"" response_does_not_contain "$result" "\"serialNumber\": \"$noc_cert_2_serial_number\"" echo "Request all approved certificates should contain one intermediate and leaf certificates" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_root_cert_2_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_2_serial_number\"" @@ -387,7 +380,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all revoked certificates should contain two intermediate and one leaf certificates" -result=$(dcld query pki all-revoked-x509-certs) +result=$(dcld query pki all-revoked-noc-x509-ica-certs) echo $result | jq check_response "$result" "\"subject\": \"$noc_cert_2_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" @@ -398,14 +391,14 @@ check_response "$result" "\"subjectKeyId\": \"$noc_leaf_cert_2_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_leaf_cert_2_serial_number\"" echo "Request all certificates by NOC certificate's subject should be empty" -result=$(dcld query pki all-subject-x509-certs --subject="$noc_cert_2_subject") +result=$(dcld query pki all-noc-subject-x509-certs --subject="$noc_cert_2_subject") check_response "$result" "Not Found" response_does_not_contain "$result" "\"$noc_cert_2_subject\"" response_does_not_contain "$result" "\"$noc_cert_2_subject_key_id\"" echo $result | jq echo "Request all certificates by NOC certificate's subjectKeyId should be empty" -result=$(dcld query pki x509-cert --subject-key-id="$noc_cert_2_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject-key-id="$noc_cert_2_subject_key_id") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_cert_2_subject\"" response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" @@ -424,7 +417,7 @@ response_does_not_contain "$result" "\"serialNumber\": \"$noc_cert_2_copy_serial response_does_not_contain "$result" "\"serialNumber\": \"$noc_cert_2_serial_number\"" echo "Request all approved certificates should contain only one root certificate" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) check_response "$result" "\"subject\": \"$noc_root_cert_2_subject\"" check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_2_serial_number\"" diff --git a/integration_tests/cli/pki-remove-noc-certificates.sh b/integration_tests/cli/pki-remove-noc-certificates.sh index 48693971f..a2436f56b 100755 --- a/integration_tests/cli/pki-remove-noc-certificates.sh +++ b/integration_tests/cli/pki-remove-noc-certificates.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh @@ -58,7 +73,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all approved certificates." -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"subject\": \"$root_cert_subject\"" check_response "$result" "\"subject\": \"$intermediate_cert_subject\"" @@ -76,7 +91,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all revoked certificates should contain only one intermediate ICA certificate with serialNumber $intermediate_cert_1_serial_number" -result=$(dcld query pki all-revoked-x509-certs) +result=$(dcld query pki all-revoked-noc-x509-ica-certs) echo $result | jq check_response "$result" "\"subject\": \"$intermediate_cert_subject\"" check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_subject_key_id\"" @@ -104,7 +119,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all certificates should not contain intermediate ICA certificate with serialNumber $intermediate_cert_1_serial_number" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"subject\": \"$root_cert_subject\"" check_response "$result" "\"subject\": \"$intermediate_cert_subject\"" @@ -126,7 +141,7 @@ check_response "$result" "\"serialNumber\": \"$intermediate_cert_2_serial_number response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_1_serial_number\"" echo "Request approved certificates by an intermediate certificate's subject and subjectKeyId should contain only one certificate with serialNumber $intermediate_cert_2_serial_number" -result=$(dcld query pki x509-cert --subject="$intermediate_cert_subject" --subject-key-id="$intermediate_cert_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject="$intermediate_cert_subject" --subject-key-id="$intermediate_cert_subject_key_id") echo $result | jq check_response "$result" "\"subject\": \"$intermediate_cert_subject\"" check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_subject_key_id\"" @@ -139,7 +154,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request approved certificates by an intermediate certificate's subject and subjectKeyId should be empty" -result=$(dcld query pki x509-cert --subject="$intermediate_cert_subject" --subject-key-id="$intermediate_cert_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject="$intermediate_cert_subject" --subject-key-id="$intermediate_cert_subject_key_id") echo $result | jq check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$intermediate_cert_subject\"" @@ -158,7 +173,7 @@ response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_2_se response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_1_serial_number\"" echo "Request all revoked certificates should be empty" -result=$(dcld query pki all-revoked-x509-certs) +result=$(dcld query pki all-revoked-noc-x509-ica-certs) echo $result | jq check_response "$result" "\[\]" response_does_not_contain "$result" "\"subject\": \"$intermediate_cert_subject\"" @@ -167,7 +182,7 @@ response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_1_se response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_2_serial_number\"" echo "Request all certificates should contain only root and leaf certificates" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"subjectKeyId\": \"$root_cert_subject_key_id\"" check_response "$result" "\"subjectKeyId\": \"$leaf_cert_subject_key_id\"" @@ -183,7 +198,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request approved leaf certificates should be empty" -result=$(dcld query pki x509-cert --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id") echo $result | jq check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$leaf_cert_subject\"" @@ -202,7 +217,7 @@ response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_2_se response_does_not_contain "$result" "\"serialNumber\": \"$leaf_cert_serial_number" echo "Request all certificates should contain only root certificate" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"subjectKeyId\": \"$root_cert_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$root_cert_1_serial_number\"" @@ -223,7 +238,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Check that root cert is added. Request all approved certificates." -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"serialNumber\": \"$root_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$root_cert_1_copy_serial_number\"" @@ -249,7 +264,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all revoked certificates should contain NOC root certificate with serialNumber $root_cert_1_serial_number" -result=$(dcld query pki all-revoked-x509-certs) +result=$(dcld query pki all-revoked-noc-x509-root-certs) echo $result | jq check_response "$result" "\"serialNumber\": \"$root_cert_1_serial_number\"" @@ -259,7 +274,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request all certificates should contain only one NOC root certificate" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"serialNumber\": \"$root_cert_1_copy_serial_number\"" check_response "$result" "\"serialNumber\": \"$intermediate_cert_1_serial_number\"" @@ -272,7 +287,7 @@ check_response "$result" "\"serialNumber\": \"$root_cert_1_copy_serial_number\"" response_does_not_contain "$result" "\"serialNumber\": \"$root_cert_1_serial_number\"" echo "Request approved certificates by NOC root's subject and subjectKeyId should contain only one root certificate" -result=$(dcld query pki x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id") echo $result | jq check_response "$result" "\"serialNumber\": \"$root_cert_1_copy_serial_number\"" response_does_not_contain "$result" "\"serialNumber\": \"$root_cert_1_serial_number\"" @@ -283,7 +298,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Check that root cert is added. Request all approved certificates." -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"serialNumber\": \"$root_cert_1_serial_number\"" check_response "$result" "\"serialNumber\": \"$root_cert_1_copy_serial_number\"" @@ -294,7 +309,7 @@ result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" echo "Request approved NOC root certificates should be empty" -result=$(dcld query pki x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id") +result=$(dcld query pki noc-x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id") echo $result | jq check_response "$result" "Not Found" response_does_not_contain "$result" "\"serialNumber\": \"$root_cert_1_serial_number" @@ -307,7 +322,7 @@ response_does_not_contain "$result" "\"serialNumber\": \"$root_cert_1_serial_num response_does_not_contain "$result" "\"serialNumber\": \"$root_cert_1_copy_serial_number" echo "Request all certificates should contain only ICA certificate" -result=$(dcld query pki all-x509-certs) +result=$(dcld query pki all-noc-x509-certs) echo $result | jq check_response "$result" "\"serialNumber\": \"$intermediate_cert_1_serial_number\"" response_does_not_contain "$result" "\"serialNumber\": \"$root_cert_1_serial_number" diff --git a/integration_tests/cli/pki-remove-x509-certificates.sh b/integration_tests/cli/pki-remove-x509-certificates.sh index 5917cd792..2340ce778 100755 --- a/integration_tests/cli/pki-remove-x509-certificates.sh +++ b/integration_tests/cli/pki-remove-x509-certificates.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh diff --git a/integration_tests/cli/pki-revocation-points.sh b/integration_tests/cli/pki-revocation-points.sh index c4b6d8fb5..dd04d3d52 100755 --- a/integration_tests/cli/pki-revocation-points.sh +++ b/integration_tests/cli/pki-revocation-points.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh diff --git a/integration_tests/cli/pki-revocation-with-revoking-child.sh b/integration_tests/cli/pki-revocation-with-revoking-child.sh index cb19b1db6..b93544d1c 100755 --- a/integration_tests/cli/pki-revocation-with-revoking-child.sh +++ b/integration_tests/cli/pki-revocation-with-revoking-child.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh diff --git a/integration_tests/cli/pki-revocation-with-serial-number.sh b/integration_tests/cli/pki-revocation-with-serial-number.sh index 63372bcef..c6bdbe639 100755 --- a/integration_tests/cli/pki-revocation-with-serial-number.sh +++ b/integration_tests/cli/pki-revocation-with-serial-number.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail source integration_tests/cli/common.sh diff --git a/integration_tests/cli_go/dclauth/cli_test.go b/integration_tests/cli_go/dclauth/cli_test.go new file mode 100644 index 000000000..de4186fd5 --- /dev/null +++ b/integration_tests/cli_go/dclauth/cli_test.go @@ -0,0 +1,59 @@ +// Copyright 2020 DSR Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dclauth_test_cli + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/cli_go/helpers" + "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/utils" + + testconstants "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/constants" + dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types" +) + +func TestAuthDemoCLI(t *testing.T) { + suite := utils.SetupTest(t, testconstants.ChainID, false) + + jack := testconstants.JackAccount + alice := testconstants.AliceAccount + + user1 := helpers.CreateAccountInfo(&suite) + + // Propose user1 account by jack + txResult, err := ProposeAccount(user1.Address, user1.Key, dclauthtypes.NodeAdmin, jack) + require.NoError(suite.T, err) + require.Equal(suite.T, txResult.Code, uint32(0)) + + // Approve user1 account by alice + txResult, err = ApproveAccount(user1.Address, alice) + require.NoError(suite.T, err) + require.Equal(suite.T, txResult.Code, uint32(0)) + + // await transaction is written + _, err = helpers.AwaitTxConfirmation(txResult.TxHash) + require.NoError(suite.T, err) + + // Query list of all active accounts + accounts, err := QueryAccounts() + require.NoError(suite.T, err) + require.True(suite.T, AccountIsInList(user1.Address, accounts.Account)) + + // Query user1 account + account, err := QueryAccount(user1.Address) + require.NoError(suite.T, err) + require.Equal(suite.T, account.Address, user1.Address) +} diff --git a/integration_tests/cli_go/dclauth/helpers.go b/integration_tests/cli_go/dclauth/helpers.go new file mode 100644 index 000000000..a7170d5bf --- /dev/null +++ b/integration_tests/cli_go/dclauth/helpers.go @@ -0,0 +1,91 @@ +package dclauth_test_cli + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/cli_go/helpers" + dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types" +) + +func ProposeAccount( + address string, + key string, + role dclauthtypes.AccountRole, + from string) (sdk.TxResponse, error) { + return helpers.Tx( + "auth", + "propose-add-account", + from, + fmt.Sprintf("--address=%s", address), + fmt.Sprintf("--pubkey=%s", key), + fmt.Sprintf("--roles=%s", string(role))) +} + +func ApproveAccount( + address string, + from string) (sdk.TxResponse, error) { + return helpers.Tx( + "auth", + "approve-add-account", + from, + fmt.Sprintf("--address=%s", address)) +} + +func QueryAccounts() (dclauthtypes.QueryAllAccountResponse, error) { + res, err := helpers.Query("auth", "all-accounts") + if err != nil { + return dclauthtypes.QueryAllAccountResponse{}, err + } + + var resp dclauthtypes.QueryAllAccountResponse + err = helpers.Codec.UnmarshalJSON([]byte(res), &resp) + if err != nil { + return dclauthtypes.QueryAllAccountResponse{}, err + } + + return resp, nil +} + +func QueryAccount(address string) (dclauthtypes.Account, error) { + res, err := helpers.Query( + "auth", + "account", + fmt.Sprintf("--address=%s", address)) + if err != nil { + return dclauthtypes.Account{}, err + } + + var resp dclauthtypes.Account + err = helpers.Codec.UnmarshalJSON([]byte(res), &resp) + if err != nil { + return dclauthtypes.Account{}, err + } + + return resp, nil +} + +func QueryPendingAccounts() (dclauthtypes.QueryAllPendingAccountResponse, error) { + res, err := helpers.Query("auth", "all-proposed-accounts") + if err != nil { + return dclauthtypes.QueryAllPendingAccountResponse{}, err + } + + var resp dclauthtypes.QueryAllPendingAccountResponse + err = helpers.Codec.UnmarshalJSON([]byte(res), &resp) + if err != nil { + return dclauthtypes.QueryAllPendingAccountResponse{}, err + } + + return resp, nil +} + +func AccountIsInList(expected string, accounts []dclauthtypes.Account) bool { + for _, account := range accounts { + if expected == account.Address { + return true + } + } + + return false +} diff --git a/integration_tests/cli_go/helpers/account.go b/integration_tests/cli_go/helpers/account.go new file mode 100644 index 000000000..658656ef3 --- /dev/null +++ b/integration_tests/cli_go/helpers/account.go @@ -0,0 +1,41 @@ +package helpers + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/hd" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/go-bip39" + testconstants "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/constants" + "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/utils" +) + +type AccountInfo struct { + Name string + Address string + Key string +} + +func CreateAccountInfo(suite *utils.TestSuite) AccountInfo { + name := RandomString() + entropySeed, _ := bip39.NewEntropy(256) + mnemonic, _ := bip39.NewMnemonic(entropySeed) + account, _ := suite.Kr.NewAccount(name, mnemonic, testconstants.Passphrase, sdk.FullFundraiserPath, hd.Secp256k1) + + address, _ := account.GetAddress() + pubKey, _ := account.GetPubKey() + + return AccountInfo{ + Name: name, + Address: address.String(), + Key: FormatKey(pubKey), + } +} + +func FormatKey(pk cryptotypes.PubKey) string { + apk, _ := codectypes.NewAnyWithValue(pk) + bz, _ := codec.ProtoMarshalJSON(apk, nil) + + return string(bz) +} diff --git a/integration_tests/cli_go/helpers/codec.go b/integration_tests/cli_go/helpers/codec.go new file mode 100644 index 000000000..5fd3d3911 --- /dev/null +++ b/integration_tests/cli_go/helpers/codec.go @@ -0,0 +1,23 @@ +package helpers + +import ( + "github.com/cosmos/cosmos-sdk/codec" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/zigbee-alliance/distributed-compliance-ledger/app" + dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +var ( + Codec codec.Codec +) + +func init() { + encodingConfig := app.MakeEncodingConfig() + govtypesv1.RegisterInterfaces(encodingConfig.InterfaceRegistry) + govtypesv1beta1.RegisterInterfaces(encodingConfig.InterfaceRegistry) + dclauthtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + pkitypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + Codec = encodingConfig.Codec +} diff --git a/integration_tests/cli_go/helpers/command.go b/integration_tests/cli_go/helpers/command.go new file mode 100644 index 000000000..a4c2e1948 --- /dev/null +++ b/integration_tests/cli_go/helpers/command.go @@ -0,0 +1,18 @@ +package helpers + +import ( + "os/exec" +) + +const CliBinaryName = "dcld" + +func Command(args ...string) ([]byte, error) { + cmd := exec.Command(CliBinaryName, args...) + + out, err := cmd.CombinedOutput() + if err != nil { + return nil, err + } + + return out, err +} diff --git a/integration_tests/cli_go/helpers/data.go b/integration_tests/cli_go/helpers/data.go new file mode 100644 index 000000000..5bb731f4b --- /dev/null +++ b/integration_tests/cli_go/helpers/data.go @@ -0,0 +1,14 @@ +package helpers + +import ( + tmrand "github.com/cometbft/cometbft/libs/rand" + "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/utils" +) + +func RandomString() string { + return utils.RandString() +} + +func RandomVid() int32 { + return int32(tmrand.Uint16()) +} diff --git a/integration_tests/cli_go/helpers/query.go b/integration_tests/cli_go/helpers/query.go new file mode 100644 index 000000000..679bf01f3 --- /dev/null +++ b/integration_tests/cli_go/helpers/query.go @@ -0,0 +1,13 @@ +package helpers + +func Query(module, command string, queryArgs ...string) (string, error) { + args := []string{"query", module, command} + args = append(args, queryArgs...) + + output, err := Command(args...) + if err != nil { + return "", err + } + + return string(output), nil +} diff --git a/integration_tests/cli_go/helpers/tx.go b/integration_tests/cli_go/helpers/tx.go new file mode 100644 index 000000000..b4a812ee5 --- /dev/null +++ b/integration_tests/cli_go/helpers/tx.go @@ -0,0 +1,50 @@ +package helpers + +import ( + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func Tx(module, command, from string, txArgs ...string) (sdk.TxResponse, error) { + args := []string{"tx", module, command} + + // TXN arguments + args = append(args, txArgs...) + + // Sender account + args = append(args, "--from", from) + + // Broadcast + args = append(args, "--yes") + + output, err := Command(args...) + if err != nil { + return sdk.TxResponse{}, err + } + + var resp sdk.TxResponse + err = Codec.UnmarshalJSON(output, &resp) + if err != nil { + return sdk.TxResponse{}, err + } + + return resp, nil +} + +func AwaitTxConfirmation(hash string) (string, error) { + var ( + result []byte + err error + ) + for i := 1; i <= 20; i++ { + result, err = Command("query", "tx", hash) + if err == nil { + return string(result), nil + } else { + time.Sleep(2 * time.Second) + } + } + + return "", err +} diff --git a/integration_tests/constants/noc_cert_3 b/integration_tests/constants/noc_cert_3 new file mode 100644 index 000000000..0acc64171 --- /dev/null +++ b/integration_tests/constants/noc_cert_3 @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICODCCAd+gAwIBAgIUE4/js/aPxhJabEzj+K5dGUFwYAIwCgYIKoZIzj0EAwIw +VTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEOMAwGA1UEAwwFTk9DLTMwIBcNMjQxMTA1 +MDcwMTE0WhgPMzAyNDAzMDgwNzAxMTRaMIGCMQswCQYDVQQGEwJVWjETMBEGA1UE +CAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhh +bXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQD +DAtOT0MtY2hpbGQtMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGxN1+kOIWaZ +R3TSKvKslrrdS2RdqOHJCShJiVJ6rjgYKXrOMAi2r431jh5uRGJ5JDHydsvduuuo +H5C9d150QeWjXTBbMB0GA1UdDgQWBBTe+R2Q1aEPI1lcP1zHLTFYL6h5MzAfBgNV +HSMEGDAWgBSIDQbZZCIpNHh/jDuu9QiTho8NIDAJBgNVHRMEAjAAMA4GA1UdDwEB +/wQEAwIBgjAKBggqhkjOPQQDAgNHADBEAiANC4+odjqANp1Cw6XDu+NwWagHtZtJ +F7E1VvJHJZz2wgIgfk2qmGYJVOpxNZQn1bNxto2Xfxx5MrEepRqHw4uvylw= +-----END CERTIFICATE----- diff --git a/integration_tests/constants/noc_leaf_cert_3 b/integration_tests/constants/noc_leaf_cert_3 new file mode 100644 index 000000000..d7469e4b9 --- /dev/null +++ b/integration_tests/constants/noc_leaf_cert_3 @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICajCCAg+gAwIBAgIUabT4B41R7EGiVRuGLVVT8ciZoHQwCgYIKoZIzj0EAwIw +gYIxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMRMwEQYDVQQHDApT +b21lIFN0YXRlMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRl +c3RpbmcgRGl2aXNpb24xFDASBgNVBAMMC05PQy1jaGlsZC0zMCAXDTI0MTEwNTA3 +MzM1OFoYDzMwMjQwMzA4MDczMzU4WjCBgTELMAkGA1UEBhMCVVoxEzARBgNVBAgM +ClNvbWUgU3RhdGUxEzARBgNVBAcMClNvbWUgU3RhdGUxGDAWBgNVBAoMD0V4YW1w +bGUgQ29tcGFueTEZMBcGA1UECwwQVGVzdGluZyBEaXZpc2lvbjETMBEGA1UEAwwK +Tk9DLWxlYWYtMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIL2WFA6/dAEs+HG +mRRpAW6ouppZMuoVRM8SIoVXLpEOxLZzfsSSCWrF3BJtyu8WpiL6mxb5mdfytvA0 +oehKoZqjYDBeMB0GA1UdDgQWBBQsR2j9ET9opRb5vumlasDN1UCTgTAfBgNVHSME +GDAWgBTe+R2Q1aEPI1lcP1zHLTFYL6h5MzAMBgNVHRMEBTADAQH/MA4GA1UdDwEB +/wQEAwIBgjAKBggqhkjOPQQDAgNJADBGAiEA323Q//UQgpjYpnecDrY7OgkSA+zQ +oLKiFhXYt6vVEx0CIQCEOOIyKNZ/P5XkBGWGpEIVVl+H5kEKhWfX7N4xIHBJOw== +-----END CERTIFICATE----- diff --git a/integration_tests/constants/upgrade_1_4_4_da_intermediate_cert b/integration_tests/constants/upgrade_1_4_4_da_intermediate_cert new file mode 100644 index 000000000..0578768c8 --- /dev/null +++ b/integration_tests/constants/upgrade_1_4_4_da_intermediate_cert @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICKTCCAc+gAwIBAgIUPiZ8EuCMDG+LVlcHIJK8b8ao3v0wCgYIKoZIzj0EAwIw +RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAgFw0yNDExMDUxMzQzMjFaGA8zMDI0MDMw +ODEzNDMyMVowgYIxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMRMw +EQYDVQQHDApTb21lIFN0YXRlMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAX +BgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xFDASBgNVBAMMC05PQy1jaGlsZC0zMFkw +EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEePd2pOUOQOh7HQ1gG0imOtG9P2KWQoQj +cskkDiS475E1n2WtYvXu49ZEt1FAyLC88mBvMMzPaWn7/TlFNC3X4KNdMFswHQYD +VR0OBBYEFKiglRibn4FNx59etYIJJ5UTDJ+HMB8GA1UdIwQYMBaAFKiglRibn4FN +x59etYIJJ5UTDJ+HMAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgGCMAoGCCqGSM49 +BAMCA0gAMEUCIAdfKhO6Kn75tgGue/xHT0rd+z/zefM4YPNA/hDWWdISAiEAsbx/ +Df72UGIF7EFn4Ap/VOPg2IQIily74snXWl9uhag= +-----END CERTIFICATE----- diff --git a/integration_tests/constants/upgrade_1_4_4_da_intermediate_cert_2 b/integration_tests/constants/upgrade_1_4_4_da_intermediate_cert_2 new file mode 100644 index 000000000..eb967fff4 --- /dev/null +++ b/integration_tests/constants/upgrade_1_4_4_da_intermediate_cert_2 @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICHjCCAcSgAwIBAgIUZ7PujzJj9zdO92By/iIsZjjgXlUwCgYIKoZIzj0EAwIw +OzELMAkGA1UEBhMCVEUxEzARBgNVBAgMClNvbWUtU3RhdGUxFzAVBgNVBAoMDlVw +Z3JhZGUxLjQuNF8xMCAXDTI0MTEwNzA1MTAzM1oYDzMwMjQwMzEwMDUxMDMzWjCB +gTELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3RhdGUxEzARBgNVBAcMClNv +bWUgU3RhdGUxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFueTEZMBcGA1UECwwQVGVz +dGluZyBEaXZpc2lvbjETMBEGA1UEAwwKREEtY2hpbGQtMzBZMBMGByqGSM49AgEG +CCqGSM49AwEHA0IABHj3dqTlDkDoex0NYBtIpjrRvT9ilkKEI3LJJA4kuO+RNZ9l +rWL17uPWRLdRQMiwvPJgbzDMz2lp+/05RTQt1+CjXTBbMB0GA1UdDgQWBBSooJUY +m5+BTcefXrWCCSeVEwyfhzAfBgNVHSMEGDAWgBSooJUYm5+BTcefXrWCCSeVEwyf +hzAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIBgjAKBggqhkjOPQQDAgNIADBFAiEA +hQOIPGSKUTf7giMzm6H/wdzSGn98vkzUWiQ/GKG3EYECIFh9XypYxBKIwEs4NvwR +4hVUy0tq9WIBOhT1xZD8s36U +-----END CERTIFICATE----- diff --git a/integration_tests/constants/upgrade_1_4_4_da_root_cert b/integration_tests/constants/upgrade_1_4_4_da_root_cert new file mode 100644 index 000000000..20dd8232d --- /dev/null +++ b/integration_tests/constants/upgrade_1_4_4_da_root_cert @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB4DCCAYWgAwIBAgIUFiQ4/IBEWGVJ7hA0exUeyCu0i3cwCgYIKoZIzj0EAwIw +RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDExMDUxMzQxMjNaFw0zNDExMDMx +MzQxMjNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYD +VQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwWTATBgcqhkjOPQIBBggqhkjO +PQMBBwNCAAR493ak5Q5A6HsdDWAbSKY60b0/YpZChCNyySQOJLjvkTWfZa1i9e7j +1kS3UUDIsLzyYG8wzM9pafv9OUU0Ldfgo1MwUTAdBgNVHQ4EFgQUqKCVGJufgU3H +n161ggknlRMMn4cwHwYDVR0jBBgwFoAUqKCVGJufgU3Hn161ggknlRMMn4cwDwYD +VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNJADBGAiEAwP316urSnoOge+/hc0nv +dE+430sIZnC+Whr26sNC62sCIQCZC7blqbcCkioHYwQWykOYVVTYlx1AaVDh7Z5B +GfDLMA== +-----END CERTIFICATE----- diff --git a/integration_tests/constants/upgrade_1_4_4_da_root_cert_2 b/integration_tests/constants/upgrade_1_4_4_da_root_cert_2 new file mode 100644 index 000000000..3ac16be02 --- /dev/null +++ b/integration_tests/constants/upgrade_1_4_4_da_root_cert_2 @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXGgAwIBAgIUZH3yzaAd7UYx7FnJ9bhVm16uOr4wCgYIKoZIzj0EAwIw +OzELMAkGA1UEBhMCVEUxEzARBgNVBAgMClNvbWUtU3RhdGUxFzAVBgNVBAoMDlVw +Z3JhZGUxLjQuNF8xMB4XDTI0MTEwNTEzNTMxMVoXDTM0MTEwMzEzNTMxMVowOzEL +MAkGA1UEBhMCVEUxEzARBgNVBAgMClNvbWUtU3RhdGUxFzAVBgNVBAoMDlVwZ3Jh +ZGUxLjQuNF8xMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEePd2pOUOQOh7HQ1g +G0imOtG9P2KWQoQjcskkDiS475E1n2WtYvXu49ZEt1FAyLC88mBvMMzPaWn7/TlF +NC3X4KNTMFEwHQYDVR0OBBYEFKiglRibn4FNx59etYIJJ5UTDJ+HMB8GA1UdIwQY +MBaAFKiglRibn4FNx59etYIJJ5UTDJ+HMA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZI +zj0EAwIDSAAwRQIhALgih0vsNe2AFz3X8YrZ8KpfLVwZ+SAkxaCvC0dTqXVhAiBj +X3e3OyWEITIBqpjIsxH5oSpYjf0/P/Hq4baV16b4XA== +-----END CERTIFICATE----- diff --git a/integration_tests/grpc_rest/pki/noc_cert_helpers.go b/integration_tests/grpc_rest/pki/noc_cert_helpers.go index 40a3dab05..847a6e975 100644 --- a/integration_tests/grpc_rest/pki/noc_cert_helpers.go +++ b/integration_tests/grpc_rest/pki/noc_cert_helpers.go @@ -24,6 +24,114 @@ import ( TODO: provide tests for error cases */ +func GetNocX509Cert(suite *utils.TestSuite, subject string, subjectKeyID string) (*pkitypes.NocCertificates, error) { + var res pkitypes.NocCertificates + if suite.Rest { + var resp pkitypes.QueryGetNocCertificatesResponse + err := suite.QueryREST( + fmt.Sprintf( + "/dcl/pki/all-noc-certificates/%s/%s", + url.QueryEscape(subject), url.QueryEscape(subjectKeyID), + ), + &resp, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.NocCertificates( + context.Background(), + &pkitypes.QueryGetNocCertificatesRequest{ + Subject: subject, + SubjectKeyId: subjectKeyID, + }, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } + + return &res, nil +} + +func GetAllNocX509CertsBySubject(suite *utils.TestSuite, subject string) (*pkitypes.NocCertificatesBySubject, error) { + var res pkitypes.NocCertificatesBySubject + if suite.Rest { + var resp pkitypes.QueryGetNocCertificatesBySubjectResponse + err := suite.QueryREST( + fmt.Sprintf( + "/dcl/pki/all-noc-certificates/%s", + url.QueryEscape(subject), + ), + &resp, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificatesBySubject() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.NocCertificatesBySubject( + context.Background(), + &pkitypes.QueryGetNocCertificatesBySubjectRequest{ + Subject: subject, + }, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificatesBySubject() + } + + return &res, nil +} + +func GetAllNocX509Certs(suite *utils.TestSuite) (res []pkitypes.NocCertificates, err error) { + return getAllNocX509Certs(suite, "") +} + +func GetAllNocX509certsBySubjectKeyID(suite *utils.TestSuite, subjectKeyID string) (res []pkitypes.NocCertificates, err error) { + return getAllNocX509Certs(suite, subjectKeyID) +} + +func getAllNocX509Certs(suite *utils.TestSuite, subjectKeyID string) (res []pkitypes.NocCertificates, err error) { + if suite.Rest { + var resp pkitypes.QueryNocCertificatesResponse + err := suite.QueryREST(fmt.Sprintf("/dcl/pki/all-noc-certificates?subjectKeyId=%s", subjectKeyID), &resp) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.NocCertificatesAll( + context.Background(), + &pkitypes.QueryNocCertificatesRequest{SubjectKeyId: subjectKeyID}, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } + + return res, nil +} + func GetAllNocX509RootCerts(suite *utils.TestSuite) (res []pkitypes.NocRootCertificates, err error) { if suite.Rest { var resp pkitypes.QueryAllNocRootCertificatesResponse @@ -82,7 +190,7 @@ func GetNocX509RootCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocR var res pkitypes.NocRootCertificates if suite.Rest { var resp pkitypes.QueryGetNocRootCertificatesResponse - err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-root-certificates/%v", vendorID), &resp) + err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-vid-root-certificates/%v", vendorID), &resp) if err != nil { return nil, err } @@ -110,7 +218,7 @@ func GetNocX509CertsByVidAndSkid(suite *utils.TestSuite, vendorID int32, subject var res pkitypes.NocCertificatesByVidAndSkid if suite.Rest { var resp pkitypes.QueryGetNocCertificatesByVidAndSkidResponse - err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-certificates/%v/%s", vendorID, url.QueryEscape(subjectKeyID)), &resp) + err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-vid-certificates/%v/%s", vendorID, url.QueryEscape(subjectKeyID)), &resp) if err != nil { return nil, err } @@ -138,7 +246,7 @@ func GetNocX509IcaCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocIc var res pkitypes.NocIcaCertificates if suite.Rest { var resp pkitypes.QueryGetNocIcaCertificatesResponse - err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-ica-certificates/%v", vendorID), &resp) + err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-vid-ica-certificates/%v", vendorID), &resp) if err != nil { return nil, err } @@ -176,6 +284,80 @@ func GetNocX509IcaCertsBySubjectAndSKID(suite *utils.TestSuite, vendorID int32, return certs.Certs } +func GetRevokedNocX509RootCert(suite *utils.TestSuite, subject string, subjectKeyID string) (*pkitypes.RevokedNocRootCertificates, error) { + var res pkitypes.RevokedNocRootCertificates + if suite.Rest { + var resp pkitypes.QueryGetRevokedNocRootCertificatesResponse + err := suite.QueryREST( + fmt.Sprintf( + "/dcl/pki/revoked-noc-root-certificates/%s/%s", + url.QueryEscape(subject), url.QueryEscape(subjectKeyID), + ), + &resp, + ) + if err != nil { + return nil, err + } + res = resp.GetRevokedNocRootCertificates() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.RevokedNocRootCertificates( + context.Background(), + &pkitypes.QueryGetRevokedNocRootCertificatesRequest{ + Subject: subject, + SubjectKeyId: subjectKeyID, + }, + ) + if err != nil { + return nil, err + } + res = resp.GetRevokedNocRootCertificates() + } + + return &res, nil +} + +func GetRevokedNocX509IcaCert(suite *utils.TestSuite, subject string, subjectKeyID string) (*pkitypes.RevokedNocIcaCertificates, error) { + var res pkitypes.RevokedNocIcaCertificates + if suite.Rest { + var resp pkitypes.QueryGetRevokedNocIcaCertificatesResponse + err := suite.QueryREST( + fmt.Sprintf( + "/dcl/pki/revoked-noc-ica-certificates/%s/%s", + url.QueryEscape(subject), url.QueryEscape(subjectKeyID), + ), + &resp, + ) + if err != nil { + return nil, err + } + res = resp.GetRevokedNocIcaCertificates() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.RevokedNocIcaCertificates( + context.Background(), + &pkitypes.QueryGetRevokedNocIcaCertificatesRequest{ + Subject: subject, + SubjectKeyId: subjectKeyID, + }, + ) + if err != nil { + return nil, err + } + res = resp.GetRevokedNocIcaCertificates() + } + + return &res, nil +} + //nolint:funlen func NocCertDemo(suite *utils.TestSuite) { // Generate VIDs @@ -335,7 +517,7 @@ func NocCertDemo(suite *utils.TestSuite) { require.Equal(suite.T, testconstants.NocRootCert3SubjectKeyID, certsWithVid2[0].SubjectKeyId) // Request NOC root certificate by Subject and SubjectKeyID - certificate, _ := GetX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + certificate, _ := GetNocX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(suite.T, testconstants.NocRootCert1Subject, certificate.Subject) require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, certificate.SubjectKeyId) require.Equal(suite.T, testconstants.NocRootCert1SubjectAsText, certificate.Certs[0].SubjectAsText) @@ -345,13 +527,13 @@ func NocCertDemo(suite *utils.TestSuite) { require.True(suite.T, certificate.Certs[0].IsRoot) // Request NOC root certificate by Subject - subjectCertificates, _ := GetAllX509CertsBySubject(suite, testconstants.NocRootCert1Subject) + subjectCertificates, _ := GetAllNocX509CertsBySubject(suite, testconstants.NocRootCert1Subject) require.Equal(suite.T, testconstants.NocRootCert1Subject, subjectCertificates.Subject) require.Equal(suite.T, 1, len(subjectCertificates.SubjectKeyIds)) require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, subjectCertificates.SubjectKeyIds[0]) // Request NOC root certificate by SubjectKeyID - certsBySubjectKeyID, _ := GetAllX509certsBySubjectKeyID(suite, testconstants.NocRootCert1SubjectKeyID) + certsBySubjectKeyID, _ := GetAllNocX509certsBySubjectKeyID(suite, testconstants.NocRootCert1SubjectKeyID) require.Equal(suite.T, 1, len(certsBySubjectKeyID)) require.Equal(suite.T, 1, len(certsBySubjectKeyID[0].Certs)) require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, certsBySubjectKeyID[0].Certs[0].SubjectKeyId) @@ -407,7 +589,7 @@ func NocCertDemo(suite *utils.TestSuite) { require.Equal(suite.T, 2, len(nocCerts[0].Certs)) // Request NOC certificate by Subject and SubjectKeyID - certs, _ := GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + certs, _ := GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, testconstants.NocCert1Subject, certs.Subject) require.Equal(suite.T, testconstants.NocCert1SubjectKeyID, certs.SubjectKeyId) require.Equal(suite.T, 1, len(certs.Certs)) @@ -415,7 +597,7 @@ func NocCertDemo(suite *utils.TestSuite) { require.Equal(suite.T, vendor1Account.Address, certs.Certs[0].Owner) require.False(suite.T, certs.Certs[0].IsRoot) - certs, _ = GetX509Cert(suite, testconstants.NocCert2Subject, testconstants.NocCert2SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocCert2Subject, testconstants.NocCert2SubjectKeyID) require.Equal(suite.T, testconstants.NocCert2Subject, certs.Subject) require.Equal(suite.T, testconstants.NocCert2SubjectKeyID, certs.SubjectKeyId) require.Equal(suite.T, 1, len(certs.Certs)) @@ -498,17 +680,17 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Request revoked certificate - revokedCerts, _ := GetRevokedX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedCerts, _ := GetRevokedNocX509IcaCert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(revokedCerts.Certs)) require.Equal(suite.T, testconstants.NocCert1Subject, revokedCerts.Subject) require.Equal(suite.T, testconstants.NocCert1SubjectKeyID, revokedCerts.SubjectKeyId) require.Equal(suite.T, testconstants.NocCert1SerialNumber, revokedCerts.Certs[0].SerialNumber) // Check approved certificates - certs, _ = GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) require.Equal(suite.T, testconstants.NocCert1CopySerialNumber, certs.Certs[0].SerialNumber) - certs, _ = GetX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) require.Equal(suite.T, testconstants.NocLeafCert1SerialNumber, certs.Certs[0].SerialNumber) @@ -526,17 +708,17 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Request revoked root certificate - revokedCerts, _ = GetRevokedX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) - require.Equal(suite.T, 1, len(revokedCerts.Certs)) - require.Equal(suite.T, testconstants.NocRootCert1Subject, revokedCerts.Subject) - require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, revokedCerts.SubjectKeyId) - require.Equal(suite.T, testconstants.NocRootCert1SerialNumber, revokedCerts.Certs[0].SerialNumber) + revokedRootCerts, _ := GetRevokedNocX509RootCert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + require.Equal(suite.T, 1, len(revokedRootCerts.Certs)) + require.Equal(suite.T, testconstants.NocRootCert1Subject, revokedRootCerts.Subject) + require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, revokedRootCerts.SubjectKeyId) + require.Equal(suite.T, testconstants.NocRootCert1SerialNumber, revokedRootCerts.Certs[0].SerialNumber) // Check approved certificate - certs, _ = GetX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) require.Equal(suite.T, testconstants.NocRootCert1CopySerialNumber, certs.Certs[0].SerialNumber) - certs, _ = GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) require.Equal(suite.T, testconstants.NocCert1CopySerialNumber, certs.Certs[0].SerialNumber) @@ -578,9 +760,9 @@ func NocCertDemo(suite *utils.TestSuite) { suite.AssertNotFound(err) // Check that two intermediate ICA certificates are removed - _, err = GetRevokedX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = GetRevokedNocX509IcaCert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) suite.AssertNotFound(err) - _, err = GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) suite.AssertNotFound(err) certificates := GetNocX509IcaCertsBySubjectAndSKID(suite, vid1, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) @@ -596,7 +778,7 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Check that leaf ICA certificate is removed - _, err = GetX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + _, err = GetNocX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) suite.AssertNotFound(err) // Request NOC ICA certificate by VID1 @@ -640,10 +822,10 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Check that leaf and ICA with different serial number is not removed - certs, _ = GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) require.Equal(suite.T, testconstants.NocCert1CopySerialNumber, certs.Certs[0].SerialNumber) - certs, _ = GetX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) certificates = GetNocX509IcaCertsBySubjectAndSKID(suite, vid1, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) @@ -663,18 +845,18 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Check that all 3 certificates are revoked - revokedCerts, _ = GetRevokedX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) - require.Equal(suite.T, 2, len(revokedCerts.Certs)) - revokedCerts, _ = GetRevokedX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedRootCerts, _ = GetRevokedNocX509RootCert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + require.Equal(suite.T, 2, len(revokedRootCerts.Certs)) + revokedCerts, _ = GetRevokedNocX509IcaCert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(revokedCerts.Certs)) - revokedCerts, _ = GetRevokedX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + revokedCerts, _ = GetRevokedNocX509IcaCert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(suite.T, 1, len(revokedCerts.Certs)) - _, err = GetX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = GetNocX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) suite.AssertNotFound(err) - _, err = GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) suite.AssertNotFound(err) - _, err = GetX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + _, err = GetNocX509Cert(suite, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) suite.AssertNotFound(err) _, err = GetNocX509CertsByVidAndSkid(suite, vid1, testconstants.NocRootCert1SubjectKeyID) @@ -712,10 +894,10 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Check that NOC root certificate is removed - revokedCerts, _ = GetRevokedX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) - require.Equal(suite.T, 1, len(revokedCerts.Certs)) - require.Equal(suite.T, testconstants.NocRootCert1CopySerialNumber, revokedCerts.Certs[0].SerialNumber) - _, err = GetX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + revokedRootCerts, _ = GetRevokedNocX509RootCert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + require.Equal(suite.T, 1, len(revokedRootCerts.Certs)) + require.Equal(suite.T, testconstants.NocRootCert1CopySerialNumber, revokedRootCerts.Certs[0].SerialNumber) + _, err = GetNocX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) suite.AssertNotFound(err) // Add root NOC certificate @@ -744,7 +926,7 @@ func NocCertDemo(suite *utils.TestSuite) { _, err = suite.BuildAndBroadcastTx([]sdk.Msg{&msgAddNocCert}, vendor1Name, vendor1Account) require.NoError(suite.T, err) - certs, _ = GetX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) // Remove revoked NOC root certificates @@ -758,16 +940,18 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Check that certificates are removed - _, err = GetX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = GetNocX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) suite.AssertNotFound(err) - _, err = GetRevokedX509Cert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = GetRevokedNocX509RootCert(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) suite.AssertNotFound(err) _, err = GetNocX509CertsByVidAndSkid(suite, vid1, testconstants.NocRootCert1SubjectKeyID) suite.AssertNotFound(err) // Check that child is not removed - certs, _ = GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + certs, _ = GetNocX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(certs.Certs)) + _, err = GetRevokedNocX509IcaCert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + suite.AssertNotFound(err) certificates = GetNocX509IcaCertsBySubjectAndSKID(suite, vid1, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(suite.T, 1, len(certificates)) require.Equal(suite.T, testconstants.NocCert1SerialNumber, certificates[0].SerialNumber) diff --git a/integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.sh b/integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.3.sh similarity index 68% rename from integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.sh rename to integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.3.sh index 0acc76af3..6f0270131 100755 --- a/integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.sh +++ b/integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.3.sh @@ -474,85 +474,72 @@ check_response "$result" "\"owner\": \"$validator_address\"" # after upgrade constatnts -vid_for_1_4=65521 -pid_1_for_1_4=44 -pid_2_for_1_4=55 -pid_3_for_1_4=66 -device_type_id_for_1_4=4321 -product_name_for_1_4="ProductName13" -product_label_for_1_4="ProductLabel13" -part_number_for_1_4="RCU2225B" -software_version_for_1_4=2 -software_version_string_for_1_4="3.0" -cd_version_number_for_1_4=413 -min_applicable_software_version_for_1_4=3 -max_applicable_software_version_for_1_4=3000 - -certification_type_for_1_4="matter" -certification_date_for_1_4="2022-01-01T00:00:00Z" -provisional_date_for_1_4="2012-12-12T00:00:00Z" -cd_certificate_id_for_1_4="18DEXC" - -root_cert_with_vid_subject="MIGYMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTEUMBIGCisGAQQBgqJ8AgEMBEZGRjE=" -root_cert_with_vid_subject_key_id="CE:A8:92:66:EA:E0:80:BD:2B:B5:68:E4:0B:07:C4:FA:2C:34:6D:31" -root_cert_with_vid_path="integration_tests/constants/root_cert_with_vid" - -paa_cert_no_vid_path="integration_tests/constants/paa_cert_no_vid" -paa_cert_no_vid_subject="MBoxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQQ==" -paa_cert_no_vid_subject_key_id="78:5C:E7:05:B8:6B:8F:4E:6F:C7:93:AA:60:CB:43:EA:69:68:82:D5" - -root_cert_subject="MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" -root_cert_subject_key_id="33:5E:0C:07:44:F8:B5:9C:CD:55:01:9B:6D:71:23:83:6F:D0:D4:BE" -root_cert_path="integration_tests/constants/root_with_same_subject_and_skid_1" - -intermediate_cert_with_vid_subject="MIGuMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDARGRkYx" -intermediate_cert_with_vid_subject_key_id="0E:8C:E8:C8:B8:AA:50:BC:25:85:56:B9:B1:9C:C2:C7:D9:C5:2F:17" -intermediate_cert_with_vid_path="integration_tests/constants/intermediate_cert_with_vid_1" -intermediate_cert_with_vid_serial_number="3" -intermediate_cert_with_vid_65521_vid=65521 - -noc_root_cert_1_path="integration_tests/constants/noc_root_cert_1" -noc_root_cert_1_subject="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ==" -noc_root_cert_1_subject_key_id="44:EB:4C:62:6B:25:48:CD:A2:B3:1C:87:41:5A:08:E7:2B:B9:83:26" -noc_root_cert_1_serial_number="47211865327720222621302679792296833381734533449" -noc_root_cert_1_subject_as_text="CN=NOC-1,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" - -noc_root_cert_2_path="integration_tests/constants/noc_root_cert_2" -noc_root_cert_2_subject="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMg==" -noc_root_cert_2_subject_key_id="CF:E6:DD:37:2B:4C:B2:B9:A9:F2:75:30:1C:AA:B1:37:1B:11:7F:1B" -noc_root_cert_2_serial_number="332802481233145945539125204504842614737181725760" -noc_root_cert_2_subject_as_text="CN=NOC-2,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" - -noc_ica_cert_1_path="integration_tests/constants/noc_cert_1" -noc_ica_cert_1_subject="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMQ==" -noc_ica_cert_1_subject_key_id="02:72:6E:BC:BB:EF:D6:BD:8D:9B:42:AE:D4:3C:C0:55:5F:66:3A:B3" -noc_ica_cert_1_serial_number="631388393741945881054190991612463928825155142122" - -noc_ica_cert_2_path="integration_tests/constants/noc_cert_2" -noc_ica_cert_2_subject="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMg==" -noc_ica_cert_2_subject_key_id="87:48:A2:33:12:1F:51:5C:93:E6:90:40:4A:2C:AB:9E:D6:19:E5:AD" -noc_ica_cert_2_serial_number="361372967010167010646904372658654439710639340814" +vid_for_1_4_3=65521 +pid_1_for_1_4_3=44 +pid_2_for_1_4_3=55 +pid_3_for_1_4_3=66 +device_type_id_for_1_4_3=4321 +product_name_for_1_4_3="ProductName13" +product_label_for_1_4_3="ProductLabel13" +part_number_for_1_4_3="RCU2225B" +software_version_for_1_4_3=2 +software_version_string_for_1_4_3="3.0" +cd_version_number_for_1_4_3=413 +min_applicable_software_version_for_1_4_3=3 +max_applicable_software_version_for_1_4_3=3000 + +certification_type_for_1_4_3="matter" +certification_date_for_1_4_3="2022-01-01T00:00:00Z" +provisional_date_for_1_4_3="2012-12-12T00:00:00Z" +cd_certificate_id_for_1_4_3="18DEXC" + +root_cert_with_vid_subject_for_1_4_3="MIGYMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTEUMBIGCisGAQQBgqJ8AgEMBEZGRjE=" +root_cert_with_vid_subject_key_id_for_1_4_3="CE:A8:92:66:EA:E0:80:BD:2B:B5:68:E4:0B:07:C4:FA:2C:34:6D:31" +root_cert_with_vid_path_for_1_4_3="integration_tests/constants/root_cert_with_vid" +root_cert_vid_for_1_4_3=65521 + +paa_cert_no_vid_path_for_1_4_3="integration_tests/constants/paa_cert_no_vid" +paa_cert_no_vid_subject_for_1_4_3="MBoxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQQ==" +paa_cert_no_vid_subject_key_id_for_1_4_3="78:5C:E7:05:B8:6B:8F:4E:6F:C7:93:AA:60:CB:43:EA:69:68:82:D5" + +root_cert_subject_for_1_4_3="MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" +root_cert_subject_key_id_for_1_4_3="33:5E:0C:07:44:F8:B5:9C:CD:55:01:9B:6D:71:23:83:6F:D0:D4:BE" +root_cert_path_for_1_4_3="integration_tests/constants/root_with_same_subject_and_skid_1" + +intermediate_cert_with_vid_subject_for_1_4_3="MIGuMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDARGRkYx" +intermediate_cert_with_vid_subject_key_id_for_1_4_3="0E:8C:E8:C8:B8:AA:50:BC:25:85:56:B9:B1:9C:C2:C7:D9:C5:2F:17" +intermediate_cert_with_vid_path_for_1_4_3="integration_tests/constants/intermediate_cert_with_vid_1" +intermediate_cert_with_vid_serial_number_for_1_4_3="3" +intermediate_cert_with_vid_65521_vid_for_1_4_3=65521 + +noc_root_cert_1_path_for_1_4_3="integration_tests/constants/noc_root_cert_1" +noc_root_cert_1_subject_for_1_4_3="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ==" +noc_root_cert_1_subject_key_id_for_1_4_3="44:EB:4C:62:6B:25:48:CD:A2:B3:1C:87:41:5A:08:E7:2B:B9:83:26" + +noc_ica_cert_1_path_for_1_4_3="integration_tests/constants/noc_cert_1" +noc_ica_cert_1_subject_for_1_4_3="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMQ==" +noc_ica_cert_1_subject_key_id_for_1_4_3="02:72:6E:BC:BB:EF:D6:BD:8D:9B:42:AE:D4:3C:C0:55:5F:66:3A:B3" crl_signer_delegated_by_pai_1="integration_tests/constants/leaf_cert_with_vid_65521" delegator_cert_with_vid_65521_path="integration_tests/constants/intermediate_cert_with_vid_1" delegator_cert_with_vid_subject_key_id="0E8CE8C8B8AA50BC258556B9B19CC2C7D9C52F17" -test_data_url_for_1_4="https://url.data.dclmodel-1.4" +test_data_url_for_1_4_3="https://url.data.dclmodel-1.4" -vendor_name_for_1_4="Vendor65521" -company_legal_name_for_1_4="LegalCompanyName65521" -company_preferred_name_for_1_4="CompanyPreferredName65521" -vendor_landing_page_url_for_1_4="https://www.new65521example.com" +vendor_name_for_1_4_3="Vendor65521" +company_legal_name_for_1_4_3="LegalCompanyName65521" +company_preferred_name_for_1_4_3="CompanyPreferredName65521" +vendor_landing_page_url_for_1_4_3="https://www.new65521example.com" -vendor_account_for_1_4="vendor_account_65521" +vendor_account_for_1_4_3="vendor_account_65521" -echo "Create Vendor account $vendor_account_for_1_4" +echo "Create Vendor account $vendor_account_for_1_4_3" -result="$(echo $passphrase | $DCLD_BIN_NEW keys add "$vendor_account_for_1_4")" +result="$(echo $passphrase | $DCLD_BIN_NEW keys add "$vendor_account_for_1_4_3")" echo "keys add $result" -_address=$(echo $passphrase | $DCLD_BIN_NEW keys show $vendor_account_for_1_4 -a) -_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $vendor_account_for_1_4 -p) -result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --vid="$vid_for_1_4" --roles="Vendor" --from "$trustee_account_1" --yes) +_address=$(echo $passphrase | $DCLD_BIN_NEW keys show $vendor_account_for_1_4_3 -a) +_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $vendor_account_for_1_4_3 -p) +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --vid="$vid_for_1_4_3" --roles="Vendor" --from "$trustee_account_1" --yes) echo "propose-add-account $result" result=$(get_txn_result "$result") result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-add-account --address="$_address" --from "$trustee_account_2" --yes) @@ -586,15 +573,15 @@ user_9_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_9 -p) # send all ledger update transactions after upgrade # VENDOR_INFO -echo "Add vendor $vendor_name_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx vendorinfo add-vendor --vid=$vid_for_1_4 --vendorName=$vendor_name_for_1_4 --companyLegalName=$company_legal_name_for_1_4 --companyPreferredName=$company_preferred_name_for_1_4 --vendorLandingPageURL=$vendor_landing_page_url_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add vendor $vendor_name_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx vendorinfo add-vendor --vid=$vid_for_1_4_3 --vendorName=$vendor_name_for_1_4_3 --companyLegalName=$company_legal_name_for_1_4_3 --companyPreferredName=$company_preferred_name_for_1_4_3 --vendorLandingPageURL=$vendor_landing_page_url_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Update vendor $vendor_name_for_1_2" -result=$(echo $passphrase | $DCLD_BIN_NEW tx vendorinfo update-vendor --vid=$vid_for_1_2 --vendorName=$vendor_name_for_1_2 --companyLegalName=$company_legal_name_for_1_2 --companyPreferredName=$company_preferred_name_for_1_4 --vendorLandingPageURL=$vendor_landing_page_url_for_1_4 --from=$vendor_account_for_1_2 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx vendorinfo update-vendor --vid=$vid_for_1_2 --vendorName=$vendor_name_for_1_2 --companyLegalName=$company_legal_name_for_1_2 --companyPreferredName=$company_preferred_name_for_1_4_3 --vendorLandingPageURL=$vendor_landing_page_url_for_1_4_3 --from=$vendor_account_for_1_2 --yes) result=$(get_txn_result "$result") echo $result check_response "$result" "\"code\": 0" @@ -603,62 +590,62 @@ test_divider # MODEL and MODEL_VERSION -echo "Add model vid=$vid_for_1_4 pid=$pid_1_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --deviceTypeID=$device_type_id_for_1_4 --productName=$product_name_for_1_4 --productLabel=$product_label_for_1_4 --partNumber=$part_number_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add model vid=$vid_for_1_4_3 pid=$pid_1_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --deviceTypeID=$device_type_id_for_1_4_3 --productName=$product_name_for_1_4_3 --productLabel=$product_label_for_1_4_3 --partNumber=$part_number_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add model version vid=$vid_for_1_4 pid=$pid_1_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --cdVersionNumber=$cd_version_number_for_1_4 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add model version vid=$vid_for_1_4_3 pid=$pid_1_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --cdVersionNumber=$cd_version_number_for_1_4_3 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_3 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add model vid=$vid_for_1_4 pid=$pid_2_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --deviceTypeID=$device_type_id_for_1_4 --productName=$product_name_for_1_4 --productLabel=$product_label_for_1_4 --partNumber=$part_number_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add model vid=$vid_for_1_4_3 pid=$pid_2_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --deviceTypeID=$device_type_id_for_1_4_3 --productName=$product_name_for_1_4_3 --productLabel=$product_label_for_1_4_3 --partNumber=$part_number_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add model version vid=$vid_for_1_4 pid=$pid_2_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --cdVersionNumber=$cd_version_number_for_1_4 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add model version vid=$vid_for_1_4_3 pid=$pid_2_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --cdVersionNumber=$cd_version_number_for_1_4_3 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_3 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add model vid=$vid_for_1_4 pid=$pid_3_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4 --pid=$pid_3_for_1_4 --deviceTypeID=$device_type_id_for_1_4 --productName=$product_name_for_1_4 --productLabel=$product_label_for_1_4 --partNumber=$part_number_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add model vid=$vid_for_1_4_3 pid=$pid_3_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4_3 --pid=$pid_3_for_1_4_3 --deviceTypeID=$device_type_id_for_1_4_3 --productName=$product_name_for_1_4_3 --productLabel=$product_label_for_1_4_3 --partNumber=$part_number_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" -echo "Add model version vid=$vid_for_1_4 pid=$pid_3_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4 --pid=$pid_3_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --cdVersionNumber=$cd_version_number_for_1_4 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Add model version vid=$vid_for_1_4_3 pid=$pid_3_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4_3 --pid=$pid_3_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --cdVersionNumber=$cd_version_number_for_1_4_3 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_3 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Delete model vid=$vid_for_1_4 pid=$pid_3_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model delete-model --vid=$vid_for_1_4 --pid=$pid_3_for_1_4 --from=$vendor_account_for_1_4 --yes) +echo "Delete model vid=$vid_for_1_4_3 pid=$pid_3_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model delete-model --vid=$vid_for_1_4_3 --pid=$pid_3_for_1_4_3 --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Update model vid=$vid pid=$pid_2" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model update-model --vid=$vid --pid=$pid_2 --productName=$product_name --productLabel=$product_label_for_1_4 --partNumber=$part_number_for_1_4 --from=$vendor_account --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx model update-model --vid=$vid --pid=$pid_2 --productName=$product_name --productLabel=$product_label_for_1_4_3 --partNumber=$part_number_for_1_4_3 --from=$vendor_account --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Update model version vid=$vid pid=$pid_2" -result=$(echo $passphrase | $DCLD_BIN_NEW tx model update-model-version --vid=$vid --pid=$pid_2 --softwareVersion=$software_version --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4 --from=$vendor_account --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx model update-model-version --vid=$vid --pid=$pid_2 --softwareVersion=$software_version --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_3 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_3 --from=$vendor_account --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" @@ -666,29 +653,29 @@ test_divider # CERTIFY_DEVICE_COMPLIANCE -echo "Certify model vid=$vid_for_1_4 pid=$pid_1_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance certify-model --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --certificationType=$certification_type_for_1_4 --certificationDate=$certification_date_for_1_4 --cdCertificateId=$cd_certificate_id_for_1_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4 --yes) +echo "Certify model vid=$vid_for_1_4_3 pid=$pid_1_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance certify-model --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --certificationType=$certification_type_for_1_4_3 --certificationDate=$certification_date_for_1_4_3 --cdCertificateId=$cd_certificate_id_for_1_4_3 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Provision model vid=$vid_for_1_4 pid=$pid_2_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance provision-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --certificationType=$certification_type_for_1_4 --provisionalDate=$provisional_date_for_1_4 --cdCertificateId=$cd_certificate_id_for_1_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4 --yes) +echo "Provision model vid=$vid_for_1_4_3 pid=$pid_2_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance provision-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --certificationType=$certification_type_for_1_4_3 --provisionalDate=$provisional_date_for_1_4_3 --cdCertificateId=$cd_certificate_id_for_1_4_3 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Certify model vid=$vid_for_1_4 pid=$pid_2_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance certify-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --certificationType=$certification_type_for_1_4 --certificationDate=$certification_date_for_1_4 --cdCertificateId=$cd_certificate_id_for_1_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4 --yes) +echo "Certify model vid=$vid_for_1_4_3 pid=$pid_2_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance certify-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --certificationType=$certification_type_for_1_4_3 --certificationDate=$certification_date_for_1_4_3 --cdCertificateId=$cd_certificate_id_for_1_4_3 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Revoke model certification vid=$vid_for_1_4 pid=$pid_2_for_1_4" -result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance revoke-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --softwareVersionString=$software_version_string_for_1_4 --certificationType=$certification_type_for_1_4 --revocationDate=$certification_date_for_1_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4 --yes) +echo "Revoke model certification vid=$vid_for_1_4_3 pid=$pid_2_for_1_4_3" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance revoke-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --softwareVersionString=$software_version_string_for_1_4_3 --certificationType=$certification_type_for_1_4_3 --revocationDate=$certification_date_for_1_4_3 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" @@ -697,161 +684,149 @@ test_divider # X509 PKI echo "Propose add root_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$root_cert_with_vid_path" --vid="$vid_for_1_4" --from=$trustee_account_1 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$root_cert_with_vid_path_for_1_4_3" --vid="$vid_for_1_4_3" --from=$trustee_account_1 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Approve add root_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$root_cert_with_vid_subject" --subject-key-id=$root_cert_with_vid_subject_key_id --from=$trustee_account_2 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$root_cert_with_vid_subject_for_1_4_3" --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3 --from=$trustee_account_2 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "reject add root_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki reject-add-x509-root-cert --subject="$root_cert_with_vid_subject" --subject-key-id=$root_cert_with_vid_subject_key_id --from=$trustee_account_3 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki reject-add-x509-root-cert --subject="$root_cert_with_vid_subject_for_1_4_3" --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3 --from=$trustee_account_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Approve add root_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$root_cert_with_vid_subject" --subject-key-id=$root_cert_with_vid_subject_key_id --from=$trustee_account_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$root_cert_with_vid_subject_for_1_4_3" --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3 --from=$trustee_account_4 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Approve add root_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$root_cert_with_vid_subject" --subject-key-id=$root_cert_with_vid_subject_key_id --from=$trustee_account_5 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$root_cert_with_vid_subject_for_1_4_3" --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3 --from=$trustee_account_5 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Propose add paa_cert_no_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$paa_cert_no_vid_path" --vid="$vid_for_1_4" --from=$trustee_account_5 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$paa_cert_no_vid_path_for_1_4_3" --vid="$vid_for_1_4_3" --from=$trustee_account_5 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Approve add paa_cert_no_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id=$paa_cert_no_vid_subject_key_id --from=$trustee_account_1 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id=$paa_cert_no_vid_subject_key_id_for_1_4_3 --from=$trustee_account_1 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Approve add paa_cert_no_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id=$paa_cert_no_vid_subject_key_id --from=$trustee_account_2 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id=$paa_cert_no_vid_subject_key_id_for_1_4_3 --from=$trustee_account_2 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Approve add paa_cert_no_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id=$paa_cert_no_vid_subject_key_id --from=$trustee_account_3 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id=$paa_cert_no_vid_subject_key_id_for_1_4_3 --from=$trustee_account_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Propose root_cert" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$root_cert_path" --vid="$vid_for_1_4" --from=$trustee_account_1 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$root_cert_path_for_1_4_3" --vid="$vid_for_1_4_3" --from=$trustee_account_1 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Add intermediate_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$intermediate_cert_with_vid_path" --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$intermediate_cert_with_vid_path_for_1_4_3" --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Revoke intermediate_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$intermediate_cert_with_vid_subject" --subject-key-id="$intermediate_cert_with_vid_subject_key_id" --serial-number="$intermediate_cert_with_vid_serial_number" --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$intermediate_cert_with_vid_subject_for_1_4_3" --subject-key-id="$intermediate_cert_with_vid_subject_key_id_for_1_4_3" --serial-number="$intermediate_cert_with_vid_serial_number_for_1_4_3" --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Propose revoke paa_cert_no_vid" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki propose-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id="$paa_cert_no_vid_subject_key_id" --from="$trustee_account_1" --yes) +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki propose-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id="$paa_cert_no_vid_subject_key_id_for_1_4_3" --from="$trustee_account_1" --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Approve revoke paa_cert_no_vid" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id="$paa_cert_no_vid_subject_key_id" --from="$trustee_account_2" --yes) +echo "Approve revoke paa_cert_no_vid_path_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id="$paa_cert_no_vid_subject_key_id_for_1_4_3" --from="$trustee_account_2" --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Approve revoke paa_cert_no_vid_path" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id="$paa_cert_no_vid_subject_key_id" --from="$trustee_account_3" --yes) +echo "Approve revoke paa_cert_no_vid_path_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id="$paa_cert_no_vid_subject_key_id_for_1_4_3" --from="$trustee_account_3" --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Approve revoke paa_cert_no_vid_path" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject" --subject-key-id="$paa_cert_no_vid_subject_key_id" --from="$trustee_account_4" --yes) +echo "Approve revoke paa_cert_no_vid_path_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$paa_cert_no_vid_subject_for_1_4_3" --subject-key-id="$paa_cert_no_vid_subject_key_id_for_1_4_3" --from="$trustee_account_4" --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Propose revoke root_cert_with_vid" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-revoke-x509-root-cert --subject="$root_cert_with_vid_subject" --subject-key-id="$root_cert_with_vid_subject_key_id" --from $trustee_account_1 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-revoke-x509-root-cert --subject="$root_cert_with_vid_subject_for_1_4_3" --subject-key-id="$root_cert_with_vid_subject_key_id_for_1_4_3" --from $trustee_account_1 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add NOC Root certificate by vendor with VID = $vid_for_1_4" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-root-cert --certificate="$noc_root_cert_1_path" --from $vendor_account_for_1_4 --yes) -result=$(get_txn_result "$result") -check_response "$result" "\"code\": 0" - -test_divider +echo "Emulation of actions, which has been done with NOC certificates on the TestNet" -echo "Add NOC ICA certificate by vendor with VID = $vid_for_1_4" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-ica-cert --certificate="$noc_ica_cert_1_path" --from $vendor_account_for_1_4 --yes) +echo "Add NOC Root certificate by vendor with VID = $vid_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-root-cert --certificate="$noc_root_cert_1_path_for_1_4_3" --from $vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add NOC Root certificate by vendor with VID = $vid_for_1_4" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-root-cert --certificate="$noc_root_cert_2_path" --from $vendor_account_for_1_4 --yes) +echo "Add NOC ICA certificate by vendor with VID = $vid_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-ica-cert --certificate="$noc_ica_cert_1_path_for_1_4_3" --from $vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Add NOC ICA certificate by vendor with VID = $vid_for_1_4" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-ica-cert --certificate="$noc_ica_cert_2_path" --from $vendor_account_for_1_4 --yes) +echo "Remove NOC root certificate by vendor with VID = $vid_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki remove-noc-x509-root-cert --subject="$noc_root_cert_1_subject_for_1_4_3" --subject-key-id="$noc_root_cert_1_subject_key_id_for_1_4_3" --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider -echo "Revoke NOC root certificate by vendor with VID = $vid_for_1_4" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki revoke-noc-x509-root-cert --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id" --from=$vendor_account_for_1_4 --yes) -result=$(get_txn_result "$result") -check_response "$result" "\"code\": 0" - -test_divider - -echo "Revoke NOC ICA certificate by vendor with VID = $vid_for_1_4" -result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki revoke-noc-x509-ica-cert --subject="$noc_ica_cert_1_subject" --subject-key-id="$noc_ica_cert_1_subject_key_id" --from=$vendor_account_for_1_4 --yes) +echo "Remove NOC ICA certificate by vendor with VID = $vid_for_1_4_3" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki remove-noc-x509-ica-cert --subject="$noc_ica_cert_1_subject_for_1_4_3" --subject-key-id="$noc_ica_cert_1_subject_key_id_for_1_4_3" --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" @@ -860,7 +835,7 @@ test_divider # PKI Revocation point echo "Add new revocation point for" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4 --revocation-type=1 --is-paa="true" --certificate="$root_cert_with_vid_path" --label="$product_label_for_1_4" --data-url="$test_data_url_for_1_4" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4_3 --revocation-type=1 --is-paa="true" --certificate="$root_cert_with_vid_path_for_1_4_3" --label="$product_label_for_1_4_3" --data-url="$test_data_url_for_1_4_3" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" @@ -868,21 +843,21 @@ test_divider echo "Update revocation point" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki update-revocation-point --vid=$vid_for_1_4 --certificate="$root_cert_with_vid_path" --label="$product_label_for_1_4" --data-url="$test_data_url_for_1_4/new" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki update-revocation-point --vid=$vid_for_1_4_3 --certificate="$root_cert_with_vid_path_for_1_4_3" --label="$product_label_for_1_4_3" --data-url="$test_data_url_for_1_4_3/new" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Delete revocation point" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki delete-revocation-point --vid=$vid_for_1_4 --label="$product_label_for_1_4" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki delete-revocation-point --vid=$vid_for_1_4_3 --label="$product_label_for_1_4_3" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Add new revocation point" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4 --revocation-type=1 --is-paa="true" --certificate="$root_cert_with_vid_path" --label="$product_label_for_1_4" --data-url="$test_data_url_for_1_4" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4_3 --revocation-type=1 --is-paa="true" --certificate="$root_cert_with_vid_path_for_1_4_3" --label="$product_label_for_1_4_3" --data-url="$test_data_url_for_1_4_3" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" @@ -890,14 +865,14 @@ test_divider echo "Add revocation point for CRL SIGNER CERTIFICATE delegated by PAI" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4 --is-paa="false" --certificate="$crl_signer_delegated_by_pai_1" --label="$product_label_for_1_4" --data-url="$test_data_url_for_1_4" --issuer-subject-key-id=$delegator_cert_with_vid_subject_key_id --revocation-type=1 --certificate-delegator="$delegator_cert_with_vid_65521_path" --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4_3 --is-paa="false" --certificate="$crl_signer_delegated_by_pai_1" --label="$product_label_for_1_4_3" --data-url="$test_data_url_for_1_4_3" --issuer-subject-key-id=$delegator_cert_with_vid_subject_key_id --revocation-type=1 --certificate-delegator="$delegator_cert_with_vid_65521_path" --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" test_divider echo "Update revocation point for CRL SIGNER CERTIFICATE delegated by PAI" -result=$(echo $passphrase | $DCLD_BIN_NEW tx pki update-revocation-point --vid=$vid_for_1_4 --certificate="$crl_signer_delegated_by_pai_1" --label="$product_label_for_1_4" --data-url="$test_data_url_for_1_4/new" --issuer-subject-key-id=$delegator_cert_with_vid_subject_key_id --certificate-delegator="$delegator_cert_with_vid_65521_path" --from=$vendor_account_for_1_4 --yes) +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki update-revocation-point --vid=$vid_for_1_4_3 --certificate="$crl_signer_delegated_by_pai_1" --label="$product_label_for_1_4_3" --data-url="$test_data_url_for_1_4_3/new" --issuer-subject-key-id=$delegator_cert_with_vid_subject_key_id --certificate-delegator="$delegator_cert_with_vid_65521_path" --from=$vendor_account_for_1_4_3 --yes) result=$(get_txn_result "$result") check_response "$result" "\"code\": 0" @@ -1059,134 +1034,134 @@ test_divider # VENDORINFO -echo "Verify if VendorInfo Record for VID: $vid_for_1_4 is present or not" -result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_4) -check_response "$result" "\"vendorID\": $vid_for_1_4" -check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4\"" +echo "Verify if VendorInfo Record for VID: $vid_for_1_4_3 is present or not" +result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_4_3) +check_response "$result" "\"vendorID\": $vid_for_1_4_3" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4_3\"" echo "Verify if VendorInfo Record for VID: $vid_for_1_2 updated or not" result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_2) check_response "$result" "\"vendorID\": $vid_for_1_2" check_response "$result" "\"vendorName\": \"$vendor_name_for_1_2\"" -check_response "$result" "\"companyPreferredName\": \"$company_preferred_name_for_1_4\"" -check_response "$result" "\"vendorLandingPageURL\": \"$vendor_landing_page_url_for_1_4\"" +check_response "$result" "\"companyPreferredName\": \"$company_preferred_name_for_1_4_3\"" +check_response "$result" "\"vendorLandingPageURL\": \"$vendor_landing_page_url_for_1_4_3\"" echo "Request all vendor infos" result=$($DCLD_BIN_NEW query vendorinfo all-vendors) -check_response "$result" "\"vendorID\": $vid_for_1_4" -check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4\"" -check_response "$result" "\"vendorName\": \"$vendor_name_for_1_4\"" +check_response "$result" "\"vendorID\": $vid_for_1_4_3" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4_3\"" +check_response "$result" "\"vendorName\": \"$vendor_name_for_1_4_3\"" test_divider # MODEL -echo "Get Model with VID: $vid_for_1_4 PID: $pid_1_for_1_4" -result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4 --pid=$pid_1_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"productLabel\": \"$product_label_for_1_4\"" +echo "Get Model with VID: $vid_for_1_4_3 PID: $pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_3\"" -echo "Get Model with VID: $vid_for_1_4 PID: $pid_2_for_1_4" -result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" -check_response "$result" "\"productLabel\": \"$product_label_for_1_4\"" +echo "Get Model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_3\"" -echo "Check Model with VID: $vid_for_1_4 PID: $pid_2_for_1_4 updated" +echo "Check Model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3 updated" result=$($DCLD_BIN_NEW query model get-model --vid=$vid --pid=$pid_2) check_response "$result" "\"vid\": $vid" check_response "$result" "\"pid\": $pid_2" -check_response "$result" "\"productLabel\": \"$product_label_for_1_4\"" -check_response "$result" "\"partNumber\": \"$part_number_for_1_4\"" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_3\"" +check_response "$result" "\"partNumber\": \"$part_number_for_1_4_3\"" -echo "Check Model version with VID: $vid_for_1_4 PID: $pid_2_for_1_4 updated" +echo "Check Model version with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3 updated" result=$($DCLD_BIN_NEW query model model-version --vid=$vid --pid=$pid_2 --softwareVersion=$software_version) check_response "$result" "\"vid\": $vid" check_response "$result" "\"pid\": $pid_2" -check_response "$result" "\"minApplicableSoftwareVersion\": $min_applicable_software_version_for_1_4" -check_response "$result" "\"maxApplicableSoftwareVersion\": $max_applicable_software_version_for_1_4" +check_response "$result" "\"minApplicableSoftwareVersion\": $min_applicable_software_version_for_1_4_3" +check_response "$result" "\"maxApplicableSoftwareVersion\": $max_applicable_software_version_for_1_4_3" echo "Get all models" result=$($DCLD_BIN_NEW query model all-models) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" echo "Get all model versions" -result=$($DCLD_BIN_NEW query model all-model-versions --vid=$vid_for_1_4 --pid=$pid_1_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" +result=$($DCLD_BIN_NEW query model all-model-versions --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" -echo "Get Vendor Models with VID: ${vid_for_1_4}" -result=$($DCLD_BIN_NEW query model vendor-models --vid=$vid_for_1_4) -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" +echo "Get Vendor Models with VID: ${vid_for_1_4_3}" +result=$($DCLD_BIN_NEW query model vendor-models --vid=$vid_for_1_4_3) +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" -echo "Get model version VID: $vid_for_1_4 PID: $pid_1_for_1_4" -result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --softwareVersion=$software_version_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"softwareVersion\": $software_version_for_1_4" +echo "Get model version VID: $vid_for_1_4_3 PID: $pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" -echo "Get model version VID: $vid_for_1_4 PID: $pid_2_for_1_4" -result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" -check_response "$result" "\"softwareVersion\": $software_version_for_1_4" +echo "Get model version VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" test_divider # COMPLIANCE -echo "Get certified model vid=$vid_for_1_4 pid=$pid_1_for_1_4" -result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --softwareVersion=$software_version_for_1_4 --certificationType=$certification_type_for_1_4) +echo "Get certified model vid=$vid_for_1_4_3 pid=$pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) check_response "$result" "\"value\": true" -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"softwareVersion\": $software_version_for_1_4" -check_response "$result" "\"certificationType\": \"$certification_type_for_1_4\"" - -echo "Get revoked Model with VID: $vid_for_1_4 PID: $pid_2_for_1_4" -result=$($DCLD_BIN_NEW query compliance revoked-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --certificationType=$certification_type_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" - -echo "Get certified model with VID: $vid_for_1_4 PID: $pid_1_for_1_4" -result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --softwareVersion=$software_version_for_1_4 --certificationType=$certification_type_for_1_4) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_3\"" + +echo "Get revoked Model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance revoked-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get certified model with VID: $vid_for_1_4_3 PID: $pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) check_response "$result" "\"value\": true" -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" -echo "Get provisional model with VID: $vid_for_1_4 PID: $pid_2_for_1_4" -result=$($DCLD_BIN_NEW query compliance provisional-model --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --certificationType=$certification_type_for_1_4) +echo "Get provisional model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance provisional-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) check_response "$result" "\"value\": false" -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" - -echo "Get compliance-info model with VID: $vid_for_1_4 PID: $pid_1_for_1_4" -result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4 --pid=$pid_1_for_1_4 --softwareVersion=$software_version_for_1_4 --certificationType=$certification_type_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"softwareVersion\": $software_version_for_1_4" -check_response "$result" "\"certificationType\": \"$certification_type_for_1_4\"" - -echo "Get compliance-info model with VID: $vid_for_1_4 PID: $pid_2_for_1_4" -result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4 --pid=$pid_2_for_1_4 --softwareVersion=$software_version_for_1_4 --certificationType=$certification_type_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" -check_response "$result" "\"softwareVersion\": $software_version_for_1_4" -check_response "$result" "\"certificationType\": \"$certification_type_for_1_4\"" - -echo "Get device software compliance cDCertificateId=$cd_certificate_id_for_1_4" -result=$($DCLD_BIN_NEW query compliance device-software-compliance --cdCertificateId=$cd_certificate_id_for_1_4) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get compliance-info model with VID: $vid_for_1_4_3 PID: $pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_3\"" + +echo "Get compliance-info model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_3\"" + +echo "Get device software compliance cDCertificateId=$cd_certificate_id_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance device-software-compliance --cdCertificateId=$cd_certificate_id_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" echo "Get all certified models" result=$($DCLD_BIN_NEW query compliance all-certified-models) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" echo "Get all provisional models" result=$($DCLD_BIN_NEW query compliance all-provisional-models) @@ -1195,93 +1170,107 @@ check_response "$result" "\"pid\": $pid_3" echo "Get all revoked models" result=$($DCLD_BIN_NEW query compliance all-revoked-models) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" echo "Get all compliance infos" result=$($DCLD_BIN_NEW query compliance all-compliance-info) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"pid\": $pid_2_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" echo "Get all device software compliances" result=$($DCLD_BIN_NEW query compliance all-device-software-compliance) -check_response "$result" "\"vid\": $vid_for_1_4" -check_response "$result" "\"pid\": $pid_1_for_1_4" -check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id_for_1_4\"" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id_for_1_4_3\"" test_divider # PKI echo "Get x509 root certificate" -result=$($DCLD_BIN_NEW query pki x509-cert --subject=$root_cert_with_vid_subject --subject-key-id=$root_cert_with_vid_subject_key_id) -check_response "$result" "\"subject\": \"$root_cert_with_vid_subject\"" -check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id\"" -check_response "$result" "\"vid\": $vid_for_1_4" +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$root_cert_with_vid_subject_for_1_4_3 --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"vid\": $vid_for_1_4_3" echo "Get all subject x509 root certificates" -result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$root_cert_with_vid_subject) -check_response "$result" "\"subject\": \"$root_cert_with_vid_subject\"" -check_response "$result" "$root_cert_with_vid_subject_key_id" +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$root_cert_with_vid_subject_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "$root_cert_with_vid_subject_key_id_for_1_4_3" echo "Get all x509 root certificates by SKID" -result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id=$root_cert_with_vid_subject_key_id) -check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id\"" -check_response "$result" "$root_cert_with_vid_subject" +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "$root_cert_with_vid_subject_for_1_4_3" echo "Get proposed x509 root certificate" -result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert --subject=$root_cert_subject --subject-key-id=$root_cert_subject_key_id) -check_response "$result" "\"subject\": \"$root_cert_subject\"" -check_response "$result" "\"subjectKeyId\": \"$root_cert_subject_key_id\"" -check_response "$result" "\"vid\": $vid_for_1_4" +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert --subject=$root_cert_subject_for_1_4_3 --subject-key-id=$root_cert_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_subject_key_id_for_1_4_3\"" +check_response "$result" "\"vid\": $vid_for_1_4_3" echo "Get revoked x509 certificate" -result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$intermediate_cert_with_vid_subject --subject-key-id=$intermediate_cert_with_vid_subject_key_id) -check_response "$result" "\"subject\": \"$intermediate_cert_with_vid_subject\"" -check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_with_vid_subject_key_id\"" -check_response "$result" "\"vid\": $intermediate_cert_with_vid_65521_vid" +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$intermediate_cert_with_vid_subject_for_1_4_3 --subject-key-id=$intermediate_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$intermediate_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"vid\": $intermediate_cert_with_vid_65521_vid_for_1_4_3" echo "Get proposed x509 root certificate to revoke" -result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert-to-revoke --subject=$root_cert_with_vid_subject --subject-key-id=$root_cert_with_vid_subject_key_id) -check_response "$result" "\"subject\": \"$root_cert_with_vid_subject\"" -check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id\"" +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert-to-revoke --subject=$root_cert_with_vid_subject_for_1_4_3 --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" echo "Get revocation point" -result=$($DCLD_BIN_NEW query pki revocation-point --vid=$vid_for_1_4 --label=$product_label_for_1_4 --issuer-subject-key-id=$issuer_subject_key_id) -check_response "$result" "\"vid\": $vid_for_1_4" +result=$($DCLD_BIN_NEW query pki revocation-point --vid=$vid_for_1_4_3 --label=$product_label_for_1_4_3 --issuer-subject-key-id=$issuer_subject_key_id) +check_response "$result" "\"vid\": $vid_for_1_4_3" check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" -check_response "$result" "\"label\": \"$product_label_for_1_4\"" -check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4\"" +check_response "$result" "\"label\": \"$product_label_for_1_4_3\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_3\"" echo "Get revocation points by issuer subject key id" result=$($DCLD_BIN_NEW query pki revocation-points --issuer-subject-key-id=$issuer_subject_key_id) -check_response "$result" "\"vid\": $vid_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" -check_response "$result" "\"label\": \"$product_label_for_1_4\"" -check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4\"" +check_response "$result" "\"label\": \"$product_label_for_1_4_3\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_3\"" echo "Get all revocation points" result=$($DCLD_BIN_NEW query pki all-revocation-points) -check_response "$result" "\"vid\": $vid_for_1_4" +check_response "$result" "\"vid\": $vid_for_1_4_3" check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" -check_response "$result" "\"label\": \"$product_label_for_1_4\"" -check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4\"" +check_response "$result" "\"label\": \"$product_label_for_1_4_3\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_3\"" + +echo "Get all certificates" +result=$(dcld query pki all-x509-certs) +check_response "$result" "\[\]" +response_does_not_contain "$result" "$noc_root_cert_1_subject_key_id_for_1_4_3" +response_does_not_contain "$result" "$noc_ica_cert_1_subject_key_id_for_1_4_3" + +echo "Get all noc x509 root certificates" +result=$($DCLD_BIN_NEW query pki noc-x509-root-certs --vid=$vid_for_1_4_3) +check_response "$result" "Not Found" +response_does_not_contain "$result" "$noc_root_cert_1_subject_key_id_for_1_4_3" -echo "Get all noc x509 root certificates by vid $vid_for_1_4" -result=$($DCLD_BIN_NEW query pki noc-x509-root-certs --vid=$vid_for_1_4) -check_response "$result" "\"subject\": \"$noc_root_cert_2_subject\"" -check_response "$result" "$noc_root_cert_2_subject_key_id" +echo "Get all noc x509 root certificates by vid=$vid_for_1_4_3 and skid=$noc_root_cert_1_subject_key_id_for_1_4_3 (must be empty)" +result=$($DCLD_BIN_NEW query pki noc-x509-certs --vid=$vid_for_1_4_3 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_3) +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject_for_1_4_3\"" +response_does_not_contain "$result" "$noc_root_cert_1_subject_key_id_for_1_4_3" -echo "Get all noc x509 root certificates by vid=$vid_for_1_4 and skid=$noc_root_cert_2_subject_key_id" -result=$($DCLD_BIN_NEW query pki noc-x509-certs --vid=$vid_for_1_4 --subject-key-id=$noc_root_cert_2_subject_key_id) -check_response "$result" "\"subject\": \"$noc_root_cert_2_subject\"" -check_response "$result" "$noc_root_cert_2_subject_key_id" +echo "Get noc x509 root certificate by subject and subject key id" +result=$(dcld query pki noc-x509-cert --subject="$noc_root_cert_1_subject_for_1_4_3" --subject-key-id="$noc_root_cert_1_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject_for_1_4_3\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_3\"" -echo "Get all noc x509 root certificates by vid $vid_for_1_4 and skid=$noc_ica_cert_2_subject_key_id" -result=$($DCLD_BIN_NEW query pki noc-x509-certs --vid=$vid_for_1_4 --subject-key-id=$noc_ica_cert_2_subject_key_id) -check_response "$result" "\"subject\": \"$noc_ica_cert_2_subject\"" -check_response "$result" "$noc_ica_cert_2_subject_key_id" +echo "Get noc x509 ica certificate by subject and subject key id" +result=$(dcld query pki noc-x509-cert --subject="$noc_ica_cert_1_subject_for_1_4_3" --subject-key-id="$noc_ica_cert_1_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subject\": \"$noc_ica_cert_1_subject_for_1_4_3\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_3\"" test_divider @@ -1330,7 +1319,7 @@ check_response "$result" "\"owner\": \"$validator_address\"" test_divider -echo "Upgrade from 1.2 to 1.4 passed" +echo "Upgrade from 1.2 to 1.4.3 passed" rm -f $DCLD_BIN_OLD rm -f $DCLD_BIN_NEW diff --git a/integration_tests/upgrade/04-test-upgrade-1.4.3-to-1.4.4.sh b/integration_tests/upgrade/04-test-upgrade-1.4.3-to-1.4.4.sh new file mode 100755 index 000000000..ee30f1f21 --- /dev/null +++ b/integration_tests/upgrade/04-test-upgrade-1.4.3-to-1.4.4.sh @@ -0,0 +1,1632 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +source integration_tests/cli/common.sh + +# Upgrade constants + +plan_name="v1.4.4" +upgrade_checksum="sha256:d196eafbe663658ac6efc9f4147e28ac9a41a9bcea348c105bedb589fb2a10e4" +binary_version_old="v1.4.3" +binary_version_new="v1.4.4-2-dev" + +wget -O dcld_old "https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/$binary_version_old/dcld" +chmod ugo+x dcld_old + +wget -O dcld_new "https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/$binary_version_new/dcld" +chmod ugo+x dcld_new + +DCLD_BIN_OLD="./dcld_old" +DCLD_BIN_NEW="./dcld_new" +$DCLD_BIN_NEW config broadcast-mode sync +######################################################################################## + +# Upgrade to version 1.4 + +get_height current_height +echo "Current height is $current_height" + +plan_height=$(expr $current_height \+ 20) + +test_divider + +echo "Propose upgrade $plan_name at height $plan_height" +echo "https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/$binary_version_new/dcld?checksum=$upgrade_checksum" +result=$(echo $passphrase | $DCLD_BIN_OLD tx dclupgrade propose-upgrade --name=$plan_name --upgrade-height=$plan_height --upgrade-info="{\"binaries\":{\"linux/amd64\":\"https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/$binary_version_new/dcld?checksum=$upgrade_checksum\"}}" --from $trustee_account_1 --yes) +echo "$result" +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve upgrade $plan_name" +result=$(echo $passphrase | $DCLD_BIN_OLD tx dclupgrade approve-upgrade --name $plan_name --from $trustee_account_2 --yes) +echo "$result" +check_response "$result" "\"code\": 0" + +echo "Approve upgrade $plan_name" +result=$(echo $passphrase | $DCLD_BIN_OLD tx dclupgrade approve-upgrade --name $plan_name --from $trustee_account_3 --yes) +echo "$result" +check_response "$result" "\"code\": 0" + +echo "Approve upgrade $plan_name" +result=$(echo $passphrase | $DCLD_BIN_OLD tx dclupgrade approve-upgrade --name $plan_name --from $trustee_account_4 --yes) +echo "$result" +check_response "$result" "\"code\": 0" + +test_divider + +echo "Wait for block height to become greater than upgrade $plan_name plan height" +wait_for_height $(expr $plan_height + 1) 300 outage-safe + +test_divider + +echo "Verify that no upgrade has been scheduled anymore" +result=$($DCLD_BIN_NEW query upgrade plan 2>&1) || true +check_response_and_report "$result" "no upgrade scheduled" raw + +test_divider + +echo "Verify that upgrade is applied" +result=$($DCLD_BIN_NEW query upgrade applied $plan_name) +echo "$result" + +test_divider + +######################################################################################## + +echo "Verify that old data is not corrupted" + +test_divider + +# VENDORINFO + +echo "Verify if VendorInfo Record for VID: $vid is present or not" +result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid) +check_response "$result" "\"vendorID\": $vid" +check_response "$result" "\"companyLegalName\": \"$company_legal_name\"" +check_response "$result" "\"vendorName\": \"$vendor_name\"" +check_response "$result" "\"companyPreferredName\": \"$company_preferred_name_for_1_2\"" +check_response "$result" "\"vendorLandingPageURL\": \"$vendor_landing_page_url_for_1_2\"" + +echo "Verify if VendorInfo Record for VID: $vid_for_1_2 is present or not" +result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_2) +check_response "$result" "\"vendorID\": $vid_for_1_2" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_2\"" + +echo "Verify if VendorInfo Record for VID: $vid_for_1_4_3 is present or not" +result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_4_3) +check_response "$result" "\"vendorID\": $vid_for_1_4_3" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4_3\"" + +echo "Request all vendor infos" +result=$($DCLD_BIN_NEW query vendorinfo all-vendors) +check_response "$result" "\"vendorID\": $vid" +check_response "$result" "\"vendorID\": $vid_for_1_2" +check_response "$result" "\"vendorID\": $vid_for_1_4_3" +check_response "$result" "\"companyLegalName\": \"$company_legal_name\"" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_2\"" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4_3\"" +check_response "$result" "\"vendorName\": \"$vendor_name\"" +check_response "$result" "\"vendorName\": \"$vendor_name_for_1_2\"" +check_response "$result" "\"vendorName\": \"$vendor_name_for_1_4_3\"" + +test_divider + +# MODEL + +echo "Get Model with VID: $vid PID: $pid_1" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid --pid=$pid_1) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"productLabel\": \"$product_label\"" + +echo "Get Model with VID: $vid PID: $pid_2" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid --pid=$pid_2) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_3\"" +check_response "$result" "\"partNumber\": \"$part_number_for_1_4_3\"" + +echo "Get Model with VID: $vid_for_1_2 PID: $pid_1_for_1_2" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_2 --pid=$pid_1_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"productLabel\": \"$product_label_for_1_2\"" + +echo "Get Model with VID: $vid_for_1_2 PID: $pid_2_for_1_2" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_2 --pid=$pid_2_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" +check_response "$result" "\"productLabel\": \"$product_label_for_1_2\"" + +echo "Get Model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_3\"" + +echo "Get all models" +result=$($DCLD_BIN_NEW query model all-models) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get Vendor Models with VID: ${vid}" +result=$($DCLD_BIN_NEW query model vendor-models --vid=$vid) +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"pid\": $pid_2" + +echo "Get Vendor Models with VID: ${vid_for_1_2}" +result=$($DCLD_BIN_NEW query model vendor-models --vid=$vid_for_1_2) +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" + +echo "Get Vendor Models with VID: ${vid_for_1_2}" +result=$($DCLD_BIN_NEW query model vendor-models --vid=$vid_for_1_4_3) +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get model version VID: $vid PID: $pid_1" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid --pid=$pid_1 --softwareVersion=$software_version) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"softwareVersion\": $software_version" + +echo "Get model version VID: $vid PID: $pid_2 updated" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid --pid=$pid_2 --softwareVersion=$software_version) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"softwareVersion\": $software_version" +check_response "$result" "\"minApplicableSoftwareVersion\": $min_applicable_software_version_for_1_4_3" +check_response "$result" "\"maxApplicableSoftwareVersion\": $max_applicable_software_version_for_1_4_3" + +echo "Get model version VID: $vid_for_1_2 PID: $pid_1_for_1_2" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_2 --pid=$pid_1_for_1_2 --softwareVersion=$software_version_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"softwareVersion\": $software_version_for_1_2" + +echo "Get model version VID: $vid_for_1_2 PID: $pid_2_for_1_2" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_2 --pid=$pid_2_for_1_2 --softwareVersion=$software_version_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" +check_response "$result" "\"softwareVersion\": $software_version_for_1_2" + +echo "Get model version VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" + +test_divider + +# COMPLIANCE + +echo "Get certified model vid=$vid pid=$pid_1" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid --pid=$pid_1 --softwareVersion=$software_version --certificationType=$certification_type) +check_response "$result" "\"value\": true" +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"softwareVersion\": $software_version" +check_response "$result" "\"certificationType\": \"$certification_type\"" + +echo "Get certified model vid=$vid_for_1_2 pid=$pid_1_for_1_2" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_2 --pid=$pid_1_for_1_2 --softwareVersion=$software_version_for_1_2 --certificationType=$certification_type_for_1_2) +check_response "$result" "\"value\": true" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"softwareVersion\": $software_version_for_1_2" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_2\"" + +echo "Get certified model vid=$vid_for_1_4_3 pid=$pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"value\": true" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_3\"" + +echo "Get revoked Model with VID: $vid PID: $pid_2" +result=$($DCLD_BIN_NEW query compliance revoked-model --vid=$vid --pid=$pid_2 --softwareVersion=$software_version --certificationType=$certification_type) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_2" + +echo "Get revoked Model with VID: $vid_for_1_2 PID: $pid_2_for_1_2" +result=$($DCLD_BIN_NEW query compliance revoked-model --vid=$vid_for_1_2 --pid=$pid_2_for_1_2 --softwareVersion=$software_version_for_1_2 --certificationType=$certification_type_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" + +echo "Get revoked Model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance revoked-model --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get provisional model with VID: $vid PID: $pid_3" +result=$($DCLD_BIN_NEW query compliance provisional-model --vid=$vid --pid=$pid_3 --softwareVersion=$software_version --certificationType=$certification_type) +check_response "$result" "\"value\": true" +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_3" + +echo "Get provisional model with VID: $vid_for_1_2 PID: $pid_2_for_1_2" +result=$($DCLD_BIN_NEW query compliance provisional-model --vid=$vid_for_1_2 --pid=$pid_2_for_1_2 --softwareVersion=$software_version_for_1_2 --certificationType=$certification_type_for_1_2) +check_response "$result" "\"value\": false" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" + +echo "Get compliance-info model with VID: $vid_for_1_2 PID: $pid_1_for_1_2" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_2 --pid=$pid_1_for_1_2 --softwareVersion=$software_version_for_1_2 --certificationType=$certification_type_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"softwareVersion\": $software_version_for_1_2" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_2\"" + +echo "Get compliance-info model with VID: $vid_for_1_4_3 PID: $pid_1_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4_3 --pid=$pid_1_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_3\"" + +echo "Get compliance-info model with VID: $vid PID: $pid_1" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid --pid=$pid_1 --softwareVersion=$software_version --certificationType=$certification_type) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"softwareVersion\": $software_version" +check_response "$result" "\"certificationType\": \"$certification_type\"" + +echo "Get compliance-info model with VID: $vid_for_1_2 PID: $pid_2_for_1_2" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_2 --pid=$pid_2_for_1_2 --softwareVersion=$software_version_for_1_2 --certificationType=$certification_type_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" +check_response "$result" "\"softwareVersion\": $software_version_for_1_2" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_2\"" + +echo "Get compliance-info model with VID: $vid_for_1_4_3 PID: $pid_2_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4_3 --pid=$pid_2_for_1_4_3 --softwareVersion=$software_version_for_1_4_3 --certificationType=$certification_type_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_3" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_3\"" + +echo "Get device software compliance cDCertificateId=$cd_certificate_id" +result=$($DCLD_BIN_NEW query compliance device-software-compliance --cdCertificateId=$cd_certificate_id) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" + +echo "Get device software compliance cDCertificateId=$cd_certificate_id_for_1_2" +result=$($DCLD_BIN_NEW query compliance device-software-compliance --cdCertificateId=$cd_certificate_id_for_1_2) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" + +echo "Get device software compliance cDCertificateId=$cd_certificate_id_for_1_4_3" +result=$($DCLD_BIN_NEW query compliance device-software-compliance --cdCertificateId=$cd_certificate_id_for_1_4_3) +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" + +echo "Get all certified models" +result=$($DCLD_BIN_NEW query compliance all-certified-models) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" + +echo "Get all provisional models" +result=$($DCLD_BIN_NEW query compliance all-provisional-models) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_3" + +echo "Get all revoked models" +result=$($DCLD_BIN_NEW query compliance all-revoked-models) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get all compliance infos" +result=$($DCLD_BIN_NEW query compliance all-compliance-info) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"pid\": $pid_2_for_1_2" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"pid\": $pid_2_for_1_4_3" + +echo "Get all device software compliances" +result=$($DCLD_BIN_NEW query compliance all-device-software-compliance) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_1" +check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id\"" +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"pid\": $pid_1_for_1_2" +check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id_for_1_2\"" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"pid\": $pid_1_for_1_4_3" +check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id_for_1_4_3\"" + +test_divider + +# PKI + +echo "Get all x509 certificates" + +echo "Get all x509 certificates (GLOBAL)" +result=$($DCLD_BIN_NEW query pki all-certs) +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_for_1_4_3\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_3\"" + +echo "Get all x509 certificates (DA)" +result=$($DCLD_BIN_NEW query pki all-x509-certs) +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_for_1_4_3\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_3\"" + +echo "Get all x509 certificates (NOC)" +result=$($DCLD_BIN_NEW query pki all-noc-x509-certs) +check_response "$result" "\[\]" +response_does_not_contain "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_for_1_4_3\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_3\"" + +echo "Get subject certificates (GLOBAL)" +result=$($DCLD_BIN_NEW query pki all-subject-certs --subject=$root_cert_with_vid_subject_for_1_4_3) +check_response "$result" "$root_cert_with_vid_subject_key_id_for_1_4_3" + +result=$($DCLD_BIN_NEW query pki all-subject-certs --subject=$test_root_cert_subject_for_1_2) +check_response "$result" "$test_root_cert_subject_key_id_for_1_2" + +result=$($DCLD_BIN_NEW query pki all-subject-certs --subject=$test_root_cert_subject) +check_response "$result" "$test_root_cert_subject_key_id" + +result=$($DCLD_BIN_NEW query pki all-subject-certs --subject=$noc_root_cert_1_subject_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get subject certificates (DA)" +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$root_cert_with_vid_subject_for_1_4_3) +check_response "$result" "$root_cert_with_vid_subject_key_id_for_1_4_3" + +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$test_root_cert_subject_for_1_2) +check_response "$result" "$test_root_cert_subject_key_id_for_1_2" + +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$test_root_cert_subject) +check_response "$result" "$test_root_cert_subject_key_id" + +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$noc_root_cert_1_subject_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get subject certificates (NOC)" +result=$($DCLD_BIN_NEW query pki all-noc-subject-x509-certs --subject=$root_cert_with_vid_subject_for_1_4_3) +check_response "$result" "Not Found" + +result=$($DCLD_BIN_NEW query pki all-noc-subject-x509-certs --subject=$test_root_cert_subject_for_1_2) +check_response "$result" "Not Found" + +result=$($DCLD_BIN_NEW query pki all-noc-subject-x509-certs --subject=$test_root_cert_subject) +check_response "$result" "Not Found" + +result=$($DCLD_BIN_NEW query pki all-noc-subject-x509-certs --subject=$noc_root_cert_1_subject_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get x509 certificates" + +echo "Get x509 certificate (GLOBAL)" +result=$($DCLD_BIN_NEW query pki cert --subject=$root_cert_with_vid_subject_for_1_4_3 --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"vid\": $root_cert_vid_for_1_4_3" + +result=$($DCLD_BIN_NEW query pki cert --subject=$test_root_cert_subject_for_1_2 --subject-key-id=$test_root_cert_subject_key_id_for_1_2) +check_response "$result" "\"subject\": \"$test_root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"vid\": $test_root_cert_vid_for_1_2" + +result=$($DCLD_BIN_NEW query pki cert --subject=$test_root_cert_subject --subject-key-id=$test_root_cert_subject_key_id) +check_response "$result" "\"subject\": \"$test_root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" +check_response "$result" "\"vid\": $test_root_cert_vid" + +result=$($DCLD_BIN_NEW query pki cert --subject=$noc_root_cert_1_subject_for_1_4_3 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get x509 certificate (DA)" +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$root_cert_with_vid_subject_for_1_4_3 --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"vid\": $root_cert_vid_for_1_4_3" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$test_root_cert_subject_for_1_2 --subject-key-id=$test_root_cert_subject_key_id_for_1_2) +check_response "$result" "\"subject\": \"$test_root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"vid\": $test_root_cert_vid_for_1_2" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$test_root_cert_subject --subject-key-id=$test_root_cert_subject_key_id) +check_response "$result" "\"subject\": \"$test_root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" +check_response "$result" "\"vid\": $test_root_cert_vid" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$noc_root_cert_1_subject_for_1_4_3 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get x509 certificate (NOC)" +result=$(dcld query pki noc-x509-cert --subject="$root_cert_with_vid_subject_for_1_4_3" --subject-key-id="$root_cert_with_vid_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" + +result=$(dcld query pki noc-x509-cert --subject="$test_root_cert_subject_for_1_2" --subject-key-id="$test_root_cert_subject_key_id_for_1_2") +check_response "$result" "Not Found" + +result=$(dcld query pki noc-x509-cert --subject="$test_root_cert_subject" --subject-key-id="$test_root_cert_subject_key_id") +check_response "$result" "Not Found" + +result=$(dcld query pki noc-x509-cert --subject="$noc_root_cert_1_subject_for_1_4_3" --subject-key-id="$noc_root_cert_1_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" + +echo "Get all x509 certificates by subjectKeyId" +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id="$root_cert_with_vid_subject_key_id_for_1_4_3") +check_response "$result" "$root_cert_with_vid_subject_for_1_4_3" +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id="$test_root_cert_subject_key_id_for_1_2") +check_response "$result" "$test_root_cert_subject_for_1_2" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id="$test_root_cert_subject_key_id") +check_response "$result" "$test_root_cert_subject" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id="$noc_root_cert_1_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" + +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert --subject=$google_root_cert_subject_for_1_2 --subject-key-id=$google_root_cert_subject_key_id_for_1_2) +check_response "$result" "\"subject\": \"$google_root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$google_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"vid\": $google_root_cert_path_random_vid_for_1_2" + +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert --subject=$google_root_cert_subject --subject-key-id=$google_root_cert_subject_key_id) +check_response "$result" "\"subject\": \"$google_root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$google_root_cert_subject_key_id\"" + +echo "Get revoked x509 certificate" +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$intermediate_cert_with_vid_subject_for_1_4_3 --subject-key-id=$intermediate_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$intermediate_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_with_vid_subject_key_id_for_1_4_3\"" +check_response "$result" "\"vid\": $intermediate_cert_with_vid_65521_vid_for_1_4_3" + +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$intermediate_cert_subject_for_1_2 --subject-key-id=$intermediate_cert_subject_key_id_for_1_2) +check_response "$result" "\"subject\": \"$intermediate_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_subject_key_id_for_1_2\"" + +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$intermediate_cert_subject --subject-key-id=$intermediate_cert_subject_key_id) +check_response "$result" "\"subject\": \"$intermediate_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$intermediate_cert_subject_key_id\"" + +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$noc_root_cert_1_subject_for_1_4_3 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get proposed x509 root certificate to revoke" +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert-to-revoke --subject=$root_cert_with_vid_subject_for_1_4_3 --subject-key-id=$root_cert_with_vid_subject_key_id_for_1_4_3) +check_response "$result" "\"subject\": \"$root_cert_with_vid_subject_for_1_4_3\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_with_vid_subject_key_id_for_1_4_3\"" + +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert-to-revoke --subject=$test_root_cert_subject_for_1_2 --subject-key-id=$test_root_cert_subject_key_id_for_1_2) +check_response "$result" "\"subject\": \"$test_root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" + +result=$($DCLD_BIN_NEW query pki proposed-x509-root-cert-to-revoke --subject=$test_root_cert_subject --subject-key-id=$test_root_cert_subject_key_id) +check_response "$result" "\"subject\": \"$test_root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" + +echo "Get revocation point" +result=$($DCLD_BIN_NEW query pki revocation-point --vid=$vid_for_1_2 --label=$product_label_for_1_2 --issuer-subject-key-id=$issuer_subject_key_id) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" +check_response "$result" "\"label\": \"$product_label_for_1_2\"" +check_response "$result" "\"dataURL\": \"$test_data_url\"" + +echo "Get revocation points by issuer subject key id" +result=$($DCLD_BIN_NEW query pki revocation-points --issuer-subject-key-id=$issuer_subject_key_id) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" +check_response "$result" "\"label\": \"$product_label_for_1_2\"" +check_response "$result" "\"dataURL\": \"$test_data_url\"" + +echo "Get all proposed x509 root certificates" +result=$($DCLD_BIN_NEW query pki all-proposed-x509-root-certs) +check_response "$result" "\"subject\": \"$google_root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$google_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"subject\": \"$google_root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$google_root_cert_subject_key_id\"" + +echo "Get all revoked x509 root certificates" +result=$($DCLD_BIN_NEW query pki all-revoked-x509-root-certs) +check_response "$result" "\"subject\": \"$root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"subject\": \"$root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$root_cert_subject_key_id\"" + +echo "Get all proposed x509 root certificates to revoke" +result=$($DCLD_BIN_NEW query pki all-proposed-x509-root-certs-to-revoke) +check_response "$result" "\"subject\": \"$test_root_cert_subject_for_1_2\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id_for_1_2\"" +check_response "$result" "\"subject\": \"$test_root_cert_subject\"" +check_response "$result" "\"subjectKeyId\": \"$test_root_cert_subject_key_id\"" + +echo "Get all revocation points" +result=$($DCLD_BIN_NEW query pki all-revocation-points) +check_response "$result" "\"vid\": $vid_for_1_2" +check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" +check_response "$result" "\"label\": \"$product_label_for_1_2\"" +check_response "$result" "\"dataURL\": \"$test_data_url\"" +check_response "$result" "\"vid\": $vid_for_1_4_3" +check_response "$result" "\"label\": \"$product_label_for_1_4_3\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_3\"" + +echo "Get all noc certificates" +result=$(dcld query pki all-noc-x509-certs) +check_response "$result" "\[\]" +response_does_not_contain "$result" "$noc_root_cert_1_subject_key_id_for_1_4_3" +response_does_not_contain "$result" "$noc_ica_cert_1_subject_key_id_for_1_4_3" + +echo "Get all noc x509 root certificates" +result=$($DCLD_BIN_NEW query pki noc-x509-root-certs --vid=$vid_for_1_4_3) +check_response "$result" "Not Found" +response_does_not_contain "$result" "$noc_root_cert_1_subject_key_id_for_1_4_3" + +echo "Get all noc x509 root certificates by vid=$vid_for_1_4_3 and skid=$noc_root_cert_1_subject_key_id_for_1_4_3 (must be empty)" +result=$($DCLD_BIN_NEW query pki noc-x509-certs --vid=$vid_for_1_4_3 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_3) +check_response "$result" "Not Found" + +echo "Get noc x509 root certificate by subject and subject key id" +result=$(dcld query pki noc-x509-cert --subject="$noc_root_cert_1_subject_for_1_4_3" --subject-key-id="$noc_root_cert_1_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_3\"" + +echo "Get noc x509 ica certificate by subject and subject key id" +result=$(dcld query pki noc-x509-cert --subject="$noc_ica_cert_1_subject_for_1_4_3" --subject-key-id="$noc_ica_cert_1_subject_key_id_for_1_4_3") +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_3\"" + +test_divider + +# AUTH + +echo "Get all accounts" +result=$($DCLD_BIN_NEW query auth all-accounts) +check_response "$result" "\"address\": \"$user_5_address\"" +check_response "$result" "\"address\": \"$user_2_address\"" + +echo "Get account" +result=$($DCLD_BIN_NEW query auth account --address=$user_5_address) +check_response "$result" "\"address\": \"$user_5_address\"" + +result=$($DCLD_BIN_NEW query auth account --address=$user_2_address) +check_response "$result" "\"address\": \"$user_2_address\"" + +echo "Get all proposed accounts" +result=$($DCLD_BIN_NEW query auth all-proposed-accounts) +check_response "$result" "\"address\": \"$user_6_address\"" +check_response "$result" "\"address\": \"$user_3_address\"" + +echo "Get proposed account" +result=$($DCLD_BIN_NEW query auth proposed-account --address=$user_6_address) +check_response "$result" "\"address\": \"$user_6_address\"" + +result=$($DCLD_BIN_NEW query auth proposed-account --address=$user_3_address) +check_response "$result" "\"address\": \"$user_3_address\"" + +echo "Get all proposed accounts to revoke" +result=$($DCLD_BIN_NEW query auth all-proposed-accounts-to-revoke) +check_response "$result" "\"address\": \"$user_5_address\"" +check_response "$result" "\"address\": \"$user_2_address\"" + +echo "Get proposed account to revoke" +result=$($DCLD_BIN_NEW query auth proposed-account-to-revoke --address=$user_5_address) +check_response "$result" "\"address\": \"$user_5_address\"" + +result=$($DCLD_BIN_NEW query auth proposed-account-to-revoke --address=$user_2_address) +check_response "$result" "\"address\": \"$user_2_address\"" + +echo "Get all revoked accounts" +result=$($DCLD_BIN_NEW query auth all-revoked-accounts) +check_response "$result" "\"address\": \"$user_4_address\"" +check_response "$result" "\"address\": \"$user_1_address\"" + +echo "Get revoked account" +result=$($DCLD_BIN_NEW query auth revoked-account --address=$user_4_address) +check_response "$result" "\"address\": \"$user_4_address\"" + +result=$($DCLD_BIN_NEW query auth revoked-account --address=$user_1_address) +check_response "$result" "\"address\": \"$user_1_address\"" + +test_divider + +# Validator + +echo "Get node" +# FIXME: use proper binary (not dcld but $DCLD_BIN_OLD) +result=$(docker exec "$container" /bin/sh -c "echo test1234 | dcld query validator all-nodes") +check_response "$result" "\"owner\": \"$validator_address\"" + +######################################################################################## + +# after upgrade constants + +vid_for_1_4_4=65522 +pid_1_for_1_4_4=77 +pid_2_for_1_4_4=88 +pid_3_for_1_4_4=99 +device_type_id_for_1_4_4=4433 +product_name_for_1_4_4="ProductName1.4.4" +product_label_for_1_4_4="ProductLabel1.4.4" +part_number_for_1_4_4="RCU2245B" +software_version_for_1_4_4=2 +software_version_string_for_1_4_4="4.0" +cd_version_number_for_1_4_4=513 +min_applicable_software_version_for_1_4_4=4 +max_applicable_software_version_for_1_4_4=4000 + +certification_type_for_1_4_4="matter" +certification_date_for_1_4_4="2023-01-01T00:00:00Z" +provisional_date_for_1_4_4="2014-12-12T00:00:00Z" +cd_certificate_id_for_1_4_4="20DEXC" + +da_root_cert_1_path_for_1_4_4="integration_tests/constants/upgrade_1_4_4_da_root_cert" +da_root_cert_1_subject_for_1_4_4="MEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQ=" +da_root_cert_1_subject_key_id_for_1_4_4="A8:A0:95:18:9B:9F:81:4D:C7:9F:5E:B5:82:09:27:95:13:0C:9F:87" + +da_intermediate_cert_1_path_for_1_4_4="integration_tests/constants/upgrade_1_4_4_da_intermediate_cert" +da_intermediate_cert_1_subject_for_1_4_4="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMw==" +da_intermediate_cert_1_subject_key_id_for_1_4_4="A8:A0:95:18:9B:9F:81:4D:C7:9F:5E:B5:82:09:27:95:13:0C:9F:87" +da_intermediate_cert_1_serial_number_for_1_4_4="3" + +da_root_cert_2_path_for_1_4_4="integration_tests/constants/upgrade_1_4_4_da_root_cert_2" +da_root_cert_2_subject_for_1_4_4="MDsxCzAJBgNVBAYTAlRFMRMwEQYDVQQIDApTb21lLVN0YXRlMRcwFQYDVQQKDA5VcGdyYWRlMS40LjRfMQ==" +da_root_cert_2_subject_key_id_for_1_4_4="A8:A0:95:18:9B:9F:81:4D:C7:9F:5E:B5:82:09:27:95:13:0C:9F:87" + +da_intermediate_cert_2_path_for_1_4_4="integration_tests/constants/upgrade_1_4_4_da_intermediate_cert_2" +da_intermediate_cert_2_subject_for_1_4_4="MIGBMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRMwEQYDVQQDDApEQS1jaGlsZC0z" +da_intermediate_cert_2_subject_key_id_for_1_4_4="A8:A0:95:18:9B:9F:81:4D:C7:9F:5E:B5:82:09:27:95:13:0C:9F:87" +da_intermediate_cert_2_serial_number_for_1_4_4="3" +da_intermediate_cert_2_vid_for_1_4_4=65521 + +noc_root_cert_1_path_for_1_4_4="integration_tests/constants/noc_root_cert_2" +noc_root_cert_1_subject_for_1_4_4="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMg==" +noc_root_cert_1_subject_key_id_for_1_4_4="CF:E6:DD:37:2B:4C:B2:B9:A9:F2:75:30:1C:AA:B1:37:1B:11:7F:1B" + +noc_ica_cert_1_path_for_1_4_4="integration_tests/constants/noc_cert_2" +noc_ica_cert_1_subject_for_1_4_4="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMg==" +noc_ica_cert_1_subject_key_id_for_1_4_4="87:48:A2:33:12:1F:51:5C:93:E6:90:40:4A:2C:AB:9E:D6:19:E5:AD" + +noc_root_cert_2_path_for_1_4_4="integration_tests/constants/noc_root_cert_3" +noc_root_cert_2_subject_for_1_4_4="MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0z" +noc_root_cert_2_subject_key_id_for_1_4_4="88:0D:06:D9:64:22:29:34:78:7F:8C:3B:AE:F5:08:93:86:8F:0D:20" + +noc_ica_cert_2_path_for_1_4_4="integration_tests/constants/noc_cert_3" +noc_ica_cert_2_subject_for_1_4_4="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMw==" +noc_ica_cert_2_subject_key_id_for_1_4_4="DE:F9:1D:90:D5:A1:0F:23:59:5C:3F:5C:C7:2D:31:58:2F:A8:79:33" + +test_data_url_for_1_4_4="https://url.data.dclmodel-1.4.4" + +vendor_name_for_1_4_4="Vendor65522" +company_legal_name_for_1_4_4="LegalCompanyName65522" +company_preferred_name_for_1_4_4="CompanyPreferredName65522" +vendor_landing_page_url_for_1_4_4="https://www.new65522example.com" + +vendor_account_for_1_4_4="vendor_account_65522" + +echo "Create Vendor account $vendor_account_for_1_4_4" + +result="$(echo $passphrase | $DCLD_BIN_NEW keys add "$vendor_account_for_1_4_4")" +echo "keys add $result" +_address=$(echo $passphrase | $DCLD_BIN_NEW keys show $vendor_account_for_1_4_4 -a) +_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $vendor_account_for_1_4_4 -p) +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --vid="$vid_for_1_4_4" --roles="Vendor" --from "$trustee_account_1" --yes) +echo "propose-add-account $result" +result=$(get_txn_result "$result") +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-add-account --address="$_address" --from "$trustee_account_2" --yes) +result=$(get_txn_result "$result") +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-add-account --address="$_address" --from "$trustee_account_3" --yes) +result=$(get_txn_result "$result") +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-add-account --address="$_address" --from "$trustee_account_4" --yes) +result=$(get_txn_result "$result") + +random_string user_10 +echo "$user_10 generates keys" +cmd="(echo $passphrase; echo $passphrase) | $DCLD_BIN_NEW keys add $user_10" +result="$(bash -c "$cmd")" +user_10_address=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_10 -a) +user_10_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_10 -p) + +random_string user_11 +echo "$user_11 generates keys" +cmd="(echo $passphrase; echo $passphrase) | $DCLD_BIN_NEW keys add $user_11" +result="$(bash -c "$cmd")" +user_11_address=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_11 -a) +user_11_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_11 -p) + +random_string user_12 +echo "$user_12 generates keys" +cmd="(echo $passphrase; echo $passphrase) | $DCLD_BIN_NEW keys add $user_12" +result="$(bash -c "$cmd")" +user_12_address=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_12 -a) +user_12_pubkey=$(echo $passphrase | $DCLD_BIN_NEW keys show $user_12 -p) + +# send all ledger update transactions after upgrade + +# VENDOR_INFO +echo "Add vendor $vendor_name_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx vendorinfo add-vendor --vid=$vid_for_1_4_4 --vendorName=$vendor_name_for_1_4_4 --companyLegalName=$company_legal_name_for_1_4_4 --companyPreferredName=$company_preferred_name_for_1_4_4 --vendorLandingPageURL=$vendor_landing_page_url_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Update vendor $vendor_name_for_1_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx vendorinfo update-vendor --vid=$vid_for_1_2 --vendorName=$vendor_name_for_1_2 --companyLegalName=$company_legal_name_for_1_2 --companyPreferredName=$company_preferred_name_for_1_4_4 --vendorLandingPageURL=$vendor_landing_page_url_for_1_4_4 --from=$vendor_account_for_1_2 --yes) +result=$(get_txn_result "$result") +echo $result +check_response "$result" "\"code\": 0" + +test_divider + +# MODEL and MODEL_VERSION + +echo "Add model vid=$vid_for_1_4_4 pid=$pid_1_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --deviceTypeID=$device_type_id_for_1_4_4 --productName=$product_name_for_1_4_4 --productLabel=$product_label_for_1_4_4 --partNumber=$part_number_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add model version vid=$vid_for_1_4_4 pid=$pid_1_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --cdVersionNumber=$cd_version_number_for_1_4_4 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add model vid=$vid_for_1_4_4 pid=$pid_2_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --deviceTypeID=$device_type_id_for_1_4_4 --productName=$product_name_for_1_4_4 --productLabel=$product_label_for_1_4_4 --partNumber=$part_number_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add model version vid=$vid_for_1_4_4 pid=$pid_2_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --cdVersionNumber=$cd_version_number_for_1_4_4 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add model vid=$vid_for_1_4_4 pid=$pid_3_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model --vid=$vid_for_1_4_4 --pid=$pid_3_for_1_4_4 --deviceTypeID=$device_type_id_for_1_4_4 --productName=$product_name_for_1_4_4 --productLabel=$product_label_for_1_4_4 --partNumber=$part_number_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "Add model version vid=$vid_for_1_4_4 pid=$pid_3_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model add-model-version --vid=$vid_for_1_4_4 --pid=$pid_3_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --cdVersionNumber=$cd_version_number_for_1_4_4 --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Delete model vid=$vid_for_1_4_4 pid=$pid_3_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model delete-model --vid=$vid_for_1_4_4 --pid=$pid_3_for_1_4_4 --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Update model vid=$vid pid=$pid_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model update-model --vid=$vid --pid=$pid_2 --productName=$product_name --productLabel=$product_label_for_1_4_4 --partNumber=$part_number_for_1_4_4 --from=$vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Update model version vid=$vid pid=$pid_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx model update-model-version --vid=$vid --pid=$pid_2 --softwareVersion=$software_version --minApplicableSoftwareVersion=$min_applicable_software_version_for_1_4_4 --maxApplicableSoftwareVersion=$max_applicable_software_version_for_1_4_4 --from=$vendor_account --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +# CERTIFY_DEVICE_COMPLIANCE + +echo "Certify model vid=$vid_for_1_4_4 pid=$pid_1_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance certify-model --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --certificationType=$certification_type_for_1_4_4 --certificationDate=$certification_date_for_1_4_4 --cdCertificateId=$cd_certificate_id_for_1_4_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Provision model vid=$vid_for_1_4_4 pid=$pid_2_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance provision-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --certificationType=$certification_type_for_1_4_4 --provisionalDate=$provisional_date_for_1_4_4 --cdCertificateId=$cd_certificate_id_for_1_4_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Certify model vid=$vid_for_1_4_4 pid=$pid_2_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance certify-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --certificationType=$certification_type_for_1_4_4 --certificationDate=$certification_date_for_1_4_4 --cdCertificateId=$cd_certificate_id_for_1_4_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Revoke model certification vid=$vid_for_1_4_4 pid=$pid_2_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx compliance revoke-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --softwareVersionString=$software_version_string_for_1_4_4 --certificationType=$certification_type_for_1_4_4 --revocationDate=$certification_date_for_1_4_4 --from=$certification_center_account --cdVersionNumber=$cd_version_number_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +# X509 PKI + +echo "Propose add da_root_cert_1_path_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$da_root_cert_1_path_for_1_4_4" --vid="$vid_for_1_4_4" --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add da_root_cert_1" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id=$da_root_cert_1_subject_key_id_for_1_4_4 --from=$trustee_account_2 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "reject add da_root_cert_1" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki reject-add-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id=$da_root_cert_1_subject_key_id_for_1_4_4 --from=$trustee_account_3 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add da_root_cert_1" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id=$da_root_cert_1_subject_key_id_for_1_4_4 --from=$trustee_account_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add da_root_cert_1" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id=$da_root_cert_1_subject_key_id_for_1_4_4 --from=$trustee_account_5 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose add da_root_cert_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-add-x509-root-cert --certificate="$da_root_cert_2_path_for_1_4_4" --vid="$vid_for_1_4_4" --from=$trustee_account_5 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add da_root_cert_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$da_root_cert_2_subject_for_1_4_4" --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4 --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$da_root_cert_2_subject_for_1_4_4" --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4 --from=$trustee_account_2 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki approve-add-x509-root-cert --subject="$da_root_cert_2_subject_for_1_4_4" --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4 --from=$trustee_account_3 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add da_intermediate_cert_1" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$da_intermediate_cert_1_path_for_1_4_4" --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add da_intermediate_cert_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-x509-cert --certificate="$da_intermediate_cert_2_path_for_1_4_4" --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose revoke paa_cert_no_vid" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki propose-revoke-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id="$da_root_cert_1_subject_key_id_for_1_4_4" --from="$trustee_account_1" --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve revoke paa_cert_no_vid" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id="$da_root_cert_1_subject_key_id_for_1_4_4" --from="$trustee_account_2" --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve revoke $da_intermediate_cert_1_path_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id="$da_root_cert_1_subject_key_id_for_1_4_4" --from="$trustee_account_3" --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve revoke $da_intermediate_cert_1_path_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki approve-revoke-x509-root-cert --subject="$da_root_cert_1_subject_for_1_4_4" --subject-key-id="$da_root_cert_1_subject_key_id_for_1_4_4" --from="$trustee_account_4" --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +echo "Propose revoke da_root_cert_2" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki propose-revoke-x509-root-cert --subject="$da_root_cert_2_subject_for_1_4_4" --subject-key-id="$da_root_cert_2_subject_key_id_for_1_4_4" --from $trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Revoke da_intermediate_cert_1" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki revoke-x509-cert --subject="$da_intermediate_cert_1_subject_for_1_4_4" --subject-key-id="$da_intermediate_cert_1_subject_key_id_for_1_4_4" --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add NOC Root certificate by vendor with VID = $vid_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-root-cert --certificate="$noc_root_cert_1_path_for_1_4_4" --from $vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add NOC ICA certificate by vendor with VID = $vid_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-ica-cert --certificate="$noc_ica_cert_1_path_for_1_4_4" --from $vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add NOC Root certificate by vendor with VID = $vid_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-root-cert --certificate="$noc_root_cert_2_path_for_1_4_4" --from $vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add NOC ICA certificate by vendor with VID = $vid_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki add-noc-x509-ica-cert --certificate="$noc_ica_cert_2_path_for_1_4_4" --from $vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Revoke NOC root certificate by vendor with VID = $vid_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki revoke-noc-x509-root-cert --subject="$noc_root_cert_1_subject_for_1_4_4" --subject-key-id="$noc_root_cert_1_subject_key_id_for_1_4_4" --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Revoke NOC ICA certificate by vendor with VID = $vid_for_1_4_4" +result=$(echo "$passphrase" | $DCLD_BIN_NEW tx pki revoke-noc-x509-ica-cert --subject="$noc_ica_cert_1_subject_for_1_4_4" --subject-key-id="$noc_ica_cert_1_subject_key_id_for_1_4_4" --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +# PKI Revocation point + +echo "Add new revocation point for vid_for_1_4_4" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4_4 --revocation-type=1 --is-paa="true" --certificate="$da_root_cert_2_path_for_1_4_4" --label="$product_label_for_1_4_4" --data-url="$test_data_url_for_1_4_4" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Update revocation point" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki update-revocation-point --vid=$vid_for_1_4_4 --certificate="$da_root_cert_2_path_for_1_4_4" --label="$product_label_for_1_4_4" --data-url="$test_data_url_for_1_4_4/new" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Delete revocation point" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki delete-revocation-point --vid=$vid_for_1_4_4 --label="$product_label_for_1_4_4" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Add new revocation point" +result=$(echo $passphrase | $DCLD_BIN_NEW tx pki add-revocation-point --vid=$vid_for_1_4_4 --revocation-type=1 --is-paa="true" --certificate="$da_root_cert_2_path_for_1_4_4" --label="$product_label_for_1_4_4" --data-url="$test_data_url_for_1_4_4" --issuer-subject-key-id=$issuer_subject_key_id --from=$vendor_account_for_1_4_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +# AUTH + +echo "Propose add account $user_10_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-add-account --address="$user_10_address" --pubkey="$user_10_pubkey" --roles="CertificationCenter" --from="$trustee_account_1" --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add account $user_10_address" +result=$($DCLD_BIN_NEW tx auth approve-add-account --address="$user_10_address" --from=$trustee_account_2 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add account $user_10_address" +result=$($DCLD_BIN_NEW tx auth approve-add-account --address="$user_10_address" --from=$trustee_account_3 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add account $user_10_address" +result=$($DCLD_BIN_NEW tx auth approve-add-account --address="$user_10_address" --from=$trustee_account_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose add account $user_11_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-add-account --address="$user_11_address" --pubkey=$user_11_pubkey --roles=CertificationCenter --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add account $user_11_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-add-account --address="$user_11_address" --from=$trustee_account_2 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add account $user_11_address" +result=$($DCLD_BIN_NEW tx auth approve-add-account --address="$user_11_address" --from=$trustee_account_3 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve add account $user_11_address" +result=$($DCLD_BIN_NEW tx auth approve-add-account --address="$user_11_address" --from=$trustee_account_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose add account $user_12_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-add-account --address="$user_12_address" --pubkey=$user_12_pubkey --roles=CertificationCenter --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose revoke account $user_10_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-revoke-account --address="$user_10_address" --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve revoke account $user_10_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-revoke-account --address="$user_10_address" --from=$trustee_account_2 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve revoke account $user_10_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-revoke-account --address="$user_10_address" --from=$trustee_account_3 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve revoke account $user_10_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth approve-revoke-account --address="$user_10_address" --from=$trustee_account_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose revoke account $user_11_address" +result=$(echo $passphrase | $DCLD_BIN_NEW tx auth propose-revoke-account --address="$user_11_address" --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +# VALIDATOR_NODE +result=$(docker exec "$container" /bin/sh -c "echo test1234 | dcld config broadcast-mode sync") + +echo "Disable node" +result=$(docker exec "$container" /bin/sh -c "echo test1234 | dcld tx validator disable-node --from=$account --yes") +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Enable node" +result=$(docker exec "$container" /bin/sh -c "echo test1234 | dcld tx validator enable-node --from=$account --yes") +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve disable node" +result=$(echo $passphrase | $DCLD_BIN_NEW tx validator approve-disable-node --address=$validator_address --from=$trustee_account_2 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve disable node" +result=$(echo $passphrase | $DCLD_BIN_NEW tx validator approve-disable-node --address=$validator_address --from=$trustee_account_3 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Approve disable node" +result=$(echo $passphrase | $DCLD_BIN_NEW tx validator approve-disable-node --address=$validator_address --from=$trustee_account_4 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Enable node" +result=$(docker exec "$container" /bin/sh -c "echo test1234 | dcld tx validator enable-node --from=$account --yes") +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Propose disable node" +result=$(echo $passphrase | $DCLD_BIN_NEW tx validator propose-disable-node --address=$validator_address --from=$trustee_account_1 --yes) +result=$(get_txn_result "$result") +check_response "$result" "\"code\": 0" + +test_divider + +echo "Verify that new data is not corrupted" + +test_divider + +# VENDORINFO + +echo "Verify if VendorInfo Record for VID: $vid_for_1_4_4 is present or not" +result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_4_4) +check_response "$result" "\"vendorID\": $vid_for_1_4_4" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4_4\"" + +echo "Verify if VendorInfo Record for VID: $vid_for_1_2 updated or not" +result=$($DCLD_BIN_NEW query vendorinfo vendor --vid=$vid_for_1_2) +check_response "$result" "\"vendorID\": $vid_for_1_2" +check_response "$result" "\"vendorName\": \"$vendor_name_for_1_2\"" +check_response "$result" "\"companyPreferredName\": \"$company_preferred_name_for_1_4_4\"" +check_response "$result" "\"vendorLandingPageURL\": \"$vendor_landing_page_url_for_1_4_4\"" + +echo "Request all vendor infos" +result=$($DCLD_BIN_NEW query vendorinfo all-vendors) +check_response "$result" "\"vendorID\": $vid_for_1_4_4" +check_response "$result" "\"companyLegalName\": \"$company_legal_name_for_1_4_4\"" +check_response "$result" "\"vendorName\": \"$vendor_name_for_1_4_4\"" + +test_divider + +# MODEL + +echo "Get Model with VID: $vid_for_1_4_4 PID: $pid_1_for_1_4_4" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_4\"" + +echo "Get Model with VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_4\"" + +echo "Check Model with VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4 updated" +result=$($DCLD_BIN_NEW query model get-model --vid=$vid --pid=$pid_2) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"productLabel\": \"$product_label_for_1_4_4\"" +check_response "$result" "\"partNumber\": \"$part_number_for_1_4_4\"" + +echo "Check Model version with VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4 updated" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid --pid=$pid_2 --softwareVersion=$software_version) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_2" +check_response "$result" "\"minApplicableSoftwareVersion\": $min_applicable_software_version_for_1_4_4" +check_response "$result" "\"maxApplicableSoftwareVersion\": $max_applicable_software_version_for_1_4_4" + +echo "Get all models" +result=$($DCLD_BIN_NEW query model all-models) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" + +echo "Get all model versions" +result=$($DCLD_BIN_NEW query model all-model-versions --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" + +echo "Get Vendor Models with VID: ${vid_for_1_4_4}" +result=$($DCLD_BIN_NEW query model vendor-models --vid=$vid_for_1_4_4) +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" + +echo "Get model version VID: $vid_for_1_4_4 PID: $pid_1_for_1_4_4" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --softwareVersion=$software_version_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_4" + +echo "Get model version VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4" +result=$($DCLD_BIN_NEW query model model-version --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_4" + +test_divider + +# COMPLIANCE + +echo "Get certified model vid=$vid_for_1_4_4 pid=$pid_1_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --certificationType=$certification_type_for_1_4_4) +check_response "$result" "\"value\": true" +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_4" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_4\"" + +echo "Get revoked Model with VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance revoked-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --certificationType=$certification_type_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" + +echo "Get certified model with VID: $vid_for_1_4_4 PID: $pid_1_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance certified-model --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --certificationType=$certification_type_for_1_4_4) +check_response "$result" "\"value\": true" +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" + +echo "Get provisional model with VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance provisional-model --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --certificationType=$certification_type_for_1_4_4) +check_response "$result" "\"value\": false" +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" + +echo "Get compliance-info model with VID: $vid_for_1_4_4 PID: $pid_1_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4_4 --pid=$pid_1_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --certificationType=$certification_type_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_4" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_4\"" + +echo "Get compliance-info model with VID: $vid_for_1_4_4 PID: $pid_2_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance compliance-info --vid=$vid_for_1_4_4 --pid=$pid_2_for_1_4_4 --softwareVersion=$software_version_for_1_4_4 --certificationType=$certification_type_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" +check_response "$result" "\"softwareVersion\": $software_version_for_1_4_4" +check_response "$result" "\"certificationType\": \"$certification_type_for_1_4_4\"" + +echo "Get device software compliance cDCertificateId=$cd_certificate_id_for_1_4_4" +result=$($DCLD_BIN_NEW query compliance device-software-compliance --cdCertificateId=$cd_certificate_id_for_1_4_4) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" + +echo "Get all certified models" +result=$($DCLD_BIN_NEW query compliance all-certified-models) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" + +echo "Get all provisional models" +result=$($DCLD_BIN_NEW query compliance all-provisional-models) +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"pid\": $pid_3" + +echo "Get all revoked models" +result=$($DCLD_BIN_NEW query compliance all-revoked-models) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" + +echo "Get all compliance infos" +result=$($DCLD_BIN_NEW query compliance all-compliance-info) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"pid\": $pid_2_for_1_4_4" + +echo "Get all device software compliances" +result=$($DCLD_BIN_NEW query compliance all-device-software-compliance) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"pid\": $pid_1_for_1_4_4" +check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id_for_1_4_4\"" + +test_divider + +# PKI + +echo "Get certificates" + +echo "Get certificates (ALL)" +result=$(dcld query pki all-certs) +echo $result | jq +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_2_subject_key_id_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_cert_2_subject_key_id_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_ica_cert_2_subject_key_id_for_1_4_4\"" + +echo "Get certificates (DA)" +result=$($DCLD_BIN_NEW query pki all-x509-certs) +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_2_subject_key_id_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_cert_2_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_2_subject_key_id_for_1_4_4\"" + +echo "Get certificates (NOC)" +result=$($DCLD_BIN_NEW query pki all-noc-x509-certs) +check_response "$result" "$noc_root_cert_2_subject_key_id_for_1_4_4" +check_response "$result" "$noc_ica_cert_2_subject_key_id_for_1_4_4" +response_does_not_contain "$result" "$da_root_cert_1_subject_key_id_for_1_4_4" +response_does_not_contain "$result" "$noc_root_cert_1_subject_key_id_for_1_4_4" +response_does_not_contain "$result" "$noc_ica_cert_1_subject_key_id_for_1_4_4" + +echo "Get certificate" + +echo "Get certificate (ALL)" +result=$($DCLD_BIN_NEW query pki cert --subject=$da_root_cert_2_subject_for_1_4_4 --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$da_root_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki cert --subject=$da_intermediate_cert_2_subject_for_1_4_4 --subject-key-id=$da_intermediate_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$da_intermediate_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki cert --subject=$noc_root_cert_2_subject_for_1_4_4 --subject-key-id=$noc_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_root_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki cert --subject=$noc_ica_cert_2_subject_for_1_4_4 --subject-key-id=$noc_ica_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_ica_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_ica_cert_2_subject_key_id_for_1_4_4\"" + +echo "Get certificate (DA)" +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$da_root_cert_2_subject_for_1_4_4 --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$da_root_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$da_intermediate_cert_2_subject_for_1_4_4 --subject-key-id=$da_intermediate_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$da_intermediate_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$noc_root_cert_2_subject_for_1_4_4 --subject-key-id=$noc_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject=$noc_ica_cert_2_subject_for_1_4_4 --subject-key-id=$noc_ica_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get certificate (NOC)" +result=$($DCLD_BIN_NEW query pki noc-x509-cert --subject=$noc_root_cert_2_subject_for_1_4_4 --subject-key-id=$noc_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_root_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki noc-x509-cert --subject=$noc_ica_cert_2_subject_for_1_4_4 --subject-key-id=$noc_ica_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_ica_cert_2_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_ica_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki noc-x509-cert --subject=$da_root_cert_2_subject_for_1_4_4 --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +result=$($DCLD_BIN_NEW query pki noc-x509-cert --subject=$da_intermediate_cert_2_subject_for_1_4_4 --subject-key-id=$da_intermediate_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get all subject certificates" + +echo "Get all subject certificates (Global)" +result=$($DCLD_BIN_NEW query pki all-subject-certs --subject=$da_root_cert_2_subject_for_1_4_4) +check_response "$result" "$da_root_cert_2_subject_key_id_for_1_4_4" + +result=$($DCLD_BIN_NEW query pki all-subject-certs --subject=$noc_root_cert_2_subject_for_1_4_4) +check_response "$result" "$noc_root_cert_2_subject_for_1_4_4" + +echo "Get all subject certificates (DA)" +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$da_root_cert_2_subject_for_1_4_4) +check_response "$result" "$da_root_cert_2_subject_key_id_for_1_4_4" + +result=$($DCLD_BIN_NEW query pki all-subject-x509-certs --subject=$noc_root_cert_2_subject_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get all subject certificates (NOC)" +result=$($DCLD_BIN_NEW query pki all-noc-subject-x509-certs --subject=$noc_root_cert_2_subject_for_1_4_4) +check_response "$result" "$noc_root_cert_2_subject_for_1_4_4" + +result=$($DCLD_BIN_NEW query pki all-noc-subject-x509-certs --subject=$da_root_cert_2_subject_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get all certificates by SKID" + +echo "Get all certificates by SKID (DA)" +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki x509-cert --subject-key-id=$noc_root_cert_2_subject_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get all certificates by SKID (NOC)" +result=$($DCLD_BIN_NEW query pki noc-x509-cert --subject-key-id=$noc_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki noc-x509-cert --subject-key-id=$da_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get all revoked x509 root certificates" + +echo "Get all revoked x509 certificates (DA)" +result=$($DCLD_BIN_NEW query pki all-revoked-x509-certs) +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_1_subject_key_id_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_intermediate_cert_1_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_4\"" + +echo "Get all revoked x509 root certificates (DA)" +result=$($DCLD_BIN_NEW query pki all-revoked-x509-root-certs) +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_1_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_cert_2_subject_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_4\"" + +echo "Get all revoked x509 root certificates (NOC)" +result=$($DCLD_BIN_NEW query pki all-revoked-noc-x509-root-certs) +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$da_root_cert_1_subject_key_id_for_1_4_4\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_4\"" + +echo "Get all revoked x509 ica certificates (NOC)" +result=$($DCLD_BIN_NEW query pki all-revoked-noc-x509-ica-certs) +check_response "$result" "\"subjectKeyId\": \"$noc_ica_cert_1_subject_key_id_for_1_4_4\"" + +echo "Get revoked x509 certificate" + +echo "Get revoked x509 certificate (DA)" +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$da_root_cert_1_subject_for_1_4_4 --subject-key-id=$da_root_cert_1_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$da_root_cert_1_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$da_root_cert_1_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki revoked-x509-cert --subject=$noc_root_cert_1_subject_for_1_4_4 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get revoked x509 certificate (NOC)" +result=$($DCLD_BIN_NEW query pki revoked-noc-x509-root-cert --subject=$noc_root_cert_1_subject_for_1_4_4 --subject-key-id=$noc_root_cert_1_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_root_cert_1_subject_for_1_4_4\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id_for_1_4_4\"" + +result=$($DCLD_BIN_NEW query pki revoked-noc-x509-root-cert --subject=$da_root_cert_1_subject_for_1_4_4 --subject-key-id=$da_root_cert_1_subject_key_id_for_1_4_4) +check_response "$result" "Not Found" + +echo "Get revocation point" +result=$($DCLD_BIN_NEW query pki revocation-point --vid=$vid_for_1_4_4 --label=$product_label_for_1_4_4 --issuer-subject-key-id=$issuer_subject_key_id) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" +check_response "$result" "\"label\": \"$product_label_for_1_4_4\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_4\"" + +echo "Get revocation points by issuer subject key id" +result=$($DCLD_BIN_NEW query pki revocation-points --issuer-subject-key-id=$issuer_subject_key_id) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" +check_response "$result" "\"label\": \"$product_label_for_1_4_4\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_4\"" + +echo "Get all revocation points" +result=$($DCLD_BIN_NEW query pki all-revocation-points) +check_response "$result" "\"vid\": $vid_for_1_4_4" +check_response "$result" "\"issuerSubjectKeyID\": \"$issuer_subject_key_id\"" +check_response "$result" "\"label\": \"$product_label_for_1_4_4\"" +check_response "$result" "\"dataURL\": \"$test_data_url_for_1_4_4\"" + +echo "Get all noc x509 root certificates by vid=$vid_for_1_4_4 and skid=$noc_root_cert_2_subject_key_id_for_1_4_4" +result=$($DCLD_BIN_NEW query pki noc-x509-certs --vid=$vid_for_1_4_4 --subject-key-id=$noc_root_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_root_cert_2_subject_for_1_4_4\"" +check_response "$result" "$noc_root_cert_2_subject_key_id_for_1_4_4" + +echo "Get all noc x509 root certificates by vid $vid_for_1_4_4 and skid=$noc_ica_cert_2_subject_key_id_for_1_4_4" +result=$($DCLD_BIN_NEW query pki noc-x509-certs --vid=$vid_for_1_4_4 --subject-key-id=$noc_ica_cert_2_subject_key_id_for_1_4_4) +check_response "$result" "\"subject\": \"$noc_ica_cert_2_subject_for_1_4_4\"" +check_response "$result" "$noc_ica_cert_2_subject_key_id_for_1_4_4" + +test_divider + +# AUTH + +echo "Get all accounts" +result=$($DCLD_BIN_NEW query auth all-accounts) +check_response "$result" "\"address\": \"$user_11_address\"" + +echo "Get account" +result=$($DCLD_BIN_NEW query auth account --address=$user_11_address) +check_response "$result" "\"address\": \"$user_11_address\"" + +echo "Get all proposed accounts" +result=$($DCLD_BIN_NEW query auth all-proposed-accounts) +check_response "$result" "\"address\": \"$user_12_address\"" + +echo "Get proposed account" +result=$($DCLD_BIN_NEW query auth proposed-account --address=$user_12_address) +check_response "$result" "\"address\": \"$user_12_address\"" + +echo "Get all proposed accounts to revoke" +result=$($DCLD_BIN_NEW query auth all-proposed-accounts-to-revoke) +check_response "$result" "\"address\": \"$user_11_address\"" + +echo "Get proposed account to revoke" +result=$($DCLD_BIN_NEW query auth proposed-account-to-revoke --address=$user_11_address) +check_response "$result" "\"address\": \"$user_11_address\"" + +echo "Get all revoked accounts" +result=$($DCLD_BIN_NEW query auth all-revoked-accounts) +check_response "$result" "\"address\": \"$user_10_address\"" + +echo "Get revoked account" +result=$($DCLD_BIN_NEW query auth revoked-account --address=$user_10_address) +check_response "$result" "\"address\": \"$user_10_address\"" + +test_divider + +# Validator + +echo "Get node" +# FIXME: use proper binary (not dcld but $DCLD_BIN_OLD) +result=$(docker exec "$container" /bin/sh -c "echo test1234 | dcld query validator all-nodes") +check_response "$result" "\"owner\": \"$validator_address\"" + +test_divider + +echo "Upgrade from 1.4.3 to 1.4.4 passed" + +rm -f $DCLD_BIN_OLD +rm -f $DCLD_BIN_NEW diff --git a/integration_tests/upgrade/add-new-node-after-upgrade.sh b/integration_tests/upgrade/add-new-node-after-upgrade.sh index 73cc3d543..68db78efc 100755 --- a/integration_tests/upgrade/add-new-node-after-upgrade.sh +++ b/integration_tests/upgrade/add-new-node-after-upgrade.sh @@ -1,3 +1,18 @@ +#!/bin/bash +# Copyright 2020 DSR Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + source integration_tests/cli/common.sh set +euo pipefail @@ -50,7 +65,7 @@ trap cleanup EXIT check_adding_new_node() { local stable_binary_version="${1:-0.12.1}" - local latest_binary_version="${2:-1.4.3}" + local latest_binary_version="${2:-1.4.4-2-dev}" echo "1. run $node_name container" docker run -d --name $node_name --ip $ip -p "$node_p2p_port-$node_client_port:26656-26657" --network $docker_network -i dcledger diff --git a/integration_tests/upgrade/test-upgrade.sh b/integration_tests/upgrade/test-upgrade.sh index 842eaa947..b3e68cd70 100755 --- a/integration_tests/upgrade/test-upgrade.sh +++ b/integration_tests/upgrade/test-upgrade.sh @@ -17,4 +17,5 @@ set -euo pipefail source integration_tests/upgrade/01-test-upgrade-initialize-0.12.sh source integration_tests/upgrade/02-test-upgrade-0.12-to-1.2.sh -source integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.sh \ No newline at end of file +source integration_tests/upgrade/03-test-upgrade-1.2-to-1.4.3.sh +source integration_tests/upgrade/04-test-upgrade-1.4.3-to-1.4.4.sh \ No newline at end of file diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto new file mode 100644 index 000000000..dc8c078ff --- /dev/null +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +import "zigbeealliance/distributedcomplianceledger/pki/certificate.proto"; + +message AllCertificates { + string subject = 1; + string subjectKeyId = 2; + repeated Certificate certs = 3; + uint32 schemaVersion = 4; +} + diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto new file mode 100644 index 000000000..b1ee80b1a --- /dev/null +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +message AllCertificatesBySubject { + string subject = 1; + repeated string subjectKeyIds = 2; + uint32 schemaVersion = 3; + +} + diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/certificate.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/certificate.proto index 44416f8cc..c770e9343 100644 --- a/proto/zigbeealliance/distributedcomplianceledger/pki/certificate.proto +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/certificate.proto @@ -8,6 +8,12 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "zigbeealliance/distributedcomplianceledger/pki/grant.proto"; +enum CertificateType { + DeviceAttestationPKI = 0; + OperationalPKI = 1; + VIDSignerPKI = 2; +} + message Certificate { string pemCert = 1; @@ -24,6 +30,6 @@ message Certificate { string subjectAsText = 12; repeated Grant rejects = 13; int32 vid = 14 [(gogoproto.moretags) = "validate:\"gte=1,lte=65535\""]; - bool isNoc = 15; + CertificateType certificateType = 15; uint32 schemaVersion = 16; } diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/genesis.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/genesis.proto index b85b89de9..f81c35a80 100644 --- a/proto/zigbeealliance/distributedcomplianceledger/pki/genesis.proto +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/genesis.proto @@ -17,7 +17,13 @@ import "zigbeealliance/distributedcomplianceledger/pki/approved_certificates_by_ import "zigbeealliance/distributedcomplianceledger/pki/noc_root_certificates.proto"; import "zigbeealliance/distributedcomplianceledger/pki/noc_ica_certificates.proto"; import "zigbeealliance/distributedcomplianceledger/pki/revoked_noc_root_certificates.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.proto"; import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_vid_and_skid.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto"; // this line is used by starport scaffolding # genesis/proto/import import "gogoproto/gogo.proto"; @@ -42,5 +48,11 @@ message GenesisState { repeated NocIcaCertificates nocIcaCertificatesList = 15 [(gogoproto.nullable) = false]; repeated RevokedNocRootCertificates revokedNocRootCertificatesList = 16 [(gogoproto.nullable) = false]; repeated NocCertificatesByVidAndSkid nocCertificatesByVidAndSkidList = 17 [(gogoproto.nullable) = false]; + repeated NocCertificatesBySubjectKeyID NocCertificatesBySubjectKeyIDList = 18 [(gogoproto.nullable) = false]; + repeated NocCertificates nocCertificatesList = 19 [(gogoproto.nullable) = false]; + repeated NocCertificatesBySubject nocCertificatesBySubjectList = 20 [(gogoproto.nullable) = false]; + repeated AllCertificates certificatesList = 21 [(gogoproto.nullable) = false]; + repeated RevokedNocIcaCertificates revokedNocIcaCertificatesList = 22 [(gogoproto.nullable) = false]; + repeated AllCertificatesBySubject allCertificatesBySubjectList = 23 [(gogoproto.nullable) = false]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto new file mode 100644 index 000000000..aee67c148 --- /dev/null +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +import "zigbeealliance/distributedcomplianceledger/pki/certificate.proto"; + +message NocCertificates { + string subject = 1; + string subjectKeyId = 2; + repeated Certificate certs = 3; + float tq = 4; + uint32 schemaVersion = 5; +} + diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto new file mode 100644 index 000000000..6670df5a6 --- /dev/null +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +message NocCertificatesBySubject { + string subject = 1; + repeated string subjectKeyIds = 2; + uint32 schemaVersion = 3; +} + diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.proto new file mode 100644 index 000000000..5d11761e4 --- /dev/null +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +import "zigbeealliance/distributedcomplianceledger/pki/certificate.proto"; + +message NocCertificatesBySubjectKeyID { + string subjectKeyId = 1; + repeated Certificate certs = 2; + float tq = 3; + uint32 schemaVersion = 4; +} + diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/query.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/query.proto index ae45f0405..ebb6433e5 100644 --- a/proto/zigbeealliance/distributedcomplianceledger/pki/query.proto +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/query.proto @@ -14,10 +14,15 @@ import "zigbeealliance/distributedcomplianceledger/pki/approved_certificates_by_ import "zigbeealliance/distributedcomplianceledger/pki/rejected_certificate.proto"; import "zigbeealliance/distributedcomplianceledger/pki/pki_revocation_distribution_point.proto"; import "zigbeealliance/distributedcomplianceledger/pki/pki_revocation_distribution_points_by_issuer_subject_key_id.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto"; import "zigbeealliance/distributedcomplianceledger/pki/noc_root_certificates.proto"; import "zigbeealliance/distributedcomplianceledger/pki/noc_ica_certificates.proto"; import "zigbeealliance/distributedcomplianceledger/pki/revoked_noc_root_certificates.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto"; import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_vid_and_skid.proto"; +import "zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto"; // this line is used by starport scaffolding # 1 import "gogoproto/gogo.proto"; @@ -29,343 +34,451 @@ option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/ // Query defines the gRPC querier service. service Query { - // Queries a ApprovedCertificates by index. - rpc ApprovedCertificates(QueryGetApprovedCertificatesRequest) returns (QueryGetApprovedCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/certificates/{subject}/{subjectKeyId}"; - } - - // Queries a list of ApprovedCertificates items. - rpc ApprovedCertificatesAll(QueryAllApprovedCertificatesRequest) returns (QueryAllApprovedCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/certificates"; - } - - // Queries a ProposedCertificate by index. - rpc ProposedCertificate(QueryGetProposedCertificateRequest) returns (QueryGetProposedCertificateResponse) { - option (google.api.http).get = "/dcl/pki/proposed-certificates/{subject}/{subjectKeyId}"; - } - - // Queries a list of ProposedCertificate items. - rpc ProposedCertificateAll(QueryAllProposedCertificateRequest) returns (QueryAllProposedCertificateResponse) { - option (google.api.http).get = "/dcl/pki/proposed-certificates"; - } - - // Queries a ChildCertificates by index. - rpc ChildCertificates(QueryGetChildCertificatesRequest) returns (QueryGetChildCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/child-certificates/{issuer}/{authorityKeyId}"; - } - - // Queries a ProposedCertificateRevocation by index. - rpc ProposedCertificateRevocation(QueryGetProposedCertificateRevocationRequest) returns (QueryGetProposedCertificateRevocationResponse) { - option (google.api.http).get = "/dcl/pki/proposed-revocation-certificates/{subject}/{subjectKeyId}"; - } - - // Queries a list of ProposedCertificateRevocation items. - rpc ProposedCertificateRevocationAll(QueryAllProposedCertificateRevocationRequest) returns (QueryAllProposedCertificateRevocationResponse) { - option (google.api.http).get = "/dcl/pki/proposed-revocation-certificates"; - } - - // Queries a RevokedCertificates by index. - rpc RevokedCertificates(QueryGetRevokedCertificatesRequest) returns (QueryGetRevokedCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/revoked-certificates/{subject}/{subjectKeyId}"; - } - - // Queries a list of RevokedCertificates items. - rpc RevokedCertificatesAll(QueryAllRevokedCertificatesRequest) returns (QueryAllRevokedCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/revoked-certificates"; - } - - // Queries a ApprovedRootCertificates by index. - rpc ApprovedRootCertificates(QueryGetApprovedRootCertificatesRequest) returns (QueryGetApprovedRootCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/root-certificates"; - } - // Queries a RevokedRootCertificates by index. - rpc RevokedRootCertificates(QueryGetRevokedRootCertificatesRequest) returns (QueryGetRevokedRootCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/revoked-root-certificates"; - } - // Queries a ApprovedCertificatesBySubject by index. - rpc ApprovedCertificatesBySubject(QueryGetApprovedCertificatesBySubjectRequest) returns (QueryGetApprovedCertificatesBySubjectResponse) { - option (google.api.http).get = "/dcl/pki/certificates/{subject}"; - } - - - // Queries a RejectedCertificate by index. - rpc RejectedCertificate(QueryGetRejectedCertificatesRequest) returns (QueryGetRejectedCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/rejected-certificates/{subject}/{subjectKeyId}"; - } - - // Queries a list of RejectedCertificate items. - rpc RejectedCertificateAll(QueryAllRejectedCertificatesRequest) returns (QueryAllRejectedCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/rejected-certificates"; - } - - // Queries a PkiRevocationDistributionPoint by index. - rpc PkiRevocationDistributionPoint(QueryGetPkiRevocationDistributionPointRequest) returns (QueryGetPkiRevocationDistributionPointResponse) { - option (google.api.http).get = "/dcl/pki/revocation-points/{issuerSubjectKeyID}/{vid}/{label}"; - } - - // Queries a list of PkiRevocationDistributionPoint items. - rpc PkiRevocationDistributionPointAll(QueryAllPkiRevocationDistributionPointRequest) returns (QueryAllPkiRevocationDistributionPointResponse) { - option (google.api.http).get = "/dcl/pki/revocation-points"; - } - - // Queries a PkiRevocationDistributionPointsByIssuerSubjectKeyID by index. - rpc PkiRevocationDistributionPointsByIssuerSubjectKeyID(QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) returns (QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) { - option (google.api.http).get = "/dcl/pki/revocation-points/{issuerSubjectKeyID}"; - } - - // Queries a NocRootCertificates by index. - rpc NocRootCertificates(QueryGetNocRootCertificatesRequest) returns (QueryGetNocRootCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/noc-root-certificates/{vid}"; - } - - // Queries a NocCertificatesByVidAndSkid by index. - rpc NocCertificatesByVidAndSkid(QueryGetNocCertificatesByVidAndSkidRequest) returns (QueryGetNocCertificatesByVidAndSkidResponse) { - option (google.api.http).get = "/dcl/pki/noc-certificates/{vid}/{subjectKeyId}"; - } - - // Queries a list of NocRootCertificates items. - rpc NocRootCertificatesAll(QueryAllNocRootCertificatesRequest) returns (QueryAllNocRootCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/noc-root-certificates"; - } - - // Queries a NocIcaCertificates by index. - rpc NocIcaCertificates(QueryGetNocIcaCertificatesRequest) returns (QueryGetNocIcaCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/noc-ica-certificates/{vid}"; - } - - // Queries a list of NocIcaCertificates items. - rpc NocIcaCertificatesAll(QueryAllNocIcaCertificatesRequest) returns (QueryAllNocIcaCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/noc-ica-certificates"; - } - - // Queries a RevokedNocRootCertificates by index. - rpc RevokedNocRootCertificates(QueryGetRevokedNocRootCertificatesRequest) returns (QueryGetRevokedNocRootCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/revoked-noc-root-certificates/{subject}/{subjectKeyId}"; - } - - // Queries a list of RevokedNocRootCertificates items. - rpc RevokedNocRootCertificatesAll(QueryAllRevokedNocRootCertificatesRequest) returns (QueryAllRevokedNocRootCertificatesResponse) { - option (google.api.http).get = "/dcl/pki/revoked-noc-root-certificates"; - } - -// this line is used by starport scaffolding # 2 + // Queries a list of Certificates items. + rpc CertificatesAll(QueryAllCertificatesRequest) returns (QueryAllCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/all-certificates"; + } + + // Queries a AllCertificatesBySubject by index. + rpc AllCertificatesBySubject(QueryGetAllCertificatesBySubjectRequest) returns (QueryGetAllCertificatesBySubjectResponse) { + option (google.api.http).get = "/dcl/pki/all-certificates/{subject}"; + } + + // Queries a Certificates by index. + rpc Certificates(QueryGetCertificatesRequest) returns (QueryGetCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/all-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of ApprovedCertificates items. + rpc ApprovedCertificatesAll(QueryAllApprovedCertificatesRequest) returns (QueryAllApprovedCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/certificates"; + } + + // Queries a ApprovedCertificatesBySubject by index. + rpc ApprovedCertificatesBySubject(QueryGetApprovedCertificatesBySubjectRequest) returns (QueryGetApprovedCertificatesBySubjectResponse) { + option (google.api.http).get = "/dcl/pki/certificates/{subject}"; + } + + // Queries a ApprovedCertificates by index. + rpc ApprovedCertificates(QueryGetApprovedCertificatesRequest) returns (QueryGetApprovedCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/certificates/{subject}/{subjectKeyId}"; + } + + // Queries a ProposedCertificate by index. + rpc ProposedCertificate(QueryGetProposedCertificateRequest) returns (QueryGetProposedCertificateResponse) { + option (google.api.http).get = "/dcl/pki/proposed-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of ProposedCertificate items. + rpc ProposedCertificateAll(QueryAllProposedCertificateRequest) returns (QueryAllProposedCertificateResponse) { + option (google.api.http).get = "/dcl/pki/proposed-certificates"; + } + + // Queries a ChildCertificates by index. + rpc ChildCertificates(QueryGetChildCertificatesRequest) returns (QueryGetChildCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/child-certificates/{issuer}/{authorityKeyId}"; + } + + // Queries a ProposedCertificateRevocation by index. + rpc ProposedCertificateRevocation(QueryGetProposedCertificateRevocationRequest) returns (QueryGetProposedCertificateRevocationResponse) { + option (google.api.http).get = "/dcl/pki/proposed-revocation-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of ProposedCertificateRevocation items. + rpc ProposedCertificateRevocationAll(QueryAllProposedCertificateRevocationRequest) returns (QueryAllProposedCertificateRevocationResponse) { + option (google.api.http).get = "/dcl/pki/proposed-revocation-certificates"; + } + + // Queries a RevokedCertificates by index. + rpc RevokedCertificates(QueryGetRevokedCertificatesRequest) returns (QueryGetRevokedCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of RevokedCertificates items. + rpc RevokedCertificatesAll(QueryAllRevokedCertificatesRequest) returns (QueryAllRevokedCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-certificates"; + } + + // Queries a ApprovedRootCertificates by index. + rpc ApprovedRootCertificates(QueryGetApprovedRootCertificatesRequest) returns (QueryGetApprovedRootCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/root-certificates"; + } + // Queries a RevokedRootCertificates by index. + rpc RevokedRootCertificates(QueryGetRevokedRootCertificatesRequest) returns (QueryGetRevokedRootCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-root-certificates"; + } + + + // Queries a RejectedCertificate by index. + rpc RejectedCertificate(QueryGetRejectedCertificatesRequest) returns (QueryGetRejectedCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/rejected-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of RejectedCertificate items. + rpc RejectedCertificateAll(QueryAllRejectedCertificatesRequest) returns (QueryAllRejectedCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/rejected-certificates"; + } + + // Queries a PkiRevocationDistributionPoint by index. + rpc PkiRevocationDistributionPoint(QueryGetPkiRevocationDistributionPointRequest) returns (QueryGetPkiRevocationDistributionPointResponse) { + option (google.api.http).get = "/dcl/pki/revocation-points/{issuerSubjectKeyID}/{vid}/{label}"; + } + + // Queries a list of PkiRevocationDistributionPoint items. + rpc PkiRevocationDistributionPointAll(QueryAllPkiRevocationDistributionPointRequest) returns (QueryAllPkiRevocationDistributionPointResponse) { + option (google.api.http).get = "/dcl/pki/revocation-points"; + } + + // Queries a PkiRevocationDistributionPointsByIssuerSubjectKeyID by index. + rpc PkiRevocationDistributionPointsByIssuerSubjectKeyID(QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) returns (QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) { + option (google.api.http).get = "/dcl/pki/revocation-points/{issuerSubjectKeyID}"; + } + + // Queries a list of NocCertificates items. + rpc NocCertificatesAll(QueryNocCertificatesRequest) returns (QueryNocCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/all-noc-certificates"; + } + // Queries a NocCertificatesBySubject by index. + rpc NocCertificatesBySubject(QueryGetNocCertificatesBySubjectRequest) returns (QueryGetNocCertificatesBySubjectResponse) { + option (google.api.http).get = "/dcl/pki/all-noc-certificates/{subject}"; + } + // Queries a NocCertificates by index. + rpc NocCertificates(QueryGetNocCertificatesRequest) returns (QueryGetNocCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/all-noc-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a NocCertificatesByVidAndSkid by index. + rpc NocCertificatesByVidAndSkid(QueryGetNocCertificatesByVidAndSkidRequest) returns (QueryGetNocCertificatesByVidAndSkidResponse) { + option (google.api.http).get = "/dcl/pki/noc-vid-certificates/{vid}/{subjectKeyId}"; + } + + // Queries a NocRootCertificates by index. + rpc NocRootCertificates(QueryGetNocRootCertificatesRequest) returns (QueryGetNocRootCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/noc-vid-root-certificates/{vid}"; + } + + // Queries a list of NocRootCertificates items. + rpc NocRootCertificatesAll(QueryAllNocRootCertificatesRequest) returns (QueryAllNocRootCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/noc-root-certificates"; + } + + // Queries a NocIcaCertificates by index. + rpc NocIcaCertificates(QueryGetNocIcaCertificatesRequest) returns (QueryGetNocIcaCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/noc-vid-ica-certificates/{vid}"; + } + + // Queries a list of NocIcaCertificates items. + rpc NocIcaCertificatesAll(QueryAllNocIcaCertificatesRequest) returns (QueryAllNocIcaCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/noc-ica-certificates"; + } + + // Queries a RevokedNocRootCertificates by index. + rpc RevokedNocRootCertificates(QueryGetRevokedNocRootCertificatesRequest) returns (QueryGetRevokedNocRootCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-noc-root-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of RevokedNocRootCertificates items. + rpc RevokedNocRootCertificatesAll(QueryAllRevokedNocRootCertificatesRequest) returns (QueryAllRevokedNocRootCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-noc-root-certificates"; + } + + // Queries a RevokedNocIcaCertificates by index. + rpc RevokedNocIcaCertificates(QueryGetRevokedNocIcaCertificatesRequest) returns (QueryGetRevokedNocIcaCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-noc-ica-certificates/{subject}/{subjectKeyId}"; + } + + // Queries a list of RevokedNocIcaCertificates items. + rpc RevokedNocIcaCertificatesAll(QueryAllRevokedNocIcaCertificatesRequest) returns (QueryAllRevokedNocIcaCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/revoked-noc-ica-certificates"; + } + + // this line is used by starport scaffolding # 2 +} + +message QueryAllCertificatesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllCertificatesResponse { + repeated AllCertificates certificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetAllCertificatesBySubjectRequest { + string subject = 1; } -message QueryGetApprovedCertificatesRequest { - string subject = 1; + message QueryGetAllCertificatesBySubjectResponse { + AllCertificatesBySubject allCertificatesBySubject = 1 [(gogoproto.nullable) = false]; +} + +message QueryGetCertificatesRequest { + string subject = 1; string subjectKeyId = 2; +} +message QueryGetCertificatesResponse { + AllCertificates certificates = 1 [(gogoproto.nullable) = false]; +} + +message QueryGetApprovedCertificatesRequest { + string subject = 1; + string subjectKeyId = 2; } message QueryGetApprovedCertificatesResponse { - ApprovedCertificates approvedCertificates = 1 [(gogoproto.nullable) = false]; + ApprovedCertificates approvedCertificates = 1 [(gogoproto.nullable) = false]; } message QueryAllApprovedCertificatesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - string subjectKeyId = 2; + cosmos.base.query.v1beta1.PageRequest pagination = 1; + string subjectKeyId = 2; } message QueryAllApprovedCertificatesResponse { - repeated ApprovedCertificates approvedCertificates = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated ApprovedCertificates approvedCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetProposedCertificateRequest { - string subject = 1; + string subject = 1; string subjectKeyId = 2; } message QueryGetProposedCertificateResponse { - ProposedCertificate proposedCertificate = 1 [(gogoproto.nullable) = false]; + ProposedCertificate proposedCertificate = 1 [(gogoproto.nullable) = false]; } message QueryAllProposedCertificateRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllProposedCertificateResponse { - repeated ProposedCertificate proposedCertificate = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated ProposedCertificate proposedCertificate = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetChildCertificatesRequest { - string issuer = 1; + string issuer = 1; string authorityKeyId = 2; } message QueryGetChildCertificatesResponse { - ChildCertificates childCertificates = 1 [(gogoproto.nullable) = false]; + ChildCertificates childCertificates = 1 [(gogoproto.nullable) = false]; } message QueryGetProposedCertificateRevocationRequest { - string subject = 1; + string subject = 1; string subjectKeyId = 2; - string serialNumber = 3; + string serialNumber = 3; } message QueryGetProposedCertificateRevocationResponse { - ProposedCertificateRevocation proposedCertificateRevocation = 1 [(gogoproto.nullable) = false]; + ProposedCertificateRevocation proposedCertificateRevocation = 1 [(gogoproto.nullable) = false]; } message QueryAllProposedCertificateRevocationRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllProposedCertificateRevocationResponse { - repeated ProposedCertificateRevocation proposedCertificateRevocation = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated ProposedCertificateRevocation proposedCertificateRevocation = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetRevokedCertificatesRequest { - string subject = 1; + string subject = 1; string subjectKeyId = 2; } message QueryGetRevokedCertificatesResponse { - RevokedCertificates revokedCertificates = 1 [(gogoproto.nullable) = false]; + RevokedCertificates revokedCertificates = 1 [(gogoproto.nullable) = false]; } message QueryAllRevokedCertificatesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllRevokedCertificatesResponse { - repeated RevokedCertificates revokedCertificates = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated RevokedCertificates revokedCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetApprovedRootCertificatesRequest {} message QueryGetApprovedRootCertificatesResponse { - ApprovedRootCertificates approvedRootCertificates = 1 [(gogoproto.nullable) = false]; + ApprovedRootCertificates approvedRootCertificates = 1 [(gogoproto.nullable) = false]; } message QueryGetRevokedRootCertificatesRequest {} message QueryGetRevokedRootCertificatesResponse { - RevokedRootCertificates revokedRootCertificates = 1 [(gogoproto.nullable) = false]; + RevokedRootCertificates revokedRootCertificates = 1 [(gogoproto.nullable) = false]; } message QueryGetApprovedCertificatesBySubjectRequest { - string subject = 1; - + string subject = 1; } message QueryGetApprovedCertificatesBySubjectResponse { - ApprovedCertificatesBySubject approvedCertificatesBySubject = 1 [(gogoproto.nullable) = false]; + ApprovedCertificatesBySubject approvedCertificatesBySubject = 1 [(gogoproto.nullable) = false]; } message QueryGetRejectedCertificatesRequest { - string subject = 1; + string subject = 1; string subjectKeyId = 2; } message QueryGetRejectedCertificatesResponse { - RejectedCertificate rejectedCertificate = 1 [(gogoproto.nullable) = false]; + RejectedCertificate rejectedCertificate = 1 [(gogoproto.nullable) = false]; } message QueryAllRejectedCertificatesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllRejectedCertificatesResponse { - repeated RejectedCertificate rejectedCertificate = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated RejectedCertificate rejectedCertificate = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetPkiRevocationDistributionPointRequest { - int32 vid = 1; + int32 vid = 1; string label = 2; string issuerSubjectKeyID = 3; } message QueryGetPkiRevocationDistributionPointResponse { - PkiRevocationDistributionPoint PkiRevocationDistributionPoint = 1 [(gogoproto.nullable) = false]; + PkiRevocationDistributionPoint PkiRevocationDistributionPoint = 1 [(gogoproto.nullable) = false]; } message QueryAllPkiRevocationDistributionPointRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllPkiRevocationDistributionPointResponse { - repeated PkiRevocationDistributionPoint PkiRevocationDistributionPoint = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated PkiRevocationDistributionPoint PkiRevocationDistributionPoint = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { - string issuerSubjectKeyID = 1; + string issuerSubjectKeyID = 1; } message QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { - PkiRevocationDistributionPointsByIssuerSubjectKeyID pkiRevocationDistributionPointsByIssuerSubjectKeyID = 1 [(gogoproto.nullable) = false]; + PkiRevocationDistributionPointsByIssuerSubjectKeyID pkiRevocationDistributionPointsByIssuerSubjectKeyID = 1 [(gogoproto.nullable) = false]; } message QueryGetNocRootCertificatesRequest { - int32 vid = 1; + int32 vid = 1; } message QueryGetNocRootCertificatesResponse { - NocRootCertificates nocRootCertificates = 1 [(gogoproto.nullable) = false]; + NocRootCertificates nocRootCertificates = 1 [(gogoproto.nullable) = false]; } message QueryAllNocRootCertificatesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllNocRootCertificatesResponse { - repeated NocRootCertificates nocRootCertificates = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated NocRootCertificates nocRootCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetNocIcaCertificatesRequest { - int32 vid = 1; + int32 vid = 1; } message QueryGetNocIcaCertificatesResponse { - NocIcaCertificates nocIcaCertificates = 1 [(gogoproto.nullable) = false]; + NocIcaCertificates nocIcaCertificates = 1 [(gogoproto.nullable) = false]; } message QueryAllNocIcaCertificatesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllNocIcaCertificatesResponse { - repeated NocIcaCertificates nocIcaCertificates = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated NocIcaCertificates nocIcaCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetRevokedNocRootCertificatesRequest { - string subject = 1; - string subjectKeyId = 2; + string subject = 1; + string subjectKeyId = 2; } message QueryGetRevokedNocRootCertificatesResponse { - RevokedNocRootCertificates revokedNocRootCertificates = 1 [(gogoproto.nullable) = false]; + RevokedNocRootCertificates revokedNocRootCertificates = 1 [(gogoproto.nullable) = false]; } message QueryAllRevokedNocRootCertificatesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryAllRevokedNocRootCertificatesResponse { - repeated RevokedNocRootCertificates revokedNocRootCertificates = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated RevokedNocRootCertificates revokedNocRootCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetRevokedNocIcaCertificatesRequest { + string subject = 1; + string subjectKeyId = 2; +} + +message QueryGetRevokedNocIcaCertificatesResponse { + RevokedNocIcaCertificates revokedNocIcaCertificates = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllRevokedNocIcaCertificatesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllRevokedNocIcaCertificatesResponse { + repeated RevokedNocIcaCertificates revokedNocIcaCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetNocCertificatesByVidAndSkidRequest { - int32 vid = 1; - string subjectKeyId = 2; + int32 vid = 1; + string subjectKeyId = 2; } message QueryGetNocCertificatesByVidAndSkidResponse { - NocCertificatesByVidAndSkid nocCertificatesByVidAndSkid = 1 [(gogoproto.nullable) = false]; + NocCertificatesByVidAndSkid nocCertificatesByVidAndSkid = 1 [(gogoproto.nullable) = false]; +} + +message QueryNocCertificatesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; + string subjectKeyId = 2; +} + +message QueryNocCertificatesResponse { + repeated NocCertificates nocCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetNocCertificatesBySubjectRequest { + string subject = 1; +} + +message QueryGetNocCertificatesBySubjectResponse { + NocCertificatesBySubject nocCertificatesBySubject = 1 [(gogoproto.nullable) = false]; +} + +message QueryGetNocCertificatesRequest { + string subject = 1; + string subjectKeyId = 2; +} + +message QueryGetNocCertificatesResponse { + NocCertificates nocCertificates = 1 [(gogoproto.nullable) = false]; } // this line is used by starport scaffolding # 3 diff --git a/proto/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto b/proto/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto new file mode 100644 index 000000000..1f9f4dbbe --- /dev/null +++ b/proto/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +import "zigbeealliance/distributedcomplianceledger/pki/certificate.proto"; + +message RevokedNocIcaCertificates { + string subject = 1; + string subjectKeyId = 2; + repeated Certificate certs = 3; + uint32 schemaVersion = 4; +} + diff --git a/scripts/swagger/protoc-swagger-gen.sh b/scripts/swagger/protoc-swagger-gen.sh index 2c1dd2172..81b428d0f 100755 --- a/scripts/swagger/protoc-swagger-gen.sh +++ b/scripts/swagger/protoc-swagger-gen.sh @@ -15,7 +15,7 @@ for dir in $proto_dirs; do # generate swagger files (filter query files) query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \)) if [[ ! -z "$query_file" ]]; then - buf generate --template proto/buf.gen.swagger.yaml "$query_file" + buf generate -v --template proto/buf.gen.swagger.yaml "$query_file" cp -r zigbeealliance/distributedcomplianceledger/* swagger-out/ fi done diff --git a/tools/tools.go b/tools/tools.go index c2f88d474..d697c36cb 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -10,6 +10,7 @@ import ( _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" + _ "golang.org/x/tools/cmd/goimports" _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.compliance/module.ts b/ts-client/zigbeealliance.distributedcomplianceledger.compliance/module.ts index b6054be06..fd79838f3 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.compliance/module.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.compliance/module.ts @@ -7,11 +7,11 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgRevokeModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; -import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; import { MsgUpdateComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; -import { MsgProvisionModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; +import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; import { MsgDeleteComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; +import { MsgProvisionModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; +import { MsgRevokeModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; import { CertifiedModel as typeCertifiedModel} from "./types" import { ComplianceHistoryItem as typeComplianceHistoryItem} from "./types" @@ -20,10 +20,10 @@ import { DeviceSoftwareCompliance as typeDeviceSoftwareCompliance} from "./types import { ProvisionalModel as typeProvisionalModel} from "./types" import { RevokedModel as typeRevokedModel} from "./types" -export { MsgRevokeModel, MsgCertifyModel, MsgUpdateComplianceInfo, MsgProvisionModel, MsgDeleteComplianceInfo }; +export { MsgUpdateComplianceInfo, MsgCertifyModel, MsgDeleteComplianceInfo, MsgProvisionModel, MsgRevokeModel }; -type sendMsgRevokeModelParams = { - value: MsgRevokeModel, +type sendMsgUpdateComplianceInfoParams = { + value: MsgUpdateComplianceInfo, fee?: StdFee, memo?: string }; @@ -34,8 +34,8 @@ type sendMsgCertifyModelParams = { memo?: string }; -type sendMsgUpdateComplianceInfoParams = { - value: MsgUpdateComplianceInfo, +type sendMsgDeleteComplianceInfoParams = { + value: MsgDeleteComplianceInfo, fee?: StdFee, memo?: string }; @@ -46,31 +46,31 @@ type sendMsgProvisionModelParams = { memo?: string }; -type sendMsgDeleteComplianceInfoParams = { - value: MsgDeleteComplianceInfo, +type sendMsgRevokeModelParams = { + value: MsgRevokeModel, fee?: StdFee, memo?: string }; -type msgRevokeModelParams = { - value: MsgRevokeModel, +type msgUpdateComplianceInfoParams = { + value: MsgUpdateComplianceInfo, }; type msgCertifyModelParams = { value: MsgCertifyModel, }; -type msgUpdateComplianceInfoParams = { - value: MsgUpdateComplianceInfo, +type msgDeleteComplianceInfoParams = { + value: MsgDeleteComplianceInfo, }; type msgProvisionModelParams = { value: MsgProvisionModel, }; -type msgDeleteComplianceInfoParams = { - value: MsgDeleteComplianceInfo, +type msgRevokeModelParams = { + value: MsgRevokeModel, }; @@ -103,17 +103,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgRevokeModel({ value, fee, memo }: sendMsgRevokeModelParams): Promise { + async sendMsgUpdateComplianceInfo({ value, fee, memo }: sendMsgUpdateComplianceInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeModel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateComplianceInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRevokeModel({ value: MsgRevokeModel.fromPartial(value) }) + let msg = this.msgUpdateComplianceInfo({ value: MsgUpdateComplianceInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeModel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateComplianceInfo: Could not broadcast Tx: '+ e.message) } }, @@ -131,17 +131,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdateComplianceInfo({ value, fee, memo }: sendMsgUpdateComplianceInfoParams): Promise { + async sendMsgDeleteComplianceInfo({ value, fee, memo }: sendMsgDeleteComplianceInfoParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateComplianceInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeleteComplianceInfo: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgUpdateComplianceInfo({ value: MsgUpdateComplianceInfo.fromPartial(value) }) + let msg = this.msgDeleteComplianceInfo({ value: MsgDeleteComplianceInfo.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateComplianceInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeleteComplianceInfo: Could not broadcast Tx: '+ e.message) } }, @@ -159,26 +159,26 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgDeleteComplianceInfo({ value, fee, memo }: sendMsgDeleteComplianceInfoParams): Promise { + async sendMsgRevokeModel({ value, fee, memo }: sendMsgRevokeModelParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeleteComplianceInfo: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeModel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgDeleteComplianceInfo({ value: MsgDeleteComplianceInfo.fromPartial(value) }) + let msg = this.msgRevokeModel({ value: MsgRevokeModel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeleteComplianceInfo: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeModel: Could not broadcast Tx: '+ e.message) } }, - msgRevokeModel({ value }: msgRevokeModelParams): EncodeObject { + msgUpdateComplianceInfo({ value }: msgUpdateComplianceInfoParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgRevokeModel", value: MsgRevokeModel.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", value: MsgUpdateComplianceInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeModel: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdateComplianceInfo: Could not create message: ' + e.message) } }, @@ -190,11 +190,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdateComplianceInfo({ value }: msgUpdateComplianceInfoParams): EncodeObject { + msgDeleteComplianceInfo({ value }: msgDeleteComplianceInfoParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", value: MsgUpdateComplianceInfo.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgDeleteComplianceInfo", value: MsgDeleteComplianceInfo.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateComplianceInfo: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeleteComplianceInfo: Could not create message: ' + e.message) } }, @@ -206,11 +206,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgDeleteComplianceInfo({ value }: msgDeleteComplianceInfoParams): EncodeObject { + msgRevokeModel({ value }: msgRevokeModelParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgDeleteComplianceInfo", value: MsgDeleteComplianceInfo.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgRevokeModel", value: MsgRevokeModel.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeleteComplianceInfo: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeModel: Could not create message: ' + e.message) } }, diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.compliance/registry.ts b/ts-client/zigbeealliance.distributedcomplianceledger.compliance/registry.ts index 56859a84d..ae2ff0273 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.compliance/registry.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.compliance/registry.ts @@ -1,16 +1,16 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgRevokeModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; -import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; import { MsgUpdateComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; -import { MsgProvisionModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; +import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; import { MsgDeleteComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; +import { MsgProvisionModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; +import { MsgRevokeModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/zigbeealliance.distributedcomplianceledger.compliance.MsgRevokeModel", MsgRevokeModel], - ["/zigbeealliance.distributedcomplianceledger.compliance.MsgCertifyModel", MsgCertifyModel], ["/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", MsgUpdateComplianceInfo], - ["/zigbeealliance.distributedcomplianceledger.compliance.MsgProvisionModel", MsgProvisionModel], + ["/zigbeealliance.distributedcomplianceledger.compliance.MsgCertifyModel", MsgCertifyModel], ["/zigbeealliance.distributedcomplianceledger.compliance.MsgDeleteComplianceInfo", MsgDeleteComplianceInfo], + ["/zigbeealliance.distributedcomplianceledger.compliance.MsgProvisionModel", MsgProvisionModel], + ["/zigbeealliance.distributedcomplianceledger.compliance.MsgRevokeModel", MsgRevokeModel], ]; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/module.ts b/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/module.ts index fc8419731..1c12dd37c 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/module.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/module.ts @@ -8,10 +8,10 @@ import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; import { MsgProposeAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; -import { MsgApproveAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; -import { MsgRejectAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; import { MsgApproveRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; import { MsgProposeRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; +import { MsgRejectAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; +import { MsgApproveAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; import { Account as typeAccount} from "./types" import { AccountStat as typeAccountStat} from "./types" @@ -21,7 +21,7 @@ import { PendingAccountRevocation as typePendingAccountRevocation} from "./types import { RejectedAccount as typeRejectedAccount} from "./types" import { RevokedAccount as typeRevokedAccount} from "./types" -export { MsgProposeAddAccount, MsgApproveAddAccount, MsgRejectAddAccount, MsgApproveRevokeAccount, MsgProposeRevokeAccount }; +export { MsgProposeAddAccount, MsgApproveRevokeAccount, MsgProposeRevokeAccount, MsgRejectAddAccount, MsgApproveAddAccount }; type sendMsgProposeAddAccountParams = { value: MsgProposeAddAccount, @@ -29,26 +29,26 @@ type sendMsgProposeAddAccountParams = { memo?: string }; -type sendMsgApproveAddAccountParams = { - value: MsgApproveAddAccount, +type sendMsgApproveRevokeAccountParams = { + value: MsgApproveRevokeAccount, fee?: StdFee, memo?: string }; -type sendMsgRejectAddAccountParams = { - value: MsgRejectAddAccount, +type sendMsgProposeRevokeAccountParams = { + value: MsgProposeRevokeAccount, fee?: StdFee, memo?: string }; -type sendMsgApproveRevokeAccountParams = { - value: MsgApproveRevokeAccount, +type sendMsgRejectAddAccountParams = { + value: MsgRejectAddAccount, fee?: StdFee, memo?: string }; -type sendMsgProposeRevokeAccountParams = { - value: MsgProposeRevokeAccount, +type sendMsgApproveAddAccountParams = { + value: MsgApproveAddAccount, fee?: StdFee, memo?: string }; @@ -58,14 +58,6 @@ type msgProposeAddAccountParams = { value: MsgProposeAddAccount, }; -type msgApproveAddAccountParams = { - value: MsgApproveAddAccount, -}; - -type msgRejectAddAccountParams = { - value: MsgRejectAddAccount, -}; - type msgApproveRevokeAccountParams = { value: MsgApproveRevokeAccount, }; @@ -74,6 +66,14 @@ type msgProposeRevokeAccountParams = { value: MsgProposeRevokeAccount, }; +type msgRejectAddAccountParams = { + value: MsgRejectAddAccount, +}; + +type msgApproveAddAccountParams = { + value: MsgApproveAddAccount, +}; + export const registry = new Registry(msgTypes); @@ -118,59 +118,59 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgApproveAddAccount({ value, fee, memo }: sendMsgApproveAddAccountParams): Promise { + async sendMsgApproveRevokeAccount({ value, fee, memo }: sendMsgApproveRevokeAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgApproveAddAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgApproveRevokeAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgApproveAddAccount({ value: MsgApproveAddAccount.fromPartial(value) }) + let msg = this.msgApproveRevokeAccount({ value: MsgApproveRevokeAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgApproveAddAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgApproveRevokeAccount: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRejectAddAccount({ value, fee, memo }: sendMsgRejectAddAccountParams): Promise { + async sendMsgProposeRevokeAccount({ value, fee, memo }: sendMsgProposeRevokeAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRejectAddAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgProposeRevokeAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRejectAddAccount({ value: MsgRejectAddAccount.fromPartial(value) }) + let msg = this.msgProposeRevokeAccount({ value: MsgProposeRevokeAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRejectAddAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgProposeRevokeAccount: Could not broadcast Tx: '+ e.message) } }, - async sendMsgApproveRevokeAccount({ value, fee, memo }: sendMsgApproveRevokeAccountParams): Promise { + async sendMsgRejectAddAccount({ value, fee, memo }: sendMsgRejectAddAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgApproveRevokeAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRejectAddAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgApproveRevokeAccount({ value: MsgApproveRevokeAccount.fromPartial(value) }) + let msg = this.msgRejectAddAccount({ value: MsgRejectAddAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgApproveRevokeAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRejectAddAccount: Could not broadcast Tx: '+ e.message) } }, - async sendMsgProposeRevokeAccount({ value, fee, memo }: sendMsgProposeRevokeAccountParams): Promise { + async sendMsgApproveAddAccount({ value, fee, memo }: sendMsgApproveAddAccountParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgProposeRevokeAccount: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgApproveAddAccount: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgProposeRevokeAccount({ value: MsgProposeRevokeAccount.fromPartial(value) }) + let msg = this.msgApproveAddAccount({ value: MsgApproveAddAccount.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgProposeRevokeAccount: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgApproveAddAccount: Could not broadcast Tx: '+ e.message) } }, @@ -183,35 +183,35 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgApproveAddAccount({ value }: msgApproveAddAccountParams): EncodeObject { + msgApproveRevokeAccount({ value }: msgApproveRevokeAccountParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveAddAccount", value: MsgApproveAddAccount.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveRevokeAccount", value: MsgApproveRevokeAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgApproveAddAccount: Could not create message: ' + e.message) + throw new Error('TxClient:MsgApproveRevokeAccount: Could not create message: ' + e.message) } }, - msgRejectAddAccount({ value }: msgRejectAddAccountParams): EncodeObject { + msgProposeRevokeAccount({ value }: msgProposeRevokeAccountParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgRejectAddAccount", value: MsgRejectAddAccount.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeRevokeAccount", value: MsgProposeRevokeAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRejectAddAccount: Could not create message: ' + e.message) + throw new Error('TxClient:MsgProposeRevokeAccount: Could not create message: ' + e.message) } }, - msgApproveRevokeAccount({ value }: msgApproveRevokeAccountParams): EncodeObject { + msgRejectAddAccount({ value }: msgRejectAddAccountParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveRevokeAccount", value: MsgApproveRevokeAccount.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgRejectAddAccount", value: MsgRejectAddAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgApproveRevokeAccount: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRejectAddAccount: Could not create message: ' + e.message) } }, - msgProposeRevokeAccount({ value }: msgProposeRevokeAccountParams): EncodeObject { + msgApproveAddAccount({ value }: msgApproveAddAccountParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeRevokeAccount", value: MsgProposeRevokeAccount.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveAddAccount", value: MsgApproveAddAccount.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgProposeRevokeAccount: Could not create message: ' + e.message) + throw new Error('TxClient:MsgApproveAddAccount: Could not create message: ' + e.message) } }, diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/registry.ts b/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/registry.ts index bdc07df48..c44224ed3 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/registry.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.dclauth/registry.ts @@ -1,16 +1,16 @@ import { GeneratedType } from "@cosmjs/proto-signing"; import { MsgProposeAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; -import { MsgApproveAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; -import { MsgRejectAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; import { MsgApproveRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; import { MsgProposeRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; +import { MsgRejectAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; +import { MsgApproveAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx"; const msgTypes: Array<[string, GeneratedType]> = [ ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeAddAccount", MsgProposeAddAccount], - ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveAddAccount", MsgApproveAddAccount], - ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgRejectAddAccount", MsgRejectAddAccount], ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveRevokeAccount", MsgApproveRevokeAccount], ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeRevokeAccount", MsgProposeRevokeAccount], + ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgRejectAddAccount", MsgRejectAddAccount], + ["/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveAddAccount", MsgApproveAddAccount], ]; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/module.ts b/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/module.ts index c66dbc0d4..7d78166af 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/module.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/module.ts @@ -7,19 +7,19 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgApproveUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; -import { MsgProposeUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; import { MsgRejectUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; +import { MsgProposeUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; +import { MsgApproveUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; import { ApprovedUpgrade as typeApprovedUpgrade} from "./types" import { Grant as typeGrant} from "./types" import { ProposedUpgrade as typeProposedUpgrade} from "./types" import { RejectedUpgrade as typeRejectedUpgrade} from "./types" -export { MsgApproveUpgrade, MsgProposeUpgrade, MsgRejectUpgrade }; +export { MsgRejectUpgrade, MsgProposeUpgrade, MsgApproveUpgrade }; -type sendMsgApproveUpgradeParams = { - value: MsgApproveUpgrade, +type sendMsgRejectUpgradeParams = { + value: MsgRejectUpgrade, fee?: StdFee, memo?: string }; @@ -30,23 +30,23 @@ type sendMsgProposeUpgradeParams = { memo?: string }; -type sendMsgRejectUpgradeParams = { - value: MsgRejectUpgrade, +type sendMsgApproveUpgradeParams = { + value: MsgApproveUpgrade, fee?: StdFee, memo?: string }; -type msgApproveUpgradeParams = { - value: MsgApproveUpgrade, +type msgRejectUpgradeParams = { + value: MsgRejectUpgrade, }; type msgProposeUpgradeParams = { value: MsgProposeUpgrade, }; -type msgRejectUpgradeParams = { - value: MsgRejectUpgrade, +type msgApproveUpgradeParams = { + value: MsgApproveUpgrade, }; @@ -79,17 +79,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgApproveUpgrade({ value, fee, memo }: sendMsgApproveUpgradeParams): Promise { + async sendMsgRejectUpgrade({ value, fee, memo }: sendMsgRejectUpgradeParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgApproveUpgrade: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRejectUpgrade: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgApproveUpgrade({ value: MsgApproveUpgrade.fromPartial(value) }) + let msg = this.msgRejectUpgrade({ value: MsgRejectUpgrade.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgApproveUpgrade: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRejectUpgrade: Could not broadcast Tx: '+ e.message) } }, @@ -107,26 +107,26 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgRejectUpgrade({ value, fee, memo }: sendMsgRejectUpgradeParams): Promise { + async sendMsgApproveUpgrade({ value, fee, memo }: sendMsgApproveUpgradeParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRejectUpgrade: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgApproveUpgrade: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRejectUpgrade({ value: MsgRejectUpgrade.fromPartial(value) }) + let msg = this.msgApproveUpgrade({ value: MsgApproveUpgrade.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRejectUpgrade: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgApproveUpgrade: Could not broadcast Tx: '+ e.message) } }, - msgApproveUpgrade({ value }: msgApproveUpgradeParams): EncodeObject { + msgRejectUpgrade({ value }: msgRejectUpgradeParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgApproveUpgrade", value: MsgApproveUpgrade.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgRejectUpgrade", value: MsgRejectUpgrade.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgApproveUpgrade: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRejectUpgrade: Could not create message: ' + e.message) } }, @@ -138,11 +138,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgRejectUpgrade({ value }: msgRejectUpgradeParams): EncodeObject { + msgApproveUpgrade({ value }: msgApproveUpgradeParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgRejectUpgrade", value: MsgRejectUpgrade.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgApproveUpgrade", value: MsgApproveUpgrade.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRejectUpgrade: Could not create message: ' + e.message) + throw new Error('TxClient:MsgApproveUpgrade: Could not create message: ' + e.message) } }, diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/registry.ts b/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/registry.ts index e81fcdafd..ac3376f27 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/registry.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.dclupgrade/registry.ts @@ -1,12 +1,12 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgApproveUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; -import { MsgProposeUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; import { MsgRejectUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; +import { MsgProposeUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; +import { MsgApproveUpgrade } from "./types/zigbeealliance/distributedcomplianceledger/dclupgrade/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgApproveUpgrade", MsgApproveUpgrade], - ["/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgProposeUpgrade", MsgProposeUpgrade], ["/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgRejectUpgrade", MsgRejectUpgrade], + ["/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgProposeUpgrade", MsgProposeUpgrade], + ["/zigbeealliance.distributedcomplianceledger.dclupgrade.MsgApproveUpgrade", MsgApproveUpgrade], ]; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.model/module.ts b/ts-client/zigbeealliance.distributedcomplianceledger.model/module.ts index 385173dea..13ff97e47 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.model/module.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.model/module.ts @@ -7,12 +7,12 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgCreateModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgUpdateModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgDeleteModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; -import { MsgCreateModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgUpdateModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgDeleteModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; +import { MsgCreateModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; +import { MsgCreateModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { Model as typeModel} from "./types" import { ModelVersion as typeModelVersion} from "./types" @@ -20,13 +20,7 @@ import { ModelVersions as typeModelVersions} from "./types" import { Product as typeProduct} from "./types" import { VendorProducts as typeVendorProducts} from "./types" -export { MsgCreateModel, MsgUpdateModel, MsgDeleteModelVersion, MsgCreateModelVersion, MsgUpdateModelVersion, MsgDeleteModel }; - -type sendMsgCreateModelParams = { - value: MsgCreateModel, - fee?: StdFee, - memo?: string -}; +export { MsgUpdateModel, MsgDeleteModelVersion, MsgUpdateModelVersion, MsgDeleteModel, MsgCreateModel, MsgCreateModelVersion }; type sendMsgUpdateModelParams = { value: MsgUpdateModel, @@ -40,12 +34,6 @@ type sendMsgDeleteModelVersionParams = { memo?: string }; -type sendMsgCreateModelVersionParams = { - value: MsgCreateModelVersion, - fee?: StdFee, - memo?: string -}; - type sendMsgUpdateModelVersionParams = { value: MsgUpdateModelVersion, fee?: StdFee, @@ -58,11 +46,19 @@ type sendMsgDeleteModelParams = { memo?: string }; - -type msgCreateModelParams = { +type sendMsgCreateModelParams = { value: MsgCreateModel, + fee?: StdFee, + memo?: string }; +type sendMsgCreateModelVersionParams = { + value: MsgCreateModelVersion, + fee?: StdFee, + memo?: string +}; + + type msgUpdateModelParams = { value: MsgUpdateModel, }; @@ -71,10 +67,6 @@ type msgDeleteModelVersionParams = { value: MsgDeleteModelVersion, }; -type msgCreateModelVersionParams = { - value: MsgCreateModelVersion, -}; - type msgUpdateModelVersionParams = { value: MsgUpdateModelVersion, }; @@ -83,6 +75,14 @@ type msgDeleteModelParams = { value: MsgDeleteModel, }; +type msgCreateModelParams = { + value: MsgCreateModel, +}; + +type msgCreateModelVersionParams = { + value: MsgCreateModelVersion, +}; + export const registry = new Registry(msgTypes); @@ -113,20 +113,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgCreateModel({ value, fee, memo }: sendMsgCreateModelParams): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgCreateModel: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgCreateModel({ value: MsgCreateModel.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendMsgCreateModel: Could not broadcast Tx: '+ e.message) - } - }, - async sendMsgUpdateModel({ value, fee, memo }: sendMsgUpdateModelParams): Promise { if (!signer) { throw new Error('TxClient:sendMsgUpdateModel: Unable to sign Tx. Signer is not present.') @@ -155,57 +141,63 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgCreateModelVersion({ value, fee, memo }: sendMsgCreateModelVersionParams): Promise { + async sendMsgUpdateModelVersion({ value, fee, memo }: sendMsgUpdateModelVersionParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateModelVersion: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdateModelVersion: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgCreateModelVersion({ value: MsgCreateModelVersion.fromPartial(value) }) + let msg = this.msgUpdateModelVersion({ value: MsgUpdateModelVersion.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateModelVersion: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdateModelVersion: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateModelVersion({ value, fee, memo }: sendMsgUpdateModelVersionParams): Promise { + async sendMsgDeleteModel({ value, fee, memo }: sendMsgDeleteModelParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateModelVersion: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeleteModel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgUpdateModelVersion({ value: MsgUpdateModelVersion.fromPartial(value) }) + let msg = this.msgDeleteModel({ value: MsgDeleteModel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateModelVersion: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeleteModel: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeleteModel({ value, fee, memo }: sendMsgDeleteModelParams): Promise { + async sendMsgCreateModel({ value, fee, memo }: sendMsgCreateModelParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeleteModel: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateModel: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgDeleteModel({ value: MsgDeleteModel.fromPartial(value) }) + let msg = this.msgCreateModel({ value: MsgCreateModel.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeleteModel: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateModel: Could not broadcast Tx: '+ e.message) } }, - - msgCreateModel({ value }: msgCreateModelParams): EncodeObject { - try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.model.MsgCreateModel", value: MsgCreateModel.fromPartial( value ) } + async sendMsgCreateModelVersion({ value, fee, memo }: sendMsgCreateModelVersionParams): Promise { + if (!signer) { + throw new Error('TxClient:sendMsgCreateModelVersion: Unable to sign Tx. Signer is not present.') + } + try { + const { address } = (await signer.getAccounts())[0]; + const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); + let msg = this.msgCreateModelVersion({ value: MsgCreateModelVersion.fromPartial(value) }) + return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:MsgCreateModel: Could not create message: ' + e.message) + throw new Error('TxClient:sendMsgCreateModelVersion: Could not broadcast Tx: '+ e.message) } }, + msgUpdateModel({ value }: msgUpdateModelParams): EncodeObject { try { return { typeUrl: "/zigbeealliance.distributedcomplianceledger.model.MsgUpdateModel", value: MsgUpdateModel.fromPartial( value ) } @@ -222,14 +214,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgCreateModelVersion({ value }: msgCreateModelVersionParams): EncodeObject { - try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.model.MsgCreateModelVersion", value: MsgCreateModelVersion.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgCreateModelVersion: Could not create message: ' + e.message) - } - }, - msgUpdateModelVersion({ value }: msgUpdateModelVersionParams): EncodeObject { try { return { typeUrl: "/zigbeealliance.distributedcomplianceledger.model.MsgUpdateModelVersion", value: MsgUpdateModelVersion.fromPartial( value ) } @@ -246,6 +230,22 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, + msgCreateModel({ value }: msgCreateModelParams): EncodeObject { + try { + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.model.MsgCreateModel", value: MsgCreateModel.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgCreateModel: Could not create message: ' + e.message) + } + }, + + msgCreateModelVersion({ value }: msgCreateModelVersionParams): EncodeObject { + try { + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.model.MsgCreateModelVersion", value: MsgCreateModelVersion.fromPartial( value ) } + } catch (e: any) { + throw new Error('TxClient:MsgCreateModelVersion: Could not create message: ' + e.message) + } + }, + } }; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.model/registry.ts b/ts-client/zigbeealliance.distributedcomplianceledger.model/registry.ts index 8537d5bfb..fb0123042 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.model/registry.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.model/registry.ts @@ -1,18 +1,18 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgCreateModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgUpdateModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgDeleteModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; -import { MsgCreateModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgUpdateModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; import { MsgDeleteModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; +import { MsgCreateModel } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; +import { MsgCreateModelVersion } from "./types/zigbeealliance/distributedcomplianceledger/model/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/zigbeealliance.distributedcomplianceledger.model.MsgCreateModel", MsgCreateModel], ["/zigbeealliance.distributedcomplianceledger.model.MsgUpdateModel", MsgUpdateModel], ["/zigbeealliance.distributedcomplianceledger.model.MsgDeleteModelVersion", MsgDeleteModelVersion], - ["/zigbeealliance.distributedcomplianceledger.model.MsgCreateModelVersion", MsgCreateModelVersion], ["/zigbeealliance.distributedcomplianceledger.model.MsgUpdateModelVersion", MsgUpdateModelVersion], ["/zigbeealliance.distributedcomplianceledger.model.MsgDeleteModel", MsgDeleteModel], + ["/zigbeealliance.distributedcomplianceledger.model.MsgCreateModel", MsgCreateModel], + ["/zigbeealliance.distributedcomplianceledger.model.MsgCreateModelVersion", MsgCreateModelVersion], ]; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.model/rest.ts b/ts-client/zigbeealliance.distributedcomplianceledger.model/rest.ts index e074fd071..e067585aa 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.model/rest.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.model/rest.ts @@ -44,7 +44,6 @@ export interface DistributedcomplianceledgermodelModel { /** @format int64 */ schemaVersion?: number; - managedAclExtensionRequestFlowUrl?: string; /** @format int32 */ enhancedSetupFlowOptions?: number; @@ -57,6 +56,10 @@ export interface DistributedcomplianceledgermodelModel { /** @format int64 */ enhancedSetupFlowTCFileSize?: number; maintenanceUrl?: string; + + /** @format int64 */ + discoveryCapabilitiesBitmask?: number; + commissioningFallbackUrl?: string; } export interface DistributedcomplianceledgermodelModelVersion { diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/model.ts b/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/model.ts index 5abc40b0e..546bce778 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/model.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/model.ts @@ -23,13 +23,14 @@ export interface Model { lsfRevision: number; creator: string; schemaVersion: number; - managedAclExtensionRequestFlowUrl: string; enhancedSetupFlowOptions: number; enhancedSetupFlowTCUrl: string; enhancedSetupFlowTCRevision: number; enhancedSetupFlowTCDigest: string; enhancedSetupFlowTCFileSize: number; maintenanceUrl: string; + discoveryCapabilitiesBitmask: number; + commissioningFallbackUrl: string; } function createBaseModel(): Model { @@ -53,13 +54,14 @@ function createBaseModel(): Model { lsfRevision: 0, creator: "", schemaVersion: 0, - managedAclExtensionRequestFlowUrl: "", enhancedSetupFlowOptions: 0, enhancedSetupFlowTCUrl: "", enhancedSetupFlowTCRevision: 0, enhancedSetupFlowTCDigest: "", enhancedSetupFlowTCFileSize: 0, maintenanceUrl: "", + discoveryCapabilitiesBitmask: 0, + commissioningFallbackUrl: "", }; } @@ -122,26 +124,29 @@ export const Model = { if (message.schemaVersion !== 0) { writer.uint32(152).uint32(message.schemaVersion); } - if (message.managedAclExtensionRequestFlowUrl !== "") { - writer.uint32(162).string(message.managedAclExtensionRequestFlowUrl); - } if (message.enhancedSetupFlowOptions !== 0) { - writer.uint32(168).int32(message.enhancedSetupFlowOptions); + writer.uint32(160).int32(message.enhancedSetupFlowOptions); } if (message.enhancedSetupFlowTCUrl !== "") { - writer.uint32(178).string(message.enhancedSetupFlowTCUrl); + writer.uint32(170).string(message.enhancedSetupFlowTCUrl); } if (message.enhancedSetupFlowTCRevision !== 0) { - writer.uint32(184).int32(message.enhancedSetupFlowTCRevision); + writer.uint32(176).int32(message.enhancedSetupFlowTCRevision); } if (message.enhancedSetupFlowTCDigest !== "") { - writer.uint32(194).string(message.enhancedSetupFlowTCDigest); + writer.uint32(186).string(message.enhancedSetupFlowTCDigest); } if (message.enhancedSetupFlowTCFileSize !== 0) { - writer.uint32(200).uint32(message.enhancedSetupFlowTCFileSize); + writer.uint32(192).uint32(message.enhancedSetupFlowTCFileSize); } if (message.maintenanceUrl !== "") { - writer.uint32(210).string(message.maintenanceUrl); + writer.uint32(202).string(message.maintenanceUrl); + } + if (message.discoveryCapabilitiesBitmask !== 0) { + writer.uint32(208).uint32(message.discoveryCapabilitiesBitmask); + } + if (message.commissioningFallbackUrl !== "") { + writer.uint32(218).string(message.commissioningFallbackUrl); } return writer; }, @@ -211,25 +216,28 @@ export const Model = { message.schemaVersion = reader.uint32(); break; case 20: - message.managedAclExtensionRequestFlowUrl = reader.string(); + message.enhancedSetupFlowOptions = reader.int32(); break; case 21: - message.enhancedSetupFlowOptions = reader.int32(); + message.enhancedSetupFlowTCUrl = reader.string(); break; case 22: - message.enhancedSetupFlowTCUrl = reader.string(); + message.enhancedSetupFlowTCRevision = reader.int32(); break; case 23: - message.enhancedSetupFlowTCRevision = reader.int32(); + message.enhancedSetupFlowTCDigest = reader.string(); break; case 24: - message.enhancedSetupFlowTCDigest = reader.string(); + message.enhancedSetupFlowTCFileSize = reader.uint32(); break; case 25: - message.enhancedSetupFlowTCFileSize = reader.uint32(); + message.maintenanceUrl = reader.string(); break; case 26: - message.maintenanceUrl = reader.string(); + message.discoveryCapabilitiesBitmask = reader.uint32(); + break; + case 27: + message.commissioningFallbackUrl = reader.string(); break; default: reader.skipType(tag & 7); @@ -270,9 +278,6 @@ export const Model = { lsfRevision: isSet(object.lsfRevision) ? Number(object.lsfRevision) : 0, creator: isSet(object.creator) ? String(object.creator) : "", schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, - managedAclExtensionRequestFlowUrl: isSet(object.managedAclExtensionRequestFlowUrl) - ? String(object.managedAclExtensionRequestFlowUrl) - : "", enhancedSetupFlowOptions: isSet(object.enhancedSetupFlowOptions) ? Number(object.enhancedSetupFlowOptions) : 0, enhancedSetupFlowTCUrl: isSet(object.enhancedSetupFlowTCUrl) ? String(object.enhancedSetupFlowTCUrl) : "", enhancedSetupFlowTCRevision: isSet(object.enhancedSetupFlowTCRevision) @@ -285,6 +290,10 @@ export const Model = { ? Number(object.enhancedSetupFlowTCFileSize) : 0, maintenanceUrl: isSet(object.maintenanceUrl) ? String(object.maintenanceUrl) : "", + discoveryCapabilitiesBitmask: isSet(object.discoveryCapabilitiesBitmask) + ? Number(object.discoveryCapabilitiesBitmask) + : 0, + commissioningFallbackUrl: isSet(object.commissioningFallbackUrl) ? String(object.commissioningFallbackUrl) : "", }; }, @@ -315,8 +324,6 @@ export const Model = { message.lsfRevision !== undefined && (obj.lsfRevision = Math.round(message.lsfRevision)); message.creator !== undefined && (obj.creator = message.creator); message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); - message.managedAclExtensionRequestFlowUrl !== undefined - && (obj.managedAclExtensionRequestFlowUrl = message.managedAclExtensionRequestFlowUrl); message.enhancedSetupFlowOptions !== undefined && (obj.enhancedSetupFlowOptions = Math.round(message.enhancedSetupFlowOptions)); message.enhancedSetupFlowTCUrl !== undefined && (obj.enhancedSetupFlowTCUrl = message.enhancedSetupFlowTCUrl); @@ -327,6 +334,9 @@ export const Model = { message.enhancedSetupFlowTCFileSize !== undefined && (obj.enhancedSetupFlowTCFileSize = Math.round(message.enhancedSetupFlowTCFileSize)); message.maintenanceUrl !== undefined && (obj.maintenanceUrl = message.maintenanceUrl); + message.discoveryCapabilitiesBitmask !== undefined + && (obj.discoveryCapabilitiesBitmask = Math.round(message.discoveryCapabilitiesBitmask)); + message.commissioningFallbackUrl !== undefined && (obj.commissioningFallbackUrl = message.commissioningFallbackUrl); return obj; }, @@ -351,13 +361,14 @@ export const Model = { message.lsfRevision = object.lsfRevision ?? 0; message.creator = object.creator ?? ""; message.schemaVersion = object.schemaVersion ?? 0; - message.managedAclExtensionRequestFlowUrl = object.managedAclExtensionRequestFlowUrl ?? ""; message.enhancedSetupFlowOptions = object.enhancedSetupFlowOptions ?? 0; message.enhancedSetupFlowTCUrl = object.enhancedSetupFlowTCUrl ?? ""; message.enhancedSetupFlowTCRevision = object.enhancedSetupFlowTCRevision ?? 0; message.enhancedSetupFlowTCDigest = object.enhancedSetupFlowTCDigest ?? ""; message.enhancedSetupFlowTCFileSize = object.enhancedSetupFlowTCFileSize ?? 0; message.maintenanceUrl = object.maintenanceUrl ?? ""; + message.discoveryCapabilitiesBitmask = object.discoveryCapabilitiesBitmask ?? 0; + message.commissioningFallbackUrl = object.commissioningFallbackUrl ?? ""; return message; }, }; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/tx.ts b/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/tx.ts index 2cd165be8..8e1758ca9 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/tx.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.model/types/zigbeealliance/distributedcomplianceledger/model/tx.ts @@ -23,13 +23,14 @@ export interface MsgCreateModel { productUrl: string; lsfUrl: string; schemaVersion: number; - managedAclExtensionRequestFlowUrl: string; enhancedSetupFlowOptions: number; enhancedSetupFlowTCUrl: string; enhancedSetupFlowTCRevision: number; enhancedSetupFlowTCDigest: string; enhancedSetupFlowTCFileSize: number; maintenanceUrl: string; + discoveryCapabilitiesBitmask: number; + commissioningFallbackUrl: string; } export interface MsgCreateModelResponse { @@ -51,7 +52,6 @@ export interface MsgUpdateModel { lsfUrl: string; lsfRevision: number; schemaVersion: number; - managedAclExtensionRequestFlowUrl: string; commissioningModeInitialStepsHint: number; enhancedSetupFlowOptions: number; enhancedSetupFlowTCUrl: string; @@ -59,6 +59,7 @@ export interface MsgUpdateModel { enhancedSetupFlowTCDigest: string; enhancedSetupFlowTCFileSize: number; maintenanceUrl: string; + commissioningFallbackUrl: string; } export interface MsgUpdateModelResponse { @@ -143,13 +144,14 @@ function createBaseMsgCreateModel(): MsgCreateModel { productUrl: "", lsfUrl: "", schemaVersion: 0, - managedAclExtensionRequestFlowUrl: "", enhancedSetupFlowOptions: 0, enhancedSetupFlowTCUrl: "", enhancedSetupFlowTCRevision: 0, enhancedSetupFlowTCDigest: "", enhancedSetupFlowTCFileSize: 0, maintenanceUrl: "", + discoveryCapabilitiesBitmask: 0, + commissioningFallbackUrl: "", }; } @@ -209,26 +211,29 @@ export const MsgCreateModel = { if (message.schemaVersion !== 0) { writer.uint32(144).uint32(message.schemaVersion); } - if (message.managedAclExtensionRequestFlowUrl !== "") { - writer.uint32(154).string(message.managedAclExtensionRequestFlowUrl); - } if (message.enhancedSetupFlowOptions !== 0) { - writer.uint32(160).int32(message.enhancedSetupFlowOptions); + writer.uint32(152).int32(message.enhancedSetupFlowOptions); } if (message.enhancedSetupFlowTCUrl !== "") { - writer.uint32(170).string(message.enhancedSetupFlowTCUrl); + writer.uint32(162).string(message.enhancedSetupFlowTCUrl); } if (message.enhancedSetupFlowTCRevision !== 0) { - writer.uint32(176).int32(message.enhancedSetupFlowTCRevision); + writer.uint32(168).int32(message.enhancedSetupFlowTCRevision); } if (message.enhancedSetupFlowTCDigest !== "") { - writer.uint32(186).string(message.enhancedSetupFlowTCDigest); + writer.uint32(178).string(message.enhancedSetupFlowTCDigest); } if (message.enhancedSetupFlowTCFileSize !== 0) { - writer.uint32(192).uint32(message.enhancedSetupFlowTCFileSize); + writer.uint32(184).uint32(message.enhancedSetupFlowTCFileSize); } if (message.maintenanceUrl !== "") { - writer.uint32(202).string(message.maintenanceUrl); + writer.uint32(194).string(message.maintenanceUrl); + } + if (message.discoveryCapabilitiesBitmask !== 0) { + writer.uint32(200).uint32(message.discoveryCapabilitiesBitmask); + } + if (message.commissioningFallbackUrl !== "") { + writer.uint32(210).string(message.commissioningFallbackUrl); } return writer; }, @@ -295,25 +300,28 @@ export const MsgCreateModel = { message.schemaVersion = reader.uint32(); break; case 19: - message.managedAclExtensionRequestFlowUrl = reader.string(); + message.enhancedSetupFlowOptions = reader.int32(); break; case 20: - message.enhancedSetupFlowOptions = reader.int32(); + message.enhancedSetupFlowTCUrl = reader.string(); break; case 21: - message.enhancedSetupFlowTCUrl = reader.string(); + message.enhancedSetupFlowTCRevision = reader.int32(); break; case 22: - message.enhancedSetupFlowTCRevision = reader.int32(); + message.enhancedSetupFlowTCDigest = reader.string(); break; case 23: - message.enhancedSetupFlowTCDigest = reader.string(); + message.enhancedSetupFlowTCFileSize = reader.uint32(); break; case 24: - message.enhancedSetupFlowTCFileSize = reader.uint32(); + message.maintenanceUrl = reader.string(); break; case 25: - message.maintenanceUrl = reader.string(); + message.discoveryCapabilitiesBitmask = reader.uint32(); + break; + case 26: + message.commissioningFallbackUrl = reader.string(); break; default: reader.skipType(tag & 7); @@ -353,9 +361,6 @@ export const MsgCreateModel = { productUrl: isSet(object.productUrl) ? String(object.productUrl) : "", lsfUrl: isSet(object.lsfUrl) ? String(object.lsfUrl) : "", schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, - managedAclExtensionRequestFlowUrl: isSet(object.managedAclExtensionRequestFlowUrl) - ? String(object.managedAclExtensionRequestFlowUrl) - : "", enhancedSetupFlowOptions: isSet(object.enhancedSetupFlowOptions) ? Number(object.enhancedSetupFlowOptions) : 0, enhancedSetupFlowTCUrl: isSet(object.enhancedSetupFlowTCUrl) ? String(object.enhancedSetupFlowTCUrl) : "", enhancedSetupFlowTCRevision: isSet(object.enhancedSetupFlowTCRevision) @@ -368,6 +373,10 @@ export const MsgCreateModel = { ? Number(object.enhancedSetupFlowTCFileSize) : 0, maintenanceUrl: isSet(object.maintenanceUrl) ? String(object.maintenanceUrl) : "", + discoveryCapabilitiesBitmask: isSet(object.discoveryCapabilitiesBitmask) + ? Number(object.discoveryCapabilitiesBitmask) + : 0, + commissioningFallbackUrl: isSet(object.commissioningFallbackUrl) ? String(object.commissioningFallbackUrl) : "", }; }, @@ -397,8 +406,6 @@ export const MsgCreateModel = { message.productUrl !== undefined && (obj.productUrl = message.productUrl); message.lsfUrl !== undefined && (obj.lsfUrl = message.lsfUrl); message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); - message.managedAclExtensionRequestFlowUrl !== undefined - && (obj.managedAclExtensionRequestFlowUrl = message.managedAclExtensionRequestFlowUrl); message.enhancedSetupFlowOptions !== undefined && (obj.enhancedSetupFlowOptions = Math.round(message.enhancedSetupFlowOptions)); message.enhancedSetupFlowTCUrl !== undefined && (obj.enhancedSetupFlowTCUrl = message.enhancedSetupFlowTCUrl); @@ -409,6 +416,9 @@ export const MsgCreateModel = { message.enhancedSetupFlowTCFileSize !== undefined && (obj.enhancedSetupFlowTCFileSize = Math.round(message.enhancedSetupFlowTCFileSize)); message.maintenanceUrl !== undefined && (obj.maintenanceUrl = message.maintenanceUrl); + message.discoveryCapabilitiesBitmask !== undefined + && (obj.discoveryCapabilitiesBitmask = Math.round(message.discoveryCapabilitiesBitmask)); + message.commissioningFallbackUrl !== undefined && (obj.commissioningFallbackUrl = message.commissioningFallbackUrl); return obj; }, @@ -432,13 +442,14 @@ export const MsgCreateModel = { message.productUrl = object.productUrl ?? ""; message.lsfUrl = object.lsfUrl ?? ""; message.schemaVersion = object.schemaVersion ?? 0; - message.managedAclExtensionRequestFlowUrl = object.managedAclExtensionRequestFlowUrl ?? ""; message.enhancedSetupFlowOptions = object.enhancedSetupFlowOptions ?? 0; message.enhancedSetupFlowTCUrl = object.enhancedSetupFlowTCUrl ?? ""; message.enhancedSetupFlowTCRevision = object.enhancedSetupFlowTCRevision ?? 0; message.enhancedSetupFlowTCDigest = object.enhancedSetupFlowTCDigest ?? ""; message.enhancedSetupFlowTCFileSize = object.enhancedSetupFlowTCFileSize ?? 0; message.maintenanceUrl = object.maintenanceUrl ?? ""; + message.discoveryCapabilitiesBitmask = object.discoveryCapabilitiesBitmask ?? 0; + message.commissioningFallbackUrl = object.commissioningFallbackUrl ?? ""; return message; }, }; @@ -499,7 +510,6 @@ function createBaseMsgUpdateModel(): MsgUpdateModel { lsfUrl: "", lsfRevision: 0, schemaVersion: 0, - managedAclExtensionRequestFlowUrl: "", commissioningModeInitialStepsHint: 0, enhancedSetupFlowOptions: 0, enhancedSetupFlowTCUrl: "", @@ -507,6 +517,7 @@ function createBaseMsgUpdateModel(): MsgUpdateModel { enhancedSetupFlowTCDigest: "", enhancedSetupFlowTCFileSize: 0, maintenanceUrl: "", + commissioningFallbackUrl: "", }; } @@ -557,29 +568,29 @@ export const MsgUpdateModel = { if (message.schemaVersion !== 0) { writer.uint32(120).uint32(message.schemaVersion); } - if (message.managedAclExtensionRequestFlowUrl !== "") { - writer.uint32(130).string(message.managedAclExtensionRequestFlowUrl); - } if (message.commissioningModeInitialStepsHint !== 0) { - writer.uint32(136).uint32(message.commissioningModeInitialStepsHint); + writer.uint32(128).uint32(message.commissioningModeInitialStepsHint); } if (message.enhancedSetupFlowOptions !== 0) { - writer.uint32(144).int32(message.enhancedSetupFlowOptions); + writer.uint32(136).int32(message.enhancedSetupFlowOptions); } if (message.enhancedSetupFlowTCUrl !== "") { - writer.uint32(154).string(message.enhancedSetupFlowTCUrl); + writer.uint32(146).string(message.enhancedSetupFlowTCUrl); } if (message.enhancedSetupFlowTCRevision !== 0) { - writer.uint32(160).int32(message.enhancedSetupFlowTCRevision); + writer.uint32(152).int32(message.enhancedSetupFlowTCRevision); } if (message.enhancedSetupFlowTCDigest !== "") { - writer.uint32(170).string(message.enhancedSetupFlowTCDigest); + writer.uint32(162).string(message.enhancedSetupFlowTCDigest); } if (message.enhancedSetupFlowTCFileSize !== 0) { - writer.uint32(176).uint32(message.enhancedSetupFlowTCFileSize); + writer.uint32(168).uint32(message.enhancedSetupFlowTCFileSize); } if (message.maintenanceUrl !== "") { - writer.uint32(186).string(message.maintenanceUrl); + writer.uint32(178).string(message.maintenanceUrl); + } + if (message.commissioningFallbackUrl !== "") { + writer.uint32(186).string(message.commissioningFallbackUrl); } return writer; }, @@ -637,28 +648,28 @@ export const MsgUpdateModel = { message.schemaVersion = reader.uint32(); break; case 16: - message.managedAclExtensionRequestFlowUrl = reader.string(); + message.commissioningModeInitialStepsHint = reader.uint32(); break; case 17: - message.commissioningModeInitialStepsHint = reader.uint32(); + message.enhancedSetupFlowOptions = reader.int32(); break; case 18: - message.enhancedSetupFlowOptions = reader.int32(); + message.enhancedSetupFlowTCUrl = reader.string(); break; case 19: - message.enhancedSetupFlowTCUrl = reader.string(); + message.enhancedSetupFlowTCRevision = reader.int32(); break; case 20: - message.enhancedSetupFlowTCRevision = reader.int32(); + message.enhancedSetupFlowTCDigest = reader.string(); break; case 21: - message.enhancedSetupFlowTCDigest = reader.string(); + message.enhancedSetupFlowTCFileSize = reader.uint32(); break; case 22: - message.enhancedSetupFlowTCFileSize = reader.uint32(); + message.maintenanceUrl = reader.string(); break; case 23: - message.maintenanceUrl = reader.string(); + message.commissioningFallbackUrl = reader.string(); break; default: reader.skipType(tag & 7); @@ -691,9 +702,6 @@ export const MsgUpdateModel = { lsfUrl: isSet(object.lsfUrl) ? String(object.lsfUrl) : "", lsfRevision: isSet(object.lsfRevision) ? Number(object.lsfRevision) : 0, schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, - managedAclExtensionRequestFlowUrl: isSet(object.managedAclExtensionRequestFlowUrl) - ? String(object.managedAclExtensionRequestFlowUrl) - : "", commissioningModeInitialStepsHint: isSet(object.commissioningModeInitialStepsHint) ? Number(object.commissioningModeInitialStepsHint) : 0, @@ -709,6 +717,7 @@ export const MsgUpdateModel = { ? Number(object.enhancedSetupFlowTCFileSize) : 0, maintenanceUrl: isSet(object.maintenanceUrl) ? String(object.maintenanceUrl) : "", + commissioningFallbackUrl: isSet(object.commissioningFallbackUrl) ? String(object.commissioningFallbackUrl) : "", }; }, @@ -732,8 +741,6 @@ export const MsgUpdateModel = { message.lsfUrl !== undefined && (obj.lsfUrl = message.lsfUrl); message.lsfRevision !== undefined && (obj.lsfRevision = Math.round(message.lsfRevision)); message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); - message.managedAclExtensionRequestFlowUrl !== undefined - && (obj.managedAclExtensionRequestFlowUrl = message.managedAclExtensionRequestFlowUrl); message.commissioningModeInitialStepsHint !== undefined && (obj.commissioningModeInitialStepsHint = Math.round(message.commissioningModeInitialStepsHint)); message.enhancedSetupFlowOptions !== undefined @@ -746,6 +753,7 @@ export const MsgUpdateModel = { message.enhancedSetupFlowTCFileSize !== undefined && (obj.enhancedSetupFlowTCFileSize = Math.round(message.enhancedSetupFlowTCFileSize)); message.maintenanceUrl !== undefined && (obj.maintenanceUrl = message.maintenanceUrl); + message.commissioningFallbackUrl !== undefined && (obj.commissioningFallbackUrl = message.commissioningFallbackUrl); return obj; }, @@ -766,7 +774,6 @@ export const MsgUpdateModel = { message.lsfUrl = object.lsfUrl ?? ""; message.lsfRevision = object.lsfRevision ?? 0; message.schemaVersion = object.schemaVersion ?? 0; - message.managedAclExtensionRequestFlowUrl = object.managedAclExtensionRequestFlowUrl ?? ""; message.commissioningModeInitialStepsHint = object.commissioningModeInitialStepsHint ?? 0; message.enhancedSetupFlowOptions = object.enhancedSetupFlowOptions ?? 0; message.enhancedSetupFlowTCUrl = object.enhancedSetupFlowTCUrl ?? ""; @@ -774,6 +781,7 @@ export const MsgUpdateModel = { message.enhancedSetupFlowTCDigest = object.enhancedSetupFlowTCDigest ?? ""; message.enhancedSetupFlowTCFileSize = object.enhancedSetupFlowTCFileSize ?? 0; message.maintenanceUrl = object.maintenanceUrl ?? ""; + message.commissioningFallbackUrl = object.commissioningFallbackUrl ?? ""; return message; }, }; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/api.swagger.yml b/ts-client/zigbeealliance.distributedcomplianceledger.pki/api.swagger.yml index 4dcf819c0..d573eea0a 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/api.swagger.yml +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/api.swagger.yml @@ -474,7 +474,7 @@ paths: type: boolean tags: - Query - /dcl/pki/noc-certificates/{vid}: + /dcl/pki/noc-vid-certificates/{vid}: get: operationId: NocCertificates responses: @@ -703,7 +703,7 @@ paths: type: boolean tags: - Query - /dcl/pki/noc-root-certificates/{vid}: + /dcl/pki/noc-vid-root-certificates/{vid}: get: operationId: NocRootCertificates responses: diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/module.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/module.ts index 592879cbd..b3d559e98 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/module.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/module.ts @@ -7,25 +7,27 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgApproveAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRemoveNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRevokeNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgDeletePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgAddNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRemoveNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgAddX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRejectAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRevokeNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgProposeAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgAddPkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgAssignVid } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgProposeRevokeX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRevokeNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRevokeX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgAddPkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRemoveNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgAddNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgAssignVid } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRejectAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgDeletePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgAddNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgUpdatePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRemoveNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgRemoveX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRevokeX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgApproveAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgApproveRevokeX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgUpdatePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRevokeNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { AllCertificates as typeAllCertificates} from "./types" +import { AllCertificatesBySubject as typeAllCertificatesBySubject} from "./types" import { ApprovedCertificates as typeApprovedCertificates} from "./types" import { ApprovedCertificatesBySubject as typeApprovedCertificatesBySubject} from "./types" import { ApprovedCertificatesBySubjectKeyId as typeApprovedCertificatesBySubjectKeyId} from "./types" @@ -34,101 +36,105 @@ import { Certificate as typeCertificate} from "./types" import { CertificateIdentifier as typeCertificateIdentifier} from "./types" import { ChildCertificates as typeChildCertificates} from "./types" import { Grant as typeGrant} from "./types" +import { NocCertificates as typeNocCertificates} from "./types" +import { NocCertificatesBySubject as typeNocCertificatesBySubject} from "./types" +import { NocCertificatesBySubjectKeyID as typeNocCertificatesBySubjectKeyID} from "./types" +import { NocCertificatesByVidAndSkid as typeNocCertificatesByVidAndSkid} from "./types" import { NocIcaCertificates as typeNocIcaCertificates} from "./types" import { NocRootCertificates as typeNocRootCertificates} from "./types" -import { NocRootCertificatesByVidAndSkid as typeNocRootCertificatesByVidAndSkid} from "./types" import { PkiRevocationDistributionPoint as typePkiRevocationDistributionPoint} from "./types" import { PkiRevocationDistributionPointsByIssuerSubjectKeyID as typePkiRevocationDistributionPointsByIssuerSubjectKeyID} from "./types" import { ProposedCertificate as typeProposedCertificate} from "./types" import { ProposedCertificateRevocation as typeProposedCertificateRevocation} from "./types" import { RejectedCertificate as typeRejectedCertificate} from "./types" import { RevokedCertificates as typeRevokedCertificates} from "./types" +import { RevokedNocIcaCertificates as typeRevokedNocIcaCertificates} from "./types" import { RevokedNocRootCertificates as typeRevokedNocRootCertificates} from "./types" import { RevokedRootCertificates as typeRevokedRootCertificates} from "./types" import { UniqueCertificate as typeUniqueCertificate} from "./types" -export { MsgApproveAddX509RootCert, MsgRemoveNocX509IcaCert, MsgRevokeNocX509IcaCert, MsgDeletePkiRevocationDistributionPoint, MsgAddNocX509RootCert, MsgRemoveNocX509RootCert, MsgAddX509Cert, MsgRejectAddX509RootCert, MsgRevokeNocX509RootCert, MsgProposeAddX509RootCert, MsgAddPkiRevocationDistributionPoint, MsgProposeRevokeX509RootCert, MsgAddNocX509IcaCert, MsgAssignVid, MsgRemoveX509Cert, MsgRevokeX509Cert, MsgApproveRevokeX509RootCert, MsgUpdatePkiRevocationDistributionPoint }; +export { MsgAddX509Cert, MsgProposeAddX509RootCert, MsgAssignVid, MsgProposeRevokeX509RootCert, MsgRevokeNocX509IcaCert, MsgRevokeX509Cert, MsgAddPkiRevocationDistributionPoint, MsgRemoveNocX509IcaCert, MsgAddNocX509IcaCert, MsgRejectAddX509RootCert, MsgDeletePkiRevocationDistributionPoint, MsgAddNocX509RootCert, MsgUpdatePkiRevocationDistributionPoint, MsgRemoveNocX509RootCert, MsgRemoveX509Cert, MsgApproveAddX509RootCert, MsgApproveRevokeX509RootCert, MsgRevokeNocX509RootCert }; -type sendMsgApproveAddX509RootCertParams = { - value: MsgApproveAddX509RootCert, +type sendMsgAddX509CertParams = { + value: MsgAddX509Cert, fee?: StdFee, memo?: string }; -type sendMsgRemoveNocX509IcaCertParams = { - value: MsgRemoveNocX509IcaCert, +type sendMsgProposeAddX509RootCertParams = { + value: MsgProposeAddX509RootCert, fee?: StdFee, memo?: string }; -type sendMsgRevokeNocX509IcaCertParams = { - value: MsgRevokeNocX509IcaCert, +type sendMsgAssignVidParams = { + value: MsgAssignVid, fee?: StdFee, memo?: string }; -type sendMsgDeletePkiRevocationDistributionPointParams = { - value: MsgDeletePkiRevocationDistributionPoint, +type sendMsgProposeRevokeX509RootCertParams = { + value: MsgProposeRevokeX509RootCert, fee?: StdFee, memo?: string }; -type sendMsgAddNocX509RootCertParams = { - value: MsgAddNocX509RootCert, +type sendMsgRevokeNocX509IcaCertParams = { + value: MsgRevokeNocX509IcaCert, fee?: StdFee, memo?: string }; -type sendMsgRemoveNocX509RootCertParams = { - value: MsgRemoveNocX509RootCert, +type sendMsgRevokeX509CertParams = { + value: MsgRevokeX509Cert, fee?: StdFee, memo?: string }; -type sendMsgAddX509CertParams = { - value: MsgAddX509Cert, +type sendMsgAddPkiRevocationDistributionPointParams = { + value: MsgAddPkiRevocationDistributionPoint, fee?: StdFee, memo?: string }; -type sendMsgRejectAddX509RootCertParams = { - value: MsgRejectAddX509RootCert, +type sendMsgRemoveNocX509IcaCertParams = { + value: MsgRemoveNocX509IcaCert, fee?: StdFee, memo?: string }; -type sendMsgRevokeNocX509RootCertParams = { - value: MsgRevokeNocX509RootCert, +type sendMsgAddNocX509IcaCertParams = { + value: MsgAddNocX509IcaCert, fee?: StdFee, memo?: string }; -type sendMsgProposeAddX509RootCertParams = { - value: MsgProposeAddX509RootCert, +type sendMsgRejectAddX509RootCertParams = { + value: MsgRejectAddX509RootCert, fee?: StdFee, memo?: string }; -type sendMsgAddPkiRevocationDistributionPointParams = { - value: MsgAddPkiRevocationDistributionPoint, +type sendMsgDeletePkiRevocationDistributionPointParams = { + value: MsgDeletePkiRevocationDistributionPoint, fee?: StdFee, memo?: string }; -type sendMsgProposeRevokeX509RootCertParams = { - value: MsgProposeRevokeX509RootCert, +type sendMsgAddNocX509RootCertParams = { + value: MsgAddNocX509RootCert, fee?: StdFee, memo?: string }; -type sendMsgAddNocX509IcaCertParams = { - value: MsgAddNocX509IcaCert, +type sendMsgUpdatePkiRevocationDistributionPointParams = { + value: MsgUpdatePkiRevocationDistributionPoint, fee?: StdFee, memo?: string }; -type sendMsgAssignVidParams = { - value: MsgAssignVid, +type sendMsgRemoveNocX509RootCertParams = { + value: MsgRemoveNocX509RootCert, fee?: StdFee, memo?: string }; @@ -139,8 +145,8 @@ type sendMsgRemoveX509CertParams = { memo?: string }; -type sendMsgRevokeX509CertParams = { - value: MsgRevokeX509Cert, +type sendMsgApproveAddX509RootCertParams = { + value: MsgApproveAddX509RootCert, fee?: StdFee, memo?: string }; @@ -151,83 +157,83 @@ type sendMsgApproveRevokeX509RootCertParams = { memo?: string }; -type sendMsgUpdatePkiRevocationDistributionPointParams = { - value: MsgUpdatePkiRevocationDistributionPoint, +type sendMsgRevokeNocX509RootCertParams = { + value: MsgRevokeNocX509RootCert, fee?: StdFee, memo?: string }; -type msgApproveAddX509RootCertParams = { - value: MsgApproveAddX509RootCert, +type msgAddX509CertParams = { + value: MsgAddX509Cert, }; -type msgRemoveNocX509IcaCertParams = { - value: MsgRemoveNocX509IcaCert, +type msgProposeAddX509RootCertParams = { + value: MsgProposeAddX509RootCert, }; -type msgRevokeNocX509IcaCertParams = { - value: MsgRevokeNocX509IcaCert, +type msgAssignVidParams = { + value: MsgAssignVid, }; -type msgDeletePkiRevocationDistributionPointParams = { - value: MsgDeletePkiRevocationDistributionPoint, +type msgProposeRevokeX509RootCertParams = { + value: MsgProposeRevokeX509RootCert, }; -type msgAddNocX509RootCertParams = { - value: MsgAddNocX509RootCert, +type msgRevokeNocX509IcaCertParams = { + value: MsgRevokeNocX509IcaCert, }; -type msgRemoveNocX509RootCertParams = { - value: MsgRemoveNocX509RootCert, +type msgRevokeX509CertParams = { + value: MsgRevokeX509Cert, }; -type msgAddX509CertParams = { - value: MsgAddX509Cert, +type msgAddPkiRevocationDistributionPointParams = { + value: MsgAddPkiRevocationDistributionPoint, }; -type msgRejectAddX509RootCertParams = { - value: MsgRejectAddX509RootCert, +type msgRemoveNocX509IcaCertParams = { + value: MsgRemoveNocX509IcaCert, }; -type msgRevokeNocX509RootCertParams = { - value: MsgRevokeNocX509RootCert, +type msgAddNocX509IcaCertParams = { + value: MsgAddNocX509IcaCert, }; -type msgProposeAddX509RootCertParams = { - value: MsgProposeAddX509RootCert, +type msgRejectAddX509RootCertParams = { + value: MsgRejectAddX509RootCert, }; -type msgAddPkiRevocationDistributionPointParams = { - value: MsgAddPkiRevocationDistributionPoint, +type msgDeletePkiRevocationDistributionPointParams = { + value: MsgDeletePkiRevocationDistributionPoint, }; -type msgProposeRevokeX509RootCertParams = { - value: MsgProposeRevokeX509RootCert, +type msgAddNocX509RootCertParams = { + value: MsgAddNocX509RootCert, }; -type msgAddNocX509IcaCertParams = { - value: MsgAddNocX509IcaCert, +type msgUpdatePkiRevocationDistributionPointParams = { + value: MsgUpdatePkiRevocationDistributionPoint, }; -type msgAssignVidParams = { - value: MsgAssignVid, +type msgRemoveNocX509RootCertParams = { + value: MsgRemoveNocX509RootCert, }; type msgRemoveX509CertParams = { value: MsgRemoveX509Cert, }; -type msgRevokeX509CertParams = { - value: MsgRevokeX509Cert, +type msgApproveAddX509RootCertParams = { + value: MsgApproveAddX509RootCert, }; type msgApproveRevokeX509RootCertParams = { value: MsgApproveRevokeX509RootCert, }; -type msgUpdatePkiRevocationDistributionPointParams = { - value: MsgUpdatePkiRevocationDistributionPoint, +type msgRevokeNocX509RootCertParams = { + value: MsgRevokeNocX509RootCert, }; @@ -260,199 +266,199 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgApproveAddX509RootCert({ value, fee, memo }: sendMsgApproveAddX509RootCertParams): Promise { + async sendMsgAddX509Cert({ value, fee, memo }: sendMsgAddX509CertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgApproveAddX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAddX509Cert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgApproveAddX509RootCert({ value: MsgApproveAddX509RootCert.fromPartial(value) }) + let msg = this.msgAddX509Cert({ value: MsgAddX509Cert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgApproveAddX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAddX509Cert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRemoveNocX509IcaCert({ value, fee, memo }: sendMsgRemoveNocX509IcaCertParams): Promise { + async sendMsgProposeAddX509RootCert({ value, fee, memo }: sendMsgProposeAddX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRemoveNocX509IcaCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgProposeAddX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRemoveNocX509IcaCert({ value: MsgRemoveNocX509IcaCert.fromPartial(value) }) + let msg = this.msgProposeAddX509RootCert({ value: MsgProposeAddX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRemoveNocX509IcaCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgProposeAddX509RootCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRevokeNocX509IcaCert({ value, fee, memo }: sendMsgRevokeNocX509IcaCertParams): Promise { + async sendMsgAssignVid({ value, fee, memo }: sendMsgAssignVidParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeNocX509IcaCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAssignVid: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRevokeNocX509IcaCert({ value: MsgRevokeNocX509IcaCert.fromPartial(value) }) + let msg = this.msgAssignVid({ value: MsgAssignVid.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeNocX509IcaCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAssignVid: Could not broadcast Tx: '+ e.message) } }, - async sendMsgDeletePkiRevocationDistributionPoint({ value, fee, memo }: sendMsgDeletePkiRevocationDistributionPointParams): Promise { + async sendMsgProposeRevokeX509RootCert({ value, fee, memo }: sendMsgProposeRevokeX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeletePkiRevocationDistributionPoint: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgProposeRevokeX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgDeletePkiRevocationDistributionPoint({ value: MsgDeletePkiRevocationDistributionPoint.fromPartial(value) }) + let msg = this.msgProposeRevokeX509RootCert({ value: MsgProposeRevokeX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeletePkiRevocationDistributionPoint: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgProposeRevokeX509RootCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAddNocX509RootCert({ value, fee, memo }: sendMsgAddNocX509RootCertParams): Promise { + async sendMsgRevokeNocX509IcaCert({ value, fee, memo }: sendMsgRevokeNocX509IcaCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAddNocX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeNocX509IcaCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgAddNocX509RootCert({ value: MsgAddNocX509RootCert.fromPartial(value) }) + let msg = this.msgRevokeNocX509IcaCert({ value: MsgRevokeNocX509IcaCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAddNocX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeNocX509IcaCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRemoveNocX509RootCert({ value, fee, memo }: sendMsgRemoveNocX509RootCertParams): Promise { + async sendMsgRevokeX509Cert({ value, fee, memo }: sendMsgRevokeX509CertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRemoveNocX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeX509Cert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRemoveNocX509RootCert({ value: MsgRemoveNocX509RootCert.fromPartial(value) }) + let msg = this.msgRevokeX509Cert({ value: MsgRevokeX509Cert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRemoveNocX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeX509Cert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAddX509Cert({ value, fee, memo }: sendMsgAddX509CertParams): Promise { + async sendMsgAddPkiRevocationDistributionPoint({ value, fee, memo }: sendMsgAddPkiRevocationDistributionPointParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAddX509Cert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAddPkiRevocationDistributionPoint: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgAddX509Cert({ value: MsgAddX509Cert.fromPartial(value) }) + let msg = this.msgAddPkiRevocationDistributionPoint({ value: MsgAddPkiRevocationDistributionPoint.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAddX509Cert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAddPkiRevocationDistributionPoint: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRejectAddX509RootCert({ value, fee, memo }: sendMsgRejectAddX509RootCertParams): Promise { + async sendMsgRemoveNocX509IcaCert({ value, fee, memo }: sendMsgRemoveNocX509IcaCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRejectAddX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRemoveNocX509IcaCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRejectAddX509RootCert({ value: MsgRejectAddX509RootCert.fromPartial(value) }) + let msg = this.msgRemoveNocX509IcaCert({ value: MsgRemoveNocX509IcaCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRejectAddX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRemoveNocX509IcaCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgRevokeNocX509RootCert({ value, fee, memo }: sendMsgRevokeNocX509RootCertParams): Promise { + async sendMsgAddNocX509IcaCert({ value, fee, memo }: sendMsgAddNocX509IcaCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeNocX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAddNocX509IcaCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRevokeNocX509RootCert({ value: MsgRevokeNocX509RootCert.fromPartial(value) }) + let msg = this.msgAddNocX509IcaCert({ value: MsgAddNocX509IcaCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeNocX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAddNocX509IcaCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgProposeAddX509RootCert({ value, fee, memo }: sendMsgProposeAddX509RootCertParams): Promise { + async sendMsgRejectAddX509RootCert({ value, fee, memo }: sendMsgRejectAddX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgProposeAddX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRejectAddX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgProposeAddX509RootCert({ value: MsgProposeAddX509RootCert.fromPartial(value) }) + let msg = this.msgRejectAddX509RootCert({ value: MsgRejectAddX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgProposeAddX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRejectAddX509RootCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAddPkiRevocationDistributionPoint({ value, fee, memo }: sendMsgAddPkiRevocationDistributionPointParams): Promise { + async sendMsgDeletePkiRevocationDistributionPoint({ value, fee, memo }: sendMsgDeletePkiRevocationDistributionPointParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAddPkiRevocationDistributionPoint: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDeletePkiRevocationDistributionPoint: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgAddPkiRevocationDistributionPoint({ value: MsgAddPkiRevocationDistributionPoint.fromPartial(value) }) + let msg = this.msgDeletePkiRevocationDistributionPoint({ value: MsgDeletePkiRevocationDistributionPoint.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAddPkiRevocationDistributionPoint: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDeletePkiRevocationDistributionPoint: Could not broadcast Tx: '+ e.message) } }, - async sendMsgProposeRevokeX509RootCert({ value, fee, memo }: sendMsgProposeRevokeX509RootCertParams): Promise { + async sendMsgAddNocX509RootCert({ value, fee, memo }: sendMsgAddNocX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgProposeRevokeX509RootCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgAddNocX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgProposeRevokeX509RootCert({ value: MsgProposeRevokeX509RootCert.fromPartial(value) }) + let msg = this.msgAddNocX509RootCert({ value: MsgAddNocX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgProposeRevokeX509RootCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgAddNocX509RootCert: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAddNocX509IcaCert({ value, fee, memo }: sendMsgAddNocX509IcaCertParams): Promise { + async sendMsgUpdatePkiRevocationDistributionPoint({ value, fee, memo }: sendMsgUpdatePkiRevocationDistributionPointParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAddNocX509IcaCert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgUpdatePkiRevocationDistributionPoint: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgAddNocX509IcaCert({ value: MsgAddNocX509IcaCert.fromPartial(value) }) + let msg = this.msgUpdatePkiRevocationDistributionPoint({ value: MsgUpdatePkiRevocationDistributionPoint.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAddNocX509IcaCert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgUpdatePkiRevocationDistributionPoint: Could not broadcast Tx: '+ e.message) } }, - async sendMsgAssignVid({ value, fee, memo }: sendMsgAssignVidParams): Promise { + async sendMsgRemoveNocX509RootCert({ value, fee, memo }: sendMsgRemoveNocX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgAssignVid: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRemoveNocX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgAssignVid({ value: MsgAssignVid.fromPartial(value) }) + let msg = this.msgRemoveNocX509RootCert({ value: MsgRemoveNocX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgAssignVid: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRemoveNocX509RootCert: Could not broadcast Tx: '+ e.message) } }, @@ -470,17 +476,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgRevokeX509Cert({ value, fee, memo }: sendMsgRevokeX509CertParams): Promise { + async sendMsgApproveAddX509RootCert({ value, fee, memo }: sendMsgApproveAddX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRevokeX509Cert: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgApproveAddX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRevokeX509Cert({ value: MsgRevokeX509Cert.fromPartial(value) }) + let msg = this.msgApproveAddX509RootCert({ value: MsgApproveAddX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRevokeX509Cert: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgApproveAddX509RootCert: Could not broadcast Tx: '+ e.message) } }, @@ -498,130 +504,130 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgUpdatePkiRevocationDistributionPoint({ value, fee, memo }: sendMsgUpdatePkiRevocationDistributionPointParams): Promise { + async sendMsgRevokeNocX509RootCert({ value, fee, memo }: sendMsgRevokeNocX509RootCertParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdatePkiRevocationDistributionPoint: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRevokeNocX509RootCert: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgUpdatePkiRevocationDistributionPoint({ value: MsgUpdatePkiRevocationDistributionPoint.fromPartial(value) }) + let msg = this.msgRevokeNocX509RootCert({ value: MsgRevokeNocX509RootCert.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdatePkiRevocationDistributionPoint: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRevokeNocX509RootCert: Could not broadcast Tx: '+ e.message) } }, - msgApproveAddX509RootCert({ value }: msgApproveAddX509RootCertParams): EncodeObject { + msgAddX509Cert({ value }: msgAddX509CertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", value: MsgApproveAddX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", value: MsgAddX509Cert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgApproveAddX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAddX509Cert: Could not create message: ' + e.message) } }, - msgRemoveNocX509IcaCert({ value }: msgRemoveNocX509IcaCertParams): EncodeObject { + msgProposeAddX509RootCert({ value }: msgProposeAddX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509IcaCert", value: MsgRemoveNocX509IcaCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert", value: MsgProposeAddX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRemoveNocX509IcaCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgProposeAddX509RootCert: Could not create message: ' + e.message) } }, - msgRevokeNocX509IcaCert({ value }: msgRevokeNocX509IcaCertParams): EncodeObject { + msgAssignVid({ value }: msgAssignVidParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", value: MsgRevokeNocX509IcaCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid", value: MsgAssignVid.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeNocX509IcaCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAssignVid: Could not create message: ' + e.message) } }, - msgDeletePkiRevocationDistributionPoint({ value }: msgDeletePkiRevocationDistributionPointParams): EncodeObject { + msgProposeRevokeX509RootCert({ value }: msgProposeRevokeX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", value: MsgDeletePkiRevocationDistributionPoint.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", value: MsgProposeRevokeX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeletePkiRevocationDistributionPoint: Could not create message: ' + e.message) + throw new Error('TxClient:MsgProposeRevokeX509RootCert: Could not create message: ' + e.message) } }, - msgAddNocX509RootCert({ value }: msgAddNocX509RootCertParams): EncodeObject { + msgRevokeNocX509IcaCert({ value }: msgRevokeNocX509IcaCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCert", value: MsgAddNocX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", value: MsgRevokeNocX509IcaCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAddNocX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeNocX509IcaCert: Could not create message: ' + e.message) } }, - msgRemoveNocX509RootCert({ value }: msgRemoveNocX509RootCertParams): EncodeObject { + msgRevokeX509Cert({ value }: msgRevokeX509CertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509RootCert", value: MsgRemoveNocX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", value: MsgRevokeX509Cert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRemoveNocX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeX509Cert: Could not create message: ' + e.message) } }, - msgAddX509Cert({ value }: msgAddX509CertParams): EncodeObject { + msgAddPkiRevocationDistributionPoint({ value }: msgAddPkiRevocationDistributionPointParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", value: MsgAddX509Cert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddPkiRevocationDistributionPoint", value: MsgAddPkiRevocationDistributionPoint.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAddX509Cert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAddPkiRevocationDistributionPoint: Could not create message: ' + e.message) } }, - msgRejectAddX509RootCert({ value }: msgRejectAddX509RootCertParams): EncodeObject { + msgRemoveNocX509IcaCert({ value }: msgRemoveNocX509IcaCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRejectAddX509RootCert", value: MsgRejectAddX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509IcaCert", value: MsgRemoveNocX509IcaCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRejectAddX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRemoveNocX509IcaCert: Could not create message: ' + e.message) } }, - msgRevokeNocX509RootCert({ value }: msgRevokeNocX509RootCertParams): EncodeObject { + msgAddNocX509IcaCert({ value }: msgAddNocX509IcaCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", value: MsgRevokeNocX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509IcaCert", value: MsgAddNocX509IcaCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeNocX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAddNocX509IcaCert: Could not create message: ' + e.message) } }, - msgProposeAddX509RootCert({ value }: msgProposeAddX509RootCertParams): EncodeObject { + msgRejectAddX509RootCert({ value }: msgRejectAddX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert", value: MsgProposeAddX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRejectAddX509RootCert", value: MsgRejectAddX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgProposeAddX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRejectAddX509RootCert: Could not create message: ' + e.message) } }, - msgAddPkiRevocationDistributionPoint({ value }: msgAddPkiRevocationDistributionPointParams): EncodeObject { + msgDeletePkiRevocationDistributionPoint({ value }: msgDeletePkiRevocationDistributionPointParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddPkiRevocationDistributionPoint", value: MsgAddPkiRevocationDistributionPoint.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", value: MsgDeletePkiRevocationDistributionPoint.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAddPkiRevocationDistributionPoint: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDeletePkiRevocationDistributionPoint: Could not create message: ' + e.message) } }, - msgProposeRevokeX509RootCert({ value }: msgProposeRevokeX509RootCertParams): EncodeObject { + msgAddNocX509RootCert({ value }: msgAddNocX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", value: MsgProposeRevokeX509RootCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCert", value: MsgAddNocX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgProposeRevokeX509RootCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgAddNocX509RootCert: Could not create message: ' + e.message) } }, - msgAddNocX509IcaCert({ value }: msgAddNocX509IcaCertParams): EncodeObject { + msgUpdatePkiRevocationDistributionPoint({ value }: msgUpdatePkiRevocationDistributionPointParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509IcaCert", value: MsgAddNocX509IcaCert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", value: MsgUpdatePkiRevocationDistributionPoint.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAddNocX509IcaCert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgUpdatePkiRevocationDistributionPoint: Could not create message: ' + e.message) } }, - msgAssignVid({ value }: msgAssignVidParams): EncodeObject { + msgRemoveNocX509RootCert({ value }: msgRemoveNocX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid", value: MsgAssignVid.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509RootCert", value: MsgRemoveNocX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgAssignVid: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRemoveNocX509RootCert: Could not create message: ' + e.message) } }, @@ -633,11 +639,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgRevokeX509Cert({ value }: msgRevokeX509CertParams): EncodeObject { + msgApproveAddX509RootCert({ value }: msgApproveAddX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", value: MsgRevokeX509Cert.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", value: MsgApproveAddX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRevokeX509Cert: Could not create message: ' + e.message) + throw new Error('TxClient:MsgApproveAddX509RootCert: Could not create message: ' + e.message) } }, @@ -649,11 +655,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgUpdatePkiRevocationDistributionPoint({ value }: msgUpdatePkiRevocationDistributionPointParams): EncodeObject { + msgRevokeNocX509RootCert({ value }: msgRevokeNocX509RootCertParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", value: MsgUpdatePkiRevocationDistributionPoint.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", value: MsgRevokeNocX509RootCert.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdatePkiRevocationDistributionPoint: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRevokeNocX509RootCert: Could not create message: ' + e.message) } }, @@ -679,6 +685,8 @@ class SDKModule { this.query = queryClient({ addr: client.env.apiURL }); this.updateTX(client); this.structure = { + AllCertificates: getStructure(typeAllCertificates.fromPartial({})), + AllCertificatesBySubject: getStructure(typeAllCertificatesBySubject.fromPartial({})), ApprovedCertificates: getStructure(typeApprovedCertificates.fromPartial({})), ApprovedCertificatesBySubject: getStructure(typeApprovedCertificatesBySubject.fromPartial({})), ApprovedCertificatesBySubjectKeyId: getStructure(typeApprovedCertificatesBySubjectKeyId.fromPartial({})), @@ -687,15 +695,19 @@ class SDKModule { CertificateIdentifier: getStructure(typeCertificateIdentifier.fromPartial({})), ChildCertificates: getStructure(typeChildCertificates.fromPartial({})), Grant: getStructure(typeGrant.fromPartial({})), + NocCertificates: getStructure(typeNocCertificates.fromPartial({})), + NocCertificatesBySubject: getStructure(typeNocCertificatesBySubject.fromPartial({})), + NocCertificatesBySubjectKeyID: getStructure(typeNocCertificatesBySubjectKeyID.fromPartial({})), + NocCertificatesByVidAndSkid: getStructure(typeNocCertificatesByVidAndSkid.fromPartial({})), NocIcaCertificates: getStructure(typeNocIcaCertificates.fromPartial({})), NocRootCertificates: getStructure(typeNocRootCertificates.fromPartial({})), - NocRootCertificatesByVidAndSkid: getStructure(typeNocRootCertificatesByVidAndSkid.fromPartial({})), PkiRevocationDistributionPoint: getStructure(typePkiRevocationDistributionPoint.fromPartial({})), PkiRevocationDistributionPointsByIssuerSubjectKeyID: getStructure(typePkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial({})), ProposedCertificate: getStructure(typeProposedCertificate.fromPartial({})), ProposedCertificateRevocation: getStructure(typeProposedCertificateRevocation.fromPartial({})), RejectedCertificate: getStructure(typeRejectedCertificate.fromPartial({})), RevokedCertificates: getStructure(typeRevokedCertificates.fromPartial({})), + RevokedNocIcaCertificates: getStructure(typeRevokedNocIcaCertificates.fromPartial({})), RevokedNocRootCertificates: getStructure(typeRevokedNocRootCertificates.fromPartial({})), RevokedRootCertificates: getStructure(typeRevokedRootCertificates.fromPartial({})), UniqueCertificate: getStructure(typeUniqueCertificate.fromPartial({})), diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/registry.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/registry.ts index be9dfb365..2ce7e64a6 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/registry.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/registry.ts @@ -1,42 +1,42 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgApproveAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRemoveNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRevokeNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgDeletePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgAddNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRemoveNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgAddX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRejectAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRevokeNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgProposeAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgAddPkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgAssignVid } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgProposeRevokeX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRevokeNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRevokeX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgAddPkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRemoveNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgAddNocX509IcaCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgAssignVid } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRejectAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgDeletePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgAddNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgUpdatePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRemoveNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgRemoveX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgRevokeX509Cert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgApproveAddX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; import { MsgApproveRevokeX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; -import { MsgUpdatePkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; +import { MsgRevokeNocX509RootCert } from "./types/zigbeealliance/distributedcomplianceledger/pki/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", MsgApproveAddX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509IcaCert", MsgRemoveNocX509IcaCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", MsgRevokeNocX509IcaCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", MsgDeletePkiRevocationDistributionPoint], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCert", MsgAddNocX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509RootCert", MsgRemoveNocX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", MsgAddX509Cert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRejectAddX509RootCert", MsgRejectAddX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", MsgRevokeNocX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert", MsgProposeAddX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddPkiRevocationDistributionPoint", MsgAddPkiRevocationDistributionPoint], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid", MsgAssignVid], ["/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", MsgProposeRevokeX509RootCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", MsgRevokeNocX509IcaCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", MsgRevokeX509Cert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddPkiRevocationDistributionPoint", MsgAddPkiRevocationDistributionPoint], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509IcaCert", MsgRemoveNocX509IcaCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509IcaCert", MsgAddNocX509IcaCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid", MsgAssignVid], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRejectAddX509RootCert", MsgRejectAddX509RootCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", MsgDeletePkiRevocationDistributionPoint], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCert", MsgAddNocX509RootCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", MsgUpdatePkiRevocationDistributionPoint], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveNocX509RootCert", MsgRemoveNocX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", MsgRemoveX509Cert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", MsgRevokeX509Cert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", MsgApproveAddX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", MsgApproveRevokeX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", MsgUpdatePkiRevocationDistributionPoint], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", MsgRevokeNocX509RootCert], ]; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/rest.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/rest.ts index 9617e39bc..742cc3231 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/rest.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/rest.ts @@ -9,6 +9,14 @@ * --------------------------------------------------------------- */ +export interface DistributedcomplianceledgerpkiAllCertificatesBySubject { + subject?: string; + subjectKeyIds?: string[]; + + /** @format int64 */ + schemaVersion?: number; +} + export interface DistributedcomplianceledgerpkiApprovedCertificates { subject?: string; subjectKeyId?: string; @@ -42,16 +50,40 @@ export interface DistributedcomplianceledgerpkiChildCertificates { schemaVersion?: number; } -export interface DistributedcomplianceledgerpkiNocIcaCertificates { +export interface DistributedcomplianceledgerpkiNocCertificates { + subject?: string; + subjectKeyId?: string; + certs?: PkiCertificate[]; + + /** @format float */ + tq?: number; + + /** @format int64 */ + schemaVersion?: number; +} + +export interface DistributedcomplianceledgerpkiNocCertificatesBySubject { + subject?: string; + subjectKeyIds?: string[]; + + /** @format int64 */ + schemaVersion?: number; +} + +export interface DistributedcomplianceledgerpkiNocCertificatesByVidAndSkid { /** @format int32 */ vid?: number; + subjectKeyId?: string; certs?: PkiCertificate[]; + /** @format float */ + tq?: number; + /** @format int64 */ schemaVersion?: number; } -export interface DistributedcomplianceledgerpkiNocRootCertificates { +export interface DistributedcomplianceledgerpkiNocIcaCertificates { /** @format int32 */ vid?: number; certs?: PkiCertificate[]; @@ -60,15 +92,11 @@ export interface DistributedcomplianceledgerpkiNocRootCertificates { schemaVersion?: number; } -export interface DistributedcomplianceledgerpkiNocRootCertificatesByVidAndSkid { +export interface DistributedcomplianceledgerpkiNocRootCertificates { /** @format int32 */ vid?: number; - subjectKeyId?: string; certs?: PkiCertificate[]; - /** @format float */ - tq?: number; - /** @format int64 */ schemaVersion?: number; } @@ -158,6 +186,15 @@ export interface DistributedcomplianceledgerpkiRevokedCertificates { schemaVersion?: number; } +export interface DistributedcomplianceledgerpkiRevokedNocIcaCertificates { + subject?: string; + subjectKeyId?: string; + certs?: PkiCertificate[]; + + /** @format int64 */ + schemaVersion?: number; +} + export interface DistributedcomplianceledgerpkiRevokedNocRootCertificates { subject?: string; subjectKeyId?: string; @@ -174,6 +211,15 @@ export interface DistributedcomplianceledgerpkiRevokedRootCertificates { schemaVersion?: number; } +export interface PkiAllCertificates { + subject?: string; + subjectKeyId?: string; + certs?: PkiCertificate[]; + + /** @format int64 */ + schemaVersion?: number; +} + export interface PkiCertificate { pemCert?: string; serialNumber?: string; @@ -191,7 +237,7 @@ export interface PkiCertificate { /** @format int32 */ vid?: number; - isNoc?: boolean; + certificateType?: PkiCertificateType; /** @format int64 */ schemaVersion?: number; @@ -202,6 +248,12 @@ export interface PkiCertificateIdentifier { subjectKeyId?: string; } +export enum PkiCertificateType { + DeviceAttestationPKI = "DeviceAttestationPKI", + OperationalPKI = "OperationalPKI", + VIDSignerPKI = "VIDSignerPKI", +} + export interface PkiGrant { address?: string; @@ -267,6 +319,21 @@ export interface PkiQueryAllApprovedCertificatesResponse { pagination?: V1Beta1PageResponse; } +export interface PkiQueryAllCertificatesResponse { + certificates?: PkiAllCertificates[]; + + /** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ + pagination?: V1Beta1PageResponse; +} + export interface PkiQueryAllNocIcaCertificatesResponse { nocIcaCertificates?: DistributedcomplianceledgerpkiNocIcaCertificates[]; @@ -372,6 +439,21 @@ export interface PkiQueryAllRevokedCertificatesResponse { pagination?: V1Beta1PageResponse; } +export interface PkiQueryAllRevokedNocIcaCertificatesResponse { + revokedNocIcaCertificates?: DistributedcomplianceledgerpkiRevokedNocIcaCertificates[]; + + /** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ + pagination?: V1Beta1PageResponse; +} + export interface PkiQueryAllRevokedNocRootCertificatesResponse { revokedNocRootCertificates?: DistributedcomplianceledgerpkiRevokedNocRootCertificates[]; @@ -387,6 +469,10 @@ export interface PkiQueryAllRevokedNocRootCertificatesResponse { pagination?: V1Beta1PageResponse; } +export interface PkiQueryGetAllCertificatesBySubjectResponse { + allCertificatesBySubject?: DistributedcomplianceledgerpkiAllCertificatesBySubject; +} + export interface PkiQueryGetApprovedCertificatesBySubjectResponse { approvedCertificatesBySubject?: DistributedcomplianceledgerpkiApprovedCertificatesBySubject; } @@ -399,16 +485,28 @@ export interface PkiQueryGetApprovedRootCertificatesResponse { approvedRootCertificates?: DistributedcomplianceledgerpkiApprovedRootCertificates; } +export interface PkiQueryGetCertificatesResponse { + certificates?: PkiAllCertificates; +} + export interface PkiQueryGetChildCertificatesResponse { childCertificates?: DistributedcomplianceledgerpkiChildCertificates; } -export interface PkiQueryGetNocIcaCertificatesResponse { - nocIcaCertificates?: DistributedcomplianceledgerpkiNocIcaCertificates; +export interface PkiQueryGetNocCertificatesBySubjectResponse { + nocCertificatesBySubject?: DistributedcomplianceledgerpkiNocCertificatesBySubject; +} + +export interface PkiQueryGetNocCertificatesByVidAndSkidResponse { + nocCertificatesByVidAndSkid?: DistributedcomplianceledgerpkiNocCertificatesByVidAndSkid; +} + +export interface PkiQueryGetNocCertificatesResponse { + nocCertificates?: DistributedcomplianceledgerpkiNocCertificates; } -export interface PkiQueryGetNocRootCertificatesByVidAndSkidResponse { - nocRootCertificatesByVidAndSkid?: DistributedcomplianceledgerpkiNocRootCertificatesByVidAndSkid; +export interface PkiQueryGetNocIcaCertificatesResponse { + nocIcaCertificates?: DistributedcomplianceledgerpkiNocIcaCertificates; } export interface PkiQueryGetNocRootCertificatesResponse { @@ -439,6 +537,10 @@ export interface PkiQueryGetRevokedCertificatesResponse { revokedCertificates?: DistributedcomplianceledgerpkiRevokedCertificates; } +export interface PkiQueryGetRevokedNocIcaCertificatesResponse { + revokedNocIcaCertificates?: DistributedcomplianceledgerpkiRevokedNocIcaCertificates; +} + export interface PkiQueryGetRevokedNocRootCertificatesResponse { revokedNocRootCertificates?: DistributedcomplianceledgerpkiRevokedNocRootCertificates; } @@ -447,6 +549,21 @@ export interface PkiQueryGetRevokedRootCertificatesResponse { revokedRootCertificates?: DistributedcomplianceledgerpkiRevokedRootCertificates; } +export interface PkiQueryNocCertificatesResponse { + nocCertificates?: DistributedcomplianceledgerpkiNocCertificates[]; + + /** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ + pagination?: V1Beta1PageResponse; +} + export interface ProtobufAny { "@type"?: string; } @@ -651,10 +768,127 @@ export class HttpClient { } /** - * @title zigbeealliance/distributedcomplianceledger/pki/approved_certificates.proto + * @title zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto * @version version not set */ export class Api extends HttpClient { + /** + * No description + * + * @tags Query + * @name QueryCertificatesAll + * @summary Queries a list of Certificates items. + * @request GET:/dcl/pki/all-certificates + */ + queryCertificatesAll = ( + query?: { + "pagination.key"?: string; + "pagination.offset"?: string; + "pagination.limit"?: string; + "pagination.count_total"?: boolean; + "pagination.reverse"?: boolean; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/dcl/pki/all-certificates`, + method: "GET", + query: query, + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryAllCertificatesBySubject + * @summary Queries a AllCertificatesBySubject by index. + * @request GET:/dcl/pki/all-certificates/{subject} + */ + queryAllCertificatesBySubject = (subject: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/all-certificates/${subject}`, + method: "GET", + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryCertificates + * @summary Queries a Certificates by index. + * @request GET:/dcl/pki/all-certificates/{subject}/{subjectKeyId} + */ + queryCertificates = (subject: string, subjectKeyId: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/all-certificates/${subject}/${subjectKeyId}`, + method: "GET", + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryNocCertificatesAll + * @summary Queries a list of NocCertificates items. + * @request GET:/dcl/pki/all-noc-certificates + */ + queryNocCertificatesAll = ( + query?: { + "pagination.key"?: string; + "pagination.offset"?: string; + "pagination.limit"?: string; + "pagination.count_total"?: boolean; + "pagination.reverse"?: boolean; + subjectKeyId?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/dcl/pki/all-noc-certificates`, + method: "GET", + query: query, + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryNocCertificatesBySubject + * @summary Queries a NocCertificatesBySubject by index. + * @request GET:/dcl/pki/all-noc-certificates/{subject} + */ + queryNocCertificatesBySubject = (subject: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/all-noc-certificates/${subject}`, + method: "GET", + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryNocCertificates + * @summary Queries a NocCertificates by index. + * @request GET:/dcl/pki/all-noc-certificates/{subject}/{subjectKeyId} + */ + queryNocCertificates = (subject: string, subjectKeyId: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/all-noc-certificates/${subject}/${subjectKeyId}`, + method: "GET", + format: "json", + ...params, + }); + /** * No description * @@ -756,22 +990,6 @@ export class Api extends HttpClient - this.request({ - path: `/dcl/pki/noc-ica-certificates/${vid}`, - method: "GET", - format: "json", - ...params, - }); - /** * No description * @@ -802,13 +1020,13 @@ export class Api extends HttpClient - this.request({ - path: `/dcl/pki/noc-root-certificates/${vid}`, + queryNocCertificatesByVidAndSkid = (vid: number, subjectKeyId: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/noc-vid-certificates/${vid}/${subjectKeyId}`, method: "GET", format: "json", ...params, @@ -818,13 +1036,29 @@ export class Api extends HttpClient - this.request({ - path: `/dcl/pki/noc-root-certificates/${vid}/${subjectKeyId}`, + queryNocIcaCertificates = (vid: number, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/noc-vid-ica-certificates/${vid}`, + method: "GET", + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryNocRootCertificates + * @summary Queries a NocRootCertificates by index. + * @request GET:/dcl/pki/noc-vid-root-certificates/{vid} + */ + queryNocRootCertificates = (vid: number, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/noc-vid-root-certificates/${vid}`, method: "GET", format: "json", ...params, @@ -1067,6 +1301,48 @@ export class Api extends HttpClient + this.request({ + path: `/dcl/pki/revoked-noc-ica-certificates`, + method: "GET", + query: query, + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryRevokedNocIcaCertificates + * @summary Queries a RevokedNocIcaCertificates by index. + * @request GET:/dcl/pki/revoked-noc-ica-certificates/{subject}/{subjectKeyId} + */ + queryRevokedNocIcaCertificates = (subject: string, subjectKeyId: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/revoked-noc-ica-certificates/${subject}/${subjectKeyId}`, + method: "GET", + format: "json", + ...params, + }); + /** * No description * diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types.ts index d1ee67322..97c81ee53 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types.ts @@ -1,3 +1,5 @@ +import { AllCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/all_certificates" +import { AllCertificatesBySubject } from "./types/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject" import { ApprovedCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/approved_certificates" import { ApprovedCertificatesBySubject } from "./types/zigbeealliance/distributedcomplianceledger/pki/approved_certificates_by_subject" import { ApprovedCertificatesBySubjectKeyId } from "./types/zigbeealliance/distributedcomplianceledger/pki/approved_certificates_by_subject_key_id" @@ -6,21 +8,27 @@ import { Certificate } from "./types/zigbeealliance/distributedcomplianceledger/ import { CertificateIdentifier } from "./types/zigbeealliance/distributedcomplianceledger/pki/certificate_identifier" import { ChildCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/child_certificates" import { Grant } from "./types/zigbeealliance/distributedcomplianceledger/pki/grant" +import { NocCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates" +import { NocCertificatesBySubject } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject" +import { NocCertificatesBySubjectKeyID } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id" +import { NocCertificatesByVidAndSkid } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_vid_and_skid" import { NocIcaCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_ica_certificates" import { NocRootCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_root_certificates" -import { NocRootCertificatesByVidAndSkid } from "./types/zigbeealliance/distributedcomplianceledger/pki/noc_root_certificates_by_vid_and_skid" import { PkiRevocationDistributionPoint } from "./types/zigbeealliance/distributedcomplianceledger/pki/pki_revocation_distribution_point" import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from "./types/zigbeealliance/distributedcomplianceledger/pki/pki_revocation_distribution_points_by_issuer_subject_key_id" import { ProposedCertificate } from "./types/zigbeealliance/distributedcomplianceledger/pki/proposed_certificate" import { ProposedCertificateRevocation } from "./types/zigbeealliance/distributedcomplianceledger/pki/proposed_certificate_revocation" import { RejectedCertificate } from "./types/zigbeealliance/distributedcomplianceledger/pki/rejected_certificate" import { RevokedCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/revoked_certificates" +import { RevokedNocIcaCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates" import { RevokedNocRootCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_root_certificates" import { RevokedRootCertificates } from "./types/zigbeealliance/distributedcomplianceledger/pki/revoked_root_certificates" import { UniqueCertificate } from "./types/zigbeealliance/distributedcomplianceledger/pki/unique_certificate" export { + AllCertificates, + AllCertificatesBySubject, ApprovedCertificates, ApprovedCertificatesBySubject, ApprovedCertificatesBySubjectKeyId, @@ -29,15 +37,19 @@ export { CertificateIdentifier, ChildCertificates, Grant, + NocCertificates, + NocCertificatesBySubject, + NocCertificatesBySubjectKeyID, + NocCertificatesByVidAndSkid, NocIcaCertificates, NocRootCertificates, - NocRootCertificatesByVidAndSkid, PkiRevocationDistributionPoint, PkiRevocationDistributionPointsByIssuerSubjectKeyID, ProposedCertificate, ProposedCertificateRevocation, RejectedCertificate, RevokedCertificates, + RevokedNocIcaCertificates, RevokedNocRootCertificates, RevokedRootCertificates, UniqueCertificate, diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/all_certificates.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/all_certificates.ts new file mode 100644 index 000000000..e3593d84d --- /dev/null +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/all_certificates.ts @@ -0,0 +1,107 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Certificate } from "./certificate"; + +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; + +export interface AllCertificates { + subject: string; + subjectKeyId: string; + certs: Certificate[]; + schemaVersion: number; +} + +function createBaseAllCertificates(): AllCertificates { + return { subject: "", subjectKeyId: "", certs: [], schemaVersion: 0 }; +} + +export const AllCertificates = { + encode(message: AllCertificates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } + for (const v of message.certs) { + Certificate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.schemaVersion !== 0) { + writer.uint32(32).uint32(message.schemaVersion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AllCertificates { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllCertificates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; + case 3: + message.certs.push(Certificate.decode(reader, reader.uint32())); + break; + case 4: + message.schemaVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AllCertificates { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + certs: Array.isArray(object?.certs) ? object.certs.map((e: any) => Certificate.fromJSON(e)) : [], + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, + }; + }, + + toJSON(message: AllCertificates): unknown { + const obj: any = {}; + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + if (message.certs) { + obj.certs = message.certs.map((e) => e ? Certificate.toJSON(e) : undefined); + } else { + obj.certs = []; + } + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); + return obj; + }, + + fromPartial, I>>(object: I): AllCertificates { + const message = createBaseAllCertificates(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; + message.certs = object.certs?.map((e) => Certificate.fromPartial(e)) || []; + message.schemaVersion = object.schemaVersion ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.ts new file mode 100644 index 000000000..727c42ddf --- /dev/null +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.ts @@ -0,0 +1,96 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; + +export interface AllCertificatesBySubject { + subject: string; + subjectKeyIds: string[]; + schemaVersion: number; +} + +function createBaseAllCertificatesBySubject(): AllCertificatesBySubject { + return { subject: "", subjectKeyIds: [], schemaVersion: 0 }; +} + +export const AllCertificatesBySubject = { + encode(message: AllCertificatesBySubject, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + for (const v of message.subjectKeyIds) { + writer.uint32(18).string(v!); + } + if (message.schemaVersion !== 0) { + writer.uint32(24).uint32(message.schemaVersion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AllCertificatesBySubject { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllCertificatesBySubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subject = reader.string(); + break; + case 2: + message.subjectKeyIds.push(reader.string()); + break; + case 3: + message.schemaVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AllCertificatesBySubject { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyIds: Array.isArray(object?.subjectKeyIds) ? object.subjectKeyIds.map((e: any) => String(e)) : [], + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, + }; + }, + + toJSON(message: AllCertificatesBySubject): unknown { + const obj: any = {}; + message.subject !== undefined && (obj.subject = message.subject); + if (message.subjectKeyIds) { + obj.subjectKeyIds = message.subjectKeyIds.map((e) => e); + } else { + obj.subjectKeyIds = []; + } + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); + return obj; + }, + + fromPartial, I>>(object: I): AllCertificatesBySubject { + const message = createBaseAllCertificatesBySubject(); + message.subject = object.subject ?? ""; + message.subjectKeyIds = object.subjectKeyIds?.map((e) => e) || []; + message.schemaVersion = object.schemaVersion ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/certificate.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/certificate.ts index edf0dec2a..ff3442b9f 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/certificate.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/certificate.ts @@ -4,6 +4,45 @@ import { Grant } from "./grant"; export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; +export enum CertificateType { + DeviceAttestationPKI = 0, + OperationalPKI = 1, + VIDSignerPKI = 2, + UNRECOGNIZED = -1, +} + +export function certificateTypeFromJSON(object: any): CertificateType { + switch (object) { + case 0: + case "DeviceAttestationPKI": + return CertificateType.DeviceAttestationPKI; + case 1: + case "OperationalPKI": + return CertificateType.OperationalPKI; + case 2: + case "VIDSignerPKI": + return CertificateType.VIDSignerPKI; + case -1: + case "UNRECOGNIZED": + default: + return CertificateType.UNRECOGNIZED; + } +} + +export function certificateTypeToJSON(object: CertificateType): string { + switch (object) { + case CertificateType.DeviceAttestationPKI: + return "DeviceAttestationPKI"; + case CertificateType.OperationalPKI: + return "OperationalPKI"; + case CertificateType.VIDSignerPKI: + return "VIDSignerPKI"; + case CertificateType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + export interface Certificate { pemCert: string; serialNumber: string; @@ -19,7 +58,7 @@ export interface Certificate { subjectAsText: string; rejects: Grant[]; vid: number; - isNoc: boolean; + certificateType: CertificateType; schemaVersion: number; } @@ -39,7 +78,7 @@ function createBaseCertificate(): Certificate { subjectAsText: "", rejects: [], vid: 0, - isNoc: false, + certificateType: 0, schemaVersion: 0, }; } @@ -88,8 +127,8 @@ export const Certificate = { if (message.vid !== 0) { writer.uint32(112).int32(message.vid); } - if (message.isNoc === true) { - writer.uint32(120).bool(message.isNoc); + if (message.certificateType !== 0) { + writer.uint32(120).int32(message.certificateType); } if (message.schemaVersion !== 0) { writer.uint32(128).uint32(message.schemaVersion); @@ -147,7 +186,7 @@ export const Certificate = { message.vid = reader.int32(); break; case 15: - message.isNoc = reader.bool(); + message.certificateType = reader.int32() as any; break; case 16: message.schemaVersion = reader.uint32(); @@ -176,7 +215,7 @@ export const Certificate = { subjectAsText: isSet(object.subjectAsText) ? String(object.subjectAsText) : "", rejects: Array.isArray(object?.rejects) ? object.rejects.map((e: any) => Grant.fromJSON(e)) : [], vid: isSet(object.vid) ? Number(object.vid) : 0, - isNoc: isSet(object.isNoc) ? Boolean(object.isNoc) : false, + certificateType: isSet(object.certificateType) ? certificateTypeFromJSON(object.certificateType) : 0, schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, }; }, @@ -205,7 +244,7 @@ export const Certificate = { obj.rejects = []; } message.vid !== undefined && (obj.vid = Math.round(message.vid)); - message.isNoc !== undefined && (obj.isNoc = message.isNoc); + message.certificateType !== undefined && (obj.certificateType = certificateTypeToJSON(message.certificateType)); message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); return obj; }, @@ -226,7 +265,7 @@ export const Certificate = { message.subjectAsText = object.subjectAsText ?? ""; message.rejects = object.rejects?.map((e) => Grant.fromPartial(e)) || []; message.vid = object.vid ?? 0; - message.isNoc = object.isNoc ?? false; + message.certificateType = object.certificateType ?? 0; message.schemaVersion = object.schemaVersion ?? 0; return message; }, diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/genesis.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/genesis.ts index 279824653..90deab7b4 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/genesis.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/genesis.ts @@ -1,19 +1,25 @@ /* eslint-disable */ import _m0 from "protobufjs/minimal"; +import { AllCertificates } from "./all_certificates"; +import { AllCertificatesBySubject } from "./all_certificates_by_subject"; import { ApprovedCertificates } from "./approved_certificates"; import { ApprovedCertificatesBySubject } from "./approved_certificates_by_subject"; import { ApprovedCertificatesBySubjectKeyId } from "./approved_certificates_by_subject_key_id"; import { ApprovedRootCertificates } from "./approved_root_certificates"; import { ChildCertificates } from "./child_certificates"; +import { NocCertificates } from "./noc_certificates"; +import { NocCertificatesBySubject } from "./noc_certificates_by_subject"; +import { NocCertificatesBySubjectKeyID } from "./noc_certificates_by_subject_key_id"; +import { NocCertificatesByVidAndSkid } from "./noc_certificates_by_vid_and_skid"; import { NocIcaCertificates } from "./noc_ica_certificates"; import { NocRootCertificates } from "./noc_root_certificates"; -import { NocRootCertificatesByVidAndSkid } from "./noc_root_certificates_by_vid_and_skid"; import { PkiRevocationDistributionPoint } from "./pki_revocation_distribution_point"; import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from "./pki_revocation_distribution_points_by_issuer_subject_key_id"; import { ProposedCertificate } from "./proposed_certificate"; import { ProposedCertificateRevocation } from "./proposed_certificate_revocation"; import { RejectedCertificate } from "./rejected_certificate"; import { RevokedCertificates } from "./revoked_certificates"; +import { RevokedNocIcaCertificates } from "./revoked_noc_ica_certificates"; import { RevokedNocRootCertificates } from "./revoked_noc_root_certificates"; import { RevokedRootCertificates } from "./revoked_root_certificates"; import { UniqueCertificate } from "./unique_certificate"; @@ -38,8 +44,14 @@ export interface GenesisState { nocRootCertificatesList: NocRootCertificates[]; nocIcaCertificatesList: NocIcaCertificates[]; revokedNocRootCertificatesList: RevokedNocRootCertificates[]; + nocCertificatesByVidAndSkidList: NocCertificatesByVidAndSkid[]; + NocCertificatesBySubjectKeyIDList: NocCertificatesBySubjectKeyID[]; + nocCertificatesList: NocCertificates[]; + nocCertificatesBySubjectList: NocCertificatesBySubject[]; + certificatesList: AllCertificates[]; + revokedNocIcaCertificatesList: RevokedNocIcaCertificates[]; /** this line is used by starport scaffolding # genesis/proto/state */ - nocRootCertificatesByVidAndSkidList: NocRootCertificatesByVidAndSkid[]; + allCertificatesBySubjectList: AllCertificatesBySubject[]; } function createBaseGenesisState(): GenesisState { @@ -60,7 +72,13 @@ function createBaseGenesisState(): GenesisState { nocRootCertificatesList: [], nocIcaCertificatesList: [], revokedNocRootCertificatesList: [], - nocRootCertificatesByVidAndSkidList: [], + nocCertificatesByVidAndSkidList: [], + NocCertificatesBySubjectKeyIDList: [], + nocCertificatesList: [], + nocCertificatesBySubjectList: [], + certificatesList: [], + revokedNocIcaCertificatesList: [], + allCertificatesBySubjectList: [], }; } @@ -114,8 +132,26 @@ export const GenesisState = { for (const v of message.revokedNocRootCertificatesList) { RevokedNocRootCertificates.encode(v!, writer.uint32(130).fork()).ldelim(); } - for (const v of message.nocRootCertificatesByVidAndSkidList) { - NocRootCertificatesByVidAndSkid.encode(v!, writer.uint32(138).fork()).ldelim(); + for (const v of message.nocCertificatesByVidAndSkidList) { + NocCertificatesByVidAndSkid.encode(v!, writer.uint32(138).fork()).ldelim(); + } + for (const v of message.NocCertificatesBySubjectKeyIDList) { + NocCertificatesBySubjectKeyID.encode(v!, writer.uint32(146).fork()).ldelim(); + } + for (const v of message.nocCertificatesList) { + NocCertificates.encode(v!, writer.uint32(154).fork()).ldelim(); + } + for (const v of message.nocCertificatesBySubjectList) { + NocCertificatesBySubject.encode(v!, writer.uint32(162).fork()).ldelim(); + } + for (const v of message.certificatesList) { + AllCertificates.encode(v!, writer.uint32(170).fork()).ldelim(); + } + for (const v of message.revokedNocIcaCertificatesList) { + RevokedNocIcaCertificates.encode(v!, writer.uint32(178).fork()).ldelim(); + } + for (const v of message.allCertificatesBySubjectList) { + AllCertificatesBySubject.encode(v!, writer.uint32(186).fork()).ldelim(); } return writer; }, @@ -182,9 +218,25 @@ export const GenesisState = { message.revokedNocRootCertificatesList.push(RevokedNocRootCertificates.decode(reader, reader.uint32())); break; case 17: - message.nocRootCertificatesByVidAndSkidList.push( - NocRootCertificatesByVidAndSkid.decode(reader, reader.uint32()), - ); + message.nocCertificatesByVidAndSkidList.push(NocCertificatesByVidAndSkid.decode(reader, reader.uint32())); + break; + case 18: + message.NocCertificatesBySubjectKeyIDList.push(NocCertificatesBySubjectKeyID.decode(reader, reader.uint32())); + break; + case 19: + message.nocCertificatesList.push(NocCertificates.decode(reader, reader.uint32())); + break; + case 20: + message.nocCertificatesBySubjectList.push(NocCertificatesBySubject.decode(reader, reader.uint32())); + break; + case 21: + message.certificatesList.push(AllCertificates.decode(reader, reader.uint32())); + break; + case 22: + message.revokedNocIcaCertificatesList.push(RevokedNocIcaCertificates.decode(reader, reader.uint32())); + break; + case 23: + message.allCertificatesBySubjectList.push(AllCertificatesBySubject.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -247,8 +299,26 @@ export const GenesisState = { revokedNocRootCertificatesList: Array.isArray(object?.revokedNocRootCertificatesList) ? object.revokedNocRootCertificatesList.map((e: any) => RevokedNocRootCertificates.fromJSON(e)) : [], - nocRootCertificatesByVidAndSkidList: Array.isArray(object?.nocRootCertificatesByVidAndSkidList) - ? object.nocRootCertificatesByVidAndSkidList.map((e: any) => NocRootCertificatesByVidAndSkid.fromJSON(e)) + nocCertificatesByVidAndSkidList: Array.isArray(object?.nocCertificatesByVidAndSkidList) + ? object.nocCertificatesByVidAndSkidList.map((e: any) => NocCertificatesByVidAndSkid.fromJSON(e)) + : [], + NocCertificatesBySubjectKeyIDList: Array.isArray(object?.NocCertificatesBySubjectKeyIDList) + ? object.NocCertificatesBySubjectKeyIDList.map((e: any) => NocCertificatesBySubjectKeyID.fromJSON(e)) + : [], + nocCertificatesList: Array.isArray(object?.nocCertificatesList) + ? object.nocCertificatesList.map((e: any) => NocCertificates.fromJSON(e)) + : [], + nocCertificatesBySubjectList: Array.isArray(object?.nocCertificatesBySubjectList) + ? object.nocCertificatesBySubjectList.map((e: any) => NocCertificatesBySubject.fromJSON(e)) + : [], + certificatesList: Array.isArray(object?.certificatesList) + ? object.certificatesList.map((e: any) => AllCertificates.fromJSON(e)) + : [], + revokedNocIcaCertificatesList: Array.isArray(object?.revokedNocIcaCertificatesList) + ? object.revokedNocIcaCertificatesList.map((e: any) => RevokedNocIcaCertificates.fromJSON(e)) + : [], + allCertificatesBySubjectList: Array.isArray(object?.allCertificatesBySubjectList) + ? object.allCertificatesBySubjectList.map((e: any) => AllCertificatesBySubject.fromJSON(e)) : [], }; }, @@ -356,12 +426,50 @@ export const GenesisState = { } else { obj.revokedNocRootCertificatesList = []; } - if (message.nocRootCertificatesByVidAndSkidList) { - obj.nocRootCertificatesByVidAndSkidList = message.nocRootCertificatesByVidAndSkidList.map((e) => - e ? NocRootCertificatesByVidAndSkid.toJSON(e) : undefined + if (message.nocCertificatesByVidAndSkidList) { + obj.nocCertificatesByVidAndSkidList = message.nocCertificatesByVidAndSkidList.map((e) => + e ? NocCertificatesByVidAndSkid.toJSON(e) : undefined + ); + } else { + obj.nocCertificatesByVidAndSkidList = []; + } + if (message.NocCertificatesBySubjectKeyIDList) { + obj.NocCertificatesBySubjectKeyIDList = message.NocCertificatesBySubjectKeyIDList.map((e) => + e ? NocCertificatesBySubjectKeyID.toJSON(e) : undefined + ); + } else { + obj.NocCertificatesBySubjectKeyIDList = []; + } + if (message.nocCertificatesList) { + obj.nocCertificatesList = message.nocCertificatesList.map((e) => e ? NocCertificates.toJSON(e) : undefined); + } else { + obj.nocCertificatesList = []; + } + if (message.nocCertificatesBySubjectList) { + obj.nocCertificatesBySubjectList = message.nocCertificatesBySubjectList.map((e) => + e ? NocCertificatesBySubject.toJSON(e) : undefined + ); + } else { + obj.nocCertificatesBySubjectList = []; + } + if (message.certificatesList) { + obj.certificatesList = message.certificatesList.map((e) => e ? AllCertificates.toJSON(e) : undefined); + } else { + obj.certificatesList = []; + } + if (message.revokedNocIcaCertificatesList) { + obj.revokedNocIcaCertificatesList = message.revokedNocIcaCertificatesList.map((e) => + e ? RevokedNocIcaCertificates.toJSON(e) : undefined + ); + } else { + obj.revokedNocIcaCertificatesList = []; + } + if (message.allCertificatesBySubjectList) { + obj.allCertificatesBySubjectList = message.allCertificatesBySubjectList.map((e) => + e ? AllCertificatesBySubject.toJSON(e) : undefined ); } else { - obj.nocRootCertificatesByVidAndSkidList = []; + obj.allCertificatesBySubjectList = []; } return obj; }, @@ -404,8 +512,18 @@ export const GenesisState = { message.nocIcaCertificatesList = object.nocIcaCertificatesList?.map((e) => NocIcaCertificates.fromPartial(e)) || []; message.revokedNocRootCertificatesList = object.revokedNocRootCertificatesList?.map((e) => RevokedNocRootCertificates.fromPartial(e)) || []; - message.nocRootCertificatesByVidAndSkidList = - object.nocRootCertificatesByVidAndSkidList?.map((e) => NocRootCertificatesByVidAndSkid.fromPartial(e)) || []; + message.nocCertificatesByVidAndSkidList = + object.nocCertificatesByVidAndSkidList?.map((e) => NocCertificatesByVidAndSkid.fromPartial(e)) || []; + message.NocCertificatesBySubjectKeyIDList = + object.NocCertificatesBySubjectKeyIDList?.map((e) => NocCertificatesBySubjectKeyID.fromPartial(e)) || []; + message.nocCertificatesList = object.nocCertificatesList?.map((e) => NocCertificates.fromPartial(e)) || []; + message.nocCertificatesBySubjectList = + object.nocCertificatesBySubjectList?.map((e) => NocCertificatesBySubject.fromPartial(e)) || []; + message.certificatesList = object.certificatesList?.map((e) => AllCertificates.fromPartial(e)) || []; + message.revokedNocIcaCertificatesList = + object.revokedNocIcaCertificatesList?.map((e) => RevokedNocIcaCertificates.fromPartial(e)) || []; + message.allCertificatesBySubjectList = + object.allCertificatesBySubjectList?.map((e) => AllCertificatesBySubject.fromPartial(e)) || []; return message; }, }; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.ts index 199f4a0d4..1db6e1a9c 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates.ts @@ -5,21 +5,33 @@ import { Certificate } from "./certificate"; export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; export interface NocCertificates { - vid: number; + subject: string; + subjectKeyId: string; certs: Certificate[]; + tq: number; + schemaVersion: number; } function createBaseNocCertificates(): NocCertificates { - return { vid: 0, certs: [] }; + return { subject: "", subjectKeyId: "", certs: [], tq: 0, schemaVersion: 0 }; } export const NocCertificates = { encode(message: NocCertificates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.vid !== 0) { - writer.uint32(8).int32(message.vid); + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); } for (const v of message.certs) { - Certificate.encode(v!, writer.uint32(18).fork()).ldelim(); + Certificate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.tq !== 0) { + writer.uint32(37).float(message.tq); + } + if (message.schemaVersion !== 0) { + writer.uint32(40).uint32(message.schemaVersion); } return writer; }, @@ -32,11 +44,20 @@ export const NocCertificates = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.vid = reader.int32(); + message.subject = reader.string(); break; case 2: + message.subjectKeyId = reader.string(); + break; + case 3: message.certs.push(Certificate.decode(reader, reader.uint32())); break; + case 4: + message.tq = reader.float(); + break; + case 5: + message.schemaVersion = reader.uint32(); + break; default: reader.skipType(tag & 7); break; @@ -47,26 +68,35 @@ export const NocCertificates = { fromJSON(object: any): NocCertificates { return { - vid: isSet(object.vid) ? Number(object.vid) : 0, + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", certs: Array.isArray(object?.certs) ? object.certs.map((e: any) => Certificate.fromJSON(e)) : [], + tq: isSet(object.tq) ? Number(object.tq) : 0, + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, }; }, toJSON(message: NocCertificates): unknown { const obj: any = {}; - message.vid !== undefined && (obj.vid = Math.round(message.vid)); + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); if (message.certs) { obj.certs = message.certs.map((e) => e ? Certificate.toJSON(e) : undefined); } else { obj.certs = []; } + message.tq !== undefined && (obj.tq = message.tq); + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); return obj; }, fromPartial, I>>(object: I): NocCertificates { const message = createBaseNocCertificates(); - message.vid = object.vid ?? 0; + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; message.certs = object.certs?.map((e) => Certificate.fromPartial(e)) || []; + message.tq = object.tq ?? 0; + message.schemaVersion = object.schemaVersion ?? 0; return message; }, }; diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.ts new file mode 100644 index 000000000..44172db1b --- /dev/null +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.ts @@ -0,0 +1,96 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; + +export interface NocCertificatesBySubject { + subject: string; + subjectKeyIds: string[]; + schemaVersion: number; +} + +function createBaseNocCertificatesBySubject(): NocCertificatesBySubject { + return { subject: "", subjectKeyIds: [], schemaVersion: 0 }; +} + +export const NocCertificatesBySubject = { + encode(message: NocCertificatesBySubject, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + for (const v of message.subjectKeyIds) { + writer.uint32(18).string(v!); + } + if (message.schemaVersion !== 0) { + writer.uint32(24).uint32(message.schemaVersion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NocCertificatesBySubject { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNocCertificatesBySubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subject = reader.string(); + break; + case 2: + message.subjectKeyIds.push(reader.string()); + break; + case 3: + message.schemaVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NocCertificatesBySubject { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyIds: Array.isArray(object?.subjectKeyIds) ? object.subjectKeyIds.map((e: any) => String(e)) : [], + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, + }; + }, + + toJSON(message: NocCertificatesBySubject): unknown { + const obj: any = {}; + message.subject !== undefined && (obj.subject = message.subject); + if (message.subjectKeyIds) { + obj.subjectKeyIds = message.subjectKeyIds.map((e) => e); + } else { + obj.subjectKeyIds = []; + } + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); + return obj; + }, + + fromPartial, I>>(object: I): NocCertificatesBySubject { + const message = createBaseNocCertificatesBySubject(); + message.subject = object.subject ?? ""; + message.subjectKeyIds = object.subjectKeyIds?.map((e) => e) || []; + message.schemaVersion = object.schemaVersion ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.ts new file mode 100644 index 000000000..7156597ff --- /dev/null +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.ts @@ -0,0 +1,109 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Certificate } from "./certificate"; + +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; + +export interface NocCertificatesBySubjectKeyID { + subjectKeyId: string; + certs: Certificate[]; + tq: number; + schemaVersion: number; +} + +function createBaseNocCertificatesBySubjectKeyID(): NocCertificatesBySubjectKeyID { + return { subjectKeyId: "", certs: [], tq: 0, schemaVersion: 0 }; +} + +export const NocCertificatesBySubjectKeyID = { + encode(message: NocCertificatesBySubjectKeyID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subjectKeyId !== "") { + writer.uint32(10).string(message.subjectKeyId); + } + for (const v of message.certs) { + Certificate.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.tq !== 0) { + writer.uint32(29).float(message.tq); + } + if (message.schemaVersion !== 0) { + writer.uint32(32).uint32(message.schemaVersion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NocCertificatesBySubjectKeyID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNocCertificatesBySubjectKeyID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectKeyId = reader.string(); + break; + case 2: + message.certs.push(Certificate.decode(reader, reader.uint32())); + break; + case 3: + message.tq = reader.float(); + break; + case 4: + message.schemaVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NocCertificatesBySubjectKeyID { + return { + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + certs: Array.isArray(object?.certs) ? object.certs.map((e: any) => Certificate.fromJSON(e)) : [], + tq: isSet(object.tq) ? Number(object.tq) : 0, + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, + }; + }, + + toJSON(message: NocCertificatesBySubjectKeyID): unknown { + const obj: any = {}; + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + if (message.certs) { + obj.certs = message.certs.map((e) => e ? Certificate.toJSON(e) : undefined); + } else { + obj.certs = []; + } + message.tq !== undefined && (obj.tq = message.tq); + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): NocCertificatesBySubjectKeyID { + const message = createBaseNocCertificatesBySubjectKeyID(); + message.subjectKeyId = object.subjectKeyId ?? ""; + message.certs = object.certs?.map((e) => Certificate.fromPartial(e)) || []; + message.tq = object.tq ?? 0; + message.schemaVersion = object.schemaVersion ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_vid_and_skid.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_vid_and_skid.ts new file mode 100644 index 000000000..5c43b460b --- /dev/null +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_vid_and_skid.ts @@ -0,0 +1,117 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Certificate } from "./certificate"; + +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; + +export interface NocCertificatesByVidAndSkid { + vid: number; + subjectKeyId: string; + certs: Certificate[]; + tq: number; + schemaVersion: number; +} + +function createBaseNocCertificatesByVidAndSkid(): NocCertificatesByVidAndSkid { + return { vid: 0, subjectKeyId: "", certs: [], tq: 0, schemaVersion: 0 }; +} + +export const NocCertificatesByVidAndSkid = { + encode(message: NocCertificatesByVidAndSkid, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } + for (const v of message.certs) { + Certificate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.tq !== 0) { + writer.uint32(37).float(message.tq); + } + if (message.schemaVersion !== 0) { + writer.uint32(40).uint32(message.schemaVersion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NocCertificatesByVidAndSkid { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNocCertificatesByVidAndSkid(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vid = reader.int32(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; + case 3: + message.certs.push(Certificate.decode(reader, reader.uint32())); + break; + case 4: + message.tq = reader.float(); + break; + case 5: + message.schemaVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NocCertificatesByVidAndSkid { + return { + vid: isSet(object.vid) ? Number(object.vid) : 0, + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + certs: Array.isArray(object?.certs) ? object.certs.map((e: any) => Certificate.fromJSON(e)) : [], + tq: isSet(object.tq) ? Number(object.tq) : 0, + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, + }; + }, + + toJSON(message: NocCertificatesByVidAndSkid): unknown { + const obj: any = {}; + message.vid !== undefined && (obj.vid = Math.round(message.vid)); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + if (message.certs) { + obj.certs = message.certs.map((e) => e ? Certificate.toJSON(e) : undefined); + } else { + obj.certs = []; + } + message.tq !== undefined && (obj.tq = message.tq); + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); + return obj; + }, + + fromPartial, I>>(object: I): NocCertificatesByVidAndSkid { + const message = createBaseNocCertificatesByVidAndSkid(); + message.vid = object.vid ?? 0; + message.subjectKeyId = object.subjectKeyId ?? ""; + message.certs = object.certs?.map((e) => Certificate.fromPartial(e)) || []; + message.tq = object.tq ?? 0; + message.schemaVersion = object.schemaVersion ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/query.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/query.ts index 9471c3597..fde7bf85e 100644 --- a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/query.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/query.ts @@ -1,24 +1,55 @@ /* eslint-disable */ import _m0 from "protobufjs/minimal"; import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { AllCertificates } from "./all_certificates"; +import { AllCertificatesBySubject } from "./all_certificates_by_subject"; import { ApprovedCertificates } from "./approved_certificates"; import { ApprovedCertificatesBySubject } from "./approved_certificates_by_subject"; import { ApprovedRootCertificates } from "./approved_root_certificates"; import { ChildCertificates } from "./child_certificates"; +import { NocCertificates } from "./noc_certificates"; +import { NocCertificatesBySubject } from "./noc_certificates_by_subject"; +import { NocCertificatesByVidAndSkid } from "./noc_certificates_by_vid_and_skid"; import { NocIcaCertificates } from "./noc_ica_certificates"; import { NocRootCertificates } from "./noc_root_certificates"; -import { NocRootCertificatesByVidAndSkid } from "./noc_root_certificates_by_vid_and_skid"; import { PkiRevocationDistributionPoint } from "./pki_revocation_distribution_point"; import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from "./pki_revocation_distribution_points_by_issuer_subject_key_id"; import { ProposedCertificate } from "./proposed_certificate"; import { ProposedCertificateRevocation } from "./proposed_certificate_revocation"; import { RejectedCertificate } from "./rejected_certificate"; import { RevokedCertificates } from "./revoked_certificates"; +import { RevokedNocIcaCertificates } from "./revoked_noc_ica_certificates"; import { RevokedNocRootCertificates } from "./revoked_noc_root_certificates"; import { RevokedRootCertificates } from "./revoked_root_certificates"; export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; +export interface QueryAllCertificatesRequest { + pagination: PageRequest | undefined; +} + +export interface QueryAllCertificatesResponse { + certificates: AllCertificates[]; + pagination: PageResponse | undefined; +} + +export interface QueryGetAllCertificatesBySubjectRequest { + subject: string; +} + +export interface QueryGetAllCertificatesBySubjectResponse { + allCertificatesBySubject: AllCertificatesBySubject | undefined; +} + +export interface QueryGetCertificatesRequest { + subject: string; + subjectKeyId: string; +} + +export interface QueryGetCertificatesResponse { + certificates: AllCertificates | undefined; +} + export interface QueryGetApprovedCertificatesRequest { subject: string; subjectKeyId: string; @@ -221,42 +252,81 @@ export interface QueryAllRevokedNocRootCertificatesResponse { pagination: PageResponse | undefined; } -export interface QueryGetNocRootCertificatesByVidAndSkidRequest { +export interface QueryGetRevokedNocIcaCertificatesRequest { + subject: string; + subjectKeyId: string; +} + +export interface QueryGetRevokedNocIcaCertificatesResponse { + revokedNocIcaCertificates: RevokedNocIcaCertificates | undefined; +} + +export interface QueryAllRevokedNocIcaCertificatesRequest { + pagination: PageRequest | undefined; +} + +export interface QueryAllRevokedNocIcaCertificatesResponse { + revokedNocIcaCertificates: RevokedNocIcaCertificates[]; + pagination: PageResponse | undefined; +} + +export interface QueryGetNocCertificatesByVidAndSkidRequest { vid: number; subjectKeyId: string; } -export interface QueryGetNocRootCertificatesByVidAndSkidResponse { - nocRootCertificatesByVidAndSkid: NocRootCertificatesByVidAndSkid | undefined; +export interface QueryGetNocCertificatesByVidAndSkidResponse { + nocCertificatesByVidAndSkid: NocCertificatesByVidAndSkid | undefined; } -function createBaseQueryGetApprovedCertificatesRequest(): QueryGetApprovedCertificatesRequest { - return { subject: "", subjectKeyId: "" }; +export interface QueryNocCertificatesRequest { + pagination: PageRequest | undefined; + subjectKeyId: string; } -export const QueryGetApprovedCertificatesRequest = { - encode(message: QueryGetApprovedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subject !== "") { - writer.uint32(10).string(message.subject); - } - if (message.subjectKeyId !== "") { - writer.uint32(18).string(message.subjectKeyId); +export interface QueryNocCertificatesResponse { + nocCertificates: NocCertificates[]; + pagination: PageResponse | undefined; +} + +export interface QueryGetNocCertificatesBySubjectRequest { + subject: string; +} + +export interface QueryGetNocCertificatesBySubjectResponse { + nocCertificatesBySubject: NocCertificatesBySubject | undefined; +} + +export interface QueryGetNocCertificatesRequest { + subject: string; + subjectKeyId: string; +} + +export interface QueryGetNocCertificatesResponse { + nocCertificates: NocCertificates | undefined; +} + +function createBaseQueryAllCertificatesRequest(): QueryAllCertificatesRequest { + return { pagination: undefined }; +} + +export const QueryAllCertificatesRequest = { + encode(message: QueryAllCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetApprovedCertificatesRequest(); + const message = createBaseQueryAllCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.subject = reader.string(); - break; - case 2: - message.subjectKeyId = reader.string(); + message.pagination = PageRequest.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -266,51 +336,53 @@ export const QueryGetApprovedCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetApprovedCertificatesRequest { - return { - subject: isSet(object.subject) ? String(object.subject) : "", - subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", - }; + fromJSON(object: any): QueryAllCertificatesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGetApprovedCertificatesRequest): unknown { + toJSON(message: QueryAllCertificatesRequest): unknown { const obj: any = {}; - message.subject !== undefined && (obj.subject = message.subject); - message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetApprovedCertificatesRequest { - const message = createBaseQueryGetApprovedCertificatesRequest(); - message.subject = object.subject ?? ""; - message.subjectKeyId = object.subjectKeyId ?? ""; + fromPartial, I>>(object: I): QueryAllCertificatesRequest { + const message = createBaseQueryAllCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetApprovedCertificatesResponse(): QueryGetApprovedCertificatesResponse { - return { approvedCertificates: undefined }; +function createBaseQueryAllCertificatesResponse(): QueryAllCertificatesResponse { + return { certificates: [], pagination: undefined }; } -export const QueryGetApprovedCertificatesResponse = { - encode(message: QueryGetApprovedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.approvedCertificates !== undefined) { - ApprovedCertificates.encode(message.approvedCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryAllCertificatesResponse = { + encode(message: QueryAllCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.certificates) { + AllCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetApprovedCertificatesResponse(); + const message = createBaseQueryAllCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.approvedCertificates = ApprovedCertificates.decode(reader, reader.uint32()); + message.certificates.push(AllCertificates.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -320,60 +392,58 @@ export const QueryGetApprovedCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetApprovedCertificatesResponse { + fromJSON(object: any): QueryAllCertificatesResponse { return { - approvedCertificates: isSet(object.approvedCertificates) - ? ApprovedCertificates.fromJSON(object.approvedCertificates) - : undefined, + certificates: Array.isArray(object?.certificates) + ? object.certificates.map((e: any) => AllCertificates.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryGetApprovedCertificatesResponse): unknown { + toJSON(message: QueryAllCertificatesResponse): unknown { const obj: any = {}; - message.approvedCertificates !== undefined && (obj.approvedCertificates = message.approvedCertificates - ? ApprovedCertificates.toJSON(message.approvedCertificates) - : undefined); + if (message.certificates) { + obj.certificates = message.certificates.map((e) => e ? AllCertificates.toJSON(e) : undefined); + } else { + obj.certificates = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetApprovedCertificatesResponse { - const message = createBaseQueryGetApprovedCertificatesResponse(); - message.approvedCertificates = (object.approvedCertificates !== undefined && object.approvedCertificates !== null) - ? ApprovedCertificates.fromPartial(object.approvedCertificates) + fromPartial, I>>(object: I): QueryAllCertificatesResponse { + const message = createBaseQueryAllCertificatesResponse(); + message.certificates = object.certificates?.map((e) => AllCertificates.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, }; -function createBaseQueryAllApprovedCertificatesRequest(): QueryAllApprovedCertificatesRequest { - return { pagination: undefined, subjectKeyId: "" }; +function createBaseQueryGetAllCertificatesBySubjectRequest(): QueryGetAllCertificatesBySubjectRequest { + return { subject: "" }; } -export const QueryAllApprovedCertificatesRequest = { - encode(message: QueryAllApprovedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); - } - if (message.subjectKeyId !== "") { - writer.uint32(18).string(message.subjectKeyId); +export const QueryGetAllCertificatesBySubjectRequest = { + encode(message: QueryGetAllCertificatesBySubjectRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllApprovedCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetAllCertificatesBySubjectRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllApprovedCertificatesRequest(); + const message = createBaseQueryGetAllCertificatesBySubjectRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - case 2: - message.subjectKeyId = reader.string(); + message.subject = reader.string(); break; default: reader.skipType(tag & 7); @@ -383,60 +453,46 @@ export const QueryAllApprovedCertificatesRequest = { return message; }, - fromJSON(object: any): QueryAllApprovedCertificatesRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", - }; + fromJSON(object: any): QueryGetAllCertificatesBySubjectRequest { + return { subject: isSet(object.subject) ? String(object.subject) : "" }; }, - toJSON(message: QueryAllApprovedCertificatesRequest): unknown { + toJSON(message: QueryGetAllCertificatesBySubjectRequest): unknown { const obj: any = {}; - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + message.subject !== undefined && (obj.subject = message.subject); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllApprovedCertificatesRequest { - const message = createBaseQueryAllApprovedCertificatesRequest(); - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageRequest.fromPartial(object.pagination) - : undefined; - message.subjectKeyId = object.subjectKeyId ?? ""; + ): QueryGetAllCertificatesBySubjectRequest { + const message = createBaseQueryGetAllCertificatesBySubjectRequest(); + message.subject = object.subject ?? ""; return message; }, }; -function createBaseQueryAllApprovedCertificatesResponse(): QueryAllApprovedCertificatesResponse { - return { approvedCertificates: [], pagination: undefined }; +function createBaseQueryGetAllCertificatesBySubjectResponse(): QueryGetAllCertificatesBySubjectResponse { + return { allCertificatesBySubject: undefined }; } -export const QueryAllApprovedCertificatesResponse = { - encode(message: QueryAllApprovedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.approvedCertificates) { - ApprovedCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryGetAllCertificatesBySubjectResponse = { + encode(message: QueryGetAllCertificatesBySubjectResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allCertificatesBySubject !== undefined) { + AllCertificatesBySubject.encode(message.allCertificatesBySubject, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllApprovedCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetAllCertificatesBySubjectResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllApprovedCertificatesResponse(); + const message = createBaseQueryGetAllCertificatesBySubjectResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.approvedCertificates.push(ApprovedCertificates.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.allCertificatesBySubject = AllCertificatesBySubject.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -446,47 +502,40 @@ export const QueryAllApprovedCertificatesResponse = { return message; }, - fromJSON(object: any): QueryAllApprovedCertificatesResponse { + fromJSON(object: any): QueryGetAllCertificatesBySubjectResponse { return { - approvedCertificates: Array.isArray(object?.approvedCertificates) - ? object.approvedCertificates.map((e: any) => ApprovedCertificates.fromJSON(e)) - : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + allCertificatesBySubject: isSet(object.allCertificatesBySubject) + ? AllCertificatesBySubject.fromJSON(object.allCertificatesBySubject) + : undefined, }; }, - toJSON(message: QueryAllApprovedCertificatesResponse): unknown { + toJSON(message: QueryGetAllCertificatesBySubjectResponse): unknown { const obj: any = {}; - if (message.approvedCertificates) { - obj.approvedCertificates = message.approvedCertificates.map((e) => - e ? ApprovedCertificates.toJSON(e) : undefined - ); - } else { - obj.approvedCertificates = []; - } - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.allCertificatesBySubject !== undefined && (obj.allCertificatesBySubject = message.allCertificatesBySubject + ? AllCertificatesBySubject.toJSON(message.allCertificatesBySubject) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllApprovedCertificatesResponse { - const message = createBaseQueryAllApprovedCertificatesResponse(); - message.approvedCertificates = object.approvedCertificates?.map((e) => ApprovedCertificates.fromPartial(e)) || []; - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageResponse.fromPartial(object.pagination) - : undefined; + ): QueryGetAllCertificatesBySubjectResponse { + const message = createBaseQueryGetAllCertificatesBySubjectResponse(); + message.allCertificatesBySubject = + (object.allCertificatesBySubject !== undefined && object.allCertificatesBySubject !== null) + ? AllCertificatesBySubject.fromPartial(object.allCertificatesBySubject) + : undefined; return message; }, }; -function createBaseQueryGetProposedCertificateRequest(): QueryGetProposedCertificateRequest { +function createBaseQueryGetCertificatesRequest(): QueryGetCertificatesRequest { return { subject: "", subjectKeyId: "" }; } -export const QueryGetProposedCertificateRequest = { - encode(message: QueryGetProposedCertificateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGetCertificatesRequest = { + encode(message: QueryGetCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.subject !== "") { writer.uint32(10).string(message.subject); } @@ -496,10 +545,10 @@ export const QueryGetProposedCertificateRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetProposedCertificateRequest(); + const message = createBaseQueryGetCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -517,51 +566,49 @@ export const QueryGetProposedCertificateRequest = { return message; }, - fromJSON(object: any): QueryGetProposedCertificateRequest { + fromJSON(object: any): QueryGetCertificatesRequest { return { subject: isSet(object.subject) ? String(object.subject) : "", subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", }; }, - toJSON(message: QueryGetProposedCertificateRequest): unknown { + toJSON(message: QueryGetCertificatesRequest): unknown { const obj: any = {}; message.subject !== undefined && (obj.subject = message.subject); message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetProposedCertificateRequest { - const message = createBaseQueryGetProposedCertificateRequest(); + fromPartial, I>>(object: I): QueryGetCertificatesRequest { + const message = createBaseQueryGetCertificatesRequest(); message.subject = object.subject ?? ""; message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryGetProposedCertificateResponse(): QueryGetProposedCertificateResponse { - return { proposedCertificate: undefined }; +function createBaseQueryGetCertificatesResponse(): QueryGetCertificatesResponse { + return { certificates: undefined }; } -export const QueryGetProposedCertificateResponse = { - encode(message: QueryGetProposedCertificateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.proposedCertificate !== undefined) { - ProposedCertificate.encode(message.proposedCertificate, writer.uint32(10).fork()).ldelim(); +export const QueryGetCertificatesResponse = { + encode(message: QueryGetCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.certificates !== undefined) { + AllCertificates.encode(message.certificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetProposedCertificateResponse(); + const message = createBaseQueryGetCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.proposedCertificate = ProposedCertificate.decode(reader, reader.uint32()); + message.certificates = AllCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -571,54 +618,53 @@ export const QueryGetProposedCertificateResponse = { return message; }, - fromJSON(object: any): QueryGetProposedCertificateResponse { - return { - proposedCertificate: isSet(object.proposedCertificate) - ? ProposedCertificate.fromJSON(object.proposedCertificate) - : undefined, - }; + fromJSON(object: any): QueryGetCertificatesResponse { + return { certificates: isSet(object.certificates) ? AllCertificates.fromJSON(object.certificates) : undefined }; }, - toJSON(message: QueryGetProposedCertificateResponse): unknown { + toJSON(message: QueryGetCertificatesResponse): unknown { const obj: any = {}; - message.proposedCertificate !== undefined && (obj.proposedCertificate = message.proposedCertificate - ? ProposedCertificate.toJSON(message.proposedCertificate) - : undefined); + message.certificates !== undefined + && (obj.certificates = message.certificates ? AllCertificates.toJSON(message.certificates) : undefined); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetProposedCertificateResponse { - const message = createBaseQueryGetProposedCertificateResponse(); - message.proposedCertificate = (object.proposedCertificate !== undefined && object.proposedCertificate !== null) - ? ProposedCertificate.fromPartial(object.proposedCertificate) + fromPartial, I>>(object: I): QueryGetCertificatesResponse { + const message = createBaseQueryGetCertificatesResponse(); + message.certificates = (object.certificates !== undefined && object.certificates !== null) + ? AllCertificates.fromPartial(object.certificates) : undefined; return message; }, }; -function createBaseQueryAllProposedCertificateRequest(): QueryAllProposedCertificateRequest { - return { pagination: undefined }; +function createBaseQueryGetApprovedCertificatesRequest(): QueryGetApprovedCertificatesRequest { + return { subject: "", subjectKeyId: "" }; } -export const QueryAllProposedCertificateRequest = { - encode(message: QueryAllProposedCertificateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); +export const QueryGetApprovedCertificatesRequest = { + encode(message: QueryGetApprovedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllProposedCertificateRequest(); + const message = createBaseQueryGetApprovedCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); break; default: reader.skipType(tag & 7); @@ -628,55 +674,51 @@ export const QueryAllProposedCertificateRequest = { return message; }, - fromJSON(object: any): QueryAllProposedCertificateRequest { - return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + fromJSON(object: any): QueryGetApprovedCertificatesRequest { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + }; }, - toJSON(message: QueryAllProposedCertificateRequest): unknown { + toJSON(message: QueryGetApprovedCertificatesRequest): unknown { const obj: any = {}; - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllProposedCertificateRequest { - const message = createBaseQueryAllProposedCertificateRequest(); - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageRequest.fromPartial(object.pagination) - : undefined; + ): QueryGetApprovedCertificatesRequest { + const message = createBaseQueryGetApprovedCertificatesRequest(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryAllProposedCertificateResponse(): QueryAllProposedCertificateResponse { - return { proposedCertificate: [], pagination: undefined }; +function createBaseQueryGetApprovedCertificatesResponse(): QueryGetApprovedCertificatesResponse { + return { approvedCertificates: undefined }; } -export const QueryAllProposedCertificateResponse = { - encode(message: QueryAllProposedCertificateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.proposedCertificate) { - ProposedCertificate.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryGetApprovedCertificatesResponse = { + encode(message: QueryGetApprovedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.approvedCertificates !== undefined) { + ApprovedCertificates.encode(message.approvedCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllProposedCertificateResponse(); + const message = createBaseQueryGetApprovedCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.proposedCertificate.push(ProposedCertificate.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.approvedCertificates = ApprovedCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -686,66 +728,60 @@ export const QueryAllProposedCertificateResponse = { return message; }, - fromJSON(object: any): QueryAllProposedCertificateResponse { + fromJSON(object: any): QueryGetApprovedCertificatesResponse { return { - proposedCertificate: Array.isArray(object?.proposedCertificate) - ? object.proposedCertificate.map((e: any) => ProposedCertificate.fromJSON(e)) - : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + approvedCertificates: isSet(object.approvedCertificates) + ? ApprovedCertificates.fromJSON(object.approvedCertificates) + : undefined, }; }, - toJSON(message: QueryAllProposedCertificateResponse): unknown { + toJSON(message: QueryGetApprovedCertificatesResponse): unknown { const obj: any = {}; - if (message.proposedCertificate) { - obj.proposedCertificate = message.proposedCertificate.map((e) => e ? ProposedCertificate.toJSON(e) : undefined); - } else { - obj.proposedCertificate = []; - } - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.approvedCertificates !== undefined && (obj.approvedCertificates = message.approvedCertificates + ? ApprovedCertificates.toJSON(message.approvedCertificates) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllProposedCertificateResponse { - const message = createBaseQueryAllProposedCertificateResponse(); - message.proposedCertificate = object.proposedCertificate?.map((e) => ProposedCertificate.fromPartial(e)) || []; - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageResponse.fromPartial(object.pagination) + ): QueryGetApprovedCertificatesResponse { + const message = createBaseQueryGetApprovedCertificatesResponse(); + message.approvedCertificates = (object.approvedCertificates !== undefined && object.approvedCertificates !== null) + ? ApprovedCertificates.fromPartial(object.approvedCertificates) : undefined; return message; }, }; -function createBaseQueryGetChildCertificatesRequest(): QueryGetChildCertificatesRequest { - return { issuer: "", authorityKeyId: "" }; +function createBaseQueryAllApprovedCertificatesRequest(): QueryAllApprovedCertificatesRequest { + return { pagination: undefined, subjectKeyId: "" }; } -export const QueryGetChildCertificatesRequest = { - encode(message: QueryGetChildCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.issuer !== "") { - writer.uint32(10).string(message.issuer); +export const QueryAllApprovedCertificatesRequest = { + encode(message: QueryAllApprovedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - if (message.authorityKeyId !== "") { - writer.uint32(18).string(message.authorityKeyId); + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetChildCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllApprovedCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetChildCertificatesRequest(); + const message = createBaseQueryAllApprovedCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.issuer = reader.string(); + message.pagination = PageRequest.decode(reader, reader.uint32()); break; case 2: - message.authorityKeyId = reader.string(); + message.subjectKeyId = reader.string(); break; default: reader.skipType(tag & 7); @@ -755,51 +791,60 @@ export const QueryGetChildCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetChildCertificatesRequest { + fromJSON(object: any): QueryAllApprovedCertificatesRequest { return { - issuer: isSet(object.issuer) ? String(object.issuer) : "", - authorityKeyId: isSet(object.authorityKeyId) ? String(object.authorityKeyId) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", }; }, - toJSON(message: QueryGetChildCertificatesRequest): unknown { + toJSON(message: QueryAllApprovedCertificatesRequest): unknown { const obj: any = {}; - message.issuer !== undefined && (obj.issuer = message.issuer); - message.authorityKeyId !== undefined && (obj.authorityKeyId = message.authorityKeyId); + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetChildCertificatesRequest { - const message = createBaseQueryGetChildCertificatesRequest(); - message.issuer = object.issuer ?? ""; - message.authorityKeyId = object.authorityKeyId ?? ""; + ): QueryAllApprovedCertificatesRequest { + const message = createBaseQueryAllApprovedCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryGetChildCertificatesResponse(): QueryGetChildCertificatesResponse { - return { childCertificates: undefined }; +function createBaseQueryAllApprovedCertificatesResponse(): QueryAllApprovedCertificatesResponse { + return { approvedCertificates: [], pagination: undefined }; } -export const QueryGetChildCertificatesResponse = { - encode(message: QueryGetChildCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.childCertificates !== undefined) { - ChildCertificates.encode(message.childCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryAllApprovedCertificatesResponse = { + encode(message: QueryAllApprovedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.approvedCertificates) { + ApprovedCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetChildCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllApprovedCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetChildCertificatesResponse(); + const message = createBaseQueryAllApprovedCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.childCertificates = ChildCertificates.decode(reader, reader.uint32()); + message.approvedCertificates.push(ApprovedCertificates.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -809,55 +854,60 @@ export const QueryGetChildCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetChildCertificatesResponse { + fromJSON(object: any): QueryAllApprovedCertificatesResponse { return { - childCertificates: isSet(object.childCertificates) - ? ChildCertificates.fromJSON(object.childCertificates) - : undefined, + approvedCertificates: Array.isArray(object?.approvedCertificates) + ? object.approvedCertificates.map((e: any) => ApprovedCertificates.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryGetChildCertificatesResponse): unknown { + toJSON(message: QueryAllApprovedCertificatesResponse): unknown { const obj: any = {}; - message.childCertificates !== undefined && (obj.childCertificates = message.childCertificates - ? ChildCertificates.toJSON(message.childCertificates) - : undefined); + if (message.approvedCertificates) { + obj.approvedCertificates = message.approvedCertificates.map((e) => + e ? ApprovedCertificates.toJSON(e) : undefined + ); + } else { + obj.approvedCertificates = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetChildCertificatesResponse { - const message = createBaseQueryGetChildCertificatesResponse(); - message.childCertificates = (object.childCertificates !== undefined && object.childCertificates !== null) - ? ChildCertificates.fromPartial(object.childCertificates) + ): QueryAllApprovedCertificatesResponse { + const message = createBaseQueryAllApprovedCertificatesResponse(); + message.approvedCertificates = object.approvedCertificates?.map((e) => ApprovedCertificates.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, }; -function createBaseQueryGetProposedCertificateRevocationRequest(): QueryGetProposedCertificateRevocationRequest { - return { subject: "", subjectKeyId: "", serialNumber: "" }; +function createBaseQueryGetProposedCertificateRequest(): QueryGetProposedCertificateRequest { + return { subject: "", subjectKeyId: "" }; } -export const QueryGetProposedCertificateRevocationRequest = { - encode(message: QueryGetProposedCertificateRevocationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGetProposedCertificateRequest = { + encode(message: QueryGetProposedCertificateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.subject !== "") { writer.uint32(10).string(message.subject); } if (message.subjectKeyId !== "") { writer.uint32(18).string(message.subjectKeyId); } - if (message.serialNumber !== "") { - writer.uint32(26).string(message.serialNumber); - } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateRevocationRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetProposedCertificateRevocationRequest(); + const message = createBaseQueryGetProposedCertificateRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -867,9 +917,6 @@ export const QueryGetProposedCertificateRevocationRequest = { case 2: message.subjectKeyId = reader.string(); break; - case 3: - message.serialNumber = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -878,54 +925,51 @@ export const QueryGetProposedCertificateRevocationRequest = { return message; }, - fromJSON(object: any): QueryGetProposedCertificateRevocationRequest { + fromJSON(object: any): QueryGetProposedCertificateRequest { return { subject: isSet(object.subject) ? String(object.subject) : "", subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", - serialNumber: isSet(object.serialNumber) ? String(object.serialNumber) : "", }; }, - toJSON(message: QueryGetProposedCertificateRevocationRequest): unknown { + toJSON(message: QueryGetProposedCertificateRequest): unknown { const obj: any = {}; message.subject !== undefined && (obj.subject = message.subject); message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); - message.serialNumber !== undefined && (obj.serialNumber = message.serialNumber); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetProposedCertificateRevocationRequest { - const message = createBaseQueryGetProposedCertificateRevocationRequest(); + ): QueryGetProposedCertificateRequest { + const message = createBaseQueryGetProposedCertificateRequest(); message.subject = object.subject ?? ""; message.subjectKeyId = object.subjectKeyId ?? ""; - message.serialNumber = object.serialNumber ?? ""; return message; }, }; -function createBaseQueryGetProposedCertificateRevocationResponse(): QueryGetProposedCertificateRevocationResponse { - return { proposedCertificateRevocation: undefined }; +function createBaseQueryGetProposedCertificateResponse(): QueryGetProposedCertificateResponse { + return { proposedCertificate: undefined }; } -export const QueryGetProposedCertificateRevocationResponse = { - encode(message: QueryGetProposedCertificateRevocationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.proposedCertificateRevocation !== undefined) { - ProposedCertificateRevocation.encode(message.proposedCertificateRevocation, writer.uint32(10).fork()).ldelim(); +export const QueryGetProposedCertificateResponse = { + encode(message: QueryGetProposedCertificateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposedCertificate !== undefined) { + ProposedCertificate.encode(message.proposedCertificate, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateRevocationResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetProposedCertificateRevocationResponse(); + const message = createBaseQueryGetProposedCertificateResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.proposedCertificateRevocation = ProposedCertificateRevocation.decode(reader, reader.uint32()); + message.proposedCertificate = ProposedCertificate.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -935,51 +979,49 @@ export const QueryGetProposedCertificateRevocationResponse = { return message; }, - fromJSON(object: any): QueryGetProposedCertificateRevocationResponse { + fromJSON(object: any): QueryGetProposedCertificateResponse { return { - proposedCertificateRevocation: isSet(object.proposedCertificateRevocation) - ? ProposedCertificateRevocation.fromJSON(object.proposedCertificateRevocation) + proposedCertificate: isSet(object.proposedCertificate) + ? ProposedCertificate.fromJSON(object.proposedCertificate) : undefined, }; }, - toJSON(message: QueryGetProposedCertificateRevocationResponse): unknown { + toJSON(message: QueryGetProposedCertificateResponse): unknown { const obj: any = {}; - message.proposedCertificateRevocation !== undefined - && (obj.proposedCertificateRevocation = message.proposedCertificateRevocation - ? ProposedCertificateRevocation.toJSON(message.proposedCertificateRevocation) - : undefined); + message.proposedCertificate !== undefined && (obj.proposedCertificate = message.proposedCertificate + ? ProposedCertificate.toJSON(message.proposedCertificate) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetProposedCertificateRevocationResponse { - const message = createBaseQueryGetProposedCertificateRevocationResponse(); - message.proposedCertificateRevocation = - (object.proposedCertificateRevocation !== undefined && object.proposedCertificateRevocation !== null) - ? ProposedCertificateRevocation.fromPartial(object.proposedCertificateRevocation) - : undefined; + ): QueryGetProposedCertificateResponse { + const message = createBaseQueryGetProposedCertificateResponse(); + message.proposedCertificate = (object.proposedCertificate !== undefined && object.proposedCertificate !== null) + ? ProposedCertificate.fromPartial(object.proposedCertificate) + : undefined; return message; }, }; -function createBaseQueryAllProposedCertificateRevocationRequest(): QueryAllProposedCertificateRevocationRequest { +function createBaseQueryAllProposedCertificateRequest(): QueryAllProposedCertificateRequest { return { pagination: undefined }; } -export const QueryAllProposedCertificateRevocationRequest = { - encode(message: QueryAllProposedCertificateRevocationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllProposedCertificateRequest = { + encode(message: QueryAllProposedCertificateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateRevocationRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllProposedCertificateRevocationRequest(); + const message = createBaseQueryAllProposedCertificateRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -994,21 +1036,21 @@ export const QueryAllProposedCertificateRevocationRequest = { return message; }, - fromJSON(object: any): QueryAllProposedCertificateRevocationRequest { + fromJSON(object: any): QueryAllProposedCertificateRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllProposedCertificateRevocationRequest): unknown { + toJSON(message: QueryAllProposedCertificateRequest): unknown { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllProposedCertificateRevocationRequest { - const message = createBaseQueryAllProposedCertificateRevocationRequest(); + ): QueryAllProposedCertificateRequest { + const message = createBaseQueryAllProposedCertificateRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -1016,14 +1058,14 @@ export const QueryAllProposedCertificateRevocationRequest = { }, }; -function createBaseQueryAllProposedCertificateRevocationResponse(): QueryAllProposedCertificateRevocationResponse { - return { proposedCertificateRevocation: [], pagination: undefined }; +function createBaseQueryAllProposedCertificateResponse(): QueryAllProposedCertificateResponse { + return { proposedCertificate: [], pagination: undefined }; } -export const QueryAllProposedCertificateRevocationResponse = { - encode(message: QueryAllProposedCertificateRevocationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.proposedCertificateRevocation) { - ProposedCertificateRevocation.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryAllProposedCertificateResponse = { + encode(message: QueryAllProposedCertificateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.proposedCertificate) { + ProposedCertificate.encode(v!, writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -1031,15 +1073,15 @@ export const QueryAllProposedCertificateRevocationResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateRevocationResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllProposedCertificateRevocationResponse(); + const message = createBaseQueryAllProposedCertificateResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.proposedCertificateRevocation.push(ProposedCertificateRevocation.decode(reader, reader.uint32())); + message.proposedCertificate.push(ProposedCertificate.decode(reader, reader.uint32())); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -1052,35 +1094,32 @@ export const QueryAllProposedCertificateRevocationResponse = { return message; }, - fromJSON(object: any): QueryAllProposedCertificateRevocationResponse { + fromJSON(object: any): QueryAllProposedCertificateResponse { return { - proposedCertificateRevocation: Array.isArray(object?.proposedCertificateRevocation) - ? object.proposedCertificateRevocation.map((e: any) => ProposedCertificateRevocation.fromJSON(e)) + proposedCertificate: Array.isArray(object?.proposedCertificate) + ? object.proposedCertificate.map((e: any) => ProposedCertificate.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllProposedCertificateRevocationResponse): unknown { + toJSON(message: QueryAllProposedCertificateResponse): unknown { const obj: any = {}; - if (message.proposedCertificateRevocation) { - obj.proposedCertificateRevocation = message.proposedCertificateRevocation.map((e) => - e ? ProposedCertificateRevocation.toJSON(e) : undefined - ); + if (message.proposedCertificate) { + obj.proposedCertificate = message.proposedCertificate.map((e) => e ? ProposedCertificate.toJSON(e) : undefined); } else { - obj.proposedCertificateRevocation = []; + obj.proposedCertificate = []; } message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllProposedCertificateRevocationResponse { - const message = createBaseQueryAllProposedCertificateRevocationResponse(); - message.proposedCertificateRevocation = - object.proposedCertificateRevocation?.map((e) => ProposedCertificateRevocation.fromPartial(e)) || []; + ): QueryAllProposedCertificateResponse { + const message = createBaseQueryAllProposedCertificateResponse(); + message.proposedCertificate = object.proposedCertificate?.map((e) => ProposedCertificate.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -1088,33 +1127,33 @@ export const QueryAllProposedCertificateRevocationResponse = { }, }; -function createBaseQueryGetRevokedCertificatesRequest(): QueryGetRevokedCertificatesRequest { - return { subject: "", subjectKeyId: "" }; +function createBaseQueryGetChildCertificatesRequest(): QueryGetChildCertificatesRequest { + return { issuer: "", authorityKeyId: "" }; } -export const QueryGetRevokedCertificatesRequest = { - encode(message: QueryGetRevokedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subject !== "") { - writer.uint32(10).string(message.subject); +export const QueryGetChildCertificatesRequest = { + encode(message: QueryGetChildCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.issuer !== "") { + writer.uint32(10).string(message.issuer); } - if (message.subjectKeyId !== "") { - writer.uint32(18).string(message.subjectKeyId); + if (message.authorityKeyId !== "") { + writer.uint32(18).string(message.authorityKeyId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetChildCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRevokedCertificatesRequest(); + const message = createBaseQueryGetChildCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.subject = reader.string(); + message.issuer = reader.string(); break; case 2: - message.subjectKeyId = reader.string(); + message.authorityKeyId = reader.string(); break; default: reader.skipType(tag & 7); @@ -1124,51 +1163,51 @@ export const QueryGetRevokedCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetRevokedCertificatesRequest { + fromJSON(object: any): QueryGetChildCertificatesRequest { return { - subject: isSet(object.subject) ? String(object.subject) : "", - subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + issuer: isSet(object.issuer) ? String(object.issuer) : "", + authorityKeyId: isSet(object.authorityKeyId) ? String(object.authorityKeyId) : "", }; }, - toJSON(message: QueryGetRevokedCertificatesRequest): unknown { + toJSON(message: QueryGetChildCertificatesRequest): unknown { const obj: any = {}; - message.subject !== undefined && (obj.subject = message.subject); - message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + message.issuer !== undefined && (obj.issuer = message.issuer); + message.authorityKeyId !== undefined && (obj.authorityKeyId = message.authorityKeyId); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetRevokedCertificatesRequest { - const message = createBaseQueryGetRevokedCertificatesRequest(); - message.subject = object.subject ?? ""; - message.subjectKeyId = object.subjectKeyId ?? ""; + ): QueryGetChildCertificatesRequest { + const message = createBaseQueryGetChildCertificatesRequest(); + message.issuer = object.issuer ?? ""; + message.authorityKeyId = object.authorityKeyId ?? ""; return message; }, }; -function createBaseQueryGetRevokedCertificatesResponse(): QueryGetRevokedCertificatesResponse { - return { revokedCertificates: undefined }; +function createBaseQueryGetChildCertificatesResponse(): QueryGetChildCertificatesResponse { + return { childCertificates: undefined }; } -export const QueryGetRevokedCertificatesResponse = { - encode(message: QueryGetRevokedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.revokedCertificates !== undefined) { - RevokedCertificates.encode(message.revokedCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryGetChildCertificatesResponse = { + encode(message: QueryGetChildCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.childCertificates !== undefined) { + ChildCertificates.encode(message.childCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetChildCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRevokedCertificatesResponse(); + const message = createBaseQueryGetChildCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.revokedCertificates = RevokedCertificates.decode(reader, reader.uint32()); + message.childCertificates = ChildCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1178,54 +1217,66 @@ export const QueryGetRevokedCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetRevokedCertificatesResponse { + fromJSON(object: any): QueryGetChildCertificatesResponse { return { - revokedCertificates: isSet(object.revokedCertificates) - ? RevokedCertificates.fromJSON(object.revokedCertificates) + childCertificates: isSet(object.childCertificates) + ? ChildCertificates.fromJSON(object.childCertificates) : undefined, }; }, - toJSON(message: QueryGetRevokedCertificatesResponse): unknown { + toJSON(message: QueryGetChildCertificatesResponse): unknown { const obj: any = {}; - message.revokedCertificates !== undefined && (obj.revokedCertificates = message.revokedCertificates - ? RevokedCertificates.toJSON(message.revokedCertificates) + message.childCertificates !== undefined && (obj.childCertificates = message.childCertificates + ? ChildCertificates.toJSON(message.childCertificates) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetRevokedCertificatesResponse { - const message = createBaseQueryGetRevokedCertificatesResponse(); - message.revokedCertificates = (object.revokedCertificates !== undefined && object.revokedCertificates !== null) - ? RevokedCertificates.fromPartial(object.revokedCertificates) + ): QueryGetChildCertificatesResponse { + const message = createBaseQueryGetChildCertificatesResponse(); + message.childCertificates = (object.childCertificates !== undefined && object.childCertificates !== null) + ? ChildCertificates.fromPartial(object.childCertificates) : undefined; return message; }, }; -function createBaseQueryAllRevokedCertificatesRequest(): QueryAllRevokedCertificatesRequest { - return { pagination: undefined }; +function createBaseQueryGetProposedCertificateRevocationRequest(): QueryGetProposedCertificateRevocationRequest { + return { subject: "", subjectKeyId: "", serialNumber: "" }; } -export const QueryAllRevokedCertificatesRequest = { - encode(message: QueryAllRevokedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); +export const QueryGetProposedCertificateRevocationRequest = { + encode(message: QueryGetProposedCertificateRevocationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } + if (message.serialNumber !== "") { + writer.uint32(26).string(message.serialNumber); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateRevocationRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllRevokedCertificatesRequest(); + const message = createBaseQueryGetProposedCertificateRevocationRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; + case 3: + message.serialNumber = reader.string(); break; default: reader.skipType(tag & 7); @@ -1235,55 +1286,54 @@ export const QueryAllRevokedCertificatesRequest = { return message; }, - fromJSON(object: any): QueryAllRevokedCertificatesRequest { - return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + fromJSON(object: any): QueryGetProposedCertificateRevocationRequest { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + serialNumber: isSet(object.serialNumber) ? String(object.serialNumber) : "", + }; }, - toJSON(message: QueryAllRevokedCertificatesRequest): unknown { + toJSON(message: QueryGetProposedCertificateRevocationRequest): unknown { const obj: any = {}; - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + message.serialNumber !== undefined && (obj.serialNumber = message.serialNumber); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllRevokedCertificatesRequest { - const message = createBaseQueryAllRevokedCertificatesRequest(); - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageRequest.fromPartial(object.pagination) - : undefined; + ): QueryGetProposedCertificateRevocationRequest { + const message = createBaseQueryGetProposedCertificateRevocationRequest(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; + message.serialNumber = object.serialNumber ?? ""; return message; }, }; -function createBaseQueryAllRevokedCertificatesResponse(): QueryAllRevokedCertificatesResponse { - return { revokedCertificates: [], pagination: undefined }; +function createBaseQueryGetProposedCertificateRevocationResponse(): QueryGetProposedCertificateRevocationResponse { + return { proposedCertificateRevocation: undefined }; } -export const QueryAllRevokedCertificatesResponse = { - encode(message: QueryAllRevokedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.revokedCertificates) { - RevokedCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryGetProposedCertificateRevocationResponse = { + encode(message: QueryGetProposedCertificateRevocationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposedCertificateRevocation !== undefined) { + ProposedCertificateRevocation.encode(message.proposedCertificateRevocation, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetProposedCertificateRevocationResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllRevokedCertificatesResponse(); + const message = createBaseQueryGetProposedCertificateRevocationResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.revokedCertificates.push(RevokedCertificates.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.proposedCertificateRevocation = ProposedCertificateRevocation.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1293,55 +1343,57 @@ export const QueryAllRevokedCertificatesResponse = { return message; }, - fromJSON(object: any): QueryAllRevokedCertificatesResponse { + fromJSON(object: any): QueryGetProposedCertificateRevocationResponse { return { - revokedCertificates: Array.isArray(object?.revokedCertificates) - ? object.revokedCertificates.map((e: any) => RevokedCertificates.fromJSON(e)) - : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + proposedCertificateRevocation: isSet(object.proposedCertificateRevocation) + ? ProposedCertificateRevocation.fromJSON(object.proposedCertificateRevocation) + : undefined, }; }, - toJSON(message: QueryAllRevokedCertificatesResponse): unknown { + toJSON(message: QueryGetProposedCertificateRevocationResponse): unknown { const obj: any = {}; - if (message.revokedCertificates) { - obj.revokedCertificates = message.revokedCertificates.map((e) => e ? RevokedCertificates.toJSON(e) : undefined); - } else { - obj.revokedCertificates = []; - } - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.proposedCertificateRevocation !== undefined + && (obj.proposedCertificateRevocation = message.proposedCertificateRevocation + ? ProposedCertificateRevocation.toJSON(message.proposedCertificateRevocation) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllRevokedCertificatesResponse { - const message = createBaseQueryAllRevokedCertificatesResponse(); - message.revokedCertificates = object.revokedCertificates?.map((e) => RevokedCertificates.fromPartial(e)) || []; - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageResponse.fromPartial(object.pagination) - : undefined; + ): QueryGetProposedCertificateRevocationResponse { + const message = createBaseQueryGetProposedCertificateRevocationResponse(); + message.proposedCertificateRevocation = + (object.proposedCertificateRevocation !== undefined && object.proposedCertificateRevocation !== null) + ? ProposedCertificateRevocation.fromPartial(object.proposedCertificateRevocation) + : undefined; return message; }, }; -function createBaseQueryGetApprovedRootCertificatesRequest(): QueryGetApprovedRootCertificatesRequest { - return {}; +function createBaseQueryAllProposedCertificateRevocationRequest(): QueryAllProposedCertificateRevocationRequest { + return { pagination: undefined }; } -export const QueryGetApprovedRootCertificatesRequest = { - encode(_: QueryGetApprovedRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllProposedCertificateRevocationRequest = { + encode(message: QueryAllProposedCertificateRevocationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedRootCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateRevocationRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetApprovedRootCertificatesRequest(); + const message = createBaseQueryAllProposedCertificateRevocationRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1350,44 +1402,55 @@ export const QueryGetApprovedRootCertificatesRequest = { return message; }, - fromJSON(_: any): QueryGetApprovedRootCertificatesRequest { - return {}; + fromJSON(object: any): QueryAllProposedCertificateRevocationRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(_: QueryGetApprovedRootCertificatesRequest): unknown { + toJSON(message: QueryAllProposedCertificateRevocationRequest): unknown { const obj: any = {}; + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( - _: I, - ): QueryGetApprovedRootCertificatesRequest { - const message = createBaseQueryGetApprovedRootCertificatesRequest(); + fromPartial, I>>( + object: I, + ): QueryAllProposedCertificateRevocationRequest { + const message = createBaseQueryAllProposedCertificateRevocationRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetApprovedRootCertificatesResponse(): QueryGetApprovedRootCertificatesResponse { - return { approvedRootCertificates: undefined }; +function createBaseQueryAllProposedCertificateRevocationResponse(): QueryAllProposedCertificateRevocationResponse { + return { proposedCertificateRevocation: [], pagination: undefined }; } -export const QueryGetApprovedRootCertificatesResponse = { - encode(message: QueryGetApprovedRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.approvedRootCertificates !== undefined) { - ApprovedRootCertificates.encode(message.approvedRootCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryAllProposedCertificateRevocationResponse = { + encode(message: QueryAllProposedCertificateRevocationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.proposedCertificateRevocation) { + ProposedCertificateRevocation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedRootCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllProposedCertificateRevocationResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetApprovedRootCertificatesResponse(); + const message = createBaseQueryAllProposedCertificateRevocationResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.approvedRootCertificates = ApprovedRootCertificates.decode(reader, reader.uint32()); + message.proposedCertificateRevocation.push(ProposedCertificateRevocation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1397,50 +1460,70 @@ export const QueryGetApprovedRootCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetApprovedRootCertificatesResponse { + fromJSON(object: any): QueryAllProposedCertificateRevocationResponse { return { - approvedRootCertificates: isSet(object.approvedRootCertificates) - ? ApprovedRootCertificates.fromJSON(object.approvedRootCertificates) - : undefined, + proposedCertificateRevocation: Array.isArray(object?.proposedCertificateRevocation) + ? object.proposedCertificateRevocation.map((e: any) => ProposedCertificateRevocation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryGetApprovedRootCertificatesResponse): unknown { + toJSON(message: QueryAllProposedCertificateRevocationResponse): unknown { const obj: any = {}; - message.approvedRootCertificates !== undefined && (obj.approvedRootCertificates = message.approvedRootCertificates - ? ApprovedRootCertificates.toJSON(message.approvedRootCertificates) - : undefined); + if (message.proposedCertificateRevocation) { + obj.proposedCertificateRevocation = message.proposedCertificateRevocation.map((e) => + e ? ProposedCertificateRevocation.toJSON(e) : undefined + ); + } else { + obj.proposedCertificateRevocation = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetApprovedRootCertificatesResponse { - const message = createBaseQueryGetApprovedRootCertificatesResponse(); - message.approvedRootCertificates = - (object.approvedRootCertificates !== undefined && object.approvedRootCertificates !== null) - ? ApprovedRootCertificates.fromPartial(object.approvedRootCertificates) - : undefined; + ): QueryAllProposedCertificateRevocationResponse { + const message = createBaseQueryAllProposedCertificateRevocationResponse(); + message.proposedCertificateRevocation = + object.proposedCertificateRevocation?.map((e) => ProposedCertificateRevocation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetRevokedRootCertificatesRequest(): QueryGetRevokedRootCertificatesRequest { - return {}; +function createBaseQueryGetRevokedCertificatesRequest(): QueryGetRevokedCertificatesRequest { + return { subject: "", subjectKeyId: "" }; } -export const QueryGetRevokedRootCertificatesRequest = { - encode(_: QueryGetRevokedRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGetRevokedCertificatesRequest = { + encode(message: QueryGetRevokedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedRootCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRevokedRootCertificatesRequest(); + const message = createBaseQueryGetRevokedCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -1449,44 +1532,51 @@ export const QueryGetRevokedRootCertificatesRequest = { return message; }, - fromJSON(_: any): QueryGetRevokedRootCertificatesRequest { - return {}; + fromJSON(object: any): QueryGetRevokedCertificatesRequest { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + }; }, - toJSON(_: QueryGetRevokedRootCertificatesRequest): unknown { + toJSON(message: QueryGetRevokedCertificatesRequest): unknown { const obj: any = {}; + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( - _: I, - ): QueryGetRevokedRootCertificatesRequest { - const message = createBaseQueryGetRevokedRootCertificatesRequest(); + fromPartial, I>>( + object: I, + ): QueryGetRevokedCertificatesRequest { + const message = createBaseQueryGetRevokedCertificatesRequest(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryGetRevokedRootCertificatesResponse(): QueryGetRevokedRootCertificatesResponse { - return { revokedRootCertificates: undefined }; +function createBaseQueryGetRevokedCertificatesResponse(): QueryGetRevokedCertificatesResponse { + return { revokedCertificates: undefined }; } -export const QueryGetRevokedRootCertificatesResponse = { - encode(message: QueryGetRevokedRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.revokedRootCertificates !== undefined) { - RevokedRootCertificates.encode(message.revokedRootCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryGetRevokedCertificatesResponse = { + encode(message: QueryGetRevokedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.revokedCertificates !== undefined) { + RevokedCertificates.encode(message.revokedCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedRootCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRevokedRootCertificatesResponse(); + const message = createBaseQueryGetRevokedCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.revokedRootCertificates = RevokedRootCertificates.decode(reader, reader.uint32()); + message.revokedCertificates = RevokedCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1496,55 +1586,54 @@ export const QueryGetRevokedRootCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetRevokedRootCertificatesResponse { + fromJSON(object: any): QueryGetRevokedCertificatesResponse { return { - revokedRootCertificates: isSet(object.revokedRootCertificates) - ? RevokedRootCertificates.fromJSON(object.revokedRootCertificates) + revokedCertificates: isSet(object.revokedCertificates) + ? RevokedCertificates.fromJSON(object.revokedCertificates) : undefined, }; }, - toJSON(message: QueryGetRevokedRootCertificatesResponse): unknown { + toJSON(message: QueryGetRevokedCertificatesResponse): unknown { const obj: any = {}; - message.revokedRootCertificates !== undefined && (obj.revokedRootCertificates = message.revokedRootCertificates - ? RevokedRootCertificates.toJSON(message.revokedRootCertificates) + message.revokedCertificates !== undefined && (obj.revokedCertificates = message.revokedCertificates + ? RevokedCertificates.toJSON(message.revokedCertificates) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetRevokedRootCertificatesResponse { - const message = createBaseQueryGetRevokedRootCertificatesResponse(); - message.revokedRootCertificates = - (object.revokedRootCertificates !== undefined && object.revokedRootCertificates !== null) - ? RevokedRootCertificates.fromPartial(object.revokedRootCertificates) - : undefined; + ): QueryGetRevokedCertificatesResponse { + const message = createBaseQueryGetRevokedCertificatesResponse(); + message.revokedCertificates = (object.revokedCertificates !== undefined && object.revokedCertificates !== null) + ? RevokedCertificates.fromPartial(object.revokedCertificates) + : undefined; return message; }, }; -function createBaseQueryGetApprovedCertificatesBySubjectRequest(): QueryGetApprovedCertificatesBySubjectRequest { - return { subject: "" }; +function createBaseQueryAllRevokedCertificatesRequest(): QueryAllRevokedCertificatesRequest { + return { pagination: undefined }; } -export const QueryGetApprovedCertificatesBySubjectRequest = { - encode(message: QueryGetApprovedCertificatesBySubjectRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subject !== "") { - writer.uint32(10).string(message.subject); +export const QueryAllRevokedCertificatesRequest = { + encode(message: QueryAllRevokedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesBySubjectRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetApprovedCertificatesBySubjectRequest(); + const message = createBaseQueryAllRevokedCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.subject = reader.string(); + message.pagination = PageRequest.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1554,46 +1643,55 @@ export const QueryGetApprovedCertificatesBySubjectRequest = { return message; }, - fromJSON(object: any): QueryGetApprovedCertificatesBySubjectRequest { - return { subject: isSet(object.subject) ? String(object.subject) : "" }; + fromJSON(object: any): QueryAllRevokedCertificatesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGetApprovedCertificatesBySubjectRequest): unknown { + toJSON(message: QueryAllRevokedCertificatesRequest): unknown { const obj: any = {}; - message.subject !== undefined && (obj.subject = message.subject); + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetApprovedCertificatesBySubjectRequest { - const message = createBaseQueryGetApprovedCertificatesBySubjectRequest(); - message.subject = object.subject ?? ""; + ): QueryAllRevokedCertificatesRequest { + const message = createBaseQueryAllRevokedCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetApprovedCertificatesBySubjectResponse(): QueryGetApprovedCertificatesBySubjectResponse { - return { approvedCertificatesBySubject: undefined }; +function createBaseQueryAllRevokedCertificatesResponse(): QueryAllRevokedCertificatesResponse { + return { revokedCertificates: [], pagination: undefined }; } -export const QueryGetApprovedCertificatesBySubjectResponse = { - encode(message: QueryGetApprovedCertificatesBySubjectResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.approvedCertificatesBySubject !== undefined) { - ApprovedCertificatesBySubject.encode(message.approvedCertificatesBySubject, writer.uint32(10).fork()).ldelim(); - } +export const QueryAllRevokedCertificatesResponse = { + encode(message: QueryAllRevokedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.revokedCertificates) { + RevokedCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesBySubjectResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetApprovedCertificatesBySubjectResponse(); + const message = createBaseQueryAllRevokedCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.approvedCertificatesBySubject = ApprovedCertificatesBySubject.decode(reader, reader.uint32()); + message.revokedCertificates.push(RevokedCertificates.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1603,63 +1701,55 @@ export const QueryGetApprovedCertificatesBySubjectResponse = { return message; }, - fromJSON(object: any): QueryGetApprovedCertificatesBySubjectResponse { + fromJSON(object: any): QueryAllRevokedCertificatesResponse { return { - approvedCertificatesBySubject: isSet(object.approvedCertificatesBySubject) - ? ApprovedCertificatesBySubject.fromJSON(object.approvedCertificatesBySubject) - : undefined, + revokedCertificates: Array.isArray(object?.revokedCertificates) + ? object.revokedCertificates.map((e: any) => RevokedCertificates.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryGetApprovedCertificatesBySubjectResponse): unknown { + toJSON(message: QueryAllRevokedCertificatesResponse): unknown { const obj: any = {}; - message.approvedCertificatesBySubject !== undefined - && (obj.approvedCertificatesBySubject = message.approvedCertificatesBySubject - ? ApprovedCertificatesBySubject.toJSON(message.approvedCertificatesBySubject) - : undefined); + if (message.revokedCertificates) { + obj.revokedCertificates = message.revokedCertificates.map((e) => e ? RevokedCertificates.toJSON(e) : undefined); + } else { + obj.revokedCertificates = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetApprovedCertificatesBySubjectResponse { - const message = createBaseQueryGetApprovedCertificatesBySubjectResponse(); - message.approvedCertificatesBySubject = - (object.approvedCertificatesBySubject !== undefined && object.approvedCertificatesBySubject !== null) - ? ApprovedCertificatesBySubject.fromPartial(object.approvedCertificatesBySubject) - : undefined; + ): QueryAllRevokedCertificatesResponse { + const message = createBaseQueryAllRevokedCertificatesResponse(); + message.revokedCertificates = object.revokedCertificates?.map((e) => RevokedCertificates.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetRejectedCertificatesRequest(): QueryGetRejectedCertificatesRequest { - return { subject: "", subjectKeyId: "" }; +function createBaseQueryGetApprovedRootCertificatesRequest(): QueryGetApprovedRootCertificatesRequest { + return {}; } -export const QueryGetRejectedCertificatesRequest = { - encode(message: QueryGetRejectedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subject !== "") { - writer.uint32(10).string(message.subject); - } - if (message.subjectKeyId !== "") { - writer.uint32(18).string(message.subjectKeyId); - } +export const QueryGetApprovedRootCertificatesRequest = { + encode(_: QueryGetApprovedRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRejectedCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedRootCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRejectedCertificatesRequest(); + const message = createBaseQueryGetApprovedRootCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.subject = reader.string(); - break; - case 2: - message.subjectKeyId = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -1668,51 +1758,44 @@ export const QueryGetRejectedCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetRejectedCertificatesRequest { - return { - subject: isSet(object.subject) ? String(object.subject) : "", - subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", - }; + fromJSON(_: any): QueryGetApprovedRootCertificatesRequest { + return {}; }, - toJSON(message: QueryGetRejectedCertificatesRequest): unknown { + toJSON(_: QueryGetApprovedRootCertificatesRequest): unknown { const obj: any = {}; - message.subject !== undefined && (obj.subject = message.subject); - message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetRejectedCertificatesRequest { - const message = createBaseQueryGetRejectedCertificatesRequest(); - message.subject = object.subject ?? ""; - message.subjectKeyId = object.subjectKeyId ?? ""; + fromPartial, I>>( + _: I, + ): QueryGetApprovedRootCertificatesRequest { + const message = createBaseQueryGetApprovedRootCertificatesRequest(); return message; }, }; -function createBaseQueryGetRejectedCertificatesResponse(): QueryGetRejectedCertificatesResponse { - return { rejectedCertificate: undefined }; +function createBaseQueryGetApprovedRootCertificatesResponse(): QueryGetApprovedRootCertificatesResponse { + return { approvedRootCertificates: undefined }; } -export const QueryGetRejectedCertificatesResponse = { - encode(message: QueryGetRejectedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.rejectedCertificate !== undefined) { - RejectedCertificate.encode(message.rejectedCertificate, writer.uint32(10).fork()).ldelim(); +export const QueryGetApprovedRootCertificatesResponse = { + encode(message: QueryGetApprovedRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.approvedRootCertificates !== undefined) { + ApprovedRootCertificates.encode(message.approvedRootCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRejectedCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedRootCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRejectedCertificatesResponse(); + const message = createBaseQueryGetApprovedRootCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.rejectedCertificate = RejectedCertificate.decode(reader, reader.uint32()); + message.approvedRootCertificates = ApprovedRootCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1722,55 +1805,50 @@ export const QueryGetRejectedCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetRejectedCertificatesResponse { + fromJSON(object: any): QueryGetApprovedRootCertificatesResponse { return { - rejectedCertificate: isSet(object.rejectedCertificate) - ? RejectedCertificate.fromJSON(object.rejectedCertificate) + approvedRootCertificates: isSet(object.approvedRootCertificates) + ? ApprovedRootCertificates.fromJSON(object.approvedRootCertificates) : undefined, }; }, - toJSON(message: QueryGetRejectedCertificatesResponse): unknown { + toJSON(message: QueryGetApprovedRootCertificatesResponse): unknown { const obj: any = {}; - message.rejectedCertificate !== undefined && (obj.rejectedCertificate = message.rejectedCertificate - ? RejectedCertificate.toJSON(message.rejectedCertificate) + message.approvedRootCertificates !== undefined && (obj.approvedRootCertificates = message.approvedRootCertificates + ? ApprovedRootCertificates.toJSON(message.approvedRootCertificates) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetRejectedCertificatesResponse { - const message = createBaseQueryGetRejectedCertificatesResponse(); - message.rejectedCertificate = (object.rejectedCertificate !== undefined && object.rejectedCertificate !== null) - ? RejectedCertificate.fromPartial(object.rejectedCertificate) - : undefined; + ): QueryGetApprovedRootCertificatesResponse { + const message = createBaseQueryGetApprovedRootCertificatesResponse(); + message.approvedRootCertificates = + (object.approvedRootCertificates !== undefined && object.approvedRootCertificates !== null) + ? ApprovedRootCertificates.fromPartial(object.approvedRootCertificates) + : undefined; return message; }, }; -function createBaseQueryAllRejectedCertificatesRequest(): QueryAllRejectedCertificatesRequest { - return { pagination: undefined }; +function createBaseQueryGetRevokedRootCertificatesRequest(): QueryGetRevokedRootCertificatesRequest { + return {}; } -export const QueryAllRejectedCertificatesRequest = { - encode(message: QueryAllRejectedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); - } +export const QueryGetRevokedRootCertificatesRequest = { + encode(_: QueryGetRevokedRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRejectedCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedRootCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllRejectedCertificatesRequest(); + const message = createBaseQueryGetRevokedRootCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -1779,55 +1857,44 @@ export const QueryAllRejectedCertificatesRequest = { return message; }, - fromJSON(object: any): QueryAllRejectedCertificatesRequest { - return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + fromJSON(_: any): QueryGetRevokedRootCertificatesRequest { + return {}; }, - toJSON(message: QueryAllRejectedCertificatesRequest): unknown { + toJSON(_: QueryGetRevokedRootCertificatesRequest): unknown { const obj: any = {}; - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( - object: I, - ): QueryAllRejectedCertificatesRequest { - const message = createBaseQueryAllRejectedCertificatesRequest(); - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageRequest.fromPartial(object.pagination) - : undefined; + fromPartial, I>>( + _: I, + ): QueryGetRevokedRootCertificatesRequest { + const message = createBaseQueryGetRevokedRootCertificatesRequest(); return message; }, }; -function createBaseQueryAllRejectedCertificatesResponse(): QueryAllRejectedCertificatesResponse { - return { rejectedCertificate: [], pagination: undefined }; +function createBaseQueryGetRevokedRootCertificatesResponse(): QueryGetRevokedRootCertificatesResponse { + return { revokedRootCertificates: undefined }; } -export const QueryAllRejectedCertificatesResponse = { - encode(message: QueryAllRejectedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.rejectedCertificate) { - RejectedCertificate.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryGetRevokedRootCertificatesResponse = { + encode(message: QueryGetRevokedRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.revokedRootCertificates !== undefined) { + RevokedRootCertificates.encode(message.revokedRootCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRejectedCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedRootCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllRejectedCertificatesResponse(); + const message = createBaseQueryGetRevokedRootCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.rejectedCertificate.push(RejectedCertificate.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.revokedRootCertificates = RevokedRootCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1837,72 +1904,55 @@ export const QueryAllRejectedCertificatesResponse = { return message; }, - fromJSON(object: any): QueryAllRejectedCertificatesResponse { + fromJSON(object: any): QueryGetRevokedRootCertificatesResponse { return { - rejectedCertificate: Array.isArray(object?.rejectedCertificate) - ? object.rejectedCertificate.map((e: any) => RejectedCertificate.fromJSON(e)) - : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + revokedRootCertificates: isSet(object.revokedRootCertificates) + ? RevokedRootCertificates.fromJSON(object.revokedRootCertificates) + : undefined, }; }, - toJSON(message: QueryAllRejectedCertificatesResponse): unknown { + toJSON(message: QueryGetRevokedRootCertificatesResponse): unknown { const obj: any = {}; - if (message.rejectedCertificate) { - obj.rejectedCertificate = message.rejectedCertificate.map((e) => e ? RejectedCertificate.toJSON(e) : undefined); - } else { - obj.rejectedCertificate = []; - } - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.revokedRootCertificates !== undefined && (obj.revokedRootCertificates = message.revokedRootCertificates + ? RevokedRootCertificates.toJSON(message.revokedRootCertificates) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllRejectedCertificatesResponse { - const message = createBaseQueryAllRejectedCertificatesResponse(); - message.rejectedCertificate = object.rejectedCertificate?.map((e) => RejectedCertificate.fromPartial(e)) || []; - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageResponse.fromPartial(object.pagination) - : undefined; + ): QueryGetRevokedRootCertificatesResponse { + const message = createBaseQueryGetRevokedRootCertificatesResponse(); + message.revokedRootCertificates = + (object.revokedRootCertificates !== undefined && object.revokedRootCertificates !== null) + ? RevokedRootCertificates.fromPartial(object.revokedRootCertificates) + : undefined; return message; }, }; -function createBaseQueryGetPkiRevocationDistributionPointRequest(): QueryGetPkiRevocationDistributionPointRequest { - return { vid: 0, label: "", issuerSubjectKeyID: "" }; +function createBaseQueryGetApprovedCertificatesBySubjectRequest(): QueryGetApprovedCertificatesBySubjectRequest { + return { subject: "" }; } -export const QueryGetPkiRevocationDistributionPointRequest = { - encode(message: QueryGetPkiRevocationDistributionPointRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.vid !== 0) { - writer.uint32(8).int32(message.vid); - } - if (message.label !== "") { - writer.uint32(18).string(message.label); - } - if (message.issuerSubjectKeyID !== "") { - writer.uint32(26).string(message.issuerSubjectKeyID); +export const QueryGetApprovedCertificatesBySubjectRequest = { + encode(message: QueryGetApprovedCertificatesBySubjectRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetPkiRevocationDistributionPointRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesBySubjectRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetPkiRevocationDistributionPointRequest(); + const message = createBaseQueryGetApprovedCertificatesBySubjectRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.vid = reader.int32(); - break; - case 2: - message.label = reader.string(); - break; - case 3: - message.issuerSubjectKeyID = reader.string(); + message.subject = reader.string(); break; default: reader.skipType(tag & 7); @@ -1912,57 +1962,46 @@ export const QueryGetPkiRevocationDistributionPointRequest = { return message; }, - fromJSON(object: any): QueryGetPkiRevocationDistributionPointRequest { - return { - vid: isSet(object.vid) ? Number(object.vid) : 0, - label: isSet(object.label) ? String(object.label) : "", - issuerSubjectKeyID: isSet(object.issuerSubjectKeyID) ? String(object.issuerSubjectKeyID) : "", - }; + fromJSON(object: any): QueryGetApprovedCertificatesBySubjectRequest { + return { subject: isSet(object.subject) ? String(object.subject) : "" }; }, - toJSON(message: QueryGetPkiRevocationDistributionPointRequest): unknown { + toJSON(message: QueryGetApprovedCertificatesBySubjectRequest): unknown { const obj: any = {}; - message.vid !== undefined && (obj.vid = Math.round(message.vid)); - message.label !== undefined && (obj.label = message.label); - message.issuerSubjectKeyID !== undefined && (obj.issuerSubjectKeyID = message.issuerSubjectKeyID); + message.subject !== undefined && (obj.subject = message.subject); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetPkiRevocationDistributionPointRequest { - const message = createBaseQueryGetPkiRevocationDistributionPointRequest(); - message.vid = object.vid ?? 0; - message.label = object.label ?? ""; - message.issuerSubjectKeyID = object.issuerSubjectKeyID ?? ""; + ): QueryGetApprovedCertificatesBySubjectRequest { + const message = createBaseQueryGetApprovedCertificatesBySubjectRequest(); + message.subject = object.subject ?? ""; return message; }, }; -function createBaseQueryGetPkiRevocationDistributionPointResponse(): QueryGetPkiRevocationDistributionPointResponse { - return { PkiRevocationDistributionPoint: undefined }; +function createBaseQueryGetApprovedCertificatesBySubjectResponse(): QueryGetApprovedCertificatesBySubjectResponse { + return { approvedCertificatesBySubject: undefined }; } -export const QueryGetPkiRevocationDistributionPointResponse = { - encode( - message: QueryGetPkiRevocationDistributionPointResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.PkiRevocationDistributionPoint !== undefined) { - PkiRevocationDistributionPoint.encode(message.PkiRevocationDistributionPoint, writer.uint32(10).fork()).ldelim(); +export const QueryGetApprovedCertificatesBySubjectResponse = { + encode(message: QueryGetApprovedCertificatesBySubjectResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.approvedCertificatesBySubject !== undefined) { + ApprovedCertificatesBySubject.encode(message.approvedCertificatesBySubject, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetPkiRevocationDistributionPointResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetApprovedCertificatesBySubjectResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetPkiRevocationDistributionPointResponse(); + const message = createBaseQueryGetApprovedCertificatesBySubjectResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.PkiRevocationDistributionPoint = PkiRevocationDistributionPoint.decode(reader, reader.uint32()); + message.approvedCertificatesBySubject = ApprovedCertificatesBySubject.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1972,56 +2011,62 @@ export const QueryGetPkiRevocationDistributionPointResponse = { return message; }, - fromJSON(object: any): QueryGetPkiRevocationDistributionPointResponse { + fromJSON(object: any): QueryGetApprovedCertificatesBySubjectResponse { return { - PkiRevocationDistributionPoint: isSet(object.PkiRevocationDistributionPoint) - ? PkiRevocationDistributionPoint.fromJSON(object.PkiRevocationDistributionPoint) + approvedCertificatesBySubject: isSet(object.approvedCertificatesBySubject) + ? ApprovedCertificatesBySubject.fromJSON(object.approvedCertificatesBySubject) : undefined, }; }, - toJSON(message: QueryGetPkiRevocationDistributionPointResponse): unknown { + toJSON(message: QueryGetApprovedCertificatesBySubjectResponse): unknown { const obj: any = {}; - message.PkiRevocationDistributionPoint !== undefined - && (obj.PkiRevocationDistributionPoint = message.PkiRevocationDistributionPoint - ? PkiRevocationDistributionPoint.toJSON(message.PkiRevocationDistributionPoint) + message.approvedCertificatesBySubject !== undefined + && (obj.approvedCertificatesBySubject = message.approvedCertificatesBySubject + ? ApprovedCertificatesBySubject.toJSON(message.approvedCertificatesBySubject) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetPkiRevocationDistributionPointResponse { - const message = createBaseQueryGetPkiRevocationDistributionPointResponse(); - message.PkiRevocationDistributionPoint = - (object.PkiRevocationDistributionPoint !== undefined && object.PkiRevocationDistributionPoint !== null) - ? PkiRevocationDistributionPoint.fromPartial(object.PkiRevocationDistributionPoint) + ): QueryGetApprovedCertificatesBySubjectResponse { + const message = createBaseQueryGetApprovedCertificatesBySubjectResponse(); + message.approvedCertificatesBySubject = + (object.approvedCertificatesBySubject !== undefined && object.approvedCertificatesBySubject !== null) + ? ApprovedCertificatesBySubject.fromPartial(object.approvedCertificatesBySubject) : undefined; return message; }, }; -function createBaseQueryAllPkiRevocationDistributionPointRequest(): QueryAllPkiRevocationDistributionPointRequest { - return { pagination: undefined }; +function createBaseQueryGetRejectedCertificatesRequest(): QueryGetRejectedCertificatesRequest { + return { subject: "", subjectKeyId: "" }; } -export const QueryAllPkiRevocationDistributionPointRequest = { - encode(message: QueryAllPkiRevocationDistributionPointRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); +export const QueryGetRejectedCertificatesRequest = { + encode(message: QueryGetRejectedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPkiRevocationDistributionPointRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRejectedCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllPkiRevocationDistributionPointRequest(); + const message = createBaseQueryGetRejectedCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); break; default: reader.skipType(tag & 7); @@ -2031,58 +2076,51 @@ export const QueryAllPkiRevocationDistributionPointRequest = { return message; }, - fromJSON(object: any): QueryAllPkiRevocationDistributionPointRequest { - return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + fromJSON(object: any): QueryGetRejectedCertificatesRequest { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + }; }, - toJSON(message: QueryAllPkiRevocationDistributionPointRequest): unknown { + toJSON(message: QueryGetRejectedCertificatesRequest): unknown { const obj: any = {}; - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllPkiRevocationDistributionPointRequest { - const message = createBaseQueryAllPkiRevocationDistributionPointRequest(); - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageRequest.fromPartial(object.pagination) - : undefined; + ): QueryGetRejectedCertificatesRequest { + const message = createBaseQueryGetRejectedCertificatesRequest(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryAllPkiRevocationDistributionPointResponse(): QueryAllPkiRevocationDistributionPointResponse { - return { PkiRevocationDistributionPoint: [], pagination: undefined }; +function createBaseQueryGetRejectedCertificatesResponse(): QueryGetRejectedCertificatesResponse { + return { rejectedCertificate: undefined }; } -export const QueryAllPkiRevocationDistributionPointResponse = { - encode( - message: QueryAllPkiRevocationDistributionPointResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.PkiRevocationDistributionPoint) { - PkiRevocationDistributionPoint.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryGetRejectedCertificatesResponse = { + encode(message: QueryGetRejectedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.rejectedCertificate !== undefined) { + RejectedCertificate.encode(message.rejectedCertificate, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPkiRevocationDistributionPointResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRejectedCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllPkiRevocationDistributionPointResponse(); + const message = createBaseQueryGetRejectedCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.PkiRevocationDistributionPoint.push(PkiRevocationDistributionPoint.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.rejectedCertificate = RejectedCertificate.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2092,69 +2130,54 @@ export const QueryAllPkiRevocationDistributionPointResponse = { return message; }, - fromJSON(object: any): QueryAllPkiRevocationDistributionPointResponse { + fromJSON(object: any): QueryGetRejectedCertificatesResponse { return { - PkiRevocationDistributionPoint: Array.isArray(object?.PkiRevocationDistributionPoint) - ? object.PkiRevocationDistributionPoint.map((e: any) => PkiRevocationDistributionPoint.fromJSON(e)) - : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + rejectedCertificate: isSet(object.rejectedCertificate) + ? RejectedCertificate.fromJSON(object.rejectedCertificate) + : undefined, }; }, - toJSON(message: QueryAllPkiRevocationDistributionPointResponse): unknown { + toJSON(message: QueryGetRejectedCertificatesResponse): unknown { const obj: any = {}; - if (message.PkiRevocationDistributionPoint) { - obj.PkiRevocationDistributionPoint = message.PkiRevocationDistributionPoint.map((e) => - e ? PkiRevocationDistributionPoint.toJSON(e) : undefined - ); - } else { - obj.PkiRevocationDistributionPoint = []; - } - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.rejectedCertificate !== undefined && (obj.rejectedCertificate = message.rejectedCertificate + ? RejectedCertificate.toJSON(message.rejectedCertificate) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllPkiRevocationDistributionPointResponse { - const message = createBaseQueryAllPkiRevocationDistributionPointResponse(); - message.PkiRevocationDistributionPoint = - object.PkiRevocationDistributionPoint?.map((e) => PkiRevocationDistributionPoint.fromPartial(e)) || []; - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageResponse.fromPartial(object.pagination) + ): QueryGetRejectedCertificatesResponse { + const message = createBaseQueryGetRejectedCertificatesResponse(); + message.rejectedCertificate = (object.rejectedCertificate !== undefined && object.rejectedCertificate !== null) + ? RejectedCertificate.fromPartial(object.rejectedCertificate) : undefined; return message; }, }; -function createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest(): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { - return { issuerSubjectKeyID: "" }; +function createBaseQueryAllRejectedCertificatesRequest(): QueryAllRejectedCertificatesRequest { + return { pagination: undefined }; } -export const QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest = { - encode( - message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.issuerSubjectKeyID !== "") { - writer.uint32(10).string(message.issuerSubjectKeyID); +export const QueryAllRejectedCertificatesRequest = { + encode(message: QueryAllRejectedCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRejectedCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest(); + const message = createBaseQueryAllRejectedCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.issuerSubjectKeyID = reader.string(); + message.pagination = PageRequest.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2164,56 +2187,55 @@ export const QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest return message; }, - fromJSON(object: any): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { - return { issuerSubjectKeyID: isSet(object.issuerSubjectKeyID) ? String(object.issuerSubjectKeyID) : "" }; + fromJSON(object: any): QueryAllRejectedCertificatesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest): unknown { + toJSON(message: QueryAllRejectedCertificatesRequest): unknown { const obj: any = {}; - message.issuerSubjectKeyID !== undefined && (obj.issuerSubjectKeyID = message.issuerSubjectKeyID); + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { - const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest(); - message.issuerSubjectKeyID = object.issuerSubjectKeyID ?? ""; + ): QueryAllRejectedCertificatesRequest { + const message = createBaseQueryAllRejectedCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse(): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { - return { pkiRevocationDistributionPointsByIssuerSubjectKeyID: undefined }; +function createBaseQueryAllRejectedCertificatesResponse(): QueryAllRejectedCertificatesResponse { + return { rejectedCertificate: [], pagination: undefined }; } -export const QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse = { - encode( - message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== undefined) { - PkiRevocationDistributionPointsByIssuerSubjectKeyID.encode( - message.pkiRevocationDistributionPointsByIssuerSubjectKeyID, - writer.uint32(10).fork(), - ).ldelim(); +export const QueryAllRejectedCertificatesResponse = { + encode(message: QueryAllRejectedCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rejectedCertificate) { + RejectedCertificate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRejectedCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse(); + const message = createBaseQueryAllRejectedCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pkiRevocationDistributionPointsByIssuerSubjectKeyID = - PkiRevocationDistributionPointsByIssuerSubjectKeyID.decode(reader, reader.uint32()); + message.rejectedCertificate.push(RejectedCertificate.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2223,66 +2245,73 @@ export const QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse return message; }, - fromJSON(object: any): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { + fromJSON(object: any): QueryAllRejectedCertificatesResponse { return { - pkiRevocationDistributionPointsByIssuerSubjectKeyID: - isSet(object.pkiRevocationDistributionPointsByIssuerSubjectKeyID) - ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromJSON( - object.pkiRevocationDistributionPointsByIssuerSubjectKeyID, - ) - : undefined, + rejectedCertificate: Array.isArray(object?.rejectedCertificate) + ? object.rejectedCertificate.map((e: any) => RejectedCertificate.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse): unknown { + toJSON(message: QueryAllRejectedCertificatesResponse): unknown { const obj: any = {}; - message.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== undefined - && (obj.pkiRevocationDistributionPointsByIssuerSubjectKeyID = - message.pkiRevocationDistributionPointsByIssuerSubjectKeyID - ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.toJSON( - message.pkiRevocationDistributionPointsByIssuerSubjectKeyID, - ) - : undefined); + if (message.rejectedCertificate) { + obj.rejectedCertificate = message.rejectedCertificate.map((e) => e ? RejectedCertificate.toJSON(e) : undefined); + } else { + obj.rejectedCertificate = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { - const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse(); - message.pkiRevocationDistributionPointsByIssuerSubjectKeyID = - (object.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== undefined - && object.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== null) - ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial( - object.pkiRevocationDistributionPointsByIssuerSubjectKeyID, - ) - : undefined; + ): QueryAllRejectedCertificatesResponse { + const message = createBaseQueryAllRejectedCertificatesResponse(); + message.rejectedCertificate = object.rejectedCertificate?.map((e) => RejectedCertificate.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryGetNocRootCertificatesRequest(): QueryGetNocRootCertificatesRequest { - return { vid: 0 }; +function createBaseQueryGetPkiRevocationDistributionPointRequest(): QueryGetPkiRevocationDistributionPointRequest { + return { vid: 0, label: "", issuerSubjectKeyID: "" }; } -export const QueryGetNocRootCertificatesRequest = { - encode(message: QueryGetNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryGetPkiRevocationDistributionPointRequest = { + encode(message: QueryGetPkiRevocationDistributionPointRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.vid !== 0) { writer.uint32(8).int32(message.vid); } + if (message.label !== "") { + writer.uint32(18).string(message.label); + } + if (message.issuerSubjectKeyID !== "") { + writer.uint32(26).string(message.issuerSubjectKeyID); + } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetPkiRevocationDistributionPointRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetNocRootCertificatesRequest(); + const message = createBaseQueryGetPkiRevocationDistributionPointRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.vid = reader.int32(); break; + case 2: + message.label = reader.string(); + break; + case 3: + message.issuerSubjectKeyID = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -2291,46 +2320,57 @@ export const QueryGetNocRootCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetNocRootCertificatesRequest { - return { vid: isSet(object.vid) ? Number(object.vid) : 0 }; + fromJSON(object: any): QueryGetPkiRevocationDistributionPointRequest { + return { + vid: isSet(object.vid) ? Number(object.vid) : 0, + label: isSet(object.label) ? String(object.label) : "", + issuerSubjectKeyID: isSet(object.issuerSubjectKeyID) ? String(object.issuerSubjectKeyID) : "", + }; }, - toJSON(message: QueryGetNocRootCertificatesRequest): unknown { + toJSON(message: QueryGetPkiRevocationDistributionPointRequest): unknown { const obj: any = {}; message.vid !== undefined && (obj.vid = Math.round(message.vid)); + message.label !== undefined && (obj.label = message.label); + message.issuerSubjectKeyID !== undefined && (obj.issuerSubjectKeyID = message.issuerSubjectKeyID); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetNocRootCertificatesRequest { - const message = createBaseQueryGetNocRootCertificatesRequest(); + ): QueryGetPkiRevocationDistributionPointRequest { + const message = createBaseQueryGetPkiRevocationDistributionPointRequest(); message.vid = object.vid ?? 0; + message.label = object.label ?? ""; + message.issuerSubjectKeyID = object.issuerSubjectKeyID ?? ""; return message; }, }; -function createBaseQueryGetNocRootCertificatesResponse(): QueryGetNocRootCertificatesResponse { - return { nocRootCertificates: undefined }; +function createBaseQueryGetPkiRevocationDistributionPointResponse(): QueryGetPkiRevocationDistributionPointResponse { + return { PkiRevocationDistributionPoint: undefined }; } -export const QueryGetNocRootCertificatesResponse = { - encode(message: QueryGetNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.nocRootCertificates !== undefined) { - NocRootCertificates.encode(message.nocRootCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryGetPkiRevocationDistributionPointResponse = { + encode( + message: QueryGetPkiRevocationDistributionPointResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.PkiRevocationDistributionPoint !== undefined) { + PkiRevocationDistributionPoint.encode(message.PkiRevocationDistributionPoint, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetPkiRevocationDistributionPointResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetNocRootCertificatesResponse(); + const message = createBaseQueryGetPkiRevocationDistributionPointResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.nocRootCertificates = NocRootCertificates.decode(reader, reader.uint32()); + message.PkiRevocationDistributionPoint = PkiRevocationDistributionPoint.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2340,49 +2380,884 @@ export const QueryGetNocRootCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetNocRootCertificatesResponse { + fromJSON(object: any): QueryGetPkiRevocationDistributionPointResponse { return { - nocRootCertificates: isSet(object.nocRootCertificates) - ? NocRootCertificates.fromJSON(object.nocRootCertificates) + PkiRevocationDistributionPoint: isSet(object.PkiRevocationDistributionPoint) + ? PkiRevocationDistributionPoint.fromJSON(object.PkiRevocationDistributionPoint) : undefined, }; }, - toJSON(message: QueryGetNocRootCertificatesResponse): unknown { + toJSON(message: QueryGetPkiRevocationDistributionPointResponse): unknown { const obj: any = {}; - message.nocRootCertificates !== undefined && (obj.nocRootCertificates = message.nocRootCertificates - ? NocRootCertificates.toJSON(message.nocRootCertificates) - : undefined); + message.PkiRevocationDistributionPoint !== undefined + && (obj.PkiRevocationDistributionPoint = message.PkiRevocationDistributionPoint + ? PkiRevocationDistributionPoint.toJSON(message.PkiRevocationDistributionPoint) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetPkiRevocationDistributionPointResponse { + const message = createBaseQueryGetPkiRevocationDistributionPointResponse(); + message.PkiRevocationDistributionPoint = + (object.PkiRevocationDistributionPoint !== undefined && object.PkiRevocationDistributionPoint !== null) + ? PkiRevocationDistributionPoint.fromPartial(object.PkiRevocationDistributionPoint) + : undefined; + return message; + }, +}; + +function createBaseQueryAllPkiRevocationDistributionPointRequest(): QueryAllPkiRevocationDistributionPointRequest { + return { pagination: undefined }; +} + +export const QueryAllPkiRevocationDistributionPointRequest = { + encode(message: QueryAllPkiRevocationDistributionPointRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPkiRevocationDistributionPointRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllPkiRevocationDistributionPointRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllPkiRevocationDistributionPointRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllPkiRevocationDistributionPointRequest): unknown { + const obj: any = {}; + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllPkiRevocationDistributionPointRequest { + const message = createBaseQueryAllPkiRevocationDistributionPointRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllPkiRevocationDistributionPointResponse(): QueryAllPkiRevocationDistributionPointResponse { + return { PkiRevocationDistributionPoint: [], pagination: undefined }; +} + +export const QueryAllPkiRevocationDistributionPointResponse = { + encode( + message: QueryAllPkiRevocationDistributionPointResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.PkiRevocationDistributionPoint) { + PkiRevocationDistributionPoint.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPkiRevocationDistributionPointResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllPkiRevocationDistributionPointResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.PkiRevocationDistributionPoint.push(PkiRevocationDistributionPoint.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllPkiRevocationDistributionPointResponse { + return { + PkiRevocationDistributionPoint: Array.isArray(object?.PkiRevocationDistributionPoint) + ? object.PkiRevocationDistributionPoint.map((e: any) => PkiRevocationDistributionPoint.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllPkiRevocationDistributionPointResponse): unknown { + const obj: any = {}; + if (message.PkiRevocationDistributionPoint) { + obj.PkiRevocationDistributionPoint = message.PkiRevocationDistributionPoint.map((e) => + e ? PkiRevocationDistributionPoint.toJSON(e) : undefined + ); + } else { + obj.PkiRevocationDistributionPoint = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllPkiRevocationDistributionPointResponse { + const message = createBaseQueryAllPkiRevocationDistributionPointResponse(); + message.PkiRevocationDistributionPoint = + object.PkiRevocationDistributionPoint?.map((e) => PkiRevocationDistributionPoint.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest(): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { + return { issuerSubjectKeyID: "" }; +} + +export const QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest = { + encode( + message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.issuerSubjectKeyID !== "") { + writer.uint32(10).string(message.issuerSubjectKeyID); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.issuerSubjectKeyID = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { + return { issuerSubjectKeyID: isSet(object.issuerSubjectKeyID) ? String(object.issuerSubjectKeyID) : "" }; + }, + + toJSON(message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest): unknown { + const obj: any = {}; + message.issuerSubjectKeyID !== undefined && (obj.issuerSubjectKeyID = message.issuerSubjectKeyID); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest { + const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest(); + message.issuerSubjectKeyID = object.issuerSubjectKeyID ?? ""; + return message; + }, +}; + +function createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse(): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { + return { pkiRevocationDistributionPointsByIssuerSubjectKeyID: undefined }; +} + +export const QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse = { + encode( + message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== undefined) { + PkiRevocationDistributionPointsByIssuerSubjectKeyID.encode( + message.pkiRevocationDistributionPointsByIssuerSubjectKeyID, + writer.uint32(10).fork(), + ).ldelim(); + } + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pkiRevocationDistributionPointsByIssuerSubjectKeyID = + PkiRevocationDistributionPointsByIssuerSubjectKeyID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { + return { + pkiRevocationDistributionPointsByIssuerSubjectKeyID: + isSet(object.pkiRevocationDistributionPointsByIssuerSubjectKeyID) + ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromJSON( + object.pkiRevocationDistributionPointsByIssuerSubjectKeyID, + ) + : undefined, + }; + }, + + toJSON(message: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse): unknown { + const obj: any = {}; + message.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== undefined + && (obj.pkiRevocationDistributionPointsByIssuerSubjectKeyID = + message.pkiRevocationDistributionPointsByIssuerSubjectKeyID + ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.toJSON( + message.pkiRevocationDistributionPointsByIssuerSubjectKeyID, + ) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { + const message = createBaseQueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse(); + message.pkiRevocationDistributionPointsByIssuerSubjectKeyID = + (object.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== undefined + && object.pkiRevocationDistributionPointsByIssuerSubjectKeyID !== null) + ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial( + object.pkiRevocationDistributionPointsByIssuerSubjectKeyID, + ) + : undefined; + return message; + }, +}; + +function createBaseQueryGetNocRootCertificatesRequest(): QueryGetNocRootCertificatesRequest { + return { vid: 0 }; +} + +export const QueryGetNocRootCertificatesRequest = { + encode(message: QueryGetNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetNocRootCertificatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vid = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNocRootCertificatesRequest { + return { vid: isSet(object.vid) ? Number(object.vid) : 0 }; + }, + + toJSON(message: QueryGetNocRootCertificatesRequest): unknown { + const obj: any = {}; + message.vid !== undefined && (obj.vid = Math.round(message.vid)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetNocRootCertificatesRequest { + const message = createBaseQueryGetNocRootCertificatesRequest(); + message.vid = object.vid ?? 0; + return message; + }, +}; + +function createBaseQueryGetNocRootCertificatesResponse(): QueryGetNocRootCertificatesResponse { + return { nocRootCertificates: undefined }; +} + +export const QueryGetNocRootCertificatesResponse = { + encode(message: QueryGetNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nocRootCertificates !== undefined) { + NocRootCertificates.encode(message.nocRootCertificates, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetNocRootCertificatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nocRootCertificates = NocRootCertificates.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNocRootCertificatesResponse { + return { + nocRootCertificates: isSet(object.nocRootCertificates) + ? NocRootCertificates.fromJSON(object.nocRootCertificates) + : undefined, + }; + }, + + toJSON(message: QueryGetNocRootCertificatesResponse): unknown { + const obj: any = {}; + message.nocRootCertificates !== undefined && (obj.nocRootCertificates = message.nocRootCertificates + ? NocRootCertificates.toJSON(message.nocRootCertificates) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetNocRootCertificatesResponse { + const message = createBaseQueryGetNocRootCertificatesResponse(); + message.nocRootCertificates = (object.nocRootCertificates !== undefined && object.nocRootCertificates !== null) + ? NocRootCertificates.fromPartial(object.nocRootCertificates) + : undefined; + return message; + }, +}; + +function createBaseQueryAllNocRootCertificatesRequest(): QueryAllNocRootCertificatesRequest { + return { pagination: undefined }; +} + +export const QueryAllNocRootCertificatesRequest = { + encode(message: QueryAllNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocRootCertificatesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllNocRootCertificatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllNocRootCertificatesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllNocRootCertificatesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllNocRootCertificatesRequest { + const message = createBaseQueryAllNocRootCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllNocRootCertificatesResponse(): QueryAllNocRootCertificatesResponse { + return { nocRootCertificates: [], pagination: undefined }; +} + +export const QueryAllNocRootCertificatesResponse = { + encode(message: QueryAllNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.nocRootCertificates) { + NocRootCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocRootCertificatesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllNocRootCertificatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nocRootCertificates.push(NocRootCertificates.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllNocRootCertificatesResponse { + return { + nocRootCertificates: Array.isArray(object?.nocRootCertificates) + ? object.nocRootCertificates.map((e: any) => NocRootCertificates.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllNocRootCertificatesResponse): unknown { + const obj: any = {}; + if (message.nocRootCertificates) { + obj.nocRootCertificates = message.nocRootCertificates.map((e) => e ? NocRootCertificates.toJSON(e) : undefined); + } else { + obj.nocRootCertificates = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllNocRootCertificatesResponse { + const message = createBaseQueryAllNocRootCertificatesResponse(); + message.nocRootCertificates = object.nocRootCertificates?.map((e) => NocRootCertificates.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetNocIcaCertificatesRequest(): QueryGetNocIcaCertificatesRequest { + return { vid: 0 }; +} + +export const QueryGetNocIcaCertificatesRequest = { + encode(message: QueryGetNocIcaCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocIcaCertificatesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetNocIcaCertificatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vid = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNocIcaCertificatesRequest { + return { vid: isSet(object.vid) ? Number(object.vid) : 0 }; + }, + + toJSON(message: QueryGetNocIcaCertificatesRequest): unknown { + const obj: any = {}; + message.vid !== undefined && (obj.vid = Math.round(message.vid)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetNocIcaCertificatesRequest { + const message = createBaseQueryGetNocIcaCertificatesRequest(); + message.vid = object.vid ?? 0; + return message; + }, +}; + +function createBaseQueryGetNocIcaCertificatesResponse(): QueryGetNocIcaCertificatesResponse { + return { nocIcaCertificates: undefined }; +} + +export const QueryGetNocIcaCertificatesResponse = { + encode(message: QueryGetNocIcaCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nocIcaCertificates !== undefined) { + NocIcaCertificates.encode(message.nocIcaCertificates, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocIcaCertificatesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetNocIcaCertificatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nocIcaCertificates = NocIcaCertificates.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNocIcaCertificatesResponse { + return { + nocIcaCertificates: isSet(object.nocIcaCertificates) + ? NocIcaCertificates.fromJSON(object.nocIcaCertificates) + : undefined, + }; + }, + + toJSON(message: QueryGetNocIcaCertificatesResponse): unknown { + const obj: any = {}; + message.nocIcaCertificates !== undefined && (obj.nocIcaCertificates = message.nocIcaCertificates + ? NocIcaCertificates.toJSON(message.nocIcaCertificates) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetNocIcaCertificatesResponse { + const message = createBaseQueryGetNocIcaCertificatesResponse(); + message.nocIcaCertificates = (object.nocIcaCertificates !== undefined && object.nocIcaCertificates !== null) + ? NocIcaCertificates.fromPartial(object.nocIcaCertificates) + : undefined; + return message; + }, +}; + +function createBaseQueryAllNocIcaCertificatesRequest(): QueryAllNocIcaCertificatesRequest { + return { pagination: undefined }; +} + +export const QueryAllNocIcaCertificatesRequest = { + encode(message: QueryAllNocIcaCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocIcaCertificatesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllNocIcaCertificatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllNocIcaCertificatesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllNocIcaCertificatesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllNocIcaCertificatesRequest { + const message = createBaseQueryAllNocIcaCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllNocIcaCertificatesResponse(): QueryAllNocIcaCertificatesResponse { + return { nocIcaCertificates: [], pagination: undefined }; +} + +export const QueryAllNocIcaCertificatesResponse = { + encode(message: QueryAllNocIcaCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.nocIcaCertificates) { + NocIcaCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocIcaCertificatesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllNocIcaCertificatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nocIcaCertificates.push(NocIcaCertificates.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllNocIcaCertificatesResponse { + return { + nocIcaCertificates: Array.isArray(object?.nocIcaCertificates) + ? object.nocIcaCertificates.map((e: any) => NocIcaCertificates.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllNocIcaCertificatesResponse): unknown { + const obj: any = {}; + if (message.nocIcaCertificates) { + obj.nocIcaCertificates = message.nocIcaCertificates.map((e) => e ? NocIcaCertificates.toJSON(e) : undefined); + } else { + obj.nocIcaCertificates = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllNocIcaCertificatesResponse { + const message = createBaseQueryAllNocIcaCertificatesResponse(); + message.nocIcaCertificates = object.nocIcaCertificates?.map((e) => NocIcaCertificates.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGetRevokedNocRootCertificatesRequest(): QueryGetRevokedNocRootCertificatesRequest { + return { subject: "", subjectKeyId: "" }; +} + +export const QueryGetRevokedNocRootCertificatesRequest = { + encode(message: QueryGetRevokedNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedNocRootCertificatesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetRevokedNocRootCertificatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetRevokedNocRootCertificatesRequest { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + }; + }, + + toJSON(message: QueryGetRevokedNocRootCertificatesRequest): unknown { + const obj: any = {}; + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetRevokedNocRootCertificatesRequest { + const message = createBaseQueryGetRevokedNocRootCertificatesRequest(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; + return message; + }, +}; + +function createBaseQueryGetRevokedNocRootCertificatesResponse(): QueryGetRevokedNocRootCertificatesResponse { + return { revokedNocRootCertificates: undefined }; +} + +export const QueryGetRevokedNocRootCertificatesResponse = { + encode(message: QueryGetRevokedNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.revokedNocRootCertificates !== undefined) { + RevokedNocRootCertificates.encode(message.revokedNocRootCertificates, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedNocRootCertificatesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetRevokedNocRootCertificatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revokedNocRootCertificates = RevokedNocRootCertificates.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetRevokedNocRootCertificatesResponse { + return { + revokedNocRootCertificates: isSet(object.revokedNocRootCertificates) + ? RevokedNocRootCertificates.fromJSON(object.revokedNocRootCertificates) + : undefined, + }; + }, + + toJSON(message: QueryGetRevokedNocRootCertificatesResponse): unknown { + const obj: any = {}; + message.revokedNocRootCertificates !== undefined + && (obj.revokedNocRootCertificates = message.revokedNocRootCertificates + ? RevokedNocRootCertificates.toJSON(message.revokedNocRootCertificates) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetNocRootCertificatesResponse { - const message = createBaseQueryGetNocRootCertificatesResponse(); - message.nocRootCertificates = (object.nocRootCertificates !== undefined && object.nocRootCertificates !== null) - ? NocRootCertificates.fromPartial(object.nocRootCertificates) - : undefined; + ): QueryGetRevokedNocRootCertificatesResponse { + const message = createBaseQueryGetRevokedNocRootCertificatesResponse(); + message.revokedNocRootCertificates = + (object.revokedNocRootCertificates !== undefined && object.revokedNocRootCertificates !== null) + ? RevokedNocRootCertificates.fromPartial(object.revokedNocRootCertificates) + : undefined; return message; }, }; -function createBaseQueryAllNocRootCertificatesRequest(): QueryAllNocRootCertificatesRequest { +function createBaseQueryAllRevokedNocRootCertificatesRequest(): QueryAllRevokedNocRootCertificatesRequest { return { pagination: undefined }; } -export const QueryAllNocRootCertificatesRequest = { - encode(message: QueryAllNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllRevokedNocRootCertificatesRequest = { + encode(message: QueryAllRevokedNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocRootCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedNocRootCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllNocRootCertificatesRequest(); + const message = createBaseQueryAllRevokedNocRootCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2397,21 +3272,21 @@ export const QueryAllNocRootCertificatesRequest = { return message; }, - fromJSON(object: any): QueryAllNocRootCertificatesRequest { + fromJSON(object: any): QueryAllRevokedNocRootCertificatesRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllNocRootCertificatesRequest): unknown { + toJSON(message: QueryAllRevokedNocRootCertificatesRequest): unknown { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllNocRootCertificatesRequest { - const message = createBaseQueryAllNocRootCertificatesRequest(); + ): QueryAllRevokedNocRootCertificatesRequest { + const message = createBaseQueryAllRevokedNocRootCertificatesRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -2419,14 +3294,14 @@ export const QueryAllNocRootCertificatesRequest = { }, }; -function createBaseQueryAllNocRootCertificatesResponse(): QueryAllNocRootCertificatesResponse { - return { nocRootCertificates: [], pagination: undefined }; +function createBaseQueryAllRevokedNocRootCertificatesResponse(): QueryAllRevokedNocRootCertificatesResponse { + return { revokedNocRootCertificates: [], pagination: undefined }; } -export const QueryAllNocRootCertificatesResponse = { - encode(message: QueryAllNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.nocRootCertificates) { - NocRootCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryAllRevokedNocRootCertificatesResponse = { + encode(message: QueryAllRevokedNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.revokedNocRootCertificates) { + RevokedNocRootCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -2434,15 +3309,15 @@ export const QueryAllNocRootCertificatesResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocRootCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedNocRootCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllNocRootCertificatesResponse(); + const message = createBaseQueryAllRevokedNocRootCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.nocRootCertificates.push(NocRootCertificates.decode(reader, reader.uint32())); + message.revokedNocRootCertificates.push(RevokedNocRootCertificates.decode(reader, reader.uint32())); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -2455,32 +3330,35 @@ export const QueryAllNocRootCertificatesResponse = { return message; }, - fromJSON(object: any): QueryAllNocRootCertificatesResponse { + fromJSON(object: any): QueryAllRevokedNocRootCertificatesResponse { return { - nocRootCertificates: Array.isArray(object?.nocRootCertificates) - ? object.nocRootCertificates.map((e: any) => NocRootCertificates.fromJSON(e)) + revokedNocRootCertificates: Array.isArray(object?.revokedNocRootCertificates) + ? object.revokedNocRootCertificates.map((e: any) => RevokedNocRootCertificates.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllNocRootCertificatesResponse): unknown { + toJSON(message: QueryAllRevokedNocRootCertificatesResponse): unknown { const obj: any = {}; - if (message.nocRootCertificates) { - obj.nocRootCertificates = message.nocRootCertificates.map((e) => e ? NocRootCertificates.toJSON(e) : undefined); + if (message.revokedNocRootCertificates) { + obj.revokedNocRootCertificates = message.revokedNocRootCertificates.map((e) => + e ? RevokedNocRootCertificates.toJSON(e) : undefined + ); } else { - obj.nocRootCertificates = []; + obj.revokedNocRootCertificates = []; } message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllNocRootCertificatesResponse { - const message = createBaseQueryAllNocRootCertificatesResponse(); - message.nocRootCertificates = object.nocRootCertificates?.map((e) => NocRootCertificates.fromPartial(e)) || []; + ): QueryAllRevokedNocRootCertificatesResponse { + const message = createBaseQueryAllRevokedNocRootCertificatesResponse(); + message.revokedNocRootCertificates = + object.revokedNocRootCertificates?.map((e) => RevokedNocRootCertificates.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -2488,27 +3366,33 @@ export const QueryAllNocRootCertificatesResponse = { }, }; -function createBaseQueryGetNocIcaCertificatesRequest(): QueryGetNocIcaCertificatesRequest { - return { vid: 0 }; +function createBaseQueryGetRevokedNocIcaCertificatesRequest(): QueryGetRevokedNocIcaCertificatesRequest { + return { subject: "", subjectKeyId: "" }; } -export const QueryGetNocIcaCertificatesRequest = { - encode(message: QueryGetNocIcaCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.vid !== 0) { - writer.uint32(8).int32(message.vid); +export const QueryGetRevokedNocIcaCertificatesRequest = { + encode(message: QueryGetRevokedNocIcaCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocIcaCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedNocIcaCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetNocIcaCertificatesRequest(); + const message = createBaseQueryGetRevokedNocIcaCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.vid = reader.int32(); + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); break; default: reader.skipType(tag & 7); @@ -2518,46 +3402,51 @@ export const QueryGetNocIcaCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetNocIcaCertificatesRequest { - return { vid: isSet(object.vid) ? Number(object.vid) : 0 }; + fromJSON(object: any): QueryGetRevokedNocIcaCertificatesRequest { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + }; }, - toJSON(message: QueryGetNocIcaCertificatesRequest): unknown { + toJSON(message: QueryGetRevokedNocIcaCertificatesRequest): unknown { const obj: any = {}; - message.vid !== undefined && (obj.vid = Math.round(message.vid)); + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetNocIcaCertificatesRequest { - const message = createBaseQueryGetNocIcaCertificatesRequest(); - message.vid = object.vid ?? 0; + ): QueryGetRevokedNocIcaCertificatesRequest { + const message = createBaseQueryGetRevokedNocIcaCertificatesRequest(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryGetNocIcaCertificatesResponse(): QueryGetNocIcaCertificatesResponse { - return { nocIcaCertificates: undefined }; +function createBaseQueryGetRevokedNocIcaCertificatesResponse(): QueryGetRevokedNocIcaCertificatesResponse { + return { revokedNocIcaCertificates: undefined }; } -export const QueryGetNocIcaCertificatesResponse = { - encode(message: QueryGetNocIcaCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.nocIcaCertificates !== undefined) { - NocIcaCertificates.encode(message.nocIcaCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryGetRevokedNocIcaCertificatesResponse = { + encode(message: QueryGetRevokedNocIcaCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.revokedNocIcaCertificates !== undefined) { + RevokedNocIcaCertificates.encode(message.revokedNocIcaCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocIcaCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedNocIcaCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetNocIcaCertificatesResponse(); + const message = createBaseQueryGetRevokedNocIcaCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.nocIcaCertificates = NocIcaCertificates.decode(reader, reader.uint32()); + message.revokedNocIcaCertificates = RevokedNocIcaCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2567,49 +3456,51 @@ export const QueryGetNocIcaCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetNocIcaCertificatesResponse { + fromJSON(object: any): QueryGetRevokedNocIcaCertificatesResponse { return { - nocIcaCertificates: isSet(object.nocIcaCertificates) - ? NocIcaCertificates.fromJSON(object.nocIcaCertificates) + revokedNocIcaCertificates: isSet(object.revokedNocIcaCertificates) + ? RevokedNocIcaCertificates.fromJSON(object.revokedNocIcaCertificates) : undefined, }; }, - toJSON(message: QueryGetNocIcaCertificatesResponse): unknown { + toJSON(message: QueryGetRevokedNocIcaCertificatesResponse): unknown { const obj: any = {}; - message.nocIcaCertificates !== undefined && (obj.nocIcaCertificates = message.nocIcaCertificates - ? NocIcaCertificates.toJSON(message.nocIcaCertificates) - : undefined); + message.revokedNocIcaCertificates !== undefined + && (obj.revokedNocIcaCertificates = message.revokedNocIcaCertificates + ? RevokedNocIcaCertificates.toJSON(message.revokedNocIcaCertificates) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetNocIcaCertificatesResponse { - const message = createBaseQueryGetNocIcaCertificatesResponse(); - message.nocIcaCertificates = (object.nocIcaCertificates !== undefined && object.nocIcaCertificates !== null) - ? NocIcaCertificates.fromPartial(object.nocIcaCertificates) - : undefined; + ): QueryGetRevokedNocIcaCertificatesResponse { + const message = createBaseQueryGetRevokedNocIcaCertificatesResponse(); + message.revokedNocIcaCertificates = + (object.revokedNocIcaCertificates !== undefined && object.revokedNocIcaCertificates !== null) + ? RevokedNocIcaCertificates.fromPartial(object.revokedNocIcaCertificates) + : undefined; return message; }, }; -function createBaseQueryAllNocIcaCertificatesRequest(): QueryAllNocIcaCertificatesRequest { +function createBaseQueryAllRevokedNocIcaCertificatesRequest(): QueryAllRevokedNocIcaCertificatesRequest { return { pagination: undefined }; } -export const QueryAllNocIcaCertificatesRequest = { - encode(message: QueryAllNocIcaCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QueryAllRevokedNocIcaCertificatesRequest = { + encode(message: QueryAllRevokedNocIcaCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocIcaCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedNocIcaCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllNocIcaCertificatesRequest(); + const message = createBaseQueryAllRevokedNocIcaCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2624,21 +3515,21 @@ export const QueryAllNocIcaCertificatesRequest = { return message; }, - fromJSON(object: any): QueryAllNocIcaCertificatesRequest { + fromJSON(object: any): QueryAllRevokedNocIcaCertificatesRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllNocIcaCertificatesRequest): unknown { + toJSON(message: QueryAllRevokedNocIcaCertificatesRequest): unknown { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllNocIcaCertificatesRequest { - const message = createBaseQueryAllNocIcaCertificatesRequest(); + ): QueryAllRevokedNocIcaCertificatesRequest { + const message = createBaseQueryAllRevokedNocIcaCertificatesRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageRequest.fromPartial(object.pagination) : undefined; @@ -2646,14 +3537,14 @@ export const QueryAllNocIcaCertificatesRequest = { }, }; -function createBaseQueryAllNocIcaCertificatesResponse(): QueryAllNocIcaCertificatesResponse { - return { nocIcaCertificates: [], pagination: undefined }; +function createBaseQueryAllRevokedNocIcaCertificatesResponse(): QueryAllRevokedNocIcaCertificatesResponse { + return { revokedNocIcaCertificates: [], pagination: undefined }; } -export const QueryAllNocIcaCertificatesResponse = { - encode(message: QueryAllNocIcaCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.nocIcaCertificates) { - NocIcaCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); +export const QueryAllRevokedNocIcaCertificatesResponse = { + encode(message: QueryAllRevokedNocIcaCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.revokedNocIcaCertificates) { + RevokedNocIcaCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -2661,15 +3552,15 @@ export const QueryAllNocIcaCertificatesResponse = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllNocIcaCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedNocIcaCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllNocIcaCertificatesResponse(); + const message = createBaseQueryAllRevokedNocIcaCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.nocIcaCertificates.push(NocIcaCertificates.decode(reader, reader.uint32())); + message.revokedNocIcaCertificates.push(RevokedNocIcaCertificates.decode(reader, reader.uint32())); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -2682,32 +3573,35 @@ export const QueryAllNocIcaCertificatesResponse = { return message; }, - fromJSON(object: any): QueryAllNocIcaCertificatesResponse { + fromJSON(object: any): QueryAllRevokedNocIcaCertificatesResponse { return { - nocIcaCertificates: Array.isArray(object?.nocIcaCertificates) - ? object.nocIcaCertificates.map((e: any) => NocIcaCertificates.fromJSON(e)) + revokedNocIcaCertificates: Array.isArray(object?.revokedNocIcaCertificates) + ? object.revokedNocIcaCertificates.map((e: any) => RevokedNocIcaCertificates.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryAllNocIcaCertificatesResponse): unknown { + toJSON(message: QueryAllRevokedNocIcaCertificatesResponse): unknown { const obj: any = {}; - if (message.nocIcaCertificates) { - obj.nocIcaCertificates = message.nocIcaCertificates.map((e) => e ? NocIcaCertificates.toJSON(e) : undefined); + if (message.revokedNocIcaCertificates) { + obj.revokedNocIcaCertificates = message.revokedNocIcaCertificates.map((e) => + e ? RevokedNocIcaCertificates.toJSON(e) : undefined + ); } else { - obj.nocIcaCertificates = []; + obj.revokedNocIcaCertificates = []; } message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllNocIcaCertificatesResponse { - const message = createBaseQueryAllNocIcaCertificatesResponse(); - message.nocIcaCertificates = object.nocIcaCertificates?.map((e) => NocIcaCertificates.fromPartial(e)) || []; + ): QueryAllRevokedNocIcaCertificatesResponse { + const message = createBaseQueryAllRevokedNocIcaCertificatesResponse(); + message.revokedNocIcaCertificates = + object.revokedNocIcaCertificates?.map((e) => RevokedNocIcaCertificates.fromPartial(e)) || []; message.pagination = (object.pagination !== undefined && object.pagination !== null) ? PageResponse.fromPartial(object.pagination) : undefined; @@ -2715,14 +3609,133 @@ export const QueryAllNocIcaCertificatesResponse = { }, }; -function createBaseQueryGetRevokedNocRootCertificatesRequest(): QueryGetRevokedNocRootCertificatesRequest { - return { subject: "", subjectKeyId: "" }; +function createBaseQueryGetNocCertificatesByVidAndSkidRequest(): QueryGetNocCertificatesByVidAndSkidRequest { + return { vid: 0, subjectKeyId: "" }; +} + +export const QueryGetNocCertificatesByVidAndSkidRequest = { + encode(message: QueryGetNocCertificatesByVidAndSkidRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocCertificatesByVidAndSkidRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetNocCertificatesByVidAndSkidRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vid = reader.int32(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNocCertificatesByVidAndSkidRequest { + return { + vid: isSet(object.vid) ? Number(object.vid) : 0, + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + }; + }, + + toJSON(message: QueryGetNocCertificatesByVidAndSkidRequest): unknown { + const obj: any = {}; + message.vid !== undefined && (obj.vid = Math.round(message.vid)); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetNocCertificatesByVidAndSkidRequest { + const message = createBaseQueryGetNocCertificatesByVidAndSkidRequest(); + message.vid = object.vid ?? 0; + message.subjectKeyId = object.subjectKeyId ?? ""; + return message; + }, +}; + +function createBaseQueryGetNocCertificatesByVidAndSkidResponse(): QueryGetNocCertificatesByVidAndSkidResponse { + return { nocCertificatesByVidAndSkid: undefined }; +} + +export const QueryGetNocCertificatesByVidAndSkidResponse = { + encode(message: QueryGetNocCertificatesByVidAndSkidResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nocCertificatesByVidAndSkid !== undefined) { + NocCertificatesByVidAndSkid.encode(message.nocCertificatesByVidAndSkid, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocCertificatesByVidAndSkidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetNocCertificatesByVidAndSkidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nocCertificatesByVidAndSkid = NocCertificatesByVidAndSkid.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNocCertificatesByVidAndSkidResponse { + return { + nocCertificatesByVidAndSkid: isSet(object.nocCertificatesByVidAndSkid) + ? NocCertificatesByVidAndSkid.fromJSON(object.nocCertificatesByVidAndSkid) + : undefined, + }; + }, + + toJSON(message: QueryGetNocCertificatesByVidAndSkidResponse): unknown { + const obj: any = {}; + message.nocCertificatesByVidAndSkid !== undefined + && (obj.nocCertificatesByVidAndSkid = message.nocCertificatesByVidAndSkid + ? NocCertificatesByVidAndSkid.toJSON(message.nocCertificatesByVidAndSkid) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGetNocCertificatesByVidAndSkidResponse { + const message = createBaseQueryGetNocCertificatesByVidAndSkidResponse(); + message.nocCertificatesByVidAndSkid = + (object.nocCertificatesByVidAndSkid !== undefined && object.nocCertificatesByVidAndSkid !== null) + ? NocCertificatesByVidAndSkid.fromPartial(object.nocCertificatesByVidAndSkid) + : undefined; + return message; + }, +}; + +function createBaseQueryNocCertificatesRequest(): QueryNocCertificatesRequest { + return { pagination: undefined, subjectKeyId: "" }; } -export const QueryGetRevokedNocRootCertificatesRequest = { - encode(message: QueryGetRevokedNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subject !== "") { - writer.uint32(10).string(message.subject); +export const QueryNocCertificatesRequest = { + encode(message: QueryNocCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } if (message.subjectKeyId !== "") { writer.uint32(18).string(message.subjectKeyId); @@ -2730,15 +3743,15 @@ export const QueryGetRevokedNocRootCertificatesRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedNocRootCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNocCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRevokedNocRootCertificatesRequest(); + const message = createBaseQueryNocCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.subject = reader.string(); + message.pagination = PageRequest.decode(reader, reader.uint32()); break; case 2: message.subjectKeyId = reader.string(); @@ -2751,51 +3764,58 @@ export const QueryGetRevokedNocRootCertificatesRequest = { return message; }, - fromJSON(object: any): QueryGetRevokedNocRootCertificatesRequest { + fromJSON(object: any): QueryNocCertificatesRequest { return { - subject: isSet(object.subject) ? String(object.subject) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", }; }, - toJSON(message: QueryGetRevokedNocRootCertificatesRequest): unknown { + toJSON(message: QueryNocCertificatesRequest): unknown { const obj: any = {}; - message.subject !== undefined && (obj.subject = message.subject); + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetRevokedNocRootCertificatesRequest { - const message = createBaseQueryGetRevokedNocRootCertificatesRequest(); - message.subject = object.subject ?? ""; + fromPartial, I>>(object: I): QueryNocCertificatesRequest { + const message = createBaseQueryNocCertificatesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryGetRevokedNocRootCertificatesResponse(): QueryGetRevokedNocRootCertificatesResponse { - return { revokedNocRootCertificates: undefined }; +function createBaseQueryNocCertificatesResponse(): QueryNocCertificatesResponse { + return { nocCertificates: [], pagination: undefined }; } -export const QueryGetRevokedNocRootCertificatesResponse = { - encode(message: QueryGetRevokedNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.revokedNocRootCertificates !== undefined) { - RevokedNocRootCertificates.encode(message.revokedNocRootCertificates, writer.uint32(10).fork()).ldelim(); +export const QueryNocCertificatesResponse = { + encode(message: QueryNocCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.nocCertificates) { + NocCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetRevokedNocRootCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNocCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetRevokedNocRootCertificatesResponse(); + const message = createBaseQueryNocCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.revokedNocRootCertificates = RevokedNocRootCertificates.decode(reader, reader.uint32()); + message.nocCertificates.push(NocCertificates.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2805,56 +3825,58 @@ export const QueryGetRevokedNocRootCertificatesResponse = { return message; }, - fromJSON(object: any): QueryGetRevokedNocRootCertificatesResponse { + fromJSON(object: any): QueryNocCertificatesResponse { return { - revokedNocRootCertificates: isSet(object.revokedNocRootCertificates) - ? RevokedNocRootCertificates.fromJSON(object.revokedNocRootCertificates) - : undefined, + nocCertificates: Array.isArray(object?.nocCertificates) + ? object.nocCertificates.map((e: any) => NocCertificates.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryGetRevokedNocRootCertificatesResponse): unknown { + toJSON(message: QueryNocCertificatesResponse): unknown { const obj: any = {}; - message.revokedNocRootCertificates !== undefined - && (obj.revokedNocRootCertificates = message.revokedNocRootCertificates - ? RevokedNocRootCertificates.toJSON(message.revokedNocRootCertificates) - : undefined); + if (message.nocCertificates) { + obj.nocCertificates = message.nocCertificates.map((e) => e ? NocCertificates.toJSON(e) : undefined); + } else { + obj.nocCertificates = []; + } + message.pagination !== undefined + && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial, I>>( - object: I, - ): QueryGetRevokedNocRootCertificatesResponse { - const message = createBaseQueryGetRevokedNocRootCertificatesResponse(); - message.revokedNocRootCertificates = - (object.revokedNocRootCertificates !== undefined && object.revokedNocRootCertificates !== null) - ? RevokedNocRootCertificates.fromPartial(object.revokedNocRootCertificates) - : undefined; + fromPartial, I>>(object: I): QueryNocCertificatesResponse { + const message = createBaseQueryNocCertificatesResponse(); + message.nocCertificates = object.nocCertificates?.map((e) => NocCertificates.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; return message; }, }; -function createBaseQueryAllRevokedNocRootCertificatesRequest(): QueryAllRevokedNocRootCertificatesRequest { - return { pagination: undefined }; +function createBaseQueryGetNocCertificatesBySubjectRequest(): QueryGetNocCertificatesBySubjectRequest { + return { subject: "" }; } -export const QueryAllRevokedNocRootCertificatesRequest = { - encode(message: QueryAllRevokedNocRootCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); +export const QueryGetNocCertificatesBySubjectRequest = { + encode(message: QueryGetNocCertificatesBySubjectRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedNocRootCertificatesRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocCertificatesBySubjectRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllRevokedNocRootCertificatesRequest(); + const message = createBaseQueryGetNocCertificatesBySubjectRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.subject = reader.string(); break; default: reader.skipType(tag & 7); @@ -2864,55 +3886,46 @@ export const QueryAllRevokedNocRootCertificatesRequest = { return message; }, - fromJSON(object: any): QueryAllRevokedNocRootCertificatesRequest { - return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + fromJSON(object: any): QueryGetNocCertificatesBySubjectRequest { + return { subject: isSet(object.subject) ? String(object.subject) : "" }; }, - toJSON(message: QueryAllRevokedNocRootCertificatesRequest): unknown { + toJSON(message: QueryGetNocCertificatesBySubjectRequest): unknown { const obj: any = {}; - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.subject !== undefined && (obj.subject = message.subject); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllRevokedNocRootCertificatesRequest { - const message = createBaseQueryAllRevokedNocRootCertificatesRequest(); - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageRequest.fromPartial(object.pagination) - : undefined; + ): QueryGetNocCertificatesBySubjectRequest { + const message = createBaseQueryGetNocCertificatesBySubjectRequest(); + message.subject = object.subject ?? ""; return message; }, }; -function createBaseQueryAllRevokedNocRootCertificatesResponse(): QueryAllRevokedNocRootCertificatesResponse { - return { revokedNocRootCertificates: [], pagination: undefined }; +function createBaseQueryGetNocCertificatesBySubjectResponse(): QueryGetNocCertificatesBySubjectResponse { + return { nocCertificatesBySubject: undefined }; } -export const QueryAllRevokedNocRootCertificatesResponse = { - encode(message: QueryAllRevokedNocRootCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.revokedNocRootCertificates) { - RevokedNocRootCertificates.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryGetNocCertificatesBySubjectResponse = { + encode(message: QueryGetNocCertificatesBySubjectResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nocCertificatesBySubject !== undefined) { + NocCertificatesBySubject.encode(message.nocCertificatesBySubject, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllRevokedNocRootCertificatesResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocCertificatesBySubjectResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryAllRevokedNocRootCertificatesResponse(); + const message = createBaseQueryGetNocCertificatesBySubjectResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.revokedNocRootCertificates.push(RevokedNocRootCertificates.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.nocCertificatesBySubject = NocCertificatesBySubject.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2922,53 +3935,42 @@ export const QueryAllRevokedNocRootCertificatesResponse = { return message; }, - fromJSON(object: any): QueryAllRevokedNocRootCertificatesResponse { + fromJSON(object: any): QueryGetNocCertificatesBySubjectResponse { return { - revokedNocRootCertificates: Array.isArray(object?.revokedNocRootCertificates) - ? object.revokedNocRootCertificates.map((e: any) => RevokedNocRootCertificates.fromJSON(e)) - : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + nocCertificatesBySubject: isSet(object.nocCertificatesBySubject) + ? NocCertificatesBySubject.fromJSON(object.nocCertificatesBySubject) + : undefined, }; }, - toJSON(message: QueryAllRevokedNocRootCertificatesResponse): unknown { + toJSON(message: QueryGetNocCertificatesBySubjectResponse): unknown { const obj: any = {}; - if (message.revokedNocRootCertificates) { - obj.revokedNocRootCertificates = message.revokedNocRootCertificates.map((e) => - e ? RevokedNocRootCertificates.toJSON(e) : undefined - ); - } else { - obj.revokedNocRootCertificates = []; - } - message.pagination !== undefined - && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.nocCertificatesBySubject !== undefined && (obj.nocCertificatesBySubject = message.nocCertificatesBySubject + ? NocCertificatesBySubject.toJSON(message.nocCertificatesBySubject) + : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryAllRevokedNocRootCertificatesResponse { - const message = createBaseQueryAllRevokedNocRootCertificatesResponse(); - message.revokedNocRootCertificates = - object.revokedNocRootCertificates?.map((e) => RevokedNocRootCertificates.fromPartial(e)) || []; - message.pagination = (object.pagination !== undefined && object.pagination !== null) - ? PageResponse.fromPartial(object.pagination) - : undefined; + ): QueryGetNocCertificatesBySubjectResponse { + const message = createBaseQueryGetNocCertificatesBySubjectResponse(); + message.nocCertificatesBySubject = + (object.nocCertificatesBySubject !== undefined && object.nocCertificatesBySubject !== null) + ? NocCertificatesBySubject.fromPartial(object.nocCertificatesBySubject) + : undefined; return message; }, }; -function createBaseQueryGetNocRootCertificatesByVidAndSkidRequest(): QueryGetNocRootCertificatesByVidAndSkidRequest { - return { vid: 0, subjectKeyId: "" }; +function createBaseQueryGetNocCertificatesRequest(): QueryGetNocCertificatesRequest { + return { subject: "", subjectKeyId: "" }; } -export const QueryGetNocRootCertificatesByVidAndSkidRequest = { - encode( - message: QueryGetNocRootCertificatesByVidAndSkidRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.vid !== 0) { - writer.uint32(8).int32(message.vid); +export const QueryGetNocCertificatesRequest = { + encode(message: QueryGetNocCertificatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); } if (message.subjectKeyId !== "") { writer.uint32(18).string(message.subjectKeyId); @@ -2976,15 +3978,15 @@ export const QueryGetNocRootCertificatesByVidAndSkidRequest = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesByVidAndSkidRequest { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocCertificatesRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetNocRootCertificatesByVidAndSkidRequest(); + const message = createBaseQueryGetNocCertificatesRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.vid = reader.int32(); + message.subject = reader.string(); break; case 2: message.subjectKeyId = reader.string(); @@ -2997,55 +3999,51 @@ export const QueryGetNocRootCertificatesByVidAndSkidRequest = { return message; }, - fromJSON(object: any): QueryGetNocRootCertificatesByVidAndSkidRequest { + fromJSON(object: any): QueryGetNocCertificatesRequest { return { - vid: isSet(object.vid) ? Number(object.vid) : 0, + subject: isSet(object.subject) ? String(object.subject) : "", subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", }; }, - toJSON(message: QueryGetNocRootCertificatesByVidAndSkidRequest): unknown { + toJSON(message: QueryGetNocCertificatesRequest): unknown { const obj: any = {}; - message.vid !== undefined && (obj.vid = Math.round(message.vid)); + message.subject !== undefined && (obj.subject = message.subject); message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetNocRootCertificatesByVidAndSkidRequest { - const message = createBaseQueryGetNocRootCertificatesByVidAndSkidRequest(); - message.vid = object.vid ?? 0; + ): QueryGetNocCertificatesRequest { + const message = createBaseQueryGetNocCertificatesRequest(); + message.subject = object.subject ?? ""; message.subjectKeyId = object.subjectKeyId ?? ""; return message; }, }; -function createBaseQueryGetNocRootCertificatesByVidAndSkidResponse(): QueryGetNocRootCertificatesByVidAndSkidResponse { - return { nocRootCertificatesByVidAndSkid: undefined }; +function createBaseQueryGetNocCertificatesResponse(): QueryGetNocCertificatesResponse { + return { nocCertificates: undefined }; } -export const QueryGetNocRootCertificatesByVidAndSkidResponse = { - encode( - message: QueryGetNocRootCertificatesByVidAndSkidResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.nocRootCertificatesByVidAndSkid !== undefined) { - NocRootCertificatesByVidAndSkid.encode(message.nocRootCertificatesByVidAndSkid, writer.uint32(10).fork()) - .ldelim(); +export const QueryGetNocCertificatesResponse = { + encode(message: QueryGetNocCertificatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nocCertificates !== undefined) { + NocCertificates.encode(message.nocCertificates, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesByVidAndSkidResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGetNocCertificatesResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryGetNocRootCertificatesByVidAndSkidResponse(); + const message = createBaseQueryGetNocCertificatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.nocRootCertificatesByVidAndSkid = NocRootCertificatesByVidAndSkid.decode(reader, reader.uint32()); + message.nocCertificates = NocCertificates.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -3055,41 +4053,48 @@ export const QueryGetNocRootCertificatesByVidAndSkidResponse = { return message; }, - fromJSON(object: any): QueryGetNocRootCertificatesByVidAndSkidResponse { + fromJSON(object: any): QueryGetNocCertificatesResponse { return { - nocRootCertificatesByVidAndSkid: isSet(object.nocRootCertificatesByVidAndSkid) - ? NocRootCertificatesByVidAndSkid.fromJSON(object.nocRootCertificatesByVidAndSkid) - : undefined, + nocCertificates: isSet(object.nocCertificates) ? NocCertificates.fromJSON(object.nocCertificates) : undefined, }; }, - toJSON(message: QueryGetNocRootCertificatesByVidAndSkidResponse): unknown { + toJSON(message: QueryGetNocCertificatesResponse): unknown { const obj: any = {}; - message.nocRootCertificatesByVidAndSkid !== undefined - && (obj.nocRootCertificatesByVidAndSkid = message.nocRootCertificatesByVidAndSkid - ? NocRootCertificatesByVidAndSkid.toJSON(message.nocRootCertificatesByVidAndSkid) - : undefined); + message.nocCertificates !== undefined + && (obj.nocCertificates = message.nocCertificates ? NocCertificates.toJSON(message.nocCertificates) : undefined); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I, - ): QueryGetNocRootCertificatesByVidAndSkidResponse { - const message = createBaseQueryGetNocRootCertificatesByVidAndSkidResponse(); - message.nocRootCertificatesByVidAndSkid = - (object.nocRootCertificatesByVidAndSkid !== undefined && object.nocRootCertificatesByVidAndSkid !== null) - ? NocRootCertificatesByVidAndSkid.fromPartial(object.nocRootCertificatesByVidAndSkid) - : undefined; + ): QueryGetNocCertificatesResponse { + const message = createBaseQueryGetNocCertificatesResponse(); + message.nocCertificates = (object.nocCertificates !== undefined && object.nocCertificates !== null) + ? NocCertificates.fromPartial(object.nocCertificates) + : undefined; return message; }, }; /** Query defines the gRPC querier service. */ export interface Query { - /** Queries a ApprovedCertificates by index. */ - ApprovedCertificates(request: QueryGetApprovedCertificatesRequest): Promise; + /** Queries a list of Certificates items. */ + CertificatesAll(request: QueryAllCertificatesRequest): Promise; + /** Queries a AllCertificatesBySubject by index. */ + AllCertificatesBySubject( + request: QueryGetAllCertificatesBySubjectRequest, + ): Promise; + /** Queries a Certificates by index. */ + Certificates(request: QueryGetCertificatesRequest): Promise; /** Queries a list of ApprovedCertificates items. */ ApprovedCertificatesAll(request: QueryAllApprovedCertificatesRequest): Promise; + /** Queries a ApprovedCertificatesBySubject by index. */ + ApprovedCertificatesBySubject( + request: QueryGetApprovedCertificatesBySubjectRequest, + ): Promise; + /** Queries a ApprovedCertificates by index. */ + ApprovedCertificates(request: QueryGetApprovedCertificatesRequest): Promise; /** Queries a ProposedCertificate by index. */ ProposedCertificate(request: QueryGetProposedCertificateRequest): Promise; /** Queries a list of ProposedCertificate items. */ @@ -3116,10 +4121,6 @@ export interface Query { RevokedRootCertificates( request: QueryGetRevokedRootCertificatesRequest, ): Promise; - /** Queries a ApprovedCertificatesBySubject by index. */ - ApprovedCertificatesBySubject( - request: QueryGetApprovedCertificatesBySubjectRequest, - ): Promise; /** Queries a RejectedCertificate by index. */ RejectedCertificate(request: QueryGetRejectedCertificatesRequest): Promise; /** Queries a list of RejectedCertificate items. */ @@ -3136,12 +4137,20 @@ export interface Query { PkiRevocationDistributionPointsByIssuerSubjectKeyID( request: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest, ): Promise; + /** Queries a list of NocCertificates items. */ + NocCertificatesAll(request: QueryNocCertificatesRequest): Promise; + /** Queries a NocCertificatesBySubject by index. */ + NocCertificatesBySubject( + request: QueryGetNocCertificatesBySubjectRequest, + ): Promise; + /** Queries a NocCertificates by index. */ + NocCertificates(request: QueryGetNocCertificatesRequest): Promise; + /** Queries a NocCertificatesByVidAndSkid by index. */ + NocCertificatesByVidAndSkid( + request: QueryGetNocCertificatesByVidAndSkidRequest, + ): Promise; /** Queries a NocRootCertificates by index. */ NocRootCertificates(request: QueryGetNocRootCertificatesRequest): Promise; - /** Queries a NocRootCertificatesByVidAndSkid by index. */ - NocRootCertificatesByVidAndSkid( - request: QueryGetNocRootCertificatesByVidAndSkidRequest, - ): Promise; /** Queries a list of NocRootCertificates items. */ NocRootCertificatesAll(request: QueryAllNocRootCertificatesRequest): Promise; /** Queries a NocIcaCertificates by index. */ @@ -3156,14 +4165,26 @@ export interface Query { RevokedNocRootCertificatesAll( request: QueryAllRevokedNocRootCertificatesRequest, ): Promise; + /** Queries a RevokedNocIcaCertificates by index. */ + RevokedNocIcaCertificates( + request: QueryGetRevokedNocIcaCertificatesRequest, + ): Promise; + /** Queries a list of RevokedNocIcaCertificates items. */ + RevokedNocIcaCertificatesAll( + request: QueryAllRevokedNocIcaCertificatesRequest, + ): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; - this.ApprovedCertificates = this.ApprovedCertificates.bind(this); + this.CertificatesAll = this.CertificatesAll.bind(this); + this.AllCertificatesBySubject = this.AllCertificatesBySubject.bind(this); + this.Certificates = this.Certificates.bind(this); this.ApprovedCertificatesAll = this.ApprovedCertificatesAll.bind(this); + this.ApprovedCertificatesBySubject = this.ApprovedCertificatesBySubject.bind(this); + this.ApprovedCertificates = this.ApprovedCertificates.bind(this); this.ProposedCertificate = this.ProposedCertificate.bind(this); this.ProposedCertificateAll = this.ProposedCertificateAll.bind(this); this.ChildCertificates = this.ChildCertificates.bind(this); @@ -3173,29 +4194,47 @@ export class QueryClientImpl implements Query { this.RevokedCertificatesAll = this.RevokedCertificatesAll.bind(this); this.ApprovedRootCertificates = this.ApprovedRootCertificates.bind(this); this.RevokedRootCertificates = this.RevokedRootCertificates.bind(this); - this.ApprovedCertificatesBySubject = this.ApprovedCertificatesBySubject.bind(this); this.RejectedCertificate = this.RejectedCertificate.bind(this); this.RejectedCertificateAll = this.RejectedCertificateAll.bind(this); this.PkiRevocationDistributionPoint = this.PkiRevocationDistributionPoint.bind(this); this.PkiRevocationDistributionPointAll = this.PkiRevocationDistributionPointAll.bind(this); this.PkiRevocationDistributionPointsByIssuerSubjectKeyID = this.PkiRevocationDistributionPointsByIssuerSubjectKeyID .bind(this); + this.NocCertificatesAll = this.NocCertificatesAll.bind(this); + this.NocCertificatesBySubject = this.NocCertificatesBySubject.bind(this); + this.NocCertificates = this.NocCertificates.bind(this); + this.NocCertificatesByVidAndSkid = this.NocCertificatesByVidAndSkid.bind(this); this.NocRootCertificates = this.NocRootCertificates.bind(this); - this.NocRootCertificatesByVidAndSkid = this.NocRootCertificatesByVidAndSkid.bind(this); this.NocRootCertificatesAll = this.NocRootCertificatesAll.bind(this); this.NocIcaCertificates = this.NocIcaCertificates.bind(this); this.NocIcaCertificatesAll = this.NocIcaCertificatesAll.bind(this); this.RevokedNocRootCertificates = this.RevokedNocRootCertificates.bind(this); this.RevokedNocRootCertificatesAll = this.RevokedNocRootCertificatesAll.bind(this); + this.RevokedNocIcaCertificates = this.RevokedNocIcaCertificates.bind(this); + this.RevokedNocIcaCertificatesAll = this.RevokedNocIcaCertificatesAll.bind(this); } - ApprovedCertificates(request: QueryGetApprovedCertificatesRequest): Promise { - const data = QueryGetApprovedCertificatesRequest.encode(request).finish(); + CertificatesAll(request: QueryAllCertificatesRequest): Promise { + const data = QueryAllCertificatesRequest.encode(request).finish(); + const promise = this.rpc.request("zigbeealliance.distributedcomplianceledger.pki.Query", "CertificatesAll", data); + return promise.then((data) => QueryAllCertificatesResponse.decode(new _m0.Reader(data))); + } + + AllCertificatesBySubject( + request: QueryGetAllCertificatesBySubjectRequest, + ): Promise { + const data = QueryGetAllCertificatesBySubjectRequest.encode(request).finish(); const promise = this.rpc.request( "zigbeealliance.distributedcomplianceledger.pki.Query", - "ApprovedCertificates", + "AllCertificatesBySubject", data, ); - return promise.then((data) => QueryGetApprovedCertificatesResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryGetAllCertificatesBySubjectResponse.decode(new _m0.Reader(data))); + } + + Certificates(request: QueryGetCertificatesRequest): Promise { + const data = QueryGetCertificatesRequest.encode(request).finish(); + const promise = this.rpc.request("zigbeealliance.distributedcomplianceledger.pki.Query", "Certificates", data); + return promise.then((data) => QueryGetCertificatesResponse.decode(new _m0.Reader(data))); } ApprovedCertificatesAll(request: QueryAllApprovedCertificatesRequest): Promise { @@ -3208,6 +4247,28 @@ export class QueryClientImpl implements Query { return promise.then((data) => QueryAllApprovedCertificatesResponse.decode(new _m0.Reader(data))); } + ApprovedCertificatesBySubject( + request: QueryGetApprovedCertificatesBySubjectRequest, + ): Promise { + const data = QueryGetApprovedCertificatesBySubjectRequest.encode(request).finish(); + const promise = this.rpc.request( + "zigbeealliance.distributedcomplianceledger.pki.Query", + "ApprovedCertificatesBySubject", + data, + ); + return promise.then((data) => QueryGetApprovedCertificatesBySubjectResponse.decode(new _m0.Reader(data))); + } + + ApprovedCertificates(request: QueryGetApprovedCertificatesRequest): Promise { + const data = QueryGetApprovedCertificatesRequest.encode(request).finish(); + const promise = this.rpc.request( + "zigbeealliance.distributedcomplianceledger.pki.Query", + "ApprovedCertificates", + data, + ); + return promise.then((data) => QueryGetApprovedCertificatesResponse.decode(new _m0.Reader(data))); + } + ProposedCertificate(request: QueryGetProposedCertificateRequest): Promise { const data = QueryGetProposedCertificateRequest.encode(request).finish(); const promise = this.rpc.request( @@ -3302,18 +4363,6 @@ export class QueryClientImpl implements Query { return promise.then((data) => QueryGetRevokedRootCertificatesResponse.decode(new _m0.Reader(data))); } - ApprovedCertificatesBySubject( - request: QueryGetApprovedCertificatesBySubjectRequest, - ): Promise { - const data = QueryGetApprovedCertificatesBySubjectRequest.encode(request).finish(); - const promise = this.rpc.request( - "zigbeealliance.distributedcomplianceledger.pki.Query", - "ApprovedCertificatesBySubject", - data, - ); - return promise.then((data) => QueryGetApprovedCertificatesBySubjectResponse.decode(new _m0.Reader(data))); - } - RejectedCertificate(request: QueryGetRejectedCertificatesRequest): Promise { const data = QueryGetRejectedCertificatesRequest.encode(request).finish(); const promise = this.rpc.request( @@ -3372,26 +4421,54 @@ export class QueryClientImpl implements Query { ); } - NocRootCertificates(request: QueryGetNocRootCertificatesRequest): Promise { - const data = QueryGetNocRootCertificatesRequest.encode(request).finish(); + NocCertificatesAll(request: QueryNocCertificatesRequest): Promise { + const data = QueryNocCertificatesRequest.encode(request).finish(); const promise = this.rpc.request( "zigbeealliance.distributedcomplianceledger.pki.Query", - "NocRootCertificates", + "NocCertificatesAll", data, ); - return promise.then((data) => QueryGetNocRootCertificatesResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryNocCertificatesResponse.decode(new _m0.Reader(data))); + } + + NocCertificatesBySubject( + request: QueryGetNocCertificatesBySubjectRequest, + ): Promise { + const data = QueryGetNocCertificatesBySubjectRequest.encode(request).finish(); + const promise = this.rpc.request( + "zigbeealliance.distributedcomplianceledger.pki.Query", + "NocCertificatesBySubject", + data, + ); + return promise.then((data) => QueryGetNocCertificatesBySubjectResponse.decode(new _m0.Reader(data))); + } + + NocCertificates(request: QueryGetNocCertificatesRequest): Promise { + const data = QueryGetNocCertificatesRequest.encode(request).finish(); + const promise = this.rpc.request("zigbeealliance.distributedcomplianceledger.pki.Query", "NocCertificates", data); + return promise.then((data) => QueryGetNocCertificatesResponse.decode(new _m0.Reader(data))); + } + + NocCertificatesByVidAndSkid( + request: QueryGetNocCertificatesByVidAndSkidRequest, + ): Promise { + const data = QueryGetNocCertificatesByVidAndSkidRequest.encode(request).finish(); + const promise = this.rpc.request( + "zigbeealliance.distributedcomplianceledger.pki.Query", + "NocCertificatesByVidAndSkid", + data, + ); + return promise.then((data) => QueryGetNocCertificatesByVidAndSkidResponse.decode(new _m0.Reader(data))); } - NocRootCertificatesByVidAndSkid( - request: QueryGetNocRootCertificatesByVidAndSkidRequest, - ): Promise { - const data = QueryGetNocRootCertificatesByVidAndSkidRequest.encode(request).finish(); + NocRootCertificates(request: QueryGetNocRootCertificatesRequest): Promise { + const data = QueryGetNocRootCertificatesRequest.encode(request).finish(); const promise = this.rpc.request( "zigbeealliance.distributedcomplianceledger.pki.Query", - "NocRootCertificatesByVidAndSkid", + "NocRootCertificates", data, ); - return promise.then((data) => QueryGetNocRootCertificatesByVidAndSkidResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryGetNocRootCertificatesResponse.decode(new _m0.Reader(data))); } NocRootCertificatesAll(request: QueryAllNocRootCertificatesRequest): Promise { @@ -3447,6 +4524,30 @@ export class QueryClientImpl implements Query { ); return promise.then((data) => QueryAllRevokedNocRootCertificatesResponse.decode(new _m0.Reader(data))); } + + RevokedNocIcaCertificates( + request: QueryGetRevokedNocIcaCertificatesRequest, + ): Promise { + const data = QueryGetRevokedNocIcaCertificatesRequest.encode(request).finish(); + const promise = this.rpc.request( + "zigbeealliance.distributedcomplianceledger.pki.Query", + "RevokedNocIcaCertificates", + data, + ); + return promise.then((data) => QueryGetRevokedNocIcaCertificatesResponse.decode(new _m0.Reader(data))); + } + + RevokedNocIcaCertificatesAll( + request: QueryAllRevokedNocIcaCertificatesRequest, + ): Promise { + const data = QueryAllRevokedNocIcaCertificatesRequest.encode(request).finish(); + const promise = this.rpc.request( + "zigbeealliance.distributedcomplianceledger.pki.Query", + "RevokedNocIcaCertificatesAll", + data, + ); + return promise.then((data) => QueryAllRevokedNocIcaCertificatesResponse.decode(new _m0.Reader(data))); + } } interface Rpc { diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.ts b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.ts new file mode 100644 index 000000000..54da420cc --- /dev/null +++ b/ts-client/zigbeealliance.distributedcomplianceledger.pki/types/zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.ts @@ -0,0 +1,107 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Certificate } from "./certificate"; + +export const protobufPackage = "zigbeealliance.distributedcomplianceledger.pki"; + +export interface RevokedNocIcaCertificates { + subject: string; + subjectKeyId: string; + certs: Certificate[]; + schemaVersion: number; +} + +function createBaseRevokedNocIcaCertificates(): RevokedNocIcaCertificates { + return { subject: "", subjectKeyId: "", certs: [], schemaVersion: 0 }; +} + +export const RevokedNocIcaCertificates = { + encode(message: RevokedNocIcaCertificates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subject !== "") { + writer.uint32(10).string(message.subject); + } + if (message.subjectKeyId !== "") { + writer.uint32(18).string(message.subjectKeyId); + } + for (const v of message.certs) { + Certificate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.schemaVersion !== 0) { + writer.uint32(32).uint32(message.schemaVersion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RevokedNocIcaCertificates { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRevokedNocIcaCertificates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subject = reader.string(); + break; + case 2: + message.subjectKeyId = reader.string(); + break; + case 3: + message.certs.push(Certificate.decode(reader, reader.uint32())); + break; + case 4: + message.schemaVersion = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RevokedNocIcaCertificates { + return { + subject: isSet(object.subject) ? String(object.subject) : "", + subjectKeyId: isSet(object.subjectKeyId) ? String(object.subjectKeyId) : "", + certs: Array.isArray(object?.certs) ? object.certs.map((e: any) => Certificate.fromJSON(e)) : [], + schemaVersion: isSet(object.schemaVersion) ? Number(object.schemaVersion) : 0, + }; + }, + + toJSON(message: RevokedNocIcaCertificates): unknown { + const obj: any = {}; + message.subject !== undefined && (obj.subject = message.subject); + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId); + if (message.certs) { + obj.certs = message.certs.map((e) => e ? Certificate.toJSON(e) : undefined); + } else { + obj.certs = []; + } + message.schemaVersion !== undefined && (obj.schemaVersion = Math.round(message.schemaVersion)); + return obj; + }, + + fromPartial, I>>(object: I): RevokedNocIcaCertificates { + const message = createBaseRevokedNocIcaCertificates(); + message.subject = object.subject ?? ""; + message.subjectKeyId = object.subjectKeyId ?? ""; + message.certs = object.certs?.map((e) => Certificate.fromPartial(e)) || []; + message.schemaVersion = object.schemaVersion ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.validator/module.ts b/ts-client/zigbeealliance.distributedcomplianceledger.validator/module.ts index 37803b1b8..cb85ae35a 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.validator/module.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.validator/module.ts @@ -8,11 +8,11 @@ import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; import { MsgCreateValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; -import { MsgRejectDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; -import { MsgEnableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; +import { MsgDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; import { MsgApproveDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; +import { MsgEnableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; import { MsgProposeDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; -import { MsgDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; +import { MsgRejectDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; import { Description as typeDescription} from "./types" import { DisabledValidator as typeDisabledValidator} from "./types" @@ -22,7 +22,7 @@ import { ProposedDisableValidator as typeProposedDisableValidator} from "./types import { RejectedDisableValidator as typeRejectedDisableValidator} from "./types" import { Validator as typeValidator} from "./types" -export { MsgCreateValidator, MsgRejectDisableValidator, MsgEnableValidator, MsgApproveDisableValidator, MsgProposeDisableValidator, MsgDisableValidator }; +export { MsgCreateValidator, MsgDisableValidator, MsgApproveDisableValidator, MsgEnableValidator, MsgProposeDisableValidator, MsgRejectDisableValidator }; type sendMsgCreateValidatorParams = { value: MsgCreateValidator, @@ -30,20 +30,20 @@ type sendMsgCreateValidatorParams = { memo?: string }; -type sendMsgRejectDisableValidatorParams = { - value: MsgRejectDisableValidator, +type sendMsgDisableValidatorParams = { + value: MsgDisableValidator, fee?: StdFee, memo?: string }; -type sendMsgEnableValidatorParams = { - value: MsgEnableValidator, +type sendMsgApproveDisableValidatorParams = { + value: MsgApproveDisableValidator, fee?: StdFee, memo?: string }; -type sendMsgApproveDisableValidatorParams = { - value: MsgApproveDisableValidator, +type sendMsgEnableValidatorParams = { + value: MsgEnableValidator, fee?: StdFee, memo?: string }; @@ -54,8 +54,8 @@ type sendMsgProposeDisableValidatorParams = { memo?: string }; -type sendMsgDisableValidatorParams = { - value: MsgDisableValidator, +type sendMsgRejectDisableValidatorParams = { + value: MsgRejectDisableValidator, fee?: StdFee, memo?: string }; @@ -65,24 +65,24 @@ type msgCreateValidatorParams = { value: MsgCreateValidator, }; -type msgRejectDisableValidatorParams = { - value: MsgRejectDisableValidator, -}; - -type msgEnableValidatorParams = { - value: MsgEnableValidator, +type msgDisableValidatorParams = { + value: MsgDisableValidator, }; type msgApproveDisableValidatorParams = { value: MsgApproveDisableValidator, }; +type msgEnableValidatorParams = { + value: MsgEnableValidator, +}; + type msgProposeDisableValidatorParams = { value: MsgProposeDisableValidator, }; -type msgDisableValidatorParams = { - value: MsgDisableValidator, +type msgRejectDisableValidatorParams = { + value: MsgRejectDisableValidator, }; @@ -129,45 +129,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgRejectDisableValidator({ value, fee, memo }: sendMsgRejectDisableValidatorParams): Promise { + async sendMsgDisableValidator({ value, fee, memo }: sendMsgDisableValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgRejectDisableValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgDisableValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRejectDisableValidator({ value: MsgRejectDisableValidator.fromPartial(value) }) + let msg = this.msgDisableValidator({ value: MsgDisableValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgRejectDisableValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgDisableValidator: Could not broadcast Tx: '+ e.message) } }, - async sendMsgEnableValidator({ value, fee, memo }: sendMsgEnableValidatorParams): Promise { + async sendMsgApproveDisableValidator({ value, fee, memo }: sendMsgApproveDisableValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgEnableValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgApproveDisableValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgEnableValidator({ value: MsgEnableValidator.fromPartial(value) }) + let msg = this.msgApproveDisableValidator({ value: MsgApproveDisableValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgEnableValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgApproveDisableValidator: Could not broadcast Tx: '+ e.message) } }, - async sendMsgApproveDisableValidator({ value, fee, memo }: sendMsgApproveDisableValidatorParams): Promise { + async sendMsgEnableValidator({ value, fee, memo }: sendMsgEnableValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgApproveDisableValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgEnableValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgApproveDisableValidator({ value: MsgApproveDisableValidator.fromPartial(value) }) + let msg = this.msgEnableValidator({ value: MsgEnableValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgApproveDisableValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgEnableValidator: Could not broadcast Tx: '+ e.message) } }, @@ -185,17 +185,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgDisableValidator({ value, fee, memo }: sendMsgDisableValidatorParams): Promise { + async sendMsgRejectDisableValidator({ value, fee, memo }: sendMsgRejectDisableValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDisableValidator: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRejectDisableValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgDisableValidator({ value: MsgDisableValidator.fromPartial(value) }) + let msg = this.msgRejectDisableValidator({ value: MsgRejectDisableValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDisableValidator: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRejectDisableValidator: Could not broadcast Tx: '+ e.message) } }, @@ -208,27 +208,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgRejectDisableValidator({ value }: msgRejectDisableValidatorParams): EncodeObject { + msgDisableValidator({ value }: msgDisableValidatorParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgRejectDisableValidator", value: MsgRejectDisableValidator.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgDisableValidator", value: MsgDisableValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgRejectDisableValidator: Could not create message: ' + e.message) + throw new Error('TxClient:MsgDisableValidator: Could not create message: ' + e.message) } }, - msgEnableValidator({ value }: msgEnableValidatorParams): EncodeObject { + msgApproveDisableValidator({ value }: msgApproveDisableValidatorParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgEnableValidator", value: MsgEnableValidator.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgApproveDisableValidator", value: MsgApproveDisableValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgEnableValidator: Could not create message: ' + e.message) + throw new Error('TxClient:MsgApproveDisableValidator: Could not create message: ' + e.message) } }, - msgApproveDisableValidator({ value }: msgApproveDisableValidatorParams): EncodeObject { + msgEnableValidator({ value }: msgEnableValidatorParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgApproveDisableValidator", value: MsgApproveDisableValidator.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgEnableValidator", value: MsgEnableValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgApproveDisableValidator: Could not create message: ' + e.message) + throw new Error('TxClient:MsgEnableValidator: Could not create message: ' + e.message) } }, @@ -240,11 +240,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgDisableValidator({ value }: msgDisableValidatorParams): EncodeObject { + msgRejectDisableValidator({ value }: msgRejectDisableValidatorParams): EncodeObject { try { - return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgDisableValidator", value: MsgDisableValidator.fromPartial( value ) } + return { typeUrl: "/zigbeealliance.distributedcomplianceledger.validator.MsgRejectDisableValidator", value: MsgRejectDisableValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDisableValidator: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRejectDisableValidator: Could not create message: ' + e.message) } }, diff --git a/ts-client/zigbeealliance.distributedcomplianceledger.validator/registry.ts b/ts-client/zigbeealliance.distributedcomplianceledger.validator/registry.ts index 3075b03dc..8f3e89f23 100755 --- a/ts-client/zigbeealliance.distributedcomplianceledger.validator/registry.ts +++ b/ts-client/zigbeealliance.distributedcomplianceledger.validator/registry.ts @@ -1,18 +1,18 @@ import { GeneratedType } from "@cosmjs/proto-signing"; import { MsgCreateValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; -import { MsgRejectDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; -import { MsgEnableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; +import { MsgDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; import { MsgApproveDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; +import { MsgEnableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; import { MsgProposeDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; -import { MsgDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; +import { MsgRejectDisableValidator } from "./types/zigbeealliance/distributedcomplianceledger/validator/tx"; const msgTypes: Array<[string, GeneratedType]> = [ ["/zigbeealliance.distributedcomplianceledger.validator.MsgCreateValidator", MsgCreateValidator], - ["/zigbeealliance.distributedcomplianceledger.validator.MsgRejectDisableValidator", MsgRejectDisableValidator], - ["/zigbeealliance.distributedcomplianceledger.validator.MsgEnableValidator", MsgEnableValidator], + ["/zigbeealliance.distributedcomplianceledger.validator.MsgDisableValidator", MsgDisableValidator], ["/zigbeealliance.distributedcomplianceledger.validator.MsgApproveDisableValidator", MsgApproveDisableValidator], + ["/zigbeealliance.distributedcomplianceledger.validator.MsgEnableValidator", MsgEnableValidator], ["/zigbeealliance.distributedcomplianceledger.validator.MsgProposeDisableValidator", MsgProposeDisableValidator], - ["/zigbeealliance.distributedcomplianceledger.validator.MsgDisableValidator", MsgDisableValidator], + ["/zigbeealliance.distributedcomplianceledger.validator.MsgRejectDisableValidator", MsgRejectDisableValidator], ]; diff --git a/vue/package.json b/vue/package.json index 17795d32f..65d69f193 100644 --- a/vue/package.json +++ b/vue/package.json @@ -1,5 +1,5 @@ { - "author": "Tendermint, Inc ", + "author": "Tendermint, Inc \u003chello@tendermint.com\u003e", "dependencies": { "@cosmjs/launchpad": "0.25.0", "@cosmjs/proto-signing": "0.25.0", @@ -42,7 +42,7 @@ "dev": "vue-cli-service serve", "lint": "vue-cli-service lint", "serve": "vue-cli-service serve --mode=production", - "test": "echo \"Error: run tests from root\" && exit 1" + "test": "echo \"Error: run tests from root\" \u0026\u0026 exit 1" }, "version": "0.1.53" } diff --git a/vue/src/composables/useZigbeeallianceDistributedcomplianceledgerPki/index.ts b/vue/src/composables/useZigbeeallianceDistributedcomplianceledgerPki/index.ts index 0b64716ab..b451eef38 100755 --- a/vue/src/composables/useZigbeeallianceDistributedcomplianceledgerPki/index.ts +++ b/vue/src/composables/useZigbeeallianceDistributedcomplianceledgerPki/index.ts @@ -5,11 +5,35 @@ import type { Ref } from 'vue' export default function useZigbeeallianceDistributedcomplianceledgerPki() { const client = useClient(); - const QueryApprovedCertificates = (subject: string, subjectKeyId: string, options: any) => { - const key = { type: 'QueryApprovedCertificates', subject, subjectKeyId }; + const QueryCertificatesAll = (query: any, options: any, perPage: number) => { + const key = { type: 'QueryCertificatesAll', query }; + return useInfiniteQuery([key], ({pageParam = 1}: { pageParam?: number}) => { + const {query } = key + + query['pagination.limit']=perPage; + query['pagination.offset']= (pageParam-1)*perPage; + query['pagination.count_total']= true; + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryCertificatesAll(query ?? undefined).then( res => ({...res.data,pageParam}) ); + }, {...options, + getNextPageParam: (lastPage, allPages) => { if ((lastPage.pagination?.total ?? 0) >((lastPage.pageParam ?? 0) * perPage)) {return lastPage.pageParam+1 } else {return undefined}}, + getPreviousPageParam: (firstPage, allPages) => { if (firstPage.pageParam==1) { return undefined } else { return firstPage.pageParam-1}} + } + ); + } + + const QueryAllCertificatesBySubject = (subject: string, options: any) => { + const key = { type: 'QueryAllCertificatesBySubject', subject }; + return useQuery([key], () => { + const { subject } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryAllCertificatesBySubject(subject).then( res => res.data ); + }, options); + } + + const QueryCertificates = (subject: string, subjectKeyId: string, options: any) => { + const key = { type: 'QueryCertificates', subject, subjectKeyId }; return useQuery([key], () => { const { subject, subjectKeyId } = key - return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryApprovedCertificates(subject, subjectKeyId).then( res => res.data ); + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryCertificates(subject, subjectKeyId).then( res => res.data ); }, options); } @@ -29,6 +53,22 @@ export default function useZigbeeallianceDistributedcomplianceledgerPki() { ); } + const QueryApprovedCertificatesBySubject = (subject: string, options: any) => { + const key = { type: 'QueryApprovedCertificatesBySubject', subject }; + return useQuery([key], () => { + const { subject } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryApprovedCertificatesBySubject(subject).then( res => res.data ); + }, options); + } + + const QueryApprovedCertificates = (subject: string, subjectKeyId: string, options: any) => { + const key = { type: 'QueryApprovedCertificates', subject, subjectKeyId }; + return useQuery([key], () => { + const { subject, subjectKeyId } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryApprovedCertificates(subject, subjectKeyId).then( res => res.data ); + }, options); + } + const QueryProposedCertificate = (subject: string, subjectKeyId: string, options: any) => { const key = { type: 'QueryProposedCertificate', subject, subjectKeyId }; return useQuery([key], () => { @@ -123,14 +163,6 @@ export default function useZigbeeallianceDistributedcomplianceledgerPki() { }, options); } - const QueryApprovedCertificatesBySubject = (subject: string, options: any) => { - const key = { type: 'QueryApprovedCertificatesBySubject', subject }; - return useQuery([key], () => { - const { subject } = key - return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryApprovedCertificatesBySubject(subject).then( res => res.data ); - }, options); - } - const QueryRejectedCertificate = (subject: string, subjectKeyId: string, options: any) => { const key = { type: 'QueryRejectedCertificate', subject, subjectKeyId }; return useQuery([key], () => { @@ -187,19 +219,51 @@ export default function useZigbeeallianceDistributedcomplianceledgerPki() { }, options); } - const QueryNocRootCertificates = (vid: string, options: any) => { - const key = { type: 'QueryNocRootCertificates', vid }; + const QueryNocCertificatesAll = (query: any, options: any, perPage: number) => { + const key = { type: 'QueryNocCertificatesAll', query }; + return useInfiniteQuery([key], ({pageParam = 1}: { pageParam?: number}) => { + const {query } = key + + query['pagination.limit']=perPage; + query['pagination.offset']= (pageParam-1)*perPage; + query['pagination.count_total']= true; + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocCertificatesAll(query ?? undefined).then( res => ({...res.data,pageParam}) ); + }, {...options, + getNextPageParam: (lastPage, allPages) => { if ((lastPage.pagination?.total ?? 0) >((lastPage.pageParam ?? 0) * perPage)) {return lastPage.pageParam+1 } else {return undefined}}, + getPreviousPageParam: (firstPage, allPages) => { if (firstPage.pageParam==1) { return undefined } else { return firstPage.pageParam-1}} + } + ); + } + + const QueryNocCertificatesBySubject = (subject: string, options: any) => { + const key = { type: 'QueryNocCertificatesBySubject', subject }; return useQuery([key], () => { - const { vid } = key - return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocRootCertificates(vid).then( res => res.data ); + const { subject } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocCertificatesBySubject(subject).then( res => res.data ); + }, options); + } + + const QueryNocCertificates = (subject: string, subjectKeyId: string, options: any) => { + const key = { type: 'QueryNocCertificates', subject, subjectKeyId }; + return useQuery([key], () => { + const { subject, subjectKeyId } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocCertificates(subject, subjectKeyId).then( res => res.data ); }, options); } - const QueryNocRootCertificatesByVidAndSkid = (vid: string, subjectKeyId: string, options: any) => { - const key = { type: 'QueryNocRootCertificatesByVidAndSkid', vid, subjectKeyId }; + const QueryNocCertificatesByVidAndSkid = (vid: string, subjectKeyId: string, options: any) => { + const key = { type: 'QueryNocCertificatesByVidAndSkid', vid, subjectKeyId }; return useQuery([key], () => { const { vid, subjectKeyId } = key - return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocRootCertificatesByVidAndSkid(vid, subjectKeyId).then( res => res.data ); + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocCertificatesByVidAndSkid(vid, subjectKeyId).then( res => res.data ); + }, options); + } + + const QueryNocRootCertificates = (vid: string, options: any) => { + const key = { type: 'QueryNocRootCertificates', vid }; + return useQuery([key], () => { + const { vid } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryNocRootCertificates(vid).then( res => res.data ); }, options); } @@ -267,6 +331,30 @@ export default function useZigbeeallianceDistributedcomplianceledgerPki() { ); } - return {QueryApprovedCertificates,QueryApprovedCertificatesAll,QueryProposedCertificate,QueryProposedCertificateAll,QueryChildCertificates,QueryProposedCertificateRevocation,QueryProposedCertificateRevocationAll,QueryRevokedCertificates,QueryRevokedCertificatesAll,QueryApprovedRootCertificates,QueryRevokedRootCertificates,QueryApprovedCertificatesBySubject,QueryRejectedCertificate,QueryRejectedCertificateAll,QueryPkiRevocationDistributionPoint,QueryPkiRevocationDistributionPointAll,QueryPkiRevocationDistributionPointsByIssuerSubjectKeyID,QueryNocRootCertificates,QueryNocRootCertificatesByVidAndSkid,QueryNocRootCertificatesAll,QueryNocIcaCertificates,QueryNocIcaCertificatesAll,QueryRevokedNocRootCertificates,QueryRevokedNocRootCertificatesAll, + const QueryRevokedNocIcaCertificates = (subject: string, subjectKeyId: string, options: any) => { + const key = { type: 'QueryRevokedNocIcaCertificates', subject, subjectKeyId }; + return useQuery([key], () => { + const { subject, subjectKeyId } = key + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryRevokedNocIcaCertificates(subject, subjectKeyId).then( res => res.data ); + }, options); + } + + const QueryRevokedNocIcaCertificatesAll = (query: any, options: any, perPage: number) => { + const key = { type: 'QueryRevokedNocIcaCertificatesAll', query }; + return useInfiniteQuery([key], ({pageParam = 1}: { pageParam?: number}) => { + const {query } = key + + query['pagination.limit']=perPage; + query['pagination.offset']= (pageParam-1)*perPage; + query['pagination.count_total']= true; + return client.ZigbeeallianceDistributedcomplianceledgerPki.query.queryRevokedNocIcaCertificatesAll(query ?? undefined).then( res => ({...res.data,pageParam}) ); + }, {...options, + getNextPageParam: (lastPage, allPages) => { if ((lastPage.pagination?.total ?? 0) >((lastPage.pageParam ?? 0) * perPage)) {return lastPage.pageParam+1 } else {return undefined}}, + getPreviousPageParam: (firstPage, allPages) => { if (firstPage.pageParam==1) { return undefined } else { return firstPage.pageParam-1}} + } + ); + } + + return {QueryCertificatesAll,QueryAllCertificatesBySubject,QueryCertificates,QueryApprovedCertificatesAll,QueryApprovedCertificatesBySubject,QueryApprovedCertificates,QueryProposedCertificate,QueryProposedCertificateAll,QueryChildCertificates,QueryProposedCertificateRevocation,QueryProposedCertificateRevocationAll,QueryRevokedCertificates,QueryRevokedCertificatesAll,QueryApprovedRootCertificates,QueryRevokedRootCertificates,QueryRejectedCertificate,QueryRejectedCertificateAll,QueryPkiRevocationDistributionPoint,QueryPkiRevocationDistributionPointAll,QueryPkiRevocationDistributionPointsByIssuerSubjectKeyID,QueryNocCertificatesAll,QueryNocCertificatesBySubject,QueryNocCertificates,QueryNocCertificatesByVidAndSkid,QueryNocRootCertificates,QueryNocRootCertificatesAll,QueryNocIcaCertificates,QueryNocIcaCertificatesAll,QueryRevokedNocRootCertificates,QueryRevokedNocRootCertificatesAll,QueryRevokedNocIcaCertificates,QueryRevokedNocIcaCertificatesAll, } } \ No newline at end of file diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts index 6ef490e38..057f5b520 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts @@ -787,11 +787,11 @@ export class Api extends HttpClient this.request({ - path: `/dcl/pki/noc-ica-certificates/${vid}`, + path: `/dcl/pki/noc-vid-ica-certificates/${vid}`, method: "GET", format: "json", ...params, @@ -829,11 +829,11 @@ export class Api extends HttpClient this.request({ - path: `/dcl/pki/noc-root-certificates/${vid}`, + path: `/dcl/pki/noc-vid-root-certificates/${vid}`, method: "GET", format: "json", ...params, @@ -845,11 +845,11 @@ export class Api extends HttpClient this.request({ - path: `/dcl/pki/noc-root-certificates/${vid}/${subjectKeyId}`, + path: `/dcl/pki/noc-vid-root-certificates/${vid}/${subjectKeyId}`, method: "GET", format: "json", ...params, diff --git a/x/model/client/cli/tx_model_test.go b/x/model/client/cli/tx_model_test.go index 08098d29d..cd143e8e7 100644 --- a/x/model/client/cli/tx_model_test.go +++ b/x/model/client/cli/tx_model_test.go @@ -189,8 +189,7 @@ func TestUpdateModel(t *testing.T) { desc: "model does not exist", idVid: testconstants.Vid, idPid: testconstants.Pid + 1, - - err: types.ErrModelDoesNotExist, + err: types.ErrModelDoesNotExist, }, } { tc := tc diff --git a/x/pki/client/cli/query.go b/x/pki/client/cli/query.go index 5af2eced2..06f9f295f 100644 --- a/x/pki/client/cli/query.go +++ b/x/pki/client/cli/query.go @@ -42,10 +42,18 @@ func GetQueryCmd(_ string) *cobra.Command { cmd.AddCommand(CmdListNocRootCertificates()) cmd.AddCommand(CmdShowNocRootCertificates()) cmd.AddCommand(CmdShowNocCertificatesByVidAndSkid()) + cmd.AddCommand(CmdListNocCertificates()) + cmd.AddCommand(CmdShowNocCertificates()) + cmd.AddCommand(CmdShowNocCertificatesBySubject()) cmd.AddCommand(CmdListNocIcaCertificates()) cmd.AddCommand(CmdShowNocIcaCertificates()) cmd.AddCommand(CmdListRevokedNocRootCertificates()) cmd.AddCommand(CmdShowRevokedNocRootCertificates()) + cmd.AddCommand(CmdListCertificates()) + cmd.AddCommand(CmdShowCertificates()) + cmd.AddCommand(CmdListRevokedNocIcaCertificates()) + cmd.AddCommand(CmdShowRevokedNocIcaCertificates()) + cmd.AddCommand(CmdListAllCertificatesBySubject()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/pki/client/cli/query_all_certificates_by_subject.go b/x/pki/client/cli/query_all_certificates_by_subject.go new file mode 100644 index 000000000..7c8d79356 --- /dev/null +++ b/x/pki/client/cli/query_all_certificates_by_subject.go @@ -0,0 +1,43 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func CmdListAllCertificatesBySubject() *cobra.Command { + var subject string + + cmd := &cobra.Command{ + Use: "all-subject-certs", + Short: "Gets all certificates (DA and Noc) associated with subject", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + var res types.AllCertificatesBySubject + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.AllCertificatesBySubjectKeyPrefix, + types.AllCertificatesBySubjectKey(subject), + &res, + ) + }, + } + + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject") + flags.AddQueryFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(FlagSubject) + + return cmd +} diff --git a/x/pki/client/cli/query_all_certificates_by_subject_test.go b/x/pki/client/cli/query_all_certificates_by_subject_test.go new file mode 100644 index 000000000..9393f5a82 --- /dev/null +++ b/x/pki/client/cli/query_all_certificates_by_subject_test.go @@ -0,0 +1,162 @@ +package cli_test + +/*import ( + "fmt" + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + tmcli "github.com/cometbft/cometbft/libs/cli" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/network" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/client/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func networkWithAllCertificatesBySubjectObjects(t *testing.T, n int) (*network.Network, []types.AllCertificatesBySubject) { + t.Helper() + cfg := network.DefaultConfig() + state := types.GenesisState{} + for i := 0; i < n; i++ { + allCertificatesBySubject := types.AllCertificatesBySubject{ + Subject: strconv.Itoa(i), + + } + nullify.Fill(&allCertificatesBySubject) + state.AllCertificatesBySubjectList = append(state.AllCertificatesBySubjectList, allCertificatesBySubject) + } + buf, err := cfg.Codec.MarshalJSON(&state) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), state.AllCertificatesBySubjectList +} + +func TestShowAllCertificatesBySubject(t *testing.T) { + net, objs := networkWithAllCertificatesBySubjectObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idSubject string + + args []string + err error + obj types.AllCertificatesBySubject + }{ + { + desc: "found", + idSubject: objs[0].Subject, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idSubject: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idSubject, + + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowAllCertificatesBySubject(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetAllCertificatesBySubjectResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.AllCertificatesBySubject) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.AllCertificatesBySubject), + ) + } + }) + } +} + +func TestListAllCertificatesBySubject(t *testing.T) { + net, objs := networkWithAllCertificatesBySubjectObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListAllCertificatesBySubject(), args) + require.NoError(t, err) + var resp types.QueryAllAllCertificatesBySubjectResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.AllCertificatesBySubject), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.AllCertificatesBySubject), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListAllCertificatesBySubject(), args) + require.NoError(t, err) + var resp types.QueryAllAllCertificatesBySubjectResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.AllCertificatesBySubject), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.AllCertificatesBySubject), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListAllCertificatesBySubject(), args) + require.NoError(t, err) + var resp types.QueryAllAllCertificatesBySubjectResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.AllCertificatesBySubject), + ) + }) +}*/ diff --git a/x/pki/client/cli/query_approved_certificates_test.go b/x/pki/client/cli/query_approved_certificates_test.go index 5b49d2d65..d930d3f0b 100644 --- a/x/pki/client/cli/query_approved_certificates_test.go +++ b/x/pki/client/cli/query_approved_certificates_test.go @@ -30,7 +30,7 @@ func networkWithApprovedCertificatesObjects(t *testing.T, n int) (*network.Netwo for i := 0; i < n; i++ { approvedCertificates := types.ApprovedCertificates{ Subject: strconv.Itoa(i), - SubjectKeyId: strconv.Itoa(i), + SubjectKeyID: strconv.Itoa(i), } nullify.Fill(&approvedCertificates) state.ApprovedCertificatesList = append(state.ApprovedCertificatesList, approvedCertificates) @@ -60,7 +60,7 @@ func TestShowApprovedCertificates(t *testing.T) { { desc: "found", idSubject: objs[0].Subject, - idSubjectKeyId: objs[0].SubjectKeyId, + idSubjectKeyId: objs[0].SubjectKeyID, args: common, obj: objs[0], diff --git a/x/pki/client/cli/query_certificates.go b/x/pki/client/cli/query_certificates.go new file mode 100644 index 000000000..c484c9111 --- /dev/null +++ b/x/pki/client/cli/query_certificates.go @@ -0,0 +1,88 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func CmdListCertificates() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-certs", + Short: "Gets all certificates", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllCertificatesRequest{ + Pagination: pageReq, + } + + res, err := queryClient.CertificatesAll(context.Background(), params) + if cli.IsKeyNotFoundRPCError(err) { + return clientCtx.PrintString(cli.LightClientProxyForListQueries) + } + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowCertificates() *cobra.Command { + var ( + subject string + subjectKeyID string + ) + + cmd := &cobra.Command{ + Use: "cert", + Short: "Gets certificates by the given combination of subject and subject-key-id", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + var res types.AllCertificates + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.AllCertificatesKeyPrefix, + types.AllCertificatesKey(subject, subjectKeyID), + &res, + ) + }, + } + + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject - required") + cmd.Flags().StringVarP(&subjectKeyID, FlagSubjectKeyID, FlagSubjectKeyIDShortcut, "", "Certificate's subject key id (hex) - required") + flags.AddQueryFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(FlagSubjectKeyID) + + return cmd +} diff --git a/x/pki/client/cli/query_noc_certificates.go b/x/pki/client/cli/query_noc_certificates.go index 40824e9f8..950d6fc18 100644 --- a/x/pki/client/cli/query_noc_certificates.go +++ b/x/pki/client/cli/query_noc_certificates.go @@ -6,18 +6,20 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" ) -func CmdListNocIcaCertificates() *cobra.Command { +func CmdListNocCertificates() *cobra.Command { cmd := &cobra.Command{ - Use: "all-noc-x509-ica-certs", - Short: "Gets all NOC ICA certificates (ICACs)", + Use: "all-noc-x509-certs", + Short: "Gets all noc certificates (root and ica)", RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } pageReq, err := client.ReadPageRequest(cmd.Flags()) if err != nil { @@ -26,11 +28,14 @@ func CmdListNocIcaCertificates() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllNocIcaCertificatesRequest{ + params := &types.QueryNocCertificatesRequest{ Pagination: pageReq, } - res, err := queryClient.NocIcaCertificatesAll(context.Background(), params) + res, err := queryClient.NocCertificatesAll(context.Background(), params) + if cli.IsKeyNotFoundRPCError(err) { + return clientCtx.PrintString(cli.LightClientProxyForListQueries) + } if err != nil { return err } @@ -45,31 +50,51 @@ func CmdListNocIcaCertificates() *cobra.Command { return cmd } -func CmdShowNocIcaCertificates() *cobra.Command { - var vid int32 +func CmdShowNocCertificates() *cobra.Command { + var ( + subject string + subjectKeyID string + ) + cmd := &cobra.Command{ - Use: "noc-x509-ica-certs", - Short: "Gets NOC ICA certificates (ICACs) by VID", - Args: cobra.ExactArgs(0), + Use: "noc-x509-cert", + Short: "Gets certificates (either root or ica) " + + "by the given combination of subject and subject-key-id or just subject-key-id", + Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } - var res types.NocIcaCertificates + if subject != "" { + var res types.NocCertificates + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.NocCertificatesKeyPrefix, + types.NocCertificatesKey(subject, subjectKeyID), + &res, + ) + } + var res types.NocCertificatesBySubjectKeyID return cli.QueryWithProof( clientCtx, pkitypes.StoreKey, - types.NocIcaCertificatesKeyPrefix, - types.NocIcaCertificatesKey(vid), + types.NocCertificatesBySubjectKeyIDKeyPrefix, + types.NocCertificatesBySubjectKeyIDKey(subjectKeyID), &res, ) }, } - cmd.Flags().Int32Var(&vid, FlagVid, 0, "Vendor ID (positive non-zero)") + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject - optional") + cmd.Flags().StringVarP(&subjectKeyID, FlagSubjectKeyID, FlagSubjectKeyIDShortcut, "", "Certificate's subject key id (hex) - required") flags.AddQueryFlagsToCmd(cmd) - _ = cmd.MarkFlagRequired(FlagVid) + _ = cmd.MarkFlagRequired(FlagSubjectKeyID) return cmd } diff --git a/x/pki/client/cli/query_noc_certificates_by_subject.go b/x/pki/client/cli/query_noc_certificates_by_subject.go new file mode 100644 index 000000000..a98ae05da --- /dev/null +++ b/x/pki/client/cli/query_noc_certificates_by_subject.go @@ -0,0 +1,43 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func CmdShowNocCertificatesBySubject() *cobra.Command { + var subject string + + cmd := &cobra.Command{ + Use: "all-noc-subject-x509-certs", + Short: "Gets all noc certificates (root and ica) associated with subject", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + var res types.NocCertificatesBySubject + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.NocCertificatesBySubjectKeyPrefix, + types.NocCertificatesBySubjectKey(subject), + &res, + ) + }, + } + + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject") + flags.AddQueryFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(FlagSubject) + + return cmd +} diff --git a/x/pki/client/cli/query_noc_ica_certificates.go b/x/pki/client/cli/query_noc_ica_certificates.go new file mode 100644 index 000000000..40824e9f8 --- /dev/null +++ b/x/pki/client/cli/query_noc_ica_certificates.go @@ -0,0 +1,75 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func CmdListNocIcaCertificates() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-noc-x509-ica-certs", + Short: "Gets all NOC ICA certificates (ICACs)", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllNocIcaCertificatesRequest{ + Pagination: pageReq, + } + + res, err := queryClient.NocIcaCertificatesAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowNocIcaCertificates() *cobra.Command { + var vid int32 + cmd := &cobra.Command{ + Use: "noc-x509-ica-certs", + Short: "Gets NOC ICA certificates (ICACs) by VID", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + var res types.NocIcaCertificates + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.NocIcaCertificatesKeyPrefix, + types.NocIcaCertificatesKey(vid), + &res, + ) + }, + } + + cmd.Flags().Int32Var(&vid, FlagVid, 0, "Vendor ID (positive non-zero)") + flags.AddQueryFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(FlagVid) + + return cmd +} diff --git a/x/pki/client/cli/query_noc_certificates_test.go b/x/pki/client/cli/query_noc_ica_certificates_test.go similarity index 100% rename from x/pki/client/cli/query_noc_certificates_test.go rename to x/pki/client/cli/query_noc_ica_certificates_test.go diff --git a/x/pki/client/cli/query_proposed_certificate_revocation_test.go b/x/pki/client/cli/query_proposed_certificate_revocation_test.go index 30f30a7b3..eb07ff225 100644 --- a/x/pki/client/cli/query_proposed_certificate_revocation_test.go +++ b/x/pki/client/cli/query_proposed_certificate_revocation_test.go @@ -30,7 +30,7 @@ func networkWithProposedCertificateRevocationObjects(t *testing.T, n int) (*netw for i := 0; i < n; i++ { proposedCertificateRevocation := types.ProposedCertificateRevocation{ Subject: strconv.Itoa(i), - SubjectKeyId: strconv.Itoa(i), + SubjectKeyID: strconv.Itoa(i), } nullify.Fill(&proposedCertificateRevocation) state.ProposedCertificateRevocationList = append(state.ProposedCertificateRevocationList, proposedCertificateRevocation) @@ -60,7 +60,7 @@ func TestShowProposedCertificateRevocation(t *testing.T) { { desc: "found", idSubject: objs[0].Subject, - idSubjectKeyId: objs[0].SubjectKeyId, + idSubjectKeyId: objs[0].SubjectKeyID, args: common, obj: objs[0], diff --git a/x/pki/client/cli/query_proposed_certificate_test.go b/x/pki/client/cli/query_proposed_certificate_test.go index dc64814a8..e23fb2d72 100644 --- a/x/pki/client/cli/query_proposed_certificate_test.go +++ b/x/pki/client/cli/query_proposed_certificate_test.go @@ -30,7 +30,7 @@ func networkWithProposedCertificateObjects(t *testing.T, n int) (*network.Networ for i := 0; i < n; i++ { proposedCertificate := types.ProposedCertificate{ Subject: strconv.Itoa(i), - SubjectKeyId: strconv.Itoa(i), + SubjectKeyID: strconv.Itoa(i), } nullify.Fill(&proposedCertificate) state.ProposedCertificateList = append(state.ProposedCertificateList, proposedCertificate) @@ -60,7 +60,7 @@ func TestShowProposedCertificate(t *testing.T) { { desc: "found", idSubject: objs[0].Subject, - idSubjectKeyId: objs[0].SubjectKeyId, + idSubjectKeyId: objs[0].SubjectKeyID, args: common, obj: objs[0], diff --git a/x/pki/client/cli/query_rejected_certificate_test.go b/x/pki/client/cli/query_rejected_certificate_test.go index 9b30449c0..a1f4daa52 100644 --- a/x/pki/client/cli/query_rejected_certificate_test.go +++ b/x/pki/client/cli/query_rejected_certificate_test.go @@ -31,7 +31,7 @@ func networkWithRejectedCertificateObjects(t *testing.T, n int) (*network.Networ for i := 0; i < n; i++ { rejectedCertificate := types.RejectedCertificate{ Subject: strconv.Itoa(i), - SubjectKeyId: strconv.Itoa(i), + SubjectKeyID: strconv.Itoa(i), } nullify.Fill(&rejectedCertificate) state.RejectedCertificateList = append(state.RejectedCertificateList, rejectedCertificate) @@ -62,7 +62,7 @@ func TestShowRejectedCertificate(t *testing.T) { { desc: "found", idSubject: objs[0].Subject, - idSubjectKeyID: objs[0].SubjectKeyId, + idSubjectKeyID: objs[0].SubjectKeyID, args: common, obj: objs[0], diff --git a/x/pki/client/cli/query_revoked_certificates_test.go b/x/pki/client/cli/query_revoked_certificates_test.go index 9565a1e12..5e248adfd 100644 --- a/x/pki/client/cli/query_revoked_certificates_test.go +++ b/x/pki/client/cli/query_revoked_certificates_test.go @@ -30,7 +30,7 @@ func networkWithRevokedCertificatesObjects(t *testing.T, n int) (*network.Networ for i := 0; i < n; i++ { revokedCertificates := types.RevokedCertificates{ Subject: strconv.Itoa(i), - SubjectKeyId: strconv.Itoa(i), + SubjectKeyID: strconv.Itoa(i), } nullify.Fill(&revokedCertificates) state.RevokedCertificatesList = append(state.RevokedCertificatesList, revokedCertificates) @@ -60,7 +60,7 @@ func TestShowRevokedCertificates(t *testing.T) { { desc: "found", idSubject: objs[0].Subject, - idSubjectKeyId: objs[0].SubjectKeyId, + idSubjectKeyId: objs[0].SubjectKeyID, args: common, obj: objs[0], diff --git a/x/pki/client/cli/query_revoked_noc_ica_certificates.go b/x/pki/client/cli/query_revoked_noc_ica_certificates.go new file mode 100644 index 000000000..373836f9e --- /dev/null +++ b/x/pki/client/cli/query_revoked_noc_ica_certificates.go @@ -0,0 +1,84 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func CmdListRevokedNocIcaCertificates() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-revoked-noc-x509-ica-certs", + Short: "Gets all revoked noc ica certificates (RCACs)", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllRevokedNocIcaCertificatesRequest{ + Pagination: pageReq, + } + + res, err := queryClient.RevokedNocIcaCertificatesAll(context.Background(), params) + if cli.IsKeyNotFoundRPCError(err) { + return clientCtx.PrintString(cli.LightClientProxyForListQueries) + } + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowRevokedNocIcaCertificates() *cobra.Command { + var ( + subject string + subjectKeyID string + ) + + cmd := &cobra.Command{ + Use: "revoked-noc-x509-ica-cert", + Short: "Gets revoked noc ica certificates (RCACs)" + + "by the given combination of subject and subject-key-id", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + var res types.RevokedNocIcaCertificates + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.RevokedNocIcaCertificatesKeyPrefix, + types.RevokedNocIcaCertificatesKey(subject, subjectKeyID), + &res, + ) + }, + } + + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject") + cmd.Flags().StringVarP(&subjectKeyID, FlagSubjectKeyID, FlagSubjectKeyIDShortcut, "", "Certificate's subject key id (hex)") + flags.AddQueryFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(FlagSubject) + _ = cmd.MarkFlagRequired(FlagSubjectKeyID) + + return cmd +} diff --git a/x/pki/client/cli/query_revoked_noc_ica_certificates_test.go b/x/pki/client/cli/query_revoked_noc_ica_certificates_test.go new file mode 100644 index 000000000..696ed76bc --- /dev/null +++ b/x/pki/client/cli/query_revoked_noc_ica_certificates_test.go @@ -0,0 +1,167 @@ +package cli_test + +// import ( +// "fmt" +// "strconv" +// "testing" +// +// "github.com/cosmos/cosmos-sdk/client/flags" +// clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" +// "github.com/stretchr/testify/require" +// tmcli "github.com/cometbft/cometbft/libs/cli" +// "google.golang.org/grpc/codes" +// "google.golang.org/grpc/status" +// +// "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/network" +// "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" +// "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/client/cli" +// "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +//) +// +//// Prevent strconv unused error +// var _ = strconv.IntSize +// +// func networkWithRevokedNocIcaCertificatesObjects(t *testing.T, n int) (*network.Network, []types.RevokedNocIcaCertificates) { +// t.Helper() +// cfg := network.DefaultConfig() +// state := types.GenesisState{} +// for i := 0; i < n; i++ { +// revokedNocIcaCertificates := types.RevokedNocIcaCertificates{ +// Subject: strconv.Itoa(i), +// SubjectKeyID: strconv.Itoa(i), +// +// } +// nullify.Fill(&revokedNocIcaCertificates) +// state.RevokedNocIcaCertificatesList = append(state.RevokedNocIcaCertificatesList, revokedNocIcaCertificates) +// } +// buf, err := cfg.Codec.MarshalJSON(&state) +// require.NoError(t, err) +// cfg.GenesisState[types.ModuleName] = buf +// return network.New(t, cfg), state.RevokedNocIcaCertificatesList +//} +// +// func TestShowRevokedNocIcaCertificates(t *testing.T) { +// net, objs := networkWithRevokedNocIcaCertificatesObjects(t, 2) +// +// ctx := net.Validators[0].ClientCtx +// common := []string{ +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// } +// tests := []struct { +// desc string +// idSubject string +// idSubjectKeyId string +// +// args []string +// err error +// obj types.RevokedNocIcaCertificates +// }{ +// { +// desc: "found", +// idSubject: objs[0].Subject, +// idSubjectKeyId: objs[0].SubjectKeyID, +// +// args: common, +// obj: objs[0], +// }, +// { +// desc: "not found", +// idSubject: strconv.Itoa(100000), +// idSubjectKeyId: strconv.Itoa(100000), +// +// args: common, +// err: status.Error(codes.NotFound, "not found"), +// }, +// } +// for _, tc := range tests { +// t.Run(tc.desc, func(t *testing.T) { +// args := []string{ +// tc.idSubject, +// tc.idSubjectKeyId, +// +// } +// args = append(args, tc.args...) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowRevokedNocIcaCertificates(), args) +// if tc.err != nil { +// stat, ok := status.FromError(tc.err) +// require.True(t, ok) +// require.ErrorIs(t, stat.Err(), tc.err) +// } else { +// require.NoError(t, err) +// var resp types.QueryGetRevokedNocIcaCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.NotNil(t, resp.RevokedNocIcaCertificates) +// require.Equal(t, +// nullify.Fill(&tc.obj), +// nullify.Fill(&resp.RevokedNocIcaCertificates), +// ) +// } +// }) +// } +//} +// +// func TestListRevokedNocIcaCertificates(t *testing.T) { +// net, objs := networkWithRevokedNocIcaCertificatesObjects(t, 5) +// +// ctx := net.Validators[0].ClientCtx +// request := func(next []byte, offset, limit uint64, total bool) []string { +// args := []string{ +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// } +// if next == nil { +// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) +// } else { +// args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) +// } +// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) +// if total { +// args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) +// } +// return args +// } +// t.Run("ByOffset", func(t *testing.T) { +// step := 2 +// for i := 0; i < len(objs); i += step { +// args := request(nil, uint64(i), uint64(step), false) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListRevokedNocIcaCertificates(), args) +// require.NoError(t, err) +// var resp types.QueryAllRevokedNocIcaCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.LessOrEqual(t, len(resp.RevokedNocIcaCertificates), step) +// require.Subset(t, +// nullify.Fill(objs), +// nullify.Fill(resp.RevokedNocIcaCertificates), +// ) +// } +// }) +// t.Run("ByKey", func(t *testing.T) { +// step := 2 +// var next []byte +// for i := 0; i < len(objs); i += step { +// args := request(next, 0, uint64(step), false) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListRevokedNocIcaCertificates(), args) +// require.NoError(t, err) +// var resp types.QueryAllRevokedNocIcaCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.LessOrEqual(t, len(resp.RevokedNocIcaCertificates), step) +// require.Subset(t, +// nullify.Fill(objs), +// nullify.Fill(resp.RevokedNocIcaCertificates), +// ) +// next = resp.Pagination.NextKey +// } +// }) +// t.Run("Total", func(t *testing.T) { +// args := request(nil, 0, uint64(len(objs)), true) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListRevokedNocIcaCertificates(), args) +// require.NoError(t, err) +// var resp types.QueryAllRevokedNocIcaCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.NoError(t, err) +// require.Equal(t, len(objs), int(resp.Pagination.Total)) +// require.ElementsMatch(t, +// nullify.Fill(objs), +// nullify.Fill(resp.RevokedNocIcaCertificates), +// ) +// }) +//} diff --git a/x/pki/client/cli/query_revoked_noc_root_certificates_test.go b/x/pki/client/cli/query_revoked_noc_root_certificates_test.go index cf13d77ac..4bfbe1817 100644 --- a/x/pki/client/cli/query_revoked_noc_root_certificates_test.go +++ b/x/pki/client/cli/query_revoked_noc_root_certificates_test.go @@ -32,7 +32,7 @@ func networkWithRevokedNocRootCertificatesObjects(t *testing.T, n int) (*network for i := 0; i < n; i++ { revokedNocRootCertificates := types.RevokedNocRootCertificates{ Subject: strconv.Itoa(i), - SubjectKeyId: strconv.Itoa(i), + SubjectKeyID: strconv.Itoa(i), } nullify.Fill(&revokedNocRootCertificates) state.RevokedNocRootCertificatesList = append(state.RevokedNocRootCertificatesList, revokedNocRootCertificates) @@ -63,7 +63,7 @@ func TestShowRevokedNocRootCertificates(t *testing.T) { { desc: "found", idSubject: objs[0].Subject, - idSubjectKeyID: objs[0].SubjectKeyId, + idSubjectKeyID: objs[0].SubjectKeyID, args: common, obj: objs[0], diff --git a/x/pki/genesis.go b/x/pki/genesis.go index 0258b6e68..d96a8edb4 100644 --- a/x/pki/genesis.go +++ b/x/pki/genesis.go @@ -77,6 +77,30 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.NocCertificatesByVidAndSkidList { k.SetNocCertificatesByVidAndSkid(ctx, elem) } + // Set all the nocCertificatesBySubjectKeyId + for _, elem := range genState.NocCertificatesBySubjectKeyIDList { + k.SetNocCertificatesBySubjectKeyID(ctx, elem) + } + // Set all the nocCertificates + for _, elem := range genState.NocCertificatesList { + k.SetNocCertificates(ctx, elem) + } + // Set all the nocCertificatesBySubject + for _, elem := range genState.NocCertificatesBySubjectList { + k.SetNocCertificatesBySubject(ctx, elem) + } + // Set all the certificates + for _, elem := range genState.CertificatesList { + k.SetAllCertificates(ctx, elem) + } + // Set all the revokedNocIcaCertificates + for _, elem := range genState.RevokedNocIcaCertificatesList { + k.SetRevokedNocIcaCertificates(ctx, elem) + } + // Set all the allCertificatesBySubject + for _, elem := range genState.AllCertificatesBySubjectList { + k.SetAllCertificatesBySubject(ctx, elem) + } // this line is used by starport scaffolding # genesis/module/init } @@ -109,6 +133,12 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.NocIcaCertificatesList = k.GetAllNocIcaCertificates(ctx) genesis.RevokedNocRootCertificatesList = k.GetAllRevokedNocRootCertificates(ctx) genesis.NocCertificatesByVidAndSkidList = k.GetAllNocCertificatesByVidAndSkid(ctx) + genesis.NocCertificatesList = k.GetAllNocCertificates(ctx) + genesis.NocCertificatesBySubjectList = k.GetAllNocCertificatesBySubject(ctx) + genesis.NocCertificatesBySubjectKeyIDList = k.GetAllNocCertificatesBySubjectKeyID(ctx) + genesis.CertificatesList = k.GetAllAllCertificates(ctx) + genesis.RevokedNocIcaCertificatesList = k.GetAllRevokedNocIcaCertificates(ctx) + genesis.AllCertificatesBySubjectList = k.GetAllAllCertificatesBySubject(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/pki/genesis_test.go b/x/pki/genesis_test.go index b6d22554c..b0b4cf4cd 100644 --- a/x/pki/genesis_test.go +++ b/x/pki/genesis_test.go @@ -170,6 +170,60 @@ func TestGenesis(t *testing.T) { SubjectKeyId: "1", }, }, + NocCertificatesBySubjectKeyIDList: []types.NocCertificatesBySubjectKeyID{ + { + SubjectKeyId: "0", + }, + { + SubjectKeyId: "1", + }, + }, + NocCertificatesList: []types.NocCertificates{ + { + Subject: "0", + SubjectKeyId: "0", + }, + { + Subject: "1", + SubjectKeyId: "1", + }, + }, + NocCertificatesBySubjectList: []types.NocCertificatesBySubject{ + { + Subject: "0", + }, + { + Subject: "1", + }, + }, + CertificatesList: []types.AllCertificates{ + { + Subject: "0", + SubjectKeyId: "0", + }, + { + Subject: "1", + SubjectKeyId: "1", + }, + }, + RevokedNocIcaCertificatesList: []types.RevokedNocIcaCertificates{ + { + Subject: "0", + SubjectKeyId: "0", + }, + { + Subject: "1", + SubjectKeyId: "1", + }, + }, + AllCertificatesBySubjectList: []types.AllCertificatesBySubject{ + { + Subject: "0", + }, + { + Subject: "1", + }, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -195,5 +249,11 @@ func TestGenesis(t *testing.T) { require.ElementsMatch(t, genesisState.NocIcaCertificatesList, got.NocIcaCertificatesList) require.ElementsMatch(t, genesisState.RevokedNocRootCertificatesList, got.RevokedNocRootCertificatesList) require.ElementsMatch(t, genesisState.NocCertificatesByVidAndSkidList, got.NocCertificatesByVidAndSkidList) + require.ElementsMatch(t, genesisState.NocCertificatesBySubjectKeyIDList, got.NocCertificatesBySubjectKeyIDList) + require.ElementsMatch(t, genesisState.NocCertificatesList, got.NocCertificatesList) + require.ElementsMatch(t, genesisState.NocCertificatesBySubjectList, got.NocCertificatesBySubjectList) + require.ElementsMatch(t, genesisState.CertificatesList, got.CertificatesList) + require.ElementsMatch(t, genesisState.RevokedNocIcaCertificatesList, got.RevokedNocIcaCertificatesList) + require.ElementsMatch(t, genesisState.AllCertificatesBySubjectList, got.AllCertificatesBySubjectList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/pki/handler_add_noc_cert_test.go b/x/pki/handler_add_noc_cert_test.go index 9c1464e19..f3be266fb 100644 --- a/x/pki/handler_add_noc_cert_test.go +++ b/x/pki/handler_add_noc_cert_test.go @@ -38,22 +38,22 @@ func TestHandler_AddNocX509Cert_AddNew(t *testing.T) { require.NoError(t, err) // query noc root certificate by Subject and SKID - approvedCertificate, err := querySingleApprovedCertificate(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + nocCertificate, err := querySingleNocCertificate(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) - require.Equal(t, testconstants.NocCert1Subject, approvedCertificate.Subject) - require.Equal(t, testconstants.NocCert1SubjectKeyID, approvedCertificate.SubjectKeyId) - require.Equal(t, testconstants.NocCert1SerialNumber, approvedCertificate.SerialNumber) - require.Equal(t, testconstants.SchemaVersion, approvedCertificate.SchemaVersion) + require.Equal(t, testconstants.NocCert1Subject, nocCertificate.Subject) + require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCertificate.SubjectKeyId) + require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificate.SerialNumber) + require.Equal(t, testconstants.SchemaVersion, nocCertificate.SchemaVersion) // query noc root certificate by SubjectKeyID - approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + nocCertificatesBySubjectKeyID, err := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID)) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID[0].Certs)) - require.Equal(t, testconstants.NocCert1SerialNumber, approvedCertificatesBySubjectKeyID[0].Certs[0].SerialNumber) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID)) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID[0].Certs)) + require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificatesBySubjectKeyID[0].Certs[0].SerialNumber) // query noc root certificate by VID - nocRootCertificate, err := querySingleNocCertificate(setup, vid) + nocRootCertificate, err := querySingleNocCertificateByVid(setup, vid) require.NoError(t, err) require.Equal(t, testconstants.NocCert1SerialNumber, nocRootCertificate.SerialNumber) @@ -100,9 +100,9 @@ func TestHandler_AddNocX509Cert_Renew(t *testing.T) { ) newNocCertificate.SerialNumber = testconstants.TestSerialNumber - setup.Keeper.AddApprovedCertificate(setup.Ctx, newNocCertificate) - setup.Keeper.AddApprovedCertificateBySubjectKeyID(setup.Ctx, newNocCertificate) - setup.Keeper.AddApprovedCertificateBySubject(setup.Ctx, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) + setup.Keeper.AddNocCertificate(setup.Ctx, newNocCertificate) + setup.Keeper.AddNocCertificateBySubjectKeyID(setup.Ctx, newNocCertificate) + setup.Keeper.AddNocCertificateBySubject(setup.Ctx, newNocCertificate) setup.Keeper.AddNocIcaCertificate(setup.Ctx, newNocCertificate) uniqueCertificate := types.UniqueCertificate{ Issuer: newNocCertificate.Issuer, @@ -117,32 +117,32 @@ func TestHandler_AddNocX509Cert_Renew(t *testing.T) { require.NoError(t, err) // query noc certificate by Subject and SKID - approvedCertificates, err := queryApprovedCertificates(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) + nocCertificates, err := queryNocCertificates(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) require.NoError(t, err) - require.Equal(t, len(approvedCertificates.Certs), 2) - require.Equal(t, &newNocCertificate, approvedCertificates.Certs[0]) + require.Equal(t, len(nocCertificates.Certs), 2) + require.Equal(t, &newNocCertificate, nocCertificates.Certs[0]) // query noc certificate by Subject - approvedCertificatesBySubject, err := queryApprovedCertificatesBySubject(setup, newNocCertificate.Subject) + nocCertificatesBySubject, err := queryNocCertificatesBySubject(setup, newNocCertificate.Subject) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubject.SubjectKeyIds)) + require.Equal(t, 1, len(nocCertificatesBySubject.SubjectKeyIds)) // query noc certificate by SKID - approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) + nocCertificatesBySubjectKeyID, err := queryAllNocCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID)) - require.Equal(t, 2, len(approvedCertificatesBySubjectKeyID[0].Certs)) - require.Equal(t, testconstants.NocCert1Subject, approvedCertificatesBySubjectKeyID[0].Certs[0].Subject) - require.Equal(t, testconstants.NocCert1SubjectKeyID, approvedCertificatesBySubjectKeyID[0].Certs[0].SubjectKeyId) - require.Equal(t, vid, approvedCertificatesBySubjectKeyID[0].Certs[0].Vid) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID)) + require.Equal(t, 2, len(nocCertificatesBySubjectKeyID[0].Certs)) + require.Equal(t, testconstants.NocCert1Subject, nocCertificatesBySubjectKeyID[0].Certs[0].Subject) + require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCertificatesBySubjectKeyID[0].Certs[0].SubjectKeyId) + require.Equal(t, vid, nocCertificatesBySubjectKeyID[0].Certs[0].Vid) // query noc certificate by VID - nocCertificates, err := queryNocCertificates(setup, testconstants.Vid) + nocCertificatesByVid, err := queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) - require.Equal(t, len(nocCertificates.Certs), 2) - require.Equal(t, testconstants.NocCert1Subject, nocCertificates.Certs[0].Subject) - require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCertificates.Certs[0].SubjectKeyId) - require.Equal(t, vid, nocCertificates.Certs[0].Vid) + require.Equal(t, len(nocCertificatesByVid.Certs), 2) + require.Equal(t, testconstants.NocCert1Subject, nocCertificatesByVid.Certs[0].Subject) + require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCertificatesByVid.Certs[0].SubjectKeyId) + require.Equal(t, vid, nocCertificatesByVid.Certs[0].Vid) } func TestHandler_AddNocX509Cert_Root_VID_Does_Not_Equal_To_AccountVID(t *testing.T) { @@ -239,15 +239,15 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { { name: "Duplicate", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: testconstants.NocCert1SerialNumber, - IsRoot: false, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocCert1SerialNumber, + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocCert: testconstants.NocCert1, err: pkitypes.ErrCertificateAlreadyExists, @@ -255,15 +255,15 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { { name: "ExistingIsRootCert", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: testconstants.NocRootCert1SerialNumber, - IsRoot: true, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocRootCert1SerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocCert: testconstants.NocCert1, err: sdkerrors.ErrUnauthorized, @@ -271,15 +271,15 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { { name: "ExistingWithDifferentIssuer", existingCert: &types.Certificate{ - Issuer: testconstants.RootIssuer, - AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: "1234", - IsRoot: false, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.RootIssuer, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocCert: testconstants.NocCert1, err: sdkerrors.ErrUnauthorized, @@ -287,15 +287,15 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { { name: "ExistingWithDifferentAuthorityKeyId", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - AuthorityKeyId: testconstants.RootSubjectKeyID, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: "1234", - IsRoot: false, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.RootSubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocCert: testconstants.NocCert1, err: sdkerrors.ErrUnauthorized, @@ -303,15 +303,15 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { { name: "ExistingNotNocCert", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: "1234", - IsRoot: false, - IsNoc: false, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + CertificateType: types.CertificateType_DeviceAttestationPKI, + Vid: testconstants.Vid, }, nocCert: testconstants.NocCert1, err: pkitypes.ErrInappropriateCertificateType, @@ -319,15 +319,15 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { { name: "ExistingCertWithDifferentVid", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: "1234", - IsRoot: false, - IsNoc: true, - Vid: testconstants.VendorID1, + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.VendorID1, }, nocCert: testconstants.NocCert1, err: sdkerrors.ErrUnauthorized, @@ -344,7 +344,7 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { addNocRootCertificate(setup, accAddress, testconstants.NocRootCert1, vid) // add the existing certificate - setup.Keeper.AddApprovedCertificate(setup.Ctx, *tc.existingCert) + setup.Keeper.AddAllCertificate(setup.Ctx, *tc.existingCert) uniqueCertificate := types.UniqueCertificate{ Issuer: tc.existingCert.Issuer, SerialNumber: tc.existingCert.SerialNumber, @@ -370,38 +370,3 @@ func addNocRootCertificate(setup *TestSetup, address sdk.AccAddress, pemCert str require.NoError(setup.T, err) require.NotNil(setup.T, nocCerts) } - -func querySingleNocCertificate( - setup *TestSetup, - vid int32, -) (*types.Certificate, error) { - certificates, err := queryNocCertificates(setup, vid) - if err != nil { - return nil, err - } - - if len(certificates.Certs) > 1 { - require.Fail(setup.T, "More than 1 certificate returned") - } - - return certificates.Certs[0], nil -} - -func queryNocCertificates( - setup *TestSetup, - vid int32, -) (*types.NocIcaCertificates, error) { - // query certificate - req := &types.QueryGetNocIcaCertificatesRequest{Vid: vid} - - resp, err := setup.Keeper.NocIcaCertificates(setup.Wctx, req) - if err != nil { - require.Nil(setup.T, resp) - - return nil, err - } - - require.NotNil(setup.T, resp) - - return &resp.NocIcaCertificates, nil -} diff --git a/x/pki/handler_add_noc_root_cert_test.go b/x/pki/handler_add_noc_root_cert_test.go index 67f9d1bd3..fb465e024 100644 --- a/x/pki/handler_add_noc_root_cert_test.go +++ b/x/pki/handler_add_noc_root_cert_test.go @@ -78,14 +78,14 @@ func TestHandler_AddNocX509RootCert_CertificateExist(t *testing.T) { { name: "Duplicate", existingCert: &types.Certificate{ - Issuer: testconstants.RootIssuer, - Subject: testconstants.RootSubject, - SubjectAsText: testconstants.RootSubjectAsText, - SubjectKeyId: testconstants.RootSubjectKeyID, - SerialNumber: testconstants.RootSerialNumber, - IsRoot: true, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.RootIssuer, + Subject: testconstants.RootSubject, + SubjectAsText: testconstants.RootSubjectAsText, + SubjectKeyId: testconstants.RootSubjectKeyID, + SerialNumber: testconstants.RootSerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.RootCertPem, err: pkitypes.ErrCertificateAlreadyExists, @@ -93,14 +93,14 @@ func TestHandler_AddNocX509RootCert_CertificateExist(t *testing.T) { { name: "ExistingNonRootCert", existingCert: &types.Certificate{ - Issuer: testconstants.TestIssuer, - Subject: testconstants.RootSubject, - SubjectAsText: testconstants.RootSubjectAsText, - SubjectKeyId: testconstants.RootSubjectKeyID, - SerialNumber: testconstants.TestSerialNumber, - IsRoot: false, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.TestIssuer, + Subject: testconstants.RootSubject, + SubjectAsText: testconstants.RootSubjectAsText, + SubjectKeyId: testconstants.RootSubjectKeyID, + SerialNumber: testconstants.TestSerialNumber, + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.RootCertPem, err: sdkerrors.ErrUnauthorized, @@ -108,14 +108,14 @@ func TestHandler_AddNocX509RootCert_CertificateExist(t *testing.T) { { name: "ExistingNotNocCert", existingCert: &types.Certificate{ - Issuer: testconstants.RootIssuer, - Subject: testconstants.RootSubject, - SubjectAsText: testconstants.RootSubjectAsText, - SubjectKeyId: testconstants.RootSubjectKeyID, - SerialNumber: testconstants.TestSerialNumber, - IsRoot: true, - IsNoc: false, - Vid: testconstants.Vid, + Issuer: testconstants.RootIssuer, + Subject: testconstants.RootSubject, + SubjectAsText: testconstants.RootSubjectAsText, + SubjectKeyId: testconstants.RootSubjectKeyID, + SerialNumber: testconstants.TestSerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_DeviceAttestationPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.RootCertPem, err: pkitypes.ErrInappropriateCertificateType, @@ -123,14 +123,14 @@ func TestHandler_AddNocX509RootCert_CertificateExist(t *testing.T) { { name: "ExistingCertWithDifferentVid", existingCert: &types.Certificate{ - Issuer: testconstants.RootIssuer, - Subject: testconstants.RootSubject, - SubjectAsText: testconstants.RootSubjectAsText, - SubjectKeyId: testconstants.RootSubjectKeyID, - SerialNumber: testconstants.GoogleSerialNumber, - IsRoot: true, - IsNoc: true, - Vid: testconstants.VendorID1, + Issuer: testconstants.RootIssuer, + Subject: testconstants.RootSubject, + SubjectAsText: testconstants.RootSubjectAsText, + SubjectKeyId: testconstants.RootSubjectKeyID, + SerialNumber: testconstants.GoogleSerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.VendorID1, }, nocRoorCert: testconstants.RootCertPem, err: sdkerrors.ErrUnauthorized, @@ -143,7 +143,7 @@ func TestHandler_AddNocX509RootCert_CertificateExist(t *testing.T) { setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, testconstants.Vid) // add the existing certificate - setup.Keeper.AddApprovedCertificate(setup.Ctx, *tc.existingCert) + setup.Keeper.AddAllCertificate(setup.Ctx, *tc.existingCert) uniqueCertificate := types.UniqueCertificate{ Issuer: tc.existingCert.Issuer, SerialNumber: tc.existingCert.SerialNumber, @@ -166,7 +166,7 @@ func TestHandler_AddNocX509RootCert_AddNew(t *testing.T) { // new NOC root certificate newNocCertificate := rootCertificate(accAddress) - newNocCertificate.IsNoc = true + newNocCertificate.CertificateType = types.CertificateType_OperationalPKI newNocCertificate.Approvals = nil newNocCertificate.Rejects = nil @@ -176,21 +176,21 @@ func TestHandler_AddNocX509RootCert_AddNew(t *testing.T) { require.NoError(t, err) // query noc root certificate by Subject and SKID - approvedCertificate, err := querySingleApprovedCertificate(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) + nocCertificate, err := querySingleNocCertificate(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) require.NoError(t, err) - require.Equal(t, &newNocCertificate, approvedCertificate) + require.Equal(t, &newNocCertificate, nocCertificate) // query noc root certificate by Subject - approvedCertificatesBySubject, err := queryApprovedCertificatesBySubject(setup, newNocCertificate.Subject) + nocCertificatesBySubject, err := queryNocCertificatesBySubject(setup, newNocCertificate.Subject) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubject.SubjectKeyIds)) - require.Equal(t, newNocCertificate.SubjectKeyId, approvedCertificatesBySubject.SubjectKeyIds[0]) + require.Equal(t, 1, len(nocCertificatesBySubject.SubjectKeyIds)) + require.Equal(t, newNocCertificate.SubjectKeyId, nocCertificatesBySubject.SubjectKeyIds[0]) - approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) + nocCertificatesBySubjectKeyID, err := queryAllNocCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID)) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID[0].Certs)) - require.Equal(t, &newNocCertificate, approvedCertificatesBySubjectKeyID[0].Certs[0]) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID)) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID[0].Certs)) + require.Equal(t, &newNocCertificate, nocCertificatesBySubjectKeyID[0].Certs[0]) // query noc root certificate by VID nocRootCertificate, err := querySingleNocRootCertificate(setup, testconstants.Vid) @@ -217,12 +217,15 @@ func TestHandler_AddNocX509RootCert_Renew(t *testing.T) { // Store the NOC root certificate nocRootCertificate := rootCertificate(accAddress) nocRootCertificate.SerialNumber = testconstants.TestSerialNumber - nocRootCertificate.IsNoc = true + nocRootCertificate.CertificateType = types.CertificateType_OperationalPKI nocRootCertificate.Approvals = nil nocRootCertificate.Rejects = nil - setup.Keeper.AddApprovedCertificate(setup.Ctx, nocRootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, nocRootCertificate) + setup.Keeper.AddNocCertificate(setup.Ctx, nocRootCertificate) setup.Keeper.AddNocRootCertificate(setup.Ctx, nocRootCertificate) + setup.Keeper.AddNocCertificateBySubject(setup.Ctx, nocRootCertificate) + uniqueCertificate := types.UniqueCertificate{ Issuer: nocRootCertificate.Issuer, SerialNumber: nocRootCertificate.SerialNumber, @@ -232,7 +235,7 @@ func TestHandler_AddNocX509RootCert_Renew(t *testing.T) { // new NOC root certificate newNocCertificate := rootCertificate(accAddress) - newNocCertificate.IsNoc = true + newNocCertificate.CertificateType = types.CertificateType_OperationalPKI newNocCertificate.Approvals = nil newNocCertificate.Rejects = nil @@ -242,23 +245,23 @@ func TestHandler_AddNocX509RootCert_Renew(t *testing.T) { require.NoError(t, err) // query noc root certificate by Subject and SKID - approvedCertificates, err := queryApprovedCertificates(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) + nocCertificates, err := queryNocCertificates(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) require.NoError(t, err) - require.Equal(t, len(approvedCertificates.Certs), 2) - require.Equal(t, &newNocCertificate, approvedCertificates.Certs[1]) + require.Equal(t, len(nocCertificates.Certs), 2) + require.Equal(t, &newNocCertificate, nocCertificates.Certs[1]) // query noc root certificate by Subject - approvedCertificatesBySubject, err := queryApprovedCertificatesBySubject(setup, newNocCertificate.Subject) + nocCertificatesBySubject, err := queryNocCertificatesBySubject(setup, newNocCertificate.Subject) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubject.SubjectKeyIds)) - require.Equal(t, newNocCertificate.SubjectKeyId, approvedCertificatesBySubject.SubjectKeyIds[0]) + require.Equal(t, 1, len(nocCertificatesBySubject.SubjectKeyIds)) + require.Equal(t, newNocCertificate.SubjectKeyId, nocCertificatesBySubject.SubjectKeyIds[0]) // query noc root certificate by SKID - approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) + nocCertificatesBySubjectKeyID, err := queryAllNocCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) require.NoError(t, err) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID)) - require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID[0].Certs)) - require.Equal(t, &newNocCertificate, approvedCertificatesBySubjectKeyID[0].Certs[0]) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID)) + require.Equal(t, 1, len(nocCertificatesBySubjectKeyID[0].Certs)) + require.Equal(t, &newNocCertificate, nocCertificatesBySubjectKeyID[0].Certs[0]) // query noc root certificate by VID nocRootCertificates, err := queryNocRootCertificates(setup, testconstants.Vid) @@ -272,75 +275,3 @@ func TestHandler_AddNocX509RootCert_Renew(t *testing.T) { require.Equal(t, &newNocCertificate, renewedNocRootCertificate) require.Equal(t, float32(1), tq) } - -func querySingleNocRootCertificate( - setup *TestSetup, - vid int32, -) (*types.Certificate, error) { - certificates, err := queryNocRootCertificates(setup, vid) - if err != nil { - return nil, err - } - - if len(certificates.Certs) > 1 { - require.Fail(setup.T, "More than 1 certificate returned") - } - - return certificates.Certs[0], nil -} - -func queryNocRootCertificates( - setup *TestSetup, - vid int32, -) (*types.NocRootCertificates, error) { - // query certificate - req := &types.QueryGetNocRootCertificatesRequest{Vid: vid} - - resp, err := setup.Keeper.NocRootCertificates(setup.Wctx, req) - if err != nil { - require.Nil(setup.T, resp) - - return nil, err - } - - require.NotNil(setup.T, resp) - - return &resp.NocRootCertificates, nil -} - -func querySingleNocCertificateByVidAndSkid( - setup *TestSetup, - vid int32, - subjectKeyID string, -) (*types.Certificate, float32, error) { - certificates, err := queryNocCertificatesByVidAndSkid(setup, vid, subjectKeyID) - if err != nil { - return nil, 0, err - } - - if len(certificates.Certs) > 1 { - require.Fail(setup.T, "More than 1 certificate returned") - } - - return certificates.Certs[0], certificates.Tq, nil -} - -func queryNocCertificatesByVidAndSkid( - setup *TestSetup, - vid int32, - subjectKeyID string, -) (*types.NocCertificatesByVidAndSkid, error) { - // query certificate - req := &types.QueryGetNocCertificatesByVidAndSkidRequest{Vid: vid, SubjectKeyId: subjectKeyID} - - resp, err := setup.Keeper.NocCertificatesByVidAndSkid(setup.Wctx, req) - if err != nil { - require.Nil(setup.T, resp) - - return nil, err - } - - require.NotNil(setup.T, resp) - - return &resp.NocCertificatesByVidAndSkid, nil -} diff --git a/x/pki/handler_add_non_root_cert_test.go b/x/pki/handler_add_non_root_cert_test.go index e8d0e53b8..1dc4014e2 100644 --- a/x/pki/handler_add_non_root_cert_test.go +++ b/x/pki/handler_add_non_root_cert_test.go @@ -18,7 +18,7 @@ func TestHandler_AddX509Cert(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) - setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) accAddress := GenerateAccAddress() setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, 1) @@ -104,7 +104,7 @@ func TestHandler_AddX509Cert_ForDuplicate(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) - setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) accAddress := GenerateAccAddress() setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, 1) @@ -124,7 +124,7 @@ func TestHandler_AddX509Cert_ForExistingNocCertificate(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) - setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) vendorAccAddress := GenerateAccAddress() setup.AddAccount(vendorAccAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, testconstants.Vid) @@ -132,9 +132,9 @@ func TestHandler_AddX509Cert_ForExistingNocCertificate(t *testing.T) { // Store the NOC certificate nocCertificate := intermediateCertificateNoVid(vendorAccAddress) nocCertificate.SerialNumber = testconstants.TestSerialNumber - nocCertificate.IsNoc = true + nocCertificate.CertificateType = types.CertificateType_OperationalPKI - setup.Keeper.AddApprovedCertificate(setup.Ctx, nocCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, nocCertificate) setup.Keeper.AddNocIcaCertificate(setup.Ctx, nocCertificate) uniqueCertificate := types.UniqueCertificate{ Issuer: nocCertificate.Issuer, @@ -157,7 +157,7 @@ func TestHandler_AddX509Cert_NoRootCert(t *testing.T) { // add intermediate certificate intermediateCertificate := intermediateCertificateNoVid(vendorAccAddress) - setup.Keeper.AddApprovedCertificate(setup.Ctx, intermediateCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, intermediateCertificate) // add leaf x509 certificate addX509Cert := types.NewMsgAddX509Cert(vendorAccAddress.String(), testconstants.LeafCertPem, testconstants.CertSchemaVersion) @@ -210,6 +210,7 @@ func TestHandler_AddX509Cert_ForDifferentSerialNumber(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) vendorAccAddress := GenerateAccAddress() @@ -222,6 +223,7 @@ func TestHandler_AddX509Cert_ForDifferentSerialNumber(t *testing.T) { setup.Ctx, uniqueCertificate(intermediateCertificate.Issuer, intermediateCertificate.SerialNumber), ) + setup.Keeper.AddAllCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, intermediateCertificate) // store intermediate certificate second time @@ -268,7 +270,7 @@ func TestHandler_AddX509Cert_ForFailedCertificateVerification(t *testing.T) { invalidRootCertificate := types.NewRootCertificate(testconstants.StubCertPem, testconstants.RootSubject, testconstants.RootSubjectAsText, testconstants.RootSubjectKeyID, testconstants.RootSerialNumber, setup.Trustee1.String(), []*types.Grant{}, []*types.Grant{}, testconstants.Vid, testconstants.SchemaVersion) - setup.Keeper.AddApprovedCertificate(setup.Ctx, invalidRootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, invalidRootCertificate) vendorAccAddress := GenerateAccAddress() setup.AddAccount(vendorAccAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, testconstants.Vid) @@ -342,6 +344,7 @@ func TestHandler_AddX509Cert_EachChildCertRefersToTwoParentCerts(t *testing.T) { // store root certificate rootCert := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCert) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCert) setup.Keeper.SetUniqueCertificate(setup.Ctx, uniqueCertificate(rootCert.Subject, rootCert.SerialNumber)) @@ -349,6 +352,7 @@ func TestHandler_AddX509Cert_EachChildCertRefersToTwoParentCerts(t *testing.T) { rootCert = rootCertificate(setup.Trustee1) rootCert.SerialNumber = SerialNumber + setup.Keeper.AddAllCertificate(setup.Ctx, rootCert) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCert) setup.Keeper.SetUniqueCertificate(setup.Ctx, uniqueCertificate(rootCert.Subject, rootCert.SerialNumber)) @@ -359,6 +363,7 @@ func TestHandler_AddX509Cert_EachChildCertRefersToTwoParentCerts(t *testing.T) { intermediateCertificate := intermediateCertificateNoVid(vendorAccAddress) intermediateCertificate.SerialNumber = SerialNumber + setup.Keeper.AddAllCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.SetUniqueCertificate( setup.Ctx, @@ -425,7 +430,7 @@ func TestHandler_AddX509Cert_ByNotOwnerButSameVendor(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) - setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) // add first vendor account with VID = 1 vendorAccAddress1 := GenerateAccAddress() @@ -434,7 +439,7 @@ func TestHandler_AddX509Cert_ByNotOwnerButSameVendor(t *testing.T) { // Store an intermediate certificate with the first vendor account as the owner intermediateCertificate := intermediateCertificateNoVid(vendorAccAddress1) intermediateCertificate.SerialNumber = SerialNumber - setup.Keeper.AddApprovedCertificate(setup.Ctx, intermediateCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.AddApprovedCertificateBySubjectKeyID(setup.Ctx, intermediateCertificate) setup.Keeper.SetUniqueCertificate( setup.Ctx, @@ -456,7 +461,7 @@ func TestHandler_AddX509Cert_ByOtherVendor(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) - setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) // add first vendor account with VID = 1 vendorAccAddress1 := GenerateAccAddress() @@ -465,7 +470,7 @@ func TestHandler_AddX509Cert_ByOtherVendor(t *testing.T) { // Store an intermediate certificate with the first vendor account as the owner intermediateCertificate := intermediateCertificateNoVid(vendorAccAddress1) intermediateCertificate.SerialNumber = SerialNumber - setup.Keeper.AddApprovedCertificate(setup.Ctx, intermediateCertificate) + setup.Keeper.AddAllCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.AddApprovedCertificateBySubjectKeyID(setup.Ctx, intermediateCertificate) setup.Keeper.SetUniqueCertificate( setup.Ctx, diff --git a/x/pki/handler_remove_noc_ica_cert_test.go b/x/pki/handler_remove_noc_ica_cert_test.go index 24ad4f0ff..2302aacf7 100644 --- a/x/pki/handler_remove_noc_ica_cert_test.go +++ b/x/pki/handler_remove_noc_ica_cert_test.go @@ -38,10 +38,10 @@ func TestHandler_RemoveNocX509IcaCert_BySubjectAndSKID(t *testing.T) { require.NoError(t, err) // get certificates for further comparison - allCerts := setup.Keeper.GetAllApprovedCertificates(setup.Ctx) - require.NotNil(t, allCerts) - require.Equal(t, 3, len(allCerts)) - require.Equal(t, 4, len(allCerts[0].Certs)+len(allCerts[1].Certs)+len(allCerts[2].Certs)) + nocCerts := setup.Keeper.GetAllNocCertificates(setup.Ctx) + require.NotNil(t, nocCerts) + require.Equal(t, 3, len(nocCerts)) + require.Equal(t, 4, len(nocCerts[0].Certs)+len(nocCerts[1].Certs)+len(nocCerts[2].Certs)) // remove all intermediate certificates but leave leaf certificate removeIcaCert := types.NewMsgRemoveNocX509IcaCert( @@ -54,10 +54,10 @@ func TestHandler_RemoveNocX509IcaCert_BySubjectAndSKID(t *testing.T) { require.NoError(t, err) // check that only root and leaf certificates exists - allCerts, _ = queryAllApprovedCertificates(setup) - require.Equal(t, 2, len(allCerts)) - require.Equal(t, 2, len(allCerts[0].Certs)+len(allCerts[1].Certs)) - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + nocCerts, _ = queryAllNocCertificates(setup) + require.Equal(t, 2, len(nocCerts)) + require.Equal(t, 2, len(nocCerts[0].Certs)+len(nocCerts[1].Certs)) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificates does not exists found := setup.Keeper.IsUniqueCertificatePresent(setup.Ctx, testconstants.NocCert1Issuer, testconstants.NocCert1SerialNumber) @@ -70,12 +70,12 @@ func TestHandler_RemoveNocX509IcaCert_BySubjectAndSKID(t *testing.T) { require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - leafCerts, _ := queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + leafCerts, _ := queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 1, len(leafCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SerialNumber, leafCerts.Certs[0].SerialNumber) // query noc certificate by VID - nocCertificates, err := queryNocCertificates(setup, vid) + nocCertificates, err := queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocLeafCert1Subject, nocCertificates.Certs[0].Subject) @@ -108,7 +108,7 @@ func TestHandler_RemoveNocX509IcaCert_BySerialNumber(t *testing.T) { _, err = setup.Handler(setup.Ctx, addIcaLeafCert) require.NoError(t, err) - intermediateCerts, _ := queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + intermediateCerts, _ := queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 2, len(intermediateCerts.Certs)) require.Equal(t, testconstants.NocCert1Subject, intermediateCerts.Certs[0].Subject) require.Equal(t, testconstants.NocCert1SubjectKeyID, intermediateCerts.Certs[0].SubjectKeyId) @@ -124,13 +124,13 @@ func TestHandler_RemoveNocX509IcaCert_BySerialNumber(t *testing.T) { require.NoError(t, err) // check that only root, intermediate(with serial number 3) and leaf certificates exists - allCerts, _ := queryAllApprovedCertificates(setup) + allCerts, _ := queryAllNocCertificates(setup) require.Equal(t, 3, len(allCerts)) require.Equal(t, 3, len(allCerts[0].Certs)+len(allCerts[1].Certs)+len(allCerts[2].Certs)) - leafCerts, _ := queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + leafCerts, _ := queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 1, len(leafCerts.Certs)) - intermediateCerts, _ = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + intermediateCerts, _ = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(intermediateCerts.Certs)) require.Equal(t, testconstants.NocCert1CopySerialNumber, intermediateCerts.Certs[0].SerialNumber) @@ -144,11 +144,11 @@ func TestHandler_RemoveNocX509IcaCert_BySerialNumber(t *testing.T) { _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - allCerts, _ = queryAllApprovedCertificates(setup) + allCerts, _ = queryAllNocCertificates(setup) require.Equal(t, 2, len(allCerts)) require.Equal(t, 2, len(allCerts[0].Certs)+len(allCerts[1].Certs)) - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificates does not exists @@ -162,18 +162,18 @@ func TestHandler_RemoveNocX509IcaCert_BySerialNumber(t *testing.T) { require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - leafCerts, _ = queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + leafCerts, _ = queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 1, len(leafCerts.Certs)) // query noc certificate by VID - nocCertificates, err := queryNocCertificates(setup, vid) + nocCertificates, err := queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocLeafCert1Subject, nocCertificates.Certs[0].Subject) require.Equal(t, testconstants.NocLeafCert1SubjectKeyID, nocCertificates.Certs[0].SubjectKeyId) } -func TestHandler_RemoveNocX509IcaCert_RevokedAndApprovedCertificate(t *testing.T) { +func TestHandler_RemoveNocX509IcaCert_RevokedAndActiveCertificate(t *testing.T) { setup := Setup(t) // Add vendor account @@ -190,7 +190,7 @@ func TestHandler_RemoveNocX509IcaCert_RevokedAndApprovedCertificate(t *testing.T require.NoError(t, err) // get certificates for further comparison - allCerts := setup.Keeper.GetAllApprovedCertificates(setup.Ctx) + allCerts := setup.Keeper.GetAllNocCertificates(setup.Ctx) require.NotNil(t, allCerts) require.Equal(t, 2, len(allCerts)) require.Equal(t, 2, len(allCerts[0].Certs)+len(allCerts[1].Certs)) @@ -212,7 +212,7 @@ func TestHandler_RemoveNocX509IcaCert_RevokedAndApprovedCertificate(t *testing.T _, err = setup.Handler(setup.Ctx, addIcaCert) require.NoError(t, err) - intermediateCerts, _ := queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + intermediateCerts, _ := queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(intermediateCerts.Certs)) require.Equal(t, testconstants.NocCert1Subject, intermediateCerts.Certs[0].Subject) require.Equal(t, testconstants.NocCert1SubjectKeyID, intermediateCerts.Certs[0].SubjectKeyId) @@ -229,12 +229,12 @@ func TestHandler_RemoveNocX509IcaCert_RevokedAndApprovedCertificate(t *testing.T require.NoError(t, err) // check that only root and leaf certificates exists - allCerts, _ = queryAllApprovedCertificates(setup) + allCerts, _ = queryAllNocCertificates(setup) require.Equal(t, 1, len(allCerts)) require.Equal(t, true, allCerts[0].Certs[0].IsRoot) - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificates does not exists @@ -249,7 +249,7 @@ func TestHandler_RemoveNocX509IcaCert_RevokedAndApprovedCertificate(t *testing.T require.Equal(t, codes.NotFound, status.Code(err)) // query noc certificate by VID - _, err = queryNocCertificates(setup, vid) + _, err = queryNocCertificatesByVid(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) } @@ -269,7 +269,7 @@ func TestHandler_RemoveNocX509IcaCert_RevokedCertificate(t *testing.T) { _, err := setup.Handler(setup.Ctx, addIcaCert) require.NoError(t, err) - intermediateCerts, _ := queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + intermediateCerts, _ := queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(intermediateCerts.Certs)) require.Equal(t, testconstants.NocCert1Subject, intermediateCerts.Certs[0].Subject) require.Equal(t, testconstants.NocCert1SubjectKeyID, intermediateCerts.Certs[0].SubjectKeyId) @@ -286,10 +286,10 @@ func TestHandler_RemoveNocX509IcaCert_RevokedCertificate(t *testing.T) { _, err = setup.Handler(setup.Ctx, revokeX509Cert) require.NoError(t, err) - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - revokedCerts, _ := queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedCerts, _ := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(revokedCerts.Certs)) require.Equal(t, testconstants.NocCert1Subject, revokedCerts.Certs[0].Subject) require.Equal(t, testconstants.NocCert1SubjectKeyID, revokedCerts.Certs[0].SubjectKeyId) @@ -304,13 +304,13 @@ func TestHandler_RemoveNocX509IcaCert_RevokedCertificate(t *testing.T) { _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - allCerts, _ := queryAllApprovedCertificates(setup) + allCerts, _ := queryAllNocCertificates(setup) require.Equal(t, 1, len(allCerts)) require.Equal(t, true, allCerts[0].Certs[0].IsRoot) - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificate does not exists @@ -323,7 +323,7 @@ func TestHandler_RemoveNocX509IcaCert_RevokedCertificate(t *testing.T) { require.Equal(t, codes.NotFound, status.Code(err)) // query noc certificate by VID - _, err = queryNocCertificates(setup, vid) + _, err = queryNocCertificatesByVid(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) } @@ -361,23 +361,23 @@ func TestHandler_RemoveNocX509IcaCert_ByNotOwnerButSameVendor(t *testing.T) { _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - // check that certificate removed from 'approved certificates' list - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + // check that certificate removed from 'noc certificates' list + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - // check that certificate removed from 'approved certificates by subject' list - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + // check that certificate removed from 'noc certificates by subject' list + _, err = queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - // check that certificate removed from 'approved certificates by SKID' list - approvedCerts, err := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + // check that certificate removed from 'noc certificates by SKID' list + nocCerts, err := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) - require.Equal(t, 0, len(approvedCerts)) + require.Equal(t, 0, len(nocCerts)) // query noc certificate by VID - _, err = queryNocCertificates(setup, vid) + _, err = queryNocCertificatesByVid(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificate key is not registered @@ -497,7 +497,9 @@ func TestHandler_RemoveNocX509IcaCert_ForNonIcaCertificate(t *testing.T) { types.RevokedCertificates{ Subject: testconstants.IntermediateSubject, SubjectKeyId: testconstants.IntermediateSubjectKeyID, - Certs: []*types.Certificate{{IsNoc: false}}, + Certs: []*types.Certificate{{ + CertificateType: types.CertificateType_DeviceAttestationPKI, + }}, }, ) @@ -505,7 +507,7 @@ func TestHandler_RemoveNocX509IcaCert_ForNonIcaCertificate(t *testing.T) { vendorAccAddress.String(), testconstants.IntermediateSubject, testconstants.IntermediateSubjectKeyID, "") _, err := setup.Handler(setup.Ctx, removeIcaCert) require.Error(t, err) - require.True(t, pkitypes.ErrInappropriateCertificateType.Is(err)) + require.True(t, pkitypes.ErrCertificateDoesNotExist.Is(err)) } func TestHandler_RemoveNocX509IcaCert_InvalidSerialNumber(t *testing.T) { diff --git a/x/pki/handler_remove_noc_root_cert_test.go b/x/pki/handler_remove_noc_root_cert_test.go index 62bf6a078..9a0144adf 100644 --- a/x/pki/handler_remove_noc_root_cert_test.go +++ b/x/pki/handler_remove_noc_root_cert_test.go @@ -31,10 +31,10 @@ func TestHandler_RemoveNocX509RootCert_BySubjectAndSKID(t *testing.T) { require.NoError(t, err) // get certificates for further comparison - approvedCerts := setup.Keeper.GetAllApprovedCertificates(setup.Ctx) - require.NotNil(t, approvedCerts) - require.Equal(t, 2, len(approvedCerts)) - require.Equal(t, 3, len(approvedCerts[0].Certs)+len(approvedCerts[1].Certs)) + nocCerts := setup.Keeper.GetAllNocCertificates(setup.Ctx) + require.NotNil(t, nocCerts) + require.Equal(t, 2, len(nocCerts)) + require.Equal(t, 3, len(nocCerts[0].Certs)+len(nocCerts[1].Certs)) // remove all root nOC certificates but IAC certificate removeIcaCert := types.NewMsgRemoveNocX509RootCert( @@ -47,12 +47,12 @@ func TestHandler_RemoveNocX509RootCert_BySubjectAndSKID(t *testing.T) { require.NoError(t, err) // check that only IAC certificate exists - approvedCerts, _ = queryAllApprovedCertificates(setup) - require.Equal(t, 1, len(approvedCerts)) - require.Equal(t, 1, len(approvedCerts[0].Certs)) - require.Equal(t, testconstants.NocCert1SerialNumber, approvedCerts[0].Certs[0].SerialNumber) + nocCerts, _ = queryAllNocCertificates(setup) + require.Equal(t, 1, len(nocCerts)) + require.Equal(t, 1, len(nocCerts[0].Certs)) + require.Equal(t, testconstants.NocCert1SerialNumber, nocCerts[0].Certs[0].SerialNumber) - nocCertificates, err := queryNocCertificates(setup, vid) + nocCertificates, err := queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificates.Certs[0].SerialNumber) @@ -64,11 +64,11 @@ func TestHandler_RemoveNocX509RootCert_BySubjectAndSKID(t *testing.T) { require.Equal(t, testconstants.NocCert1SerialNumber, certsByVidSkid.Certs[0].SerialNumber) // check that root certs removed - _, err = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Equal(t, codes.NotFound, status.Code(err)) - certsBySKID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + certsBySKID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Empty(t, certsBySKID) _, err = queryNocRootCertificates(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) @@ -99,7 +99,7 @@ func TestHandler_RemoveNocX509RootCert_BySerialNumber(t *testing.T) { _, err := setup.Handler(setup.Ctx, addIcaCert) require.NoError(t, err) - intermediateCerts, _ := queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + intermediateCerts, _ := queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 2, len(intermediateCerts.Certs)) require.Equal(t, testconstants.NocRootCert1Subject, intermediateCerts.Certs[0].Subject) require.Equal(t, testconstants.NocRootCert1SubjectKeyID, intermediateCerts.Certs[0].SubjectKeyId) @@ -114,14 +114,14 @@ func TestHandler_RemoveNocX509RootCert_BySerialNumber(t *testing.T) { _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - approvedCerts, _ := queryAllApprovedCertificates(setup) - require.Equal(t, 2, len(approvedCerts)) + nocCerts, _ := queryAllNocCertificates(setup) + require.Equal(t, 2, len(nocCerts)) - rootCerts, _ := queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + rootCerts, _ := queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 1, len(rootCerts.Certs)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, rootCerts.Certs[0].SerialNumber) - intermediateCerts, _ = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + intermediateCerts, _ = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(intermediateCerts.Certs)) require.Equal(t, testconstants.NocCert1SerialNumber, intermediateCerts.Certs[0].SerialNumber) @@ -130,7 +130,7 @@ func TestHandler_RemoveNocX509RootCert_BySerialNumber(t *testing.T) { require.Equal(t, len(nocRootCerts.Certs), 1) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, nocRootCerts.Certs[0].SerialNumber) - nocCertificates, err := queryNocCertificates(setup, vid) + nocCertificates, err := queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificates.Certs[0].SerialNumber) @@ -151,12 +151,12 @@ func TestHandler_RemoveNocX509RootCert_BySerialNumber(t *testing.T) { _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - approvedCerts, _ = queryAllApprovedCertificates(setup) - require.Equal(t, 1, len(approvedCerts)) - require.Equal(t, 1, len(approvedCerts[0].Certs)) - require.Equal(t, testconstants.NocCert1SerialNumber, approvedCerts[0].Certs[0].SerialNumber) + nocCerts, _ = queryAllNocCertificates(setup) + require.Equal(t, 1, len(nocCerts)) + require.Equal(t, 1, len(nocCerts[0].Certs)) + require.Equal(t, testconstants.NocCert1SerialNumber, nocCerts[0].Certs[0].SerialNumber) - nocCertificates, err = queryNocCertificates(setup, vid) + nocCertificates, err = queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificates.Certs[0].SerialNumber) @@ -167,11 +167,11 @@ func TestHandler_RemoveNocX509RootCert_BySerialNumber(t *testing.T) { require.Equal(t, testconstants.NocCert1SerialNumber, certsByVidSkid.Certs[0].SerialNumber) // check that root certs removed - _, err = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Equal(t, codes.NotFound, status.Code(err)) - certsBySKID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + certsBySKID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Empty(t, certsBySKID) _, err = queryNocRootCertificates(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) @@ -185,7 +185,7 @@ func TestHandler_RemoveNocX509RootCert_BySerialNumber(t *testing.T) { require.Equal(t, false, found) } -func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing.T) { +func TestHandler_RemoveNocX509RootCert_RevokedAndActiveCertificate(t *testing.T) { setup := Setup(t) // Add vendor account @@ -202,9 +202,9 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. require.NoError(t, err) // get certificates for further comparison - approvedCerts := setup.Keeper.GetAllApprovedCertificates(setup.Ctx) - require.NotNil(t, approvedCerts) - require.Equal(t, 2, len(approvedCerts)) + nocCerts := setup.Keeper.GetAllNocCertificates(setup.Ctx) + require.NotNil(t, nocCerts) + require.Equal(t, 2, len(nocCerts)) // revoke an intermediate certificate revokeX509Cert := types.NewMsgRevokeNocX509RootCert( @@ -221,7 +221,7 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. // Add NOC root certificate with new serial number addNocRootCertificate(setup, vendorAccAddress, testconstants.NocRootCert1Copy, vid) - certs, _ := queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + certs, _ := queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 1, len(certs.Certs)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, certs.Certs[0].SerialNumber) @@ -236,15 +236,15 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. require.NoError(t, err) // check that only one root and IAC certificates exists - approvedCerts, _ = queryAllApprovedCertificates(setup) - require.Equal(t, 2, len(approvedCerts)) + nocCerts, _ = queryAllNocCertificates(setup) + require.Equal(t, 2, len(nocCerts)) - certs, _ = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + certs, _ = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, certs.Certs[0].SerialNumber) - certs, _ = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + certs, _ = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(certs.Certs)) - _, err = queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryRevokedNocRootCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificates does not exists @@ -254,7 +254,7 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. require.Equal(t, true, found) // query noc certificate by VID - nocCertificates, err := queryNocCertificates(setup, vid) + nocCertificates, err := queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificates.Certs[0].SerialNumber) @@ -262,7 +262,7 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. // Add NOC root certificate with new serial number addNocRootCertificate(setup, vendorAccAddress, testconstants.NocRootCert1, vid) - certs, _ = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + certs, _ = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 2, len(certs.Certs)) // remove NOC root certificates @@ -275,12 +275,12 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - approvedCerts, _ = queryAllApprovedCertificates(setup) - require.Equal(t, 1, len(approvedCerts)) - require.Equal(t, 1, len(approvedCerts[0].Certs)) - require.Equal(t, testconstants.NocCert1SerialNumber, approvedCerts[0].Certs[0].SerialNumber) + nocCerts, _ = queryAllNocCertificates(setup) + require.Equal(t, 1, len(nocCerts)) + require.Equal(t, 1, len(nocCerts[0].Certs)) + require.Equal(t, testconstants.NocCert1SerialNumber, nocCerts[0].Certs[0].SerialNumber) - nocCertificates, err = queryNocCertificates(setup, vid) + nocCertificates, err = queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificates.Certs[0].SerialNumber) @@ -291,11 +291,11 @@ func TestHandler_RemoveNocX509RootCert_RevokedAndApprovedCertificate(t *testing. require.Equal(t, testconstants.NocCert1SerialNumber, certsByVidSkid.Certs[0].SerialNumber) // check that root certs removed - _, err = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Equal(t, codes.NotFound, status.Code(err)) - certsBySKID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + certsBySKID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Empty(t, certsBySKID) _, err = queryNocRootCertificates(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) @@ -327,7 +327,7 @@ func TestHandler_RemoveNocX509RootCert_RevokedCertificate(t *testing.T) { require.NoError(t, err) // get certificates for further comparison - allCerts := setup.Keeper.GetAllApprovedCertificates(setup.Ctx) + allCerts := setup.Keeper.GetAllNocCertificates(setup.Ctx) require.NotNil(t, allCerts) require.Equal(t, 3, len(allCerts[0].Certs)+len(allCerts[1].Certs)) @@ -343,10 +343,10 @@ func TestHandler_RemoveNocX509RootCert_RevokedCertificate(t *testing.T) { _, err = setup.Handler(setup.Ctx, revokeX509Cert) require.NoError(t, err) - _, err = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - revokedCerts, _ := queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + revokedCerts, _ := queryRevokedNocRootCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 2, len(revokedCerts.Certs)) require.Equal(t, testconstants.NocRootCert1Subject, revokedCerts.Certs[0].Subject) require.Equal(t, testconstants.NocRootCert1SubjectKeyID, revokedCerts.Certs[0].SubjectKeyId) @@ -361,11 +361,11 @@ func TestHandler_RemoveNocX509RootCert_RevokedCertificate(t *testing.T) { _, err = setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - allCerts, _ = queryAllApprovedCertificates(setup) + allCerts, _ = queryAllNocCertificates(setup) require.Equal(t, 1, len(allCerts)) require.Equal(t, testconstants.NocCert1SerialNumber, allCerts[0].Certs[0].SerialNumber) - nocCertificates, err := queryNocCertificates(setup, vid) + nocCertificates, err := queryNocCertificatesByVid(setup, vid) require.NoError(t, err) require.Equal(t, len(nocCertificates.Certs), 1) require.Equal(t, testconstants.NocCert1SerialNumber, nocCertificates.Certs[0].SerialNumber) @@ -376,13 +376,13 @@ func TestHandler_RemoveNocX509RootCert_RevokedCertificate(t *testing.T) { require.Equal(t, testconstants.NocCert1SerialNumber, certsByVidSkid.Certs[0].SerialNumber) // check that root certs are removed - _, err = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Equal(t, codes.NotFound, status.Code(err)) - certsBySKID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + certsBySKID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Empty(t, certsBySKID) - _, err = queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + _, err = queryRevokedNocRootCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) _, err = queryNocRootCertificates(setup, vid) require.Equal(t, codes.NotFound, status.Code(err)) @@ -425,20 +425,20 @@ func TestHandler_RemoveNocX509RootCert_ByNotOwnerButSameVendor(t *testing.T) { _, err := setup.Handler(setup.Ctx, removeIcaCert) require.NoError(t, err) - // check that certificate removed from 'approved certificates' list - _, err = queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + // check that certificate removed from 'noc certificates' list + _, err = queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - // check that certificate removed from 'approved certificates by subject' list - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + // check that certificate removed from 'noc certificates by subject' list + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - // check that certificate removed from 'approved certificates by SKID' list - approvedCerts, err := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + // check that certificate removed from 'noc certificates by SKID' list + nocCerts, err := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.NoError(t, err) - require.Equal(t, 0, len(approvedCerts)) + require.Equal(t, 0, len(nocCerts)) // query noc certificate by VID _, err = queryNocRootCertificates(setup, vid) diff --git a/x/pki/handler_remove_non_root_cert_test.go b/x/pki/handler_remove_non_root_cert_test.go index bd43e5f09..b034b2ed7 100644 --- a/x/pki/handler_remove_non_root_cert_test.go +++ b/x/pki/handler_remove_non_root_cert_test.go @@ -285,6 +285,7 @@ func TestHandler_RemoveX509Cert_ByNotOwnerButSameVendor(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // add first vendor account with VID = 1 @@ -335,6 +336,7 @@ func TestHandler_RemoveX509Cert_ByOtherVendor(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // add fist vendor account with VID = 1 @@ -501,5 +503,5 @@ func TestHandler_RemoveX509Cert_ForNocIcaCertificate(t *testing.T) { vendorAccAddress.String(), testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID, testconstants.NocCert1SerialNumber) _, err = setup.Handler(setup.Ctx, removeX509Cert) require.Error(t, err) - require.True(t, pkitypes.ErrInappropriateCertificateType.Is(err)) + require.True(t, pkitypes.ErrCertificateDoesNotExist.Is(err)) } diff --git a/x/pki/handler_revoke_noc_cert_test.go b/x/pki/handler_revoke_noc_cert_test.go index 444c33f46..c7c600826 100644 --- a/x/pki/handler_revoke_noc_cert_test.go +++ b/x/pki/handler_revoke_noc_cert_test.go @@ -71,14 +71,14 @@ func TestHandler_RevokeNocX509Cert_CertificateExists(t *testing.T) { { name: "ExistingRootCert", existingCert: &types.Certificate{ - Issuer: testconstants.NocCert1Subject, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: testconstants.NocCert1SerialNumber, - IsRoot: true, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocCert1Subject, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocCert1SerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.NocRootCert1, err: pkitypes.ErrInappropriateCertificateType, @@ -86,14 +86,14 @@ func TestHandler_RevokeNocX509Cert_CertificateExists(t *testing.T) { { name: "ExistingNotNocCert", existingCert: &types.Certificate{ - Issuer: testconstants.NocCert1Subject, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: testconstants.NocCert1SerialNumber, - IsRoot: true, - IsNoc: false, - Vid: testconstants.Vid, + Issuer: testconstants.NocCert1Subject, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocCert1SerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_DeviceAttestationPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.NocCert1, err: pkitypes.ErrInappropriateCertificateType, @@ -101,14 +101,14 @@ func TestHandler_RevokeNocX509Cert_CertificateExists(t *testing.T) { { name: "ExistingCertWithDifferentVid", existingCert: &types.Certificate{ - Issuer: testconstants.NocCert1Subject, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: testconstants.NocCert1SerialNumber, - IsRoot: false, - IsNoc: true, - Vid: testconstants.VendorID1, + Issuer: testconstants.NocCert1Subject, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocCert1SerialNumber, + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.VendorID1, }, nocRoorCert: testconstants.NocCert1, err: pkitypes.ErrCertVidNotEqualAccountVid, @@ -116,14 +116,14 @@ func TestHandler_RevokeNocX509Cert_CertificateExists(t *testing.T) { { name: "ExistingCertWithDifferentSerialNumber", existingCert: &types.Certificate{ - Issuer: testconstants.NocCert1Subject, - Subject: testconstants.NocCert1Subject, - SubjectAsText: testconstants.NocCert1SubjectAsText, - SubjectKeyId: testconstants.NocCert1SubjectKeyID, - SerialNumber: "1234567", - IsRoot: false, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocCert1Subject, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234567", + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.NocCert1, err: pkitypes.ErrCertificateDoesNotExist, @@ -136,7 +136,7 @@ func TestHandler_RevokeNocX509Cert_CertificateExists(t *testing.T) { setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, testconstants.Vid) // add the existing certificate - setup.Keeper.AddApprovedCertificate(setup.Ctx, *tc.existingCert) + setup.Keeper.AddNocCertificate(setup.Ctx, *tc.existingCert) uniqueCertificate := types.UniqueCertificate{ Issuer: tc.existingCert.Issuer, SerialNumber: tc.existingCert.SerialNumber, @@ -196,45 +196,45 @@ func TestHandler_RevokeNocX509Cert_RevokeDefault(t *testing.T) { _, err = setup.Handler(setup.Ctx, revokeCert) require.NoError(t, err) - revokedNocCerts, err := queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedNocCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 2, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocCert1Subject, revokedNocCerts.Subject) require.Equal(t, testconstants.NocCert1SubjectKeyID, revokedNocCerts.SubjectKeyId) // query noc certificate by Subject - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query noc certificate by Subject Key ID - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) // query noc certificate by VID - nocCerts, err := queryNocCertificates(setup, testconstants.Vid) + nocCerts, err := queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) require.Equal(t, 1, len(nocCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SubjectKeyID, nocCerts.Certs[0].SubjectKeyId) // Child certificate should not be revoked - _, err = queryRevokedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + _, err = queryRevokedNocIcaCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // query all certs - certs, err := queryAllApprovedCertificates(setup) + certs, err := queryAllNocCertificates(setup) require.NoError(t, err) require.Equal(t, 2, len(certs)) require.NotEqual(t, testconstants.NocCert1SubjectKeyID, certs[0].SubjectKeyId) require.NotEqual(t, testconstants.NocCert1SubjectKeyID, certs[1].SubjectKeyId) // query child of revoked certificate, they should not be revoked - childCerts, _ := queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + childCerts, _ := queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 1, len(childCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SubjectKeyID, childCerts.SubjectKeyId) // check that child cert is not removed - nocCerts, err = queryNocCertificates(setup, testconstants.Vid) + nocCerts, err = queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) require.Equal(t, 1, len(nocCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SubjectKeyID, nocCerts.Certs[0].SubjectKeyId) @@ -289,46 +289,46 @@ func TestHandler_RevokeNocX509Cert_RevokeWithChild(t *testing.T) { _, err = setup.Handler(setup.Ctx, revokeCert) require.NoError(t, err) - allRevokedCerts, err := queryAllRevokedCertificates(setup) + allRevokedCerts, err := queryAllRevokedNocIcaCertificates(setup) require.NoError(t, err) require.Equal(t, 2, len(allRevokedCerts)) require.Equal(t, 3, len(allRevokedCerts[0].Certs)+len(allRevokedCerts[1].Certs)) - revokedNocCerts, err := queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedNocCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 2, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocCert1Subject, revokedNocCerts.Subject) require.Equal(t, testconstants.NocCert1SubjectKeyID, revokedNocCerts.SubjectKeyId) // query all certs - certs, err := queryAllApprovedCertificates(setup) + certs, err := queryAllNocCertificates(setup) require.NoError(t, err) require.Equal(t, 1, len(certs)) require.Equal(t, testconstants.NocRootCert1SubjectKeyID, certs[0].SubjectKeyId) // query NOC cert by subject and subject key id - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1CopySubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1CopySubjectKeyID) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query NOC certificate by Subject - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocLeafCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocLeafCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query NOC certificate by Subject Key ID - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) - aprCertsBySubjectKeyID, _ = queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocLeafCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ = queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) // query noc certificate by VID - _, err = queryNocCertificates(setup, testconstants.Vid) + _, err = queryNocCertificatesByVid(setup, testconstants.Vid) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) @@ -338,13 +338,13 @@ func TestHandler_RevokeNocX509Cert_RevokeWithChild(t *testing.T) { require.Equal(t, codes.NotFound, status.Code(err)) // Child certificate should be revoked as well - revokedLeafCerts, err := queryRevokedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + revokedLeafCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(revokedLeafCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SubjectKeyID, revokedLeafCerts.SubjectKeyId) // query child of revoked certificate, they should be revoked - _, err = queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) @@ -395,48 +395,48 @@ func TestHandler_RevokeNocX509Cert_RevokeBySerialNumber(t *testing.T) { _, err = setup.Handler(setup.Ctx, revokeCert) require.NoError(t, err) - revokedNocCerts, err := queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedNocCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocCert1SerialNumber, revokedNocCerts.Certs[0].SerialNumber) // Child certificate should not be revoked - _, err = queryRevokedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + _, err = queryRevokedNocIcaCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // query NOC certificate by Subject - certsBySubject, err := queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + certsBySubject, err := queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.NoError(t, err) require.Equal(t, 1, len(certsBySubject.SubjectKeyIds)) // query NOC certificate by Subject Key ID - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(aprCertsBySubjectKeyID)) require.Equal(t, 1, len(aprCertsBySubjectKeyID[0].Certs)) require.Equal(t, testconstants.NocCert1CopySerialNumber, aprCertsBySubjectKeyID[0].Certs[0].SerialNumber) // query noc certificate by VID - nocCerts, err := queryNocCertificates(setup, testconstants.Vid) + nocCerts, err := queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) require.Equal(t, 2, len(nocCerts.Certs)) require.NotEqual(t, testconstants.NocCert1SerialNumber, nocCerts.Certs[0].SerialNumber) require.NotEqual(t, testconstants.NocCert1SerialNumber, nocCerts.Certs[1].SerialNumber) // query all certs - certs, err := queryAllApprovedCertificates(setup) + certs, err := queryAllNocCertificates(setup) require.NoError(t, err) require.Equal(t, 3, len(certs)) require.NotEqual(t, testconstants.NocCert1SerialNumber, certs[0].Certs[0].SerialNumber) require.NotEqual(t, testconstants.NocCert1SerialNumber, certs[1].Certs[0].SerialNumber) require.NotEqual(t, testconstants.NocCert1SerialNumber, certs[2].Certs[0].SerialNumber) - // query approved certificate, cert with different serial number should not be removed - approvedCerts, _ := queryApprovedCertificates(setup, testconstants.NocCert1CopySubject, testconstants.NocCert1CopySubjectKeyID) - require.Equal(t, 1, len(approvedCerts.Certs)) - require.Equal(t, testconstants.NocCert1CopySerialNumber, approvedCerts.Certs[0].SerialNumber) + // query noc certificate, cert with different serial number should not be removed + noccCerts, _ := queryNocCertificates(setup, testconstants.NocCert1CopySubject, testconstants.NocCert1CopySubjectKeyID) + require.Equal(t, 1, len(noccCerts.Certs)) + require.Equal(t, testconstants.NocCert1CopySerialNumber, noccCerts.Certs[0].SerialNumber) // query child certificate, they should not be removed - childCerts, _ := queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + childCerts, _ := queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 1, len(childCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SubjectKeyID, childCerts.SubjectKeyId) @@ -488,59 +488,59 @@ func TestHandler_RevokeNocX509Cert_RevokeBySerialNumberAndWithChild(t *testing.T _, err = setup.Handler(setup.Ctx, revokeCert) require.NoError(t, err) - allRevokedCerts, err := queryAllRevokedCertificates(setup) + allRevokedCerts, err := queryAllRevokedNocIcaCertificates(setup) require.NoError(t, err) require.Equal(t, 2, len(allRevokedCerts)) require.Equal(t, 2, len(allRevokedCerts[0].Certs)+len(allRevokedCerts[1].Certs)) - revokedNocCerts, err := queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedNocCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocCert1SerialNumber, revokedNocCerts.Certs[0].SerialNumber) // Child certificate should be revoked - revokedNocCerts, err = queryRevokedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + revokedNocCerts, err = queryRevokedNocIcaCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocLeafCert1SerialNumber, revokedNocCerts.Certs[0].SerialNumber) // query child of revoked certificate, they should be revoked - _, err = queryApprovedCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocLeafCert1Subject, testconstants.NocLeafCert1SubjectKeyID) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query all certs - certs, err := queryAllApprovedCertificates(setup) + certs, err := queryAllNocCertificates(setup) require.NoError(t, err) require.Equal(t, 2, len(certs)) require.NotEqual(t, testconstants.NocCert1SerialNumber, certs[0].Certs[0].SerialNumber) require.NotEqual(t, testconstants.NocCert1SerialNumber, certs[1].Certs[0].SerialNumber) - // query approved certificates - aprCerts, err := queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1CopySubjectKeyID) + // query noc certificates + aprCerts, err := queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1CopySubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(aprCerts.Certs)) require.Equal(t, testconstants.NocCert1CopySerialNumber, aprCerts.Certs[0].SerialNumber) // query noc certificate by Subject - certsBySubject, err := queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + certsBySubject, err := queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.NoError(t, err) require.Equal(t, 1, len(certsBySubject.SubjectKeyIds)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocLeafCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocLeafCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query noc certificate by Subject Key ID - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(aprCertsBySubjectKeyID)) require.Equal(t, testconstants.NocCert1CopySerialNumber, aprCertsBySubjectKeyID[0].Certs[0].SerialNumber) - aprCertsBySubjectKeyID, _ = queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocLeafCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ = queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocLeafCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) // query noc certificate by VID - nocCerts, err := queryNocCertificates(setup, testconstants.Vid) + nocCerts, err := queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) require.Equal(t, 1, len(nocCerts.Certs)) require.Equal(t, testconstants.NocCert1CopySerialNumber, nocCerts.Certs[0].SerialNumber) diff --git a/x/pki/handler_revoke_noc_root_cert_test.go b/x/pki/handler_revoke_noc_root_cert_test.go index a90a0fe16..dc7f6736d 100644 --- a/x/pki/handler_revoke_noc_root_cert_test.go +++ b/x/pki/handler_revoke_noc_root_cert_test.go @@ -71,14 +71,14 @@ func TestHandler_RevokeNocX509RootCert_CertificateExists(t *testing.T) { { name: "ExistingNonRootCert", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - Subject: testconstants.NocRootCert1Subject, - SubjectAsText: testconstants.NocRootCert1SubjectAsText, - SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, - SerialNumber: testconstants.NocRootCert1SerialNumber, - IsRoot: false, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + Subject: testconstants.NocRootCert1Subject, + SubjectAsText: testconstants.NocRootCert1SubjectAsText, + SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, + SerialNumber: testconstants.NocRootCert1SerialNumber, + IsRoot: false, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.RootCertPem, err: pkitypes.ErrInappropriateCertificateType, @@ -86,14 +86,14 @@ func TestHandler_RevokeNocX509RootCert_CertificateExists(t *testing.T) { { name: "ExistingNotNocCert", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - Subject: testconstants.NocRootCert1Subject, - SubjectAsText: testconstants.NocRootCert1SubjectAsText, - SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, - SerialNumber: testconstants.NocRootCert1SerialNumber, - IsRoot: true, - IsNoc: false, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + Subject: testconstants.NocRootCert1Subject, + SubjectAsText: testconstants.NocRootCert1SubjectAsText, + SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, + SerialNumber: testconstants.NocRootCert1SerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_DeviceAttestationPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.RootCertPem, err: pkitypes.ErrInappropriateCertificateType, @@ -101,14 +101,14 @@ func TestHandler_RevokeNocX509RootCert_CertificateExists(t *testing.T) { { name: "ExistingCertWithDifferentVid", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - Subject: testconstants.NocRootCert1Subject, - SubjectAsText: testconstants.NocRootCert1SubjectAsText, - SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, - SerialNumber: testconstants.NocRootCert1SerialNumber, - IsRoot: true, - IsNoc: true, - Vid: testconstants.VendorID1, + Issuer: testconstants.NocRootCert1Subject, + Subject: testconstants.NocRootCert1Subject, + SubjectAsText: testconstants.NocRootCert1SubjectAsText, + SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, + SerialNumber: testconstants.NocRootCert1SerialNumber, + IsRoot: true, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.VendorID1, }, nocRoorCert: testconstants.RootCertPem, err: pkitypes.ErrCertVidNotEqualAccountVid, @@ -116,14 +116,14 @@ func TestHandler_RevokeNocX509RootCert_CertificateExists(t *testing.T) { { name: "ExistingCertWithDifferentSerialNumber", existingCert: &types.Certificate{ - Issuer: testconstants.NocRootCert1Subject, - Subject: testconstants.NocRootCert1Subject, - SubjectAsText: testconstants.NocRootCert1SubjectAsText, - SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, - SerialNumber: "1234567", - IsRoot: true, - IsNoc: true, - Vid: testconstants.Vid, + Issuer: testconstants.NocRootCert1Subject, + Subject: testconstants.NocRootCert1Subject, + SubjectAsText: testconstants.NocRootCert1SubjectAsText, + SubjectKeyId: testconstants.NocRootCert1SubjectKeyID, + SerialNumber: "1234567", + IsRoot: true, + CertificateType: types.CertificateType_OperationalPKI, + Vid: testconstants.Vid, }, nocRoorCert: testconstants.RootCertPem, err: pkitypes.ErrCertificateDoesNotExist, @@ -136,7 +136,7 @@ func TestHandler_RevokeNocX509RootCert_CertificateExists(t *testing.T) { setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, testconstants.Vid) // add the existing certificate - setup.Keeper.AddApprovedCertificate(setup.Ctx, *tc.existingCert) + setup.Keeper.AddNocCertificate(setup.Ctx, *tc.existingCert) uniqueCertificate := types.UniqueCertificate{ Issuer: tc.existingCert.Issuer, SerialNumber: tc.existingCert.SerialNumber, @@ -202,7 +202,7 @@ func TestHandler_RevokeNocX509RootCert_RevokeDefault(t *testing.T) { require.NoError(t, err) // query all certs - certs, err := queryAllApprovedCertificates(setup) + certs, err := queryAllNocCertificates(setup) require.NoError(t, err) require.Equal(t, 3, len(certs)) require.NotEqual(t, testconstants.NocRootCert1SubjectKeyID, certs[0].SubjectKeyId) @@ -215,23 +215,17 @@ func TestHandler_RevokeNocX509RootCert_RevokeDefault(t *testing.T) { require.Equal(t, testconstants.NocRootCert1Subject, revokedNocCerts.Subject) require.Equal(t, testconstants.NocRootCert1SubjectKeyID, revokedNocCerts.SubjectKeyId) - revokedCerts, err := queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) - require.NoError(t, err) - require.Equal(t, 2, len(revokedCerts.Certs)) - require.Equal(t, testconstants.NocRootCert1Subject, revokedCerts.Subject) - require.Equal(t, testconstants.NocRootCert1SubjectKeyID, revokedCerts.SubjectKeyId) - // query that noc root certificate is not added to x509 revoked root certs revokedRootCerts, _ := queryRevokedRootCertificates(setup) require.Equal(t, 0, len(revokedRootCerts.Certs)) // query noc root certificate by Subject - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query noc root certificate by Subject Key ID - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) // query noc root certificate by VID @@ -252,16 +246,16 @@ func TestHandler_RevokeNocX509RootCert_RevokeDefault(t *testing.T) { require.Equal(t, float32(1), nocCertificatesByVidAndSkid.Tq) // Child certificate should not be revoked - _, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // query child of revoked certificate, they should not be revoked - childCerts, _ := queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + childCerts, _ := queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(childCerts.Certs)) require.Equal(t, testconstants.NocCert1SubjectKeyID, childCerts.SubjectKeyId) // check that child cert is not removed - nocCerts, err := queryNocCertificates(setup, testconstants.Vid) + nocCerts, err := queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) require.Equal(t, 2, len(nocCerts.Certs)) require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCerts.Certs[0].SubjectKeyId) @@ -307,7 +301,7 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithChild(t *testing.T) { require.NoError(t, err) // query all certs - certs, err := queryAllApprovedCertificates(setup) + certs, err := queryAllNocCertificates(setup) require.NoError(t, err) require.Equal(t, 0, len(certs)) @@ -317,23 +311,17 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithChild(t *testing.T) { require.Equal(t, testconstants.NocRootCert1Subject, revokedNocCerts.Subject) require.Equal(t, testconstants.NocRootCert1SubjectKeyID, revokedNocCerts.SubjectKeyId) - revokedCerts, err := queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) - require.NoError(t, err) - require.Equal(t, 2, len(revokedCerts.Certs)) - require.Equal(t, testconstants.NocRootCert1Subject, revokedNocCerts.Subject) - require.Equal(t, testconstants.NocRootCert1SubjectKeyID, revokedNocCerts.SubjectKeyId) - // query that noc root certificate is not added to x509 revoked root certs revokedRootCerts, _ := queryRevokedRootCertificates(setup) require.Equal(t, 0, len(revokedRootCerts.Certs)) // query noc root certificate by Subject - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // query child noc certificate by Subject - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) @@ -348,25 +336,25 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithChild(t *testing.T) { require.Equal(t, codes.NotFound, status.Code(err)) // query noc root certificate by Subject Key ID - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) // Child certificate should be revoked as well - revokedCerts, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedChildCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) - require.Equal(t, 1, len(revokedCerts.Certs)) - require.Equal(t, testconstants.NocCert1SubjectKeyID, revokedCerts.SubjectKeyId) + require.Equal(t, 1, len(revokedChildCerts.Certs)) + require.Equal(t, testconstants.NocCert1SubjectKeyID, revokedChildCerts.SubjectKeyId) // query child noc certificate by Subject Key ID - aprCertsBySubjectKeyID, _ = queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ = queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) // check that child noc cert also removed - _, err = queryNocCertificates(setup, testconstants.Vid) + _, err = queryNocCertificatesByVid(setup, testconstants.Vid) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) @@ -420,28 +408,23 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumber(t *testing.T) { require.Equal(t, 1, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocRootCert1SerialNumber, revokedNocCerts.Certs[0].SerialNumber) - revokedCerts, err := queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) - require.NoError(t, err) - require.Equal(t, 1, len(revokedCerts.Certs)) - require.Equal(t, testconstants.NocRootCert1SerialNumber, revokedCerts.Certs[0].SerialNumber) - // query that noc root certificate is not added to x509 revoked root certs revokedRootCerts, _ := queryRevokedRootCertificates(setup) require.Equal(t, 0, len(revokedRootCerts.Certs)) - // Check that cert is removed from approved lists - rootCerts, err := queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + // Check that cert is removed from noc lists + rootCerts, err := queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(rootCerts.Certs)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, rootCerts.Certs[0].SerialNumber) // Check that root with different serial number still exits - certsBySubject, err := queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + certsBySubject, err := queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.NoError(t, err) require.Equal(t, 1, len(certsBySubject.SubjectKeyIds)) require.Equal(t, testconstants.NocRootCert1Subject, certsBySubject.Subject) - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 1, len(aprCertsBySubjectKeyID)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, aprCertsBySubjectKeyID[0].Certs[0].SerialNumber) @@ -460,16 +443,16 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumber(t *testing.T) { require.Equal(t, testconstants.NocRootCert1CopySerialNumber, nocCertificatesByVidAndSkid.Certs[0].SerialNumber) // Child certificate should not be revoked - _, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) // query child of revoked certificate, they should not be revoked - childCerts, _ := queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + childCerts, _ := queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, 1, len(childCerts.Certs)) require.Equal(t, testconstants.NocCert1SubjectKeyID, childCerts.SubjectKeyId) // check that child cert is not removed - nocCerts, err := queryNocCertificates(setup, testconstants.Vid) + nocCerts, err := queryNocCertificatesByVid(setup, testconstants.Vid) require.NoError(t, err) require.Equal(t, 1, len(nocCerts.Certs)) require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCerts.Certs[0].SubjectKeyId) @@ -518,27 +501,22 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumberAndChild(t *testing require.Equal(t, 1, len(revokedNocCerts.Certs)) require.Equal(t, testconstants.NocRootCert1SerialNumber, revokedNocCerts.Certs[0].SerialNumber) - revokedCerts, err := queryRevokedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1CopySubjectKeyID) - require.NoError(t, err) - require.Equal(t, 1, len(revokedCerts.Certs)) - require.Equal(t, testconstants.NocRootCert1SerialNumber, revokedCerts.Certs[0].SerialNumber) - // query that noc root certificate is not added to x509 revoked root certs revokedRootCerts, _ := queryRevokedRootCertificates(setup) require.Equal(t, 0, len(revokedRootCerts.Certs)) // Check that root with different serial number still exits - rootCerts, err := queryApprovedCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + rootCerts, err := queryNocCertificates(setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(rootCerts.Certs)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, rootCerts.Certs[0].SerialNumber) - certsBySubject, err := queryApprovedCertificatesBySubject(setup, testconstants.NocRootCert1Subject) + certsBySubject, err := queryNocCertificatesBySubject(setup, testconstants.NocRootCert1Subject) require.NoError(t, err) require.Equal(t, 1, len(certsBySubject.SubjectKeyIds)) require.Equal(t, testconstants.NocRootCert1Subject, certsBySubject.Subject) - aprCertsBySubjectKeyID, _ := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) + aprCertsBySubjectKeyID, _ := queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocRootCert1SubjectKeyID) require.Equal(t, 1, len(aprCertsBySubjectKeyID)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, aprCertsBySubjectKeyID[0].Certs[0].SerialNumber) @@ -549,22 +527,22 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumberAndChild(t *testing require.Equal(t, testconstants.NocRootCert1CopySerialNumber, revNocRoot.Certs[0].SerialNumber) // Child certificate should be revoked as well - revokedCerts, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + revokedCerts, err := queryRevokedNocIcaCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, 1, len(revokedCerts.Certs)) require.Equal(t, testconstants.NocCert1SubjectKeyID, revokedCerts.SubjectKeyId) // query child of revoked certificate, they should be removed as well - _, err = queryApprovedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + _, err = queryNocCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = queryApprovedCertificatesBySubject(setup, testconstants.NocCert1Subject) + _, err = queryNocCertificatesBySubject(setup, testconstants.NocCert1Subject) require.Equal(t, codes.NotFound, status.Code(err)) - aprCertsBySubjectKeyID, _ = queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1Subject) + aprCertsBySubjectKeyID, _ = queryAllNocCertificatesBySubjectKeyID(setup, testconstants.NocCert1Subject) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) - _, err = queryNocCertificates(setup, testconstants.Vid) + _, err = queryNocCertificatesByVid(setup, testconstants.Vid) require.Equal(t, codes.NotFound, status.Code(err)) // check that unique certificate key is removed @@ -589,3 +567,35 @@ func queryRevokedNocRootCertificates(setup *TestSetup, subject, subjectKeyID str return &resp.RevokedNocRootCertificates, nil } + +func queryAllRevokedNocIcaCertificates(setup *TestSetup) ([]types.RevokedNocIcaCertificates, error) { //nolint:unparam + // query certificate + req := &types.QueryAllRevokedNocIcaCertificatesRequest{} + + resp, err := setup.Keeper.RevokedNocIcaCertificatesAll(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return resp.RevokedNocIcaCertificates, nil +} + +func queryRevokedNocIcaCertificates(setup *TestSetup, subject, subjectKeyID string) (*types.RevokedNocIcaCertificates, error) { //nolint:unparam + // query certificate + req := &types.QueryGetRevokedNocIcaCertificatesRequest{Subject: subject, SubjectKeyId: subjectKeyID} + + resp, err := setup.Keeper.RevokedNocIcaCertificates(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.RevokedNocIcaCertificates, nil +} diff --git a/x/pki/handler_revoke_non_root_cert_test.go b/x/pki/handler_revoke_non_root_cert_test.go index 3c2d1a774..f5c84d4d5 100644 --- a/x/pki/handler_revoke_non_root_cert_test.go +++ b/x/pki/handler_revoke_non_root_cert_test.go @@ -180,6 +180,7 @@ func TestHandler_RevokeX509Cert_ByNotOwnerButSameVendor(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // add first vendor account with VID = 1 @@ -239,6 +240,7 @@ func TestHandler_RevokeX509Cert_ByOtherVendor(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // add first vendor account with VID = 1 @@ -302,6 +304,7 @@ func TestHandler_RevokeX509Cert(t *testing.T) { // store root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // Add vendor account @@ -382,6 +385,7 @@ func TestHandler_RevokeX509Cert_BySerialNumber(t *testing.T) { require.NoError(t, err) intermediateCertificate := intermediateCertificateNoVid(vendorAccAddress) intermediateCertificate.SerialNumber = SerialNumber + setup.Keeper.AddAllCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, intermediateCertificate) setup.Keeper.AddApprovedCertificateBySubjectKeyID(setup.Ctx, intermediateCertificate) setup.Keeper.SetUniqueCertificate( diff --git a/x/pki/handler_test.go b/x/pki/handler_test.go index 98b22a8de..fe24fefcb 100644 --- a/x/pki/handler_test.go +++ b/x/pki/handler_test.go @@ -335,10 +335,11 @@ func TestHandler_ProposeAddX509RootCert_ForNocCertificate(t *testing.T) { nocRootCertificate := rootCertificate(vendorAccAddress) nocRootCertificate.SerialNumber = testconstants.TestSerialNumber - nocRootCertificate.IsNoc = true + nocRootCertificate.CertificateType = types.CertificateType_OperationalPKI nocRootCertificate.Approvals = nil nocRootCertificate.Rejects = nil + setup.Keeper.AddAllCertificate(setup.Ctx, nocRootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, nocRootCertificate) setup.Keeper.AddNocRootCertificate(setup.Ctx, nocRootCertificate) uniqueCertificate := types.UniqueCertificate{ @@ -394,6 +395,7 @@ func TestHandler_ProposeAddX509RootCert_ForDifferentSerialNumberDifferentSigner( setup.Ctx, uniqueCertificate(rootCertificate.Subject, rootCertificate.SerialNumber), ) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // propose second root certificate @@ -888,6 +890,7 @@ func TestHandler_ProposeRevokeX509RootCert_ForNonRootCertificate(t *testing.T) { // store x509 root certificate rootCertificate := rootCertificate(setup.Trustee1) + setup.Keeper.AddAllCertificate(setup.Ctx, rootCertificate) setup.Keeper.AddApprovedCertificate(setup.Ctx, rootCertificate) // Add vendor account @@ -2104,6 +2107,11 @@ func queryAllApprovedCertificates(setup *TestSetup) ([]types.ApprovedCertificate return _queryAllApprovedCertificates(setup, "") } +func queryAllNocCertificates(setup *TestSetup) ([]types.NocCertificates, error) { + // query all certificates + return _queryAllNocCertificates(setup, "") +} + func queryAllApprovedCertificatesBySubjectKeyID(setup *TestSetup, subjectKeyID string) ([]types.ApprovedCertificates, error) { // query all certificates return _queryAllApprovedCertificates(setup, subjectKeyID) @@ -2383,6 +2391,197 @@ func queryRejectedCertificates( return &resp.RejectedCertificate, nil } +func queryAllNocCertificatesBySubjectKeyID(setup *TestSetup, subjectKeyID string) ([]types.NocCertificates, error) { + // query all noc certificates + return _queryAllNocCertificates(setup, subjectKeyID) +} + +func _queryAllNocCertificates(setup *TestSetup, subjectKeyID string) ([]types.NocCertificates, error) { + // query all certificates + req := &types.QueryNocCertificatesRequest{ + SubjectKeyId: subjectKeyID, + } + + resp, err := setup.Keeper.NocCertificatesAll(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return resp.NocCertificates, nil +} + +func querySingleNocCertificate( + setup *TestSetup, + subject string, + subjectKeyID string, +) (*types.Certificate, error) { + certificates, err := queryNocCertificates(setup, subject, subjectKeyID) + if err != nil { + return nil, err + } + + if len(certificates.Certs) > 1 { + require.Fail(setup.T, "More than 1 certificate returned") + } + + return certificates.Certs[0], nil +} + +func querySingleNocCertificateByVid( + setup *TestSetup, + vid int32, +) (*types.Certificate, error) { + certificates, err := queryNocCertificatesByVid(setup, vid) + if err != nil { + return nil, err + } + + if len(certificates.Certs) > 1 { + require.Fail(setup.T, "More than 1 certificate returned") + } + + return certificates.Certs[0], nil +} + +func queryNocCertificatesByVid( + setup *TestSetup, + vid int32, +) (*types.NocIcaCertificates, error) { + // query certificate + req := &types.QueryGetNocIcaCertificatesRequest{Vid: vid} + + resp, err := setup.Keeper.NocIcaCertificates(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocIcaCertificates, nil +} + +func queryNocCertificates( + setup *TestSetup, + subject string, + subjectKeyID string, +) (*types.NocCertificates, error) { + // query certificate + req := &types.QueryGetNocCertificatesRequest{ + Subject: subject, + SubjectKeyId: subjectKeyID, + } + + resp, err := setup.Keeper.NocCertificates(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocCertificates, nil +} + +func queryNocCertificatesBySubject( + setup *TestSetup, + subject string, +) (*types.NocCertificatesBySubject, error) { + // query certificate + req := &types.QueryGetNocCertificatesBySubjectRequest{ + Subject: subject, + } + + resp, err := setup.Keeper.NocCertificatesBySubject(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocCertificatesBySubject, nil +} + +func querySingleNocCertificateByVidAndSkid( + setup *TestSetup, + vid int32, + subjectKeyID string, +) (*types.Certificate, float32, error) { + certificates, err := queryNocCertificatesByVidAndSkid(setup, vid, subjectKeyID) + if err != nil { + return nil, 0, err + } + + if len(certificates.Certs) > 1 { + require.Fail(setup.T, "More than 1 certificate returned") + } + + return certificates.Certs[0], certificates.Tq, nil +} + +func queryNocCertificatesByVidAndSkid( + setup *TestSetup, + vid int32, + subjectKeyID string, +) (*types.NocCertificatesByVidAndSkid, error) { + // query certificate + req := &types.QueryGetNocCertificatesByVidAndSkidRequest{Vid: vid, SubjectKeyId: subjectKeyID} + + resp, err := setup.Keeper.NocCertificatesByVidAndSkid(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocCertificatesByVidAndSkid, nil +} + +func querySingleNocRootCertificate( + setup *TestSetup, + vid int32, +) (*types.Certificate, error) { + certificates, err := queryNocRootCertificates(setup, vid) + if err != nil { + return nil, err + } + + if len(certificates.Certs) > 1 { + require.Fail(setup.T, "More than 1 certificate returned") + } + + return certificates.Certs[0], nil +} + +func queryNocRootCertificates( + setup *TestSetup, + vid int32, +) (*types.NocRootCertificates, error) { + // query certificate + req := &types.QueryGetNocRootCertificatesRequest{Vid: vid} + + resp, err := setup.Keeper.NocRootCertificates(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocRootCertificates, nil +} + func rootCertificate(address sdk.AccAddress) types.Certificate { return types.NewRootCertificate( testconstants.RootCertPem, diff --git a/x/pki/keeper/all_certificates.go b/x/pki/keeper/all_certificates.go new file mode 100644 index 000000000..178a385ce --- /dev/null +++ b/x/pki/keeper/all_certificates.go @@ -0,0 +1,181 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/x509" +) + +// SetAllCertificates set a specific certificates in the store from its index +func (k Keeper) SetAllCertificates(ctx sdk.Context, certificates types.AllCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + b := k.cdc.MustMarshal(&certificates) + store.Set(types.AllCertificatesKey( + certificates.Subject, + certificates.SubjectKeyId, + ), b) +} + +// AddAllCertificate add a certificate to the list of all certificates for the subject/subjectKeyId map. +func (k Keeper) AddAllCertificate(ctx sdk.Context, certificate types.Certificate) { + k._addAllCertificates(ctx, certificate.Subject, certificate.SubjectKeyId, certificate.SchemaVersion, []*types.Certificate{&certificate}) +} + +// AddAllCertificates add list of certificates in the store from its index +func (k Keeper) AddAllCertificates(ctx sdk.Context, subject string, subjectKeyID string, schemaVersion uint32, certs []*types.Certificate) { + k._addAllCertificates(ctx, subject, subjectKeyID, schemaVersion, certs) +} + +func (k Keeper) _addAllCertificates(ctx sdk.Context, subject string, subjectKeyID string, schemaVersion uint32, certs []*types.Certificate) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + + certificatesBytes := store.Get(types.AllCertificatesKey( + subject, + subjectKeyID, + )) + var certificates types.AllCertificates + + if certificatesBytes == nil { + certificates = types.AllCertificates{ + Subject: subject, + SubjectKeyId: subjectKeyID, + Certs: []*types.Certificate{}, + SchemaVersion: schemaVersion, + } + } else { + k.cdc.MustUnmarshal(certificatesBytes, &certificates) + } + + certificates.Certs = append(certificates.Certs, certs...) + + k.SetAllCertificates(ctx, certificates) +} + +// GetAllCertificates returns a certificates from its index +func (k Keeper) GetAllCertificates( + ctx sdk.Context, + subject string, + subjectKeyID string, + +) (val types.AllCertificates, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + + b := store.Get(types.AllCertificatesKey( + subject, + subjectKeyID, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// GetAllAllCertificates returns all certificates +func (k Keeper) GetAllAllCertificates(ctx sdk.Context) (list []types.AllCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.AllCertificates + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// RemoveAllCertificates removes a certificates from the store +func (k Keeper) RemoveAllCertificates( + ctx sdk.Context, + subject string, + subjectKeyID string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + store.Delete(types.AllCertificatesKey( + subject, + subjectKeyID, + )) +} + +func (k Keeper) RemoveAllCertificatesBySerialNumber(ctx sdk.Context, subject, subjectKeyID, serialNumber string) { + k._removeAllCertificatesBySerialNumber(ctx, subject, subjectKeyID, func(cert *types.Certificate) bool { + return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber + }) +} + +func (k Keeper) _removeAllCertificatesBySerialNumber(ctx sdk.Context, subject string, subjectKeyID string, filter func(cert *types.Certificate) bool) { + certs, found := k.GetAllCertificates(ctx, subject, subjectKeyID) + if !found { + return + } + + numCertsBefore := len(certs.Certs) + for i := 0; i < len(certs.Certs); { + cert := certs.Certs[i] + if filter(cert) { + certs.Certs = append(certs.Certs[:i], certs.Certs[i+1:]...) + } else { + i++ + } + } + + if len(certs.Certs) == 0 { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + store.Delete(types.AllCertificatesKey( + subject, + subjectKeyID, + )) + } else if numCertsBefore > len(certs.Certs) { // Update state only if any certificate is removed + k.SetAllCertificates(ctx, certs) + } +} + +// Tries to build a valid certificate chain for the given certificate. +// Returns the RootSubject/RootSubjectKeyID combination or an error in case no valid certificate chain can be built. +func (k Keeper) verifyCertificate(ctx sdk.Context, + x509Certificate *x509.Certificate, +) (*x509.Certificate, error) { + //nolint:nestif + if x509Certificate.IsSelfSigned() { + // in this system a certificate is self-signed if and only if it is a root certificate + if err := x509Certificate.Verify(x509Certificate, ctx.BlockTime()); err == nil { + return x509Certificate, nil + } + } else { + parentCertificates, found := k.GetAllCertificates(ctx, x509Certificate.Issuer, x509Certificate.AuthorityKeyID) + if !found { + return nil, pkitypes.NewErrRootCertificateDoesNotExist(x509Certificate.Issuer, x509Certificate.AuthorityKeyID) + } + + for _, cert := range parentCertificates.Certs { + parentX509Certificate, err := x509.DecodeX509Certificate(cert.PemCert) + if err != nil { + continue + } + + // verify certificate against parent + if err := x509Certificate.Verify(parentX509Certificate, ctx.BlockTime()); err != nil { + continue + } + + // verify parent certificate + if rootCertificate, err := k.verifyCertificate(ctx, parentX509Certificate); err == nil { + return rootCertificate, nil + } + } + } + + return nil, pkitypes.NewErrInvalidCertificate( + fmt.Sprintf("Certificate verification failed for certificate with subject=%v and subjectKeyID=%v", + x509Certificate.Subject, x509Certificate.SubjectKeyID)) +} diff --git a/x/pki/keeper/all_certificates_by_subject.go b/x/pki/keeper/all_certificates_by_subject.go new file mode 100644 index 000000000..6ea63c6a6 --- /dev/null +++ b/x/pki/keeper/all_certificates_by_subject.go @@ -0,0 +1,130 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// SetAllCertificatesBySubject set a specific allCertificatesBySubject in the store from its index +func (k Keeper) SetAllCertificatesBySubject(ctx sdk.Context, allCertificatesBySubject types.AllCertificatesBySubject) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesBySubjectKeyPrefix)) + b := k.cdc.MustMarshal(&allCertificatesBySubject) + store.Set(types.AllCertificatesBySubjectKey( + allCertificatesBySubject.Subject, + ), b) +} + +// Add AllCertificates to a subject->subjectKeyId index. +func (k Keeper) AddAllCertificateBySubject(ctx sdk.Context, subject string, subjectKeyID string) { + AllCertificatesBySubject, _ := k.GetAllCertificatesBySubject(ctx, subject) + + // Check if cert is already there + for _, existingID := range AllCertificatesBySubject.SubjectKeyIds { + if existingID == subjectKeyID { + return + } + } + + AllCertificatesBySubject.Subject = subject + AllCertificatesBySubject.SubjectKeyIds = append(AllCertificatesBySubject.SubjectKeyIds, subjectKeyID) + + k.SetAllCertificatesBySubject(ctx, AllCertificatesBySubject) +} + +// AddAllCertificates add list of certificates in the store from its index +func (k Keeper) AddAllCertificatesBySubject(ctx sdk.Context, subject string, schemaVersion uint32, subjectKeyIds []string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesBySubjectKeyPrefix)) + + certificatesBytes := store.Get(types.AllCertificatesBySubjectKey( + subject, + )) + var certificates types.AllCertificatesBySubject + + if certificatesBytes == nil { + certificates = types.AllCertificatesBySubject{ + Subject: subject, + SubjectKeyIds: []string{}, + SchemaVersion: schemaVersion, + } + } else { + k.cdc.MustUnmarshal(certificatesBytes, &certificates) + } + + certificates.SubjectKeyIds = append(certificates.SubjectKeyIds, subjectKeyIds...) + + k.SetAllCertificatesBySubject(ctx, certificates) +} + +// GetAllCertificatesBySubject returns a allCertificatesBySubject from its index +func (k Keeper) GetAllCertificatesBySubject( + ctx sdk.Context, + subject string, + +) (val types.AllCertificatesBySubject, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesBySubjectKeyPrefix)) + + b := store.Get(types.AllCertificatesBySubjectKey( + subject, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// RemoveAllCertificateBySubject removes a allCertificatesBySubject from the store +func (k Keeper) RemoveAllCertificateBySubject(ctx sdk.Context, subject string, subjectKeyID string) { + AllCertificatesBySubject, _ := k.GetAllCertificatesBySubject(ctx, subject) + + certIDIndex := -1 + for i, existingIdentifier := range AllCertificatesBySubject.SubjectKeyIds { + if existingIdentifier == subjectKeyID { + certIDIndex = i + + break + } + } + if certIDIndex == -1 { + return + } + + AllCertificatesBySubject.SubjectKeyIds = append(AllCertificatesBySubject.SubjectKeyIds[:certIDIndex], AllCertificatesBySubject.SubjectKeyIds[certIDIndex+1:]...) + + if len(AllCertificatesBySubject.SubjectKeyIds) > 0 { + k.SetAllCertificatesBySubject(ctx, AllCertificatesBySubject) + } else { + k.RemoveAllCertificatesBySubject(ctx, subject) + } +} + +// RemoveAllCertificatesBySubject removes a AllCertificatesBySubject from the store. +func (k Keeper) RemoveAllCertificatesBySubject( + ctx sdk.Context, + subject string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesBySubjectKeyPrefix)) + store.Delete(types.AllCertificatesBySubjectKey( + subject, + )) +} + +// GetAllAllCertificatesBySubject returns all allCertificatesBySubject +func (k Keeper) GetAllAllCertificatesBySubject(ctx sdk.Context) (list []types.AllCertificatesBySubject) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.AllCertificatesBySubjectKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.AllCertificatesBySubject + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/pki/keeper/all_certificates_by_subject_test.go b/x/pki/keeper/all_certificates_by_subject_test.go new file mode 100644 index 000000000..95cd36816 --- /dev/null +++ b/x/pki/keeper/all_certificates_by_subject_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNAllCertificatesBySubject(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.AllCertificatesBySubject { + items := make([]types.AllCertificatesBySubject, n) + for i := range items { + items[i].Subject = strconv.Itoa(i) + + keeper.SetAllCertificatesBySubject(ctx, items[i]) + } + + return items +} + +func TestAllCertificatesBySubjectGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNAllCertificatesBySubject(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetAllCertificatesBySubject(ctx, + item.Subject, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestAllCertificatesBySubjectRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNAllCertificatesBySubject(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveAllCertificatesBySubject(ctx, + item.Subject, + ) + _, found := keeper.GetAllCertificatesBySubject(ctx, + item.Subject, + ) + require.False(t, found) + } +} + +func TestAllCertificatesBySubjectGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNAllCertificatesBySubject(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllAllCertificatesBySubject(ctx)), + ) +} diff --git a/x/pki/keeper/all_certificates_test.go b/x/pki/keeper/all_certificates_test.go new file mode 100644 index 000000000..3aefb1207 --- /dev/null +++ b/x/pki/keeper/all_certificates_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNCertificates(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.AllCertificates { + items := make([]types.AllCertificates, n) + for i := range items { + items[i].Subject = strconv.Itoa(i) + items[i].SubjectKeyId = strconv.Itoa(i) + + keeper.SetAllCertificates(ctx, items[i]) + } + + return items +} + +func TestCertificatesGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNCertificates(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetAllCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestCertificatesRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNCertificates(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveAllCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + _, found := keeper.GetAllCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + require.False(t, found) + } +} + +func TestCertificatesGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNCertificates(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllAllCertificates(ctx)), + ) +} diff --git a/x/pki/keeper/approved_certificates.go b/x/pki/keeper/approved_certificates.go index 0131b87db..9307ab6c3 100644 --- a/x/pki/keeper/approved_certificates.go +++ b/x/pki/keeper/approved_certificates.go @@ -1,13 +1,10 @@ package keeper import ( - "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" - "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/x509" ) // SetApprovedCertificates set a specific approvedCertificates in the store from its index. @@ -54,6 +51,39 @@ func (k Keeper) RemoveApprovedCertificates( )) } +func (k Keeper) RemoveApprovedCertificatesBySerialNumber(ctx sdk.Context, subject, subjectKeyID, serialNumber string) { + k._removeApprovedCertificatesBySerialNumber(ctx, subject, subjectKeyID, func(cert *types.Certificate) bool { + return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber + }) +} + +func (k Keeper) _removeApprovedCertificatesBySerialNumber(ctx sdk.Context, subject string, subjectKeyID string, filter func(cert *types.Certificate) bool) { + certs, found := k.GetApprovedCertificates(ctx, subject, subjectKeyID) + if !found { + return + } + + numCertsBefore := len(certs.Certs) + for i := 0; i < len(certs.Certs); { + cert := certs.Certs[i] + if filter(cert) { + certs.Certs = append(certs.Certs[:i], certs.Certs[i+1:]...) + } else { + i++ + } + } + + if len(certs.Certs) == 0 { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.ApprovedCertificatesKeyPrefix)) + store.Delete(types.AllCertificatesKey( + subject, + subjectKeyID, + )) + } else if numCertsBefore > len(certs.Certs) { // Update state only if any certificate is removed + k.SetApprovedCertificates(ctx, certs) + } +} + // GetAllApprovedCertificates returns all approvedCertificates. func (k Keeper) GetAllApprovedCertificates(ctx sdk.Context) (list []types.ApprovedCertificates) { store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.ApprovedCertificatesKeyPrefix)) @@ -98,58 +128,3 @@ func (k Keeper) AddApprovedCertificate(ctx sdk.Context, approvedCertificate type approvedCertificates.SubjectKeyId, ), b) } - -// Check if the Approved Certificate record associated with a -// Subject/SubjectKeyID combination is present in the store. -func (k Keeper) IsApprovedCertificatePresent( - ctx sdk.Context, - subject string, - subjectKeyID string, -) bool { - store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.ApprovedCertificatesKeyPrefix)) - - return store.Has(types.ApprovedCertificatesKey( - subject, - subjectKeyID, - )) -} - -// Tries to build a valid certificate chain for the given certificate. -// Returns the RootSubject/RootSubjectKeyID combination or an error in case no valid certificate chain can be built. -func (k Keeper) verifyCertificate(ctx sdk.Context, - x509Certificate *x509.Certificate, -) (*x509.Certificate, error) { - //nolint:nestif - if x509Certificate.IsSelfSigned() { - // in this system a certificate is self-signed if and only if it is a root certificate - if err := x509Certificate.Verify(x509Certificate, ctx.BlockTime()); err == nil { - return x509Certificate, nil - } - } else { - parentCertificates, found := k.GetApprovedCertificates(ctx, x509Certificate.Issuer, x509Certificate.AuthorityKeyID) - if !found { - return nil, pkitypes.NewErrRootCertificateDoesNotExist(x509Certificate.Issuer, x509Certificate.AuthorityKeyID) - } - - for _, cert := range parentCertificates.Certs { - parentX509Certificate, err := x509.DecodeX509Certificate(cert.PemCert) - if err != nil { - continue - } - - // verify certificate against parent - if err := x509Certificate.Verify(parentX509Certificate, ctx.BlockTime()); err != nil { - continue - } - - // verify parent certificate - if rootCertificate, err := k.verifyCertificate(ctx, parentX509Certificate); err == nil { - return rootCertificate, nil - } - } - } - - return nil, pkitypes.NewErrInvalidCertificate( - fmt.Sprintf("Certificate verification failed for certificate with subject=%v and subjectKeyID=%v", - x509Certificate.Subject, x509Certificate.SubjectKeyID)) -} diff --git a/x/pki/keeper/approved_certificates_by_subject_key_id.go b/x/pki/keeper/approved_certificates_by_subject_key_id.go index 485598613..5d8336606 100644 --- a/x/pki/keeper/approved_certificates_by_subject_key_id.go +++ b/x/pki/keeper/approved_certificates_by_subject_key_id.go @@ -98,8 +98,8 @@ func (k Keeper) RemoveApprovedCertificatesBySubjectKeyID( } } -func (k Keeper) RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx sdk.Context, subject, subjectKeyID, serialNumber string) { - k._removeCertificatesFromSubjectKeyIDState(ctx, subjectKeyID, func(cert *types.Certificate) bool { +func (k Keeper) RemoveApprovedCertificatesBySubjectKeyIDBySerialNumber(ctx sdk.Context, subject, subjectKeyID, serialNumber string) { + k._removeApprovedCertificatesFromSubjectKeyIDState(ctx, subjectKeyID, func(cert *types.Certificate) bool { return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber }) } @@ -120,7 +120,7 @@ func (k Keeper) GetAllApprovedCertificatesBySubjectKeyID(ctx sdk.Context) (list return } -func (k Keeper) _removeCertificatesFromSubjectKeyIDState(ctx sdk.Context, subjectKeyID string, filter func(cert *types.Certificate) bool) { +func (k Keeper) _removeApprovedCertificatesFromSubjectKeyIDState(ctx sdk.Context, subjectKeyID string, filter func(cert *types.Certificate) bool) { certs, found := k.GetApprovedCertificatesBySubjectKeyID(ctx, subjectKeyID) if !found { return diff --git a/x/pki/keeper/child_certificates.go b/x/pki/keeper/child_certificates.go index e726fcfdc..e8a438327 100644 --- a/x/pki/keeper/child_certificates.go +++ b/x/pki/keeper/child_certificates.go @@ -102,7 +102,7 @@ func (k Keeper) AddChildCertificate(ctx sdk.Context, issuer string, authorityKey ), b) } -func (k msgServer) RevokeChildCertificates(ctx sdk.Context, issuer string, authorityKeyID string) { +func (k msgServer) RevokeApprovedChildCertificates(ctx sdk.Context, issuer string, authorityKeyID string) { // Get issuer's ChildCertificates record childCertificates, _ := k.GetChildCertificates(ctx, issuer, authorityKeyID) @@ -110,14 +110,15 @@ func (k msgServer) RevokeChildCertificates(ctx sdk.Context, issuer string, autho for _, certIdentifier := range childCertificates.CertIds { // Revoke certificates with this subject/subjectKeyID combination certificates, _ := k.GetApprovedCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) - k.AddRevokedCertificates(ctx, certificates) - // FIXME: Below two lines is not in the context of RevokeChildCertificates method. In future current implementation must be refactored - if len(certificates.Certs) > 0 { - // If cert is NOC then remove it from NOC ICA certificates list - k.RemoveNocIcaCertificate(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId, certificates.Certs[0].Vid) - // remove from vid, subject key ID -> certificates map - k.RemoveNocCertificateByVidSubjectAndSkid(ctx, certificates.Certs[0].Vid, certIdentifier.Subject, certificates.SubjectKeyId) - } + k.AddRevokedCertificates(ctx, types.RevokedCertificates(certificates)) + + // Remove certificate from global certificates list + k.RemoveAllCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // remove from global subject -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // Remove certificate from approved certificates list k.RemoveApprovedCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) // remove from subject -> subject key ID map @@ -127,7 +128,51 @@ func (k msgServer) RevokeChildCertificates(ctx sdk.Context, issuer string, autho k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) // Process child certificates recursively - k.RevokeChildCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + k.RevokeApprovedChildCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + } + + // Delete entire ChildCertificates record of issuer + k.RemoveChildCertificates(ctx, issuer, authorityKeyID) +} + +func (k msgServer) RevokeNocChildCertificates(ctx sdk.Context, issuer string, authorityKeyID string) { + // Get issuer's ChildCertificates record + childCertificates, _ := k.GetChildCertificates(ctx, issuer, authorityKeyID) + + // For each child certificate subject/subjectKeyID combination + for _, certIdentifier := range childCertificates.CertIds { + // Revoke certificates with this subject/subjectKeyID combination + certificates, _ := k.GetNocCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + k.AddRevokedNocIcaCertificates(ctx, types.RevokedNocIcaCertificates{ + Subject: certificates.Subject, + SubjectKeyId: certificates.SubjectKeyId, + Certs: certificates.Certs, + }) + + // Remove certificate from global certificates list + k.RemoveAllCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // remove from global subject -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // Remove certificate from noc certificates list + k.RemoveNocCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // Remove it from NOC ICA certificates list + k.RemoveNocIcaCertificate(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId, certificates.Certs[0].Vid) + + // Remove from vid, subject key ID -> certificates map + k.RemoveNocCertificateByVidSubjectAndSkid(ctx, certificates.Certs[0].Vid, certIdentifier.Subject, certificates.SubjectKeyId) + + // remove from subject -> subject key ID map + k.RemoveNocCertificateBySubject(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // remove from subject key ID -> certificates map + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + + // Process child certificates recursively + k.RevokeNocChildCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) } // Delete entire ChildCertificates record of issuer diff --git a/x/pki/keeper/grpc_query_all_certificates_by_subject.go b/x/pki/keeper/grpc_query_all_certificates_by_subject.go new file mode 100644 index 000000000..9b1faacd8 --- /dev/null +++ b/x/pki/keeper/grpc_query_all_certificates_by_subject.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) AllCertificatesBySubject(c context.Context, req *types.QueryGetAllCertificatesBySubjectRequest) (*types.QueryGetAllCertificatesBySubjectResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetAllCertificatesBySubject( + ctx, + req.Subject, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetAllCertificatesBySubjectResponse{AllCertificatesBySubject: val}, nil +} diff --git a/x/pki/keeper/grpc_query_all_certificates_by_subject_test.go b/x/pki/keeper/grpc_query_all_certificates_by_subject_test.go new file mode 100644 index 000000000..ee8c333d9 --- /dev/null +++ b/x/pki/keeper/grpc_query_all_certificates_by_subject_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func TestAllCertificatesBySubjectQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNAllCertificatesBySubject(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetAllCertificatesBySubjectRequest + response *types.QueryGetAllCertificatesBySubjectResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetAllCertificatesBySubjectRequest{ + Subject: msgs[0].Subject, + }, + response: &types.QueryGetAllCertificatesBySubjectResponse{AllCertificatesBySubject: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetAllCertificatesBySubjectRequest{ + Subject: msgs[1].Subject, + }, + response: &types.QueryGetAllCertificatesBySubjectResponse{AllCertificatesBySubject: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetAllCertificatesBySubjectRequest{ + Subject: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.AllCertificatesBySubject(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} diff --git a/x/pki/keeper/grpc_query_certificates.go b/x/pki/keeper/grpc_query_certificates.go new file mode 100644 index 000000000..25a6cfbaa --- /dev/null +++ b/x/pki/keeper/grpc_query_certificates.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func (k Keeper) CertificatesAll(c context.Context, req *types.QueryAllCertificatesRequest) (*types.QueryAllCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var ( + certificatess []types.AllCertificates + pageRes *query.PageResponse + err error + ) + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + nocCertificatesStore := prefix.NewStore(store, pkitypes.KeyPrefix(types.AllCertificatesKeyPrefix)) + + pageRes, err = query.Paginate(nocCertificatesStore, req.Pagination, func(key []byte, value []byte) error { + var certificates types.AllCertificates + if err := k.cdc.Unmarshal(value, &certificates); err != nil { + return err + } + + certificatess = append(certificatess, certificates) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllCertificatesResponse{Certificates: certificatess, Pagination: pageRes}, nil +} + +func (k Keeper) Certificates(c context.Context, req *types.QueryGetCertificatesRequest) (*types.QueryGetCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetAllCertificates( + ctx, + req.Subject, + req.SubjectKeyId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetCertificatesResponse{Certificates: val}, nil +} diff --git a/x/pki/keeper/grpc_query_certificates_test.go b/x/pki/keeper/grpc_query_certificates_test.go new file mode 100644 index 000000000..a3ced4a88 --- /dev/null +++ b/x/pki/keeper/grpc_query_certificates_test.go @@ -0,0 +1,128 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func TestCertificatesQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNCertificates(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetCertificatesRequest + response *types.QueryGetCertificatesResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetCertificatesRequest{ + Subject: msgs[0].Subject, + SubjectKeyId: msgs[0].SubjectKeyId, + }, + response: &types.QueryGetCertificatesResponse{Certificates: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetCertificatesRequest{ + Subject: msgs[1].Subject, + SubjectKeyId: msgs[1].SubjectKeyId, + }, + response: &types.QueryGetCertificatesResponse{Certificates: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetCertificatesRequest{ + Subject: strconv.Itoa(100000), + SubjectKeyId: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Certificates(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestCertificatesQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNCertificates(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllCertificatesRequest { + return &types.QueryAllCertificatesRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.CertificatesAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Certificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Certificates), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.CertificatesAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Certificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Certificates), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.CertificatesAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Certificates), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.ApprovedCertificatesAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/pki/keeper/grpc_query_noc_certificates.go b/x/pki/keeper/grpc_query_noc_certificates.go new file mode 100644 index 000000000..c5697f47b --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_certificates.go @@ -0,0 +1,80 @@ +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func (k Keeper) NocCertificatesAll(c context.Context, req *types.QueryNocCertificatesRequest) (*types.QueryNocCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var ( + nocCertificatess []types.NocCertificates + pageRes *query.PageResponse + err error + ) + ctx := sdk.UnwrapSDKContext(c) + + if req.SubjectKeyId != "" { + nocCerts, found := k.GetNocCertificatesBySubjectKeyID( + ctx, + req.SubjectKeyId, + ) + + if found { + nocCertificatess = append(nocCertificatess, types.NocCertificates{ + SubjectKeyId: nocCerts.SubjectKeyId, + Certs: nocCerts.Certs, + }) + } + pageRes = &query.PageResponse{Total: 1} + } else { + store := ctx.KVStore(k.storeKey) + nocCertificatesStore := prefix.NewStore(store, pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + + pageRes, err = query.Paginate(nocCertificatesStore, req.Pagination, func(key []byte, value []byte) error { + var nocCertificates types.NocCertificates + if err := k.cdc.Unmarshal(value, &nocCertificates); err != nil { + return err + } + + nocCertificatess = append(nocCertificatess, nocCertificates) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + } + + return &types.QueryNocCertificatesResponse{NocCertificates: nocCertificatess, Pagination: pageRes}, nil +} + +func (k Keeper) NocCertificates(c context.Context, req *types.QueryGetNocCertificatesRequest) (*types.QueryGetNocCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetNocCertificates( + ctx, + req.Subject, + req.SubjectKeyId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetNocCertificatesResponse{NocCertificates: val}, nil +} diff --git a/x/pki/keeper/grpc_query_noc_certificates_by_subject.go b/x/pki/keeper/grpc_query_noc_certificates_by_subject.go new file mode 100644 index 000000000..329d8f83d --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_certificates_by_subject.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) NocCertificatesBySubject(c context.Context, req *types.QueryGetNocCertificatesBySubjectRequest) (*types.QueryGetNocCertificatesBySubjectResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetNocCertificatesBySubject( + ctx, + req.Subject, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetNocCertificatesBySubjectResponse{NocCertificatesBySubject: val}, nil +} diff --git a/x/pki/keeper/grpc_query_noc_certificates_by_subject_test.go b/x/pki/keeper/grpc_query_noc_certificates_by_subject_test.go new file mode 100644 index 000000000..03bf46efe --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_certificates_by_subject_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func TestNocCertificatesBySubjectQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNNocCertificatesBySubject(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetNocCertificatesBySubjectRequest + response *types.QueryGetNocCertificatesBySubjectResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetNocCertificatesBySubjectRequest{ + Subject: msgs[0].Subject, + }, + response: &types.QueryGetNocCertificatesBySubjectResponse{NocCertificatesBySubject: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetNocCertificatesBySubjectRequest{ + Subject: msgs[1].Subject, + }, + response: &types.QueryGetNocCertificatesBySubjectResponse{NocCertificatesBySubject: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetNocCertificatesBySubjectRequest{ + Subject: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.NocCertificatesBySubject(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} diff --git a/x/pki/keeper/grpc_query_noc_certificates_test.go b/x/pki/keeper/grpc_query_noc_certificates_test.go new file mode 100644 index 000000000..58ac495b0 --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_certificates_test.go @@ -0,0 +1,135 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func TestNocCertificatesQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNNocCertificates(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetNocCertificatesRequest + response *types.QueryGetNocCertificatesResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetNocCertificatesRequest{ + Subject: msgs[0].Subject, + SubjectKeyId: msgs[0].SubjectKeyId, + }, + response: &types.QueryGetNocCertificatesResponse{NocCertificates: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetNocCertificatesRequest{ + Subject: msgs[1].Subject, + SubjectKeyId: msgs[1].SubjectKeyId, + }, + response: &types.QueryGetNocCertificatesResponse{NocCertificates: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetNocCertificatesRequest{ + Subject: strconv.Itoa(100000), + SubjectKeyId: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.NocCertificates(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestQueryNocCertificatesQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNNocCertificates(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool, subjectKeyId string) *types.QueryNocCertificatesRequest { + return &types.QueryNocCertificatesRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + SubjectKeyId: subjectKeyId, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.NocCertificatesAll(wctx, request(nil, uint64(i), uint64(step), false, "")) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.NocCertificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.NocCertificates), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.NocCertificatesAll(wctx, request(next, 0, uint64(step), false, "")) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.NocCertificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.NocCertificates), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.NocCertificatesAll(wctx, request(nil, 0, 0, true, "")) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.NocCertificates), + ) + }) + t.Run("By subjectkey-id", func(t *testing.T) { + resp, err := keeper.NocCertificatesAll(wctx, request(nil, 0, 0, true, "0")) + require.NoError(t, err) + require.Equal(t, 1, len(resp.NocCertificates)) + require.Equal(t, msgs[0].SubjectKeyId, resp.NocCertificates[0].SubjectKeyId) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.NocCertificatesAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/pki/keeper/grpc_query_rejected_certificate_test.go b/x/pki/keeper/grpc_query_rejected_certificate_test.go index 65991051a..031626500 100644 --- a/x/pki/keeper/grpc_query_rejected_certificate_test.go +++ b/x/pki/keeper/grpc_query_rejected_certificate_test.go @@ -33,7 +33,7 @@ func TestRejectedCertificateQuerySingle(t *testing.T) { desc: "First", request: &types.QueryGetRejectedCertificateRequest{ Subject: msgs[0].Subject, - SubjectKeyId: msgs[0].SubjectKeyId, + SubjectKeyID: msgs[0].SubjectKeyID, }, response: &types.QueryGetRejectedCertificateResponse{RejectedCertificate: msgs[0]}, }, @@ -41,7 +41,7 @@ func TestRejectedCertificateQuerySingle(t *testing.T) { desc: "Second", request: &types.QueryGetRejectedCertificateRequest{ Subject: msgs[1].Subject, - SubjectKeyId: msgs[1].SubjectKeyId, + SubjectKeyID: msgs[1].SubjectKeyID, }, response: &types.QueryGetRejectedCertificateResponse{RejectedCertificate: msgs[1]}, }, @@ -49,7 +49,7 @@ func TestRejectedCertificateQuerySingle(t *testing.T) { desc: "KeyNotFound", request: &types.QueryGetRejectedCertificateRequest{ Subject: strconv.Itoa(100000), - SubjectKeyId: strconv.Itoa(100000), + SubjectKeyID: strconv.Itoa(100000), }, err: status.Error(codes.InvalidArgument, "not found"), }, diff --git a/x/pki/keeper/grpc_query_revoked_noc_ica_certificates.go b/x/pki/keeper/grpc_query_revoked_noc_ica_certificates.go new file mode 100644 index 000000000..b7f87cabe --- /dev/null +++ b/x/pki/keeper/grpc_query_revoked_noc_ica_certificates.go @@ -0,0 +1,61 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func (k Keeper) RevokedNocIcaCertificatesAll(c context.Context, req *types.QueryAllRevokedNocIcaCertificatesRequest) (*types.QueryAllRevokedNocIcaCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var revokedNocIcaCertificatess []types.RevokedNocIcaCertificates + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + revokedNocIcaCertificatesStore := prefix.NewStore(store, pkitypes.KeyPrefix(types.RevokedNocIcaCertificatesKeyPrefix)) + + pageRes, err := query.Paginate(revokedNocIcaCertificatesStore, req.Pagination, func(key []byte, value []byte) error { + var revokedNocIcaCertificates types.RevokedNocIcaCertificates + if err := k.cdc.Unmarshal(value, &revokedNocIcaCertificates); err != nil { + return err + } + + revokedNocIcaCertificatess = append(revokedNocIcaCertificatess, revokedNocIcaCertificates) + + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllRevokedNocIcaCertificatesResponse{RevokedNocIcaCertificates: revokedNocIcaCertificatess, Pagination: pageRes}, nil +} + +func (k Keeper) RevokedNocIcaCertificates(c context.Context, req *types.QueryGetRevokedNocIcaCertificatesRequest) (*types.QueryGetRevokedNocIcaCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetRevokedNocIcaCertificates( + ctx, + req.Subject, + req.SubjectKeyId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetRevokedNocIcaCertificatesResponse{RevokedNocIcaCertificates: val}, nil +} diff --git a/x/pki/keeper/grpc_query_revoked_noc_ica_certificates_test.go b/x/pki/keeper/grpc_query_revoked_noc_ica_certificates_test.go new file mode 100644 index 000000000..dfe5625b9 --- /dev/null +++ b/x/pki/keeper/grpc_query_revoked_noc_ica_certificates_test.go @@ -0,0 +1,129 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func TestRevokedNocIcaCertificatesQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNRevokedNocIcaCertificates(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetRevokedNocIcaCertificatesRequest + response *types.QueryGetRevokedNocIcaCertificatesResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetRevokedNocIcaCertificatesRequest{ + Subject: msgs[0].Subject, + SubjectKeyId: msgs[0].SubjectKeyId, + }, + response: &types.QueryGetRevokedNocIcaCertificatesResponse{RevokedNocIcaCertificates: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetRevokedNocIcaCertificatesRequest{ + Subject: msgs[1].Subject, + SubjectKeyId: msgs[1].SubjectKeyId, + }, + response: &types.QueryGetRevokedNocIcaCertificatesResponse{RevokedNocIcaCertificates: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetRevokedNocIcaCertificatesRequest{ + Subject: strconv.Itoa(100000), + SubjectKeyId: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.RevokedNocIcaCertificates(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestRevokedNocIcaCertificatesQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNRevokedNocIcaCertificates(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllRevokedNocIcaCertificatesRequest { + return &types.QueryAllRevokedNocIcaCertificatesRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.RevokedNocIcaCertificatesAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.RevokedNocIcaCertificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.RevokedNocIcaCertificates), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.RevokedNocIcaCertificatesAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.RevokedNocIcaCertificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.RevokedNocIcaCertificates), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.RevokedNocIcaCertificatesAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.RevokedNocIcaCertificates), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.RevokedNocIcaCertificatesAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/pki/keeper/keeper.go b/x/pki/keeper/keeper.go index ef970a067..56060b0de 100644 --- a/x/pki/keeper/keeper.go +++ b/x/pki/keeper/keeper.go @@ -119,11 +119,49 @@ func filterCertificates(certificates *[]*types.Certificate, predicate Certificat func (k msgServer) removeApprovedX509Cert(ctx sdk.Context, certID types.CertificateIdentifier, certificates *types.ApprovedCertificates, serialNumber string) { if len(certificates.Certs) == 0 { + k.RemoveAllCertificates(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) k.RemoveApprovedCertificates(ctx, certID.Subject, certID.SubjectKeyId) k.RemoveApprovedCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) } else { - k.SetApprovedCertificates(ctx, *certificates) - k.RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + k.RemoveAllCertificatesBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + k.RemoveApprovedCertificatesBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + k.RemoveApprovedCertificatesBySubjectKeyIDBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + } +} + +func (k msgServer) removeNocX509Cert( + ctx sdk.Context, + certID types.CertificateIdentifier, + certificates *types.NocCertificates, + accountVid int32, + serialNumber string, + isRoot bool, +) { + if len(certificates.Certs) == 0 { //nolint:nestif + k.RemoveAllCertificates(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificates(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificatesByVidAndSkid(ctx, accountVid, certID.SubjectKeyId) + + if isRoot { + k.RemoveNocRootCertificate(ctx, certID.Subject, certID.SubjectKeyId, accountVid) + } else { + k.RemoveNocIcaCertificate(ctx, certID.Subject, certID.SubjectKeyId, accountVid) + } + } else { + k.RemoveAllCertificatesBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesBySubjectKeyIDBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesByVidAndSkidBySerialNumber(ctx, accountVid, certID.Subject, certID.SubjectKeyId, serialNumber) + + if isRoot { + k.RemoveNocRootCertificateBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, accountVid, serialNumber) + } else { + k.RemoveNocIcaCertificateBySerialNumber(ctx, certID.Subject, certID.SubjectKeyId, accountVid, serialNumber) + } } } diff --git a/x/pki/keeper/migrations.go b/x/pki/keeper/migrations.go index 6d8eb9592..4c3ddc1f6 100644 --- a/x/pki/keeper/migrations.go +++ b/x/pki/keeper/migrations.go @@ -26,3 +26,17 @@ func (m Migrator) Migrate2to3(ctx sdk.Context) error { return nil } + +// Migrate3to4 migrates from version 3 to 4. +func (m Migrator) Migrate3to4(ctx sdk.Context) error { + approvedCertificates := m.keeper.GetAllApprovedCertificates(ctx) + for _, cert := range approvedCertificates { + m.keeper.AddAllCertificates(ctx, cert.Subject, cert.SubjectKeyId, cert.SchemaVersion, cert.Certs) + } + approvedCertificatesBySubject := m.keeper.GetAllApprovedCertificatesBySubject(ctx) + for _, cert := range approvedCertificatesBySubject { + m.keeper.AddAllCertificatesBySubject(ctx, cert.Subject, cert.SchemaVersion, cert.SubjectKeyIds) + } + + return nil +} diff --git a/x/pki/keeper/migrations_test.go b/x/pki/keeper/migrations_test.go index 7928794e3..eb87541b4 100644 --- a/x/pki/keeper/migrations_test.go +++ b/x/pki/keeper/migrations_test.go @@ -27,6 +27,17 @@ func _createNApprovedCertificates(keeper *keeper.Keeper, ctx sdk.Context, n int) return items } +func _createNApprovedCertificatesBySubject(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.ApprovedCertificatesBySubject { + items := make([]types.ApprovedCertificatesBySubject, n) + for i := range items { + items[i].Subject = strconv.Itoa(i) + items[i].SubjectKeyIds = []string{strconv.Itoa(i)} + keeper.SetApprovedCertificatesBySubject(ctx, items[i]) + } + + return items +} + func TestMigrator_Migrate2to3(t *testing.T) { _keeper, ctx := keepertest.PkiKeeper(t, nil) msg := _createNApprovedCertificates(_keeper, ctx, 5) @@ -43,3 +54,32 @@ func TestMigrator_Migrate2to3(t *testing.T) { require.Equal(t, subjectKeyID, list.SubjectKeyId) require.Equal(t, msg[0].Certs, list.Certs) } + +func TestMigrator_Migrate3to4(t *testing.T) { + _keeper, ctx := keepertest.PkiKeeper(t, nil) + msg := _createNApprovedCertificates(_keeper, ctx, 5) + _createNApprovedCertificatesBySubject(_keeper, ctx, 5) + + migrator := keeper.NewMigrator(*_keeper) + err := migrator.Migrate3to4(ctx) + require.NoError(t, err) + + // check that all certificates migrated + subject := "0" + subjectKeyID := "0" + list, found := _keeper.GetAllCertificates(ctx, subject, subjectKeyID) + require.True(t, found) + + require.Equal(t, 1, len(list.Certs)) + require.Equal(t, subjectKeyID, list.SubjectKeyId) + require.Equal(t, msg[0].Certs, list.Certs) + + allList := _keeper.GetAllAllCertificates(ctx) + require.Equal(t, 5, len(allList)) + + // check that all certificates by subject migrated + subjList, found := _keeper.GetAllCertificatesBySubject(ctx, subject) + require.True(t, found) + require.Equal(t, subject, subjList.Subject) + require.Equal(t, 1, len(subjList.SubjectKeyIds)) +} diff --git a/x/pki/keeper/msg_server_add_noc_x_509_ica_cert.go b/x/pki/keeper/msg_server_add_noc_x_509_ica_cert.go index c7a5fc557..713d3d4e6 100644 --- a/x/pki/keeper/msg_server_add_noc_x_509_ica_cert.go +++ b/x/pki/keeper/msg_server_add_noc_x_509_ica_cert.go @@ -43,7 +43,7 @@ func (k msgServer) AddNocX509IcaCert(goCtx context.Context, msg *types.MsgAddNoc accountVid := signerAccount.VendorID // Get list of certificates for Subject / Subject Key Id combination - certificates, _ := k.GetApprovedCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) + certificates, _ := k.GetAllCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) if len(certificates.Certs) > 0 { existingCertificate := certificates.Certs[0] @@ -56,7 +56,7 @@ func (k msgServer) AddNocX509IcaCert(goCtx context.Context, msg *types.MsgAddNoc } // Existing certificate must be NOC certificate - if !existingCertificate.IsNoc { + if existingCertificate.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(x509Certificate.Subject, x509Certificate.SubjectKeyID) } @@ -65,19 +65,21 @@ func (k msgServer) AddNocX509IcaCert(goCtx context.Context, msg *types.MsgAddNoc return nil, pkitypes.NewErrUnauthorizedCertVendor(existingCertificate.Vid) } } + // Valid certificate chain must be built for new certificate rootCert, err := k.verifyCertificate(ctx, x509Certificate) if err != nil { return nil, err } // Check Root and Intermediate certs for VID scoping - rootCerts, _ := k.GetApprovedCertificates(ctx, rootCert.Subject, rootCert.SubjectKeyID) + rootCerts, _ := k.GetAllCertificates(ctx, rootCert.Subject, rootCert.SubjectKeyID) if len(rootCerts.Certs) == 0 { return nil, pkitypes.NewErrRootCertificateDoesNotExist(rootCert.Subject, rootCert.SubjectKeyID) } nocRootCert := rootCerts.Certs[0] + // Root certificate must be NOC certificate - if !nocRootCert.IsNoc { + if nocRootCert.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrRootOfNocCertIsNotNoc(rootCert.Subject, rootCert.SubjectKeyID) } // Check VID scoping @@ -101,11 +103,14 @@ func (k msgServer) AddNocX509IcaCert(goCtx context.Context, msg *types.MsgAddNoc msg.CertSchemaVersion, ) - // Add a NOC certificate to the list of NOC certificates with the same VID - k.AddNocIcaCertificate(ctx, certificate) + // Add to the global list of certificates + k.AddAllCertificate(ctx, certificate) - // append new certificate to list of certificates with the same Subject/SubjectKeyId combination and store updated list - k.AddApprovedCertificate(ctx, certificate) + // Add to the list of all NOC certificates + k.AddNocCertificate(ctx, certificate) + + // Add to the list of NOC ica certificates with the same VID + k.AddNocIcaCertificate(ctx, certificate) // add the certificate identifier to the issuer's Child Certificates record certificateIdentifier := types.CertificateIdentifier{ @@ -122,14 +127,14 @@ func (k msgServer) AddNocX509IcaCert(goCtx context.Context, msg *types.MsgAddNoc } k.SetUniqueCertificate(ctx, uniqueCertificate) - // add to vid, subject -> certificates map + // add to certificates map indexed by { vid, subject key id } k.AddNocCertificateByVidAndSkid(ctx, certificate) - // add to subject -> subject key ID map - k.AddApprovedCertificateBySubject(ctx, certificate.Subject, certificate.SubjectKeyId) + // add to certificates map indexed by { subject } + k.AddNocCertificateBySubject(ctx, certificate) - // add to subject key ID -> certificates map - k.AddApprovedCertificateBySubjectKeyID(ctx, certificate) + // add to certificates map indexed by { subject key id } + k.AddNocCertificateBySubjectKeyID(ctx, certificate) return &types.MsgAddNocX509IcaCertResponse{}, nil } diff --git a/x/pki/keeper/msg_server_add_noc_x_509_root_cert.go b/x/pki/keeper/msg_server_add_noc_x_509_root_cert.go index 2984e163f..20a356933 100644 --- a/x/pki/keeper/msg_server_add_noc_x_509_root_cert.go +++ b/x/pki/keeper/msg_server_add_noc_x_509_root_cert.go @@ -50,7 +50,7 @@ func (k msgServer) AddNocX509RootCert(goCtx context.Context, msg *types.MsgAddNo signerVid := signerAccount.VendorID // Get list of certificates for Subject / Subject Key Id combination - existingCertificates, found := k.GetApprovedCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) + existingCertificates, found := k.GetAllCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) if found && len(existingCertificates.Certs) > 0 { existingCertificate := existingCertificates.Certs[0] @@ -62,7 +62,7 @@ func (k msgServer) AddNocX509RootCert(goCtx context.Context, msg *types.MsgAddNo } // Existing certificate must be NOC certificate - if !existingCertificate.IsNoc { + if existingCertificate.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(x509Certificate.Subject, x509Certificate.SubjectKeyID) } @@ -84,11 +84,17 @@ func (k msgServer) AddNocX509RootCert(goCtx context.Context, msg *types.MsgAddNo msg.CertSchemaVersion, ) - // Add a NOC root certificate to the list of NOC root certificates with the same VID - k.AddNocRootCertificate(ctx, certificate) + // Add to the global list of certificates + k.AddAllCertificate(ctx, certificate) + + // append to global list of certificates indexed by subject + k.AddAllCertificateBySubject(ctx, certificate.Subject, certificate.SubjectKeyId) - // append new certificate to list of certificates with the same Subject/SubjectKeyId combination and store updated list - k.AddApprovedCertificate(ctx, certificate) + // Add to the list of all NOC certificates + k.AddNocCertificate(ctx, certificate) + + // Add to the list of NOC root certificates with the same VID + k.AddNocRootCertificate(ctx, certificate) // register the unique certificate key uniqueCertificate := types.UniqueCertificate{ @@ -98,14 +104,14 @@ func (k msgServer) AddNocX509RootCert(goCtx context.Context, msg *types.MsgAddNo } k.SetUniqueCertificate(ctx, uniqueCertificate) - // add to vid, subject -> certificates map + // add to certificates map indexed by { vid, subject key id } k.AddNocCertificateByVidAndSkid(ctx, certificate) - // add to subject -> subject key ID map - k.AddApprovedCertificateBySubject(ctx, certificate.Subject, certificate.SubjectKeyId) + // add to certificates map indexed by { subject } + k.AddNocCertificateBySubject(ctx, certificate) - // add to subject key ID -> certificates map - k.AddApprovedCertificateBySubjectKeyID(ctx, certificate) + // add to certificates map indexed by { subject key id } + k.AddNocCertificateBySubjectKeyID(ctx, certificate) return &types.MsgAddNocX509RootCertResponse{}, nil } diff --git a/x/pki/keeper/msg_server_add_x_509_cert.go b/x/pki/keeper/msg_server_add_x_509_cert.go index c535f48cd..eff3416ea 100644 --- a/x/pki/keeper/msg_server_add_x_509_cert.go +++ b/x/pki/keeper/msg_server_add_x_509_cert.go @@ -41,7 +41,7 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert) } // Get list of certificates for Subject / Subject Key Id combination - certificates, found := k.GetApprovedCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) + certificates, found := k.GetAllCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) if found && len(certificates.Certs) > 0 { existingCertificate := certificates.Certs[0] @@ -54,7 +54,7 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert) } // Existing certificate must not be NOC certificate - if existingCertificate.IsNoc { + if existingCertificate.CertificateType == types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNotNocCertButExistingNoc(x509Certificate.Subject, x509Certificate.SubjectKeyID) } @@ -70,14 +70,14 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert) } // get the full structure of the root certificate which contains the necessary fields for further validation - approvedRootCerts, _ := k.GetApprovedCertificates(ctx, decodedRootCert.Subject, decodedRootCert.SubjectKeyID) - if len(approvedRootCerts.Certs) == 0 { + rootCerts, _ := k.GetAllCertificates(ctx, decodedRootCert.Subject, decodedRootCert.SubjectKeyID) + if len(rootCerts.Certs) == 0 { return nil, pkitypes.NewErrRootCertificateDoesNotExist(decodedRootCert.Subject, decodedRootCert.SubjectKeyID) } - rootCert := approvedRootCerts.Certs[0] + rootCert := rootCerts.Certs[0] // Root certificate must not be NOC - if rootCert.IsNoc { + if rootCert.CertificateType == types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNotNocCertButRootIsNoc() } @@ -107,7 +107,13 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert) msg.CertSchemaVersion, ) - // append new certificate to list of certificates with the same Subject/SubjectKeyId combination and store updated list + // append to global list of certificates + k.AddAllCertificate(ctx, certificate) + + // append to global list of certificates indexed by subject + k.AddAllCertificateBySubject(ctx, certificate.Subject, certificate.SubjectKeyId) + + // append new certificate to list of certificates with the same Subject/SubjectKeyID combination and store updated list k.AddApprovedCertificate(ctx, certificate) // add the certificate identifier to the issuer's Child Certificates record diff --git a/x/pki/keeper/msg_server_approve_add_x_509_root_cert.go b/x/pki/keeper/msg_server_approve_add_x_509_root_cert.go index 49496765f..8a198b0b6 100644 --- a/x/pki/keeper/msg_server_approve_add_x_509_root_cert.go +++ b/x/pki/keeper/msg_server_approve_add_x_509_root_cert.go @@ -76,12 +76,18 @@ func (k msgServer) ApproveAddX509RootCert(goCtx context.Context, msg *types.MsgA proposedCertificate.CertSchemaVersion, ) - // add approved certificate to stored list of certificates with the same Subject/SubjectKeyId combination - k.AddApprovedCertificate(ctx, rootCertificate) - // delete proposed certificate k.RemoveProposedCertificate(ctx, msg.Subject, msg.SubjectKeyId) + // add approved certificate to stored list of all certificates + k.AddAllCertificate(ctx, rootCertificate) + + // append to global list of certificates indexed by subject + k.AddAllCertificateBySubject(ctx, rootCertificate.Subject, rootCertificate.SubjectKeyId) + + // add approved certificate to stored list of certificates with the same Subject/SubjectKeyID combination + k.AddApprovedCertificate(ctx, rootCertificate) + // add to root certificates index certID := types.CertificateIdentifier{ Subject: rootCertificate.Subject, diff --git a/x/pki/keeper/msg_server_approve_revoke_x_509_root_cert.go b/x/pki/keeper/msg_server_approve_revoke_x_509_root_cert.go index 08a4b5db8..342ea1593 100644 --- a/x/pki/keeper/msg_server_approve_revoke_x_509_root_cert.go +++ b/x/pki/keeper/msg_server_approve_revoke_x_509_root_cert.go @@ -61,6 +61,7 @@ func (k msgServer) ApproveRevokeX509RootCert(goCtx context.Context, msg *types.M SubjectKeyId: msg.SubjectKeyId, } k.AddRevokedRootCertificate(ctx, certID) + k.RemoveProposedCertificateRevocation(ctx, msg.Subject, msg.SubjectKeyId, msg.SerialNumber) if msg.SerialNumber != "" { @@ -70,7 +71,7 @@ func (k msgServer) ApproveRevokeX509RootCert(goCtx context.Context, msg *types.M } if revocation.RevokeChild { - k.RevokeChildCertificates(ctx, certID.Subject, certID.SubjectKeyId) + k.RevokeApprovedChildCertificates(ctx, certID.Subject, certID.SubjectKeyId) } } else { k.SetProposedCertificateRevocation(ctx, revocation) @@ -95,9 +96,13 @@ func (k msgServer) _revokeRootCertificates( Subject: certificates.Subject, SubjectKeyId: certificates.SubjectKeyId, } + // remove from root certs index, add to revoked root certs + k.AddRevokedCertificates(ctx, types.RevokedCertificates(certificates)) + k.RemoveApprovedRootCertificate(ctx, certID) - k.AddRevokedCertificates(ctx, certificates) + k.RemoveAllCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) k.RemoveApprovedCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) // remove from subject -> subject key ID map k.RemoveApprovedCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) @@ -113,15 +118,19 @@ func (k msgServer) _revokeRootCertificate( ) { cert, _ := findCertificate(serialNumber, &certificates.Certs) cert.Approvals = approvals - revCert := types.ApprovedCertificates{ - Subject: cert.Subject, - SubjectKeyId: cert.SubjectKeyId, - Certs: []*types.Certificate{cert}, + revCert := types.RevokedCertificates{ + Subject: cert.Subject, + SubjectKeyId: cert.SubjectKeyId, + Certs: []*types.Certificate{cert}, + SchemaVersion: cert.SchemaVersion, } k.AddRevokedCertificates(ctx, revCert) removeCertFromList(cert.Issuer, cert.SerialNumber, &certificates.Certs) + if len(certificates.Certs) == 0 { + k.RemoveAllCertificates(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) k.RemoveApprovedCertificates(ctx, cert.Subject, cert.SubjectKeyId) k.RemoveApprovedRootCertificate(ctx, types.CertificateIdentifier{ @@ -133,6 +142,7 @@ func (k msgServer) _revokeRootCertificate( k.RemoveApprovedCertificatesBySubjectKeyID(ctx, cert.Subject, cert.SubjectKeyId) } else { k.SetApprovedCertificates(ctx, certificates) - k.RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveAllCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveApprovedCertificatesBySubjectKeyIDBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) } } diff --git a/x/pki/keeper/msg_server_assign_vid.go b/x/pki/keeper/msg_server_assign_vid.go index ec7080b8a..32e8ad2fa 100644 --- a/x/pki/keeper/msg_server_assign_vid.go +++ b/x/pki/keeper/msg_server_assign_vid.go @@ -28,8 +28,8 @@ func (k msgServer) AssignVid(goCtx context.Context, msg *types.MsgAssignVid) (*t ) } - // get corresponding approved certificates - certificates, found := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + // get corresponding certificates + certificates, found := k.GetAllCertificates(ctx, msg.Subject, msg.SubjectKeyId) if !found { return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId) } @@ -44,6 +44,14 @@ func (k msgServer) AssignVid(goCtx context.Context, msg *types.MsgAssignVid) (*t ) } + // Existing certificate must not be NOC certificate + if certificate.CertificateType == types.CertificateType_OperationalPKI { + return nil, pkitypes.NewErrInappropriateCertificateType( + fmt.Sprintf("Inappropriate Certificate Type: Certificate with subject=%v and subjectKeyID=%v "+ + "is NOC certificate.", msg.Subject, msg.SubjectKeyId), + ) + } + // check that the certificate VID and Message VID are equal subjectVid, err := x509.GetVidFromSubject(certificate.SubjectAsText) if err != nil { @@ -53,25 +61,50 @@ func (k msgServer) AssignVid(goCtx context.Context, msg *types.MsgAssignVid) (*t return nil, pkitypes.NewErrCertificateVidNotEqualMsgVid(fmt.Sprintf("Certificate VID=%d is not equal to the msg VID=%d", subjectVid, msg.Vid)) } + // assign VID to certificates in global list + hasCertificateWithoutVid := k.assignVid(&certificates.Certs, msg.Vid) + // check that the VID has been set for at least one certificate + if !hasCertificateWithoutVid { + return nil, pkitypes.NewErrNotEmptyVid("Vendor ID (VID) already present in certificates") + } + + // assign VID to certificates in approved list + approvedCertificates, found := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + if !found { + return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId) + } + k.assignVid(&approvedCertificates.Certs, msg.Vid) + + // assign VID to certificates in list indexed by subject key id + certificatesBySubjectKeyID, found := k.GetApprovedCertificatesBySubjectKeyID(ctx, msg.SubjectKeyId) + if !found { + return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId) + } + k.assignVid(&certificatesBySubjectKeyID.Certs, msg.Vid) + + // update global certificates list + k.SetAllCertificates(ctx, certificates) + // update approved certificates list + k.SetApprovedCertificates(ctx, approvedCertificates) + // update certificates list indexed by subject key id + k.SetApprovedCertificatesBySubjectKeyID(ctx, certificatesBySubjectKeyID) + + return &types.MsgAssignVidResponse{}, nil +} + +func (k msgServer) assignVid(certificates *[]*types.Certificate, vid int32) bool { hasCertificateWithoutVid := false // assign the VID to certificates that don't have it - for _, certificate := range certificates.Certs { + for _, certificate := range *certificates { if certificate.Vid != 0 { continue } hasCertificateWithoutVid = true - certificate.Vid = msg.Vid + certificate.Vid = vid } - // check that the VID has been set for at least one certificate - if !hasCertificateWithoutVid { - return nil, pkitypes.NewErrNotEmptyVid("Vendor ID (VID) already present in certificates") - } - - k.SetApprovedCertificates(ctx, certificates) - - return &types.MsgAssignVidResponse{}, nil + return hasCertificateWithoutVid } diff --git a/x/pki/keeper/msg_server_propose_add_x_509_root_cert.go b/x/pki/keeper/msg_server_propose_add_x_509_root_cert.go index f38845b0f..ccd786dac 100644 --- a/x/pki/keeper/msg_server_propose_add_x_509_root_cert.go +++ b/x/pki/keeper/msg_server_propose_add_x_509_root_cert.go @@ -40,7 +40,7 @@ func (k msgServer) ProposeAddX509RootCert(goCtx context.Context, msg *types.MsgP "so it cannot be used as a root certificate.") } - // check if `Proposed` certificate with the same Subject/SubjectKeyId combination already exists + // check if `Proposed` certificate with the same Subject/SubjectKeyID combination already exists if k.IsProposedCertificatePresent(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) { return nil, pkitypes.NewErrProposedCertificateAlreadyExists(x509Certificate.Subject, x509Certificate.SubjectKeyID) } @@ -69,7 +69,7 @@ func (k msgServer) ProposeAddX509RootCert(goCtx context.Context, msg *types.MsgP } // Existing certificate must not be NOC certificate - if existingCertificate.IsNoc { + if existingCertificate.CertificateType == types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNotNocCertButExistingNoc(x509Certificate.Subject, x509Certificate.SubjectKeyID) } diff --git a/x/pki/keeper/msg_server_remove_noc_x_509_ica_cert.go b/x/pki/keeper/msg_server_remove_noc_x_509_ica_cert.go index dc637156f..0d8a94ce0 100644 --- a/x/pki/keeper/msg_server_remove_noc_x_509_ica_cert.go +++ b/x/pki/keeper/msg_server_remove_noc_x_509_ica_cert.go @@ -26,8 +26,8 @@ func (k msgServer) RemoveNocX509IcaCert(goCtx context.Context, msg *types.MsgRem signerAccount, _ := k.dclauthKeeper.GetAccountO(ctx, signerAddr) accountVid := signerAccount.VendorID - icaCerts, foundActive := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) - revCerts, foundRevoked := k.GetRevokedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + icaCerts, foundActive := k.GetNocCertificates(ctx, msg.Subject, msg.SubjectKeyId) + revCerts, foundRevoked := k.GetRevokedNocIcaCertificates(ctx, msg.Subject, msg.SubjectKeyId) certificates := icaCerts.Certs certificates = append(certificates, revCerts.Certs...) if len(certificates) == 0 { @@ -41,7 +41,7 @@ func (k msgServer) RemoveNocX509IcaCert(goCtx context.Context, msg *types.MsgRem } // Existing certificate must be NOC certificate - if !cert.IsNoc { + if cert.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(msg.Subject, msg.SubjectKeyId) } @@ -69,30 +69,32 @@ func (k msgServer) RemoveNocX509IcaCert(goCtx context.Context, msg *types.MsgRem k.RemoveUniqueCertificate(ctx, certBySerialNumber.Issuer, certBySerialNumber.SerialNumber) if foundActive { - // Remove from Approved lists + // Remove from certificates lists removeCertFromList(certBySerialNumber.Issuer, certBySerialNumber.SerialNumber, &icaCerts.Certs) - k.removeApprovedX509Cert(ctx, certID, &icaCerts, msg.SerialNumber) - - // Remove from ICA lists - k.RemoveNocIcaCertificateBySerialNumber(ctx, accountVid, certID.Subject, certID.SubjectKeyId, msg.SerialNumber) - k.RemoveNocCertificateByVidSubjectSkidAndSerialNumber(ctx, accountVid, certID.Subject, certID.SubjectKeyId, msg.SerialNumber) + k.removeNocX509Cert(ctx, certID, &icaCerts, accountVid, msg.SerialNumber, false) } + if foundRevoked { removeCertFromList(certBySerialNumber.Issuer, certBySerialNumber.SerialNumber, &revCerts.Certs) - k.removeOrUpdateRevokedX509Cert(ctx, certID, &revCerts) + k._removeRevokedNocX509IcaCert(ctx, certID, &revCerts) } } else { + // remove from global certificates map + k.RemoveAllCertificates(ctx, certID.Subject, certID.SubjectKeyId) + // remove from global subject -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + // remove from noc certificates map + k.RemoveNocCertificates(ctx, certID.Subject, certID.SubjectKeyId) + // remove from noc ica certificates map k.RemoveNocIcaCertificate(ctx, certID.Subject, certID.SubjectKeyId, accountVid) // remove from vid, subject key id map k.RemoveNocCertificatesByVidAndSkid(ctx, accountVid, certID.SubjectKeyId) - // remove from approved list - k.RemoveApprovedCertificates(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject -> subject key ID map - k.RemoveApprovedCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject key ID -> certificates map - k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) // remove from revoked list - k.RemoveRevokedCertificates(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveRevokedNocIcaCertificates(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject with serialNumber map for _, cert := range certificates { k.RemoveUniqueCertificate(ctx, cert.Issuer, cert.SerialNumber) @@ -101,3 +103,11 @@ func (k msgServer) RemoveNocX509IcaCert(goCtx context.Context, msg *types.MsgRem return &types.MsgRemoveNocX509IcaCertResponse{}, nil } + +func (k msgServer) _removeRevokedNocX509IcaCert(ctx sdk.Context, certID types.CertificateIdentifier, certificates *types.RevokedNocIcaCertificates) { + if len(certificates.Certs) == 0 { + k.RemoveRevokedNocIcaCertificates(ctx, certID.Subject, certID.SubjectKeyId) + } else { + k.SetRevokedNocIcaCertificates(ctx, *certificates) + } +} diff --git a/x/pki/keeper/msg_server_remove_noc_x_509_root_cert.go b/x/pki/keeper/msg_server_remove_noc_x_509_root_cert.go index f364eb31c..791af0a64 100644 --- a/x/pki/keeper/msg_server_remove_noc_x_509_root_cert.go +++ b/x/pki/keeper/msg_server_remove_noc_x_509_root_cert.go @@ -26,7 +26,7 @@ func (k msgServer) RemoveNocX509RootCert(goCtx context.Context, msg *types.MsgRe signerAccount, _ := k.dclauthKeeper.GetAccountO(ctx, signerAddr) accountVid := signerAccount.VendorID - nocCerts, foundActive := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + nocCerts, foundActive := k.GetNocCertificates(ctx, msg.Subject, msg.SubjectKeyId) revCerts, foundRevoked := k.GetRevokedNocRootCertificates(ctx, msg.Subject, msg.SubjectKeyId) certificates := nocCerts.Certs certificates = append(certificates, revCerts.Certs...) @@ -41,7 +41,7 @@ func (k msgServer) RemoveNocX509RootCert(goCtx context.Context, msg *types.MsgRe } // Existing certificate must be NOC certificate - if !cert.IsNoc { + if cert.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(msg.Subject, msg.SubjectKeyId) } @@ -65,13 +65,9 @@ func (k msgServer) RemoveNocX509RootCert(goCtx context.Context, msg *types.MsgRe k.RemoveUniqueCertificate(ctx, certBySerialNumber.Subject, certBySerialNumber.SerialNumber) if foundActive { - // Remove from Approved lists + // Remove from lists removeCertFromList(certBySerialNumber.Issuer, certBySerialNumber.SerialNumber, &nocCerts.Certs) - k.removeApprovedX509Cert(ctx, certID, &nocCerts, msg.SerialNumber) - - // Remove from NOC lists - k.RemoveNocRootCertificateBySerialNumber(ctx, accountVid, certID.Subject, certID.SubjectKeyId, msg.SerialNumber) - k.RemoveNocCertificateByVidSubjectSkidAndSerialNumber(ctx, accountVid, certID.Subject, certID.SubjectKeyId, msg.SerialNumber) + k.removeNocX509Cert(ctx, certID, &nocCerts, accountVid, msg.SerialNumber, true) } if foundRevoked { @@ -79,19 +75,22 @@ func (k msgServer) RemoveNocX509RootCert(goCtx context.Context, msg *types.MsgRe k._removeRevokedNocX509RootCert(ctx, certID, &revCerts) } } else { - k.RemoveNocRootCertificate(ctx, accountVid, certID.Subject, certID.SubjectKeyId) + // remove from global certificates map + k.RemoveAllCertificates(ctx, certID.Subject, certID.SubjectKeyId) + // remove from global subject -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + // remove from noc certificates map + k.RemoveNocCertificates(ctx, certID.Subject, certID.SubjectKeyId) + // remove from noc root certificates map + k.RemoveNocRootCertificate(ctx, certID.Subject, certID.SubjectKeyId, accountVid) // remove from vid, subject key id map k.RemoveNocCertificatesByVidAndSkid(ctx, accountVid, certID.SubjectKeyId) - // remove from revoked noc root certs - k.RemoveRevokedNocRootCertificates(ctx, certID.Subject, certID.SubjectKeyId) - // remove from revoked list - k.RemoveRevokedCertificates(ctx, certID.Subject, certID.SubjectKeyId) - // remove from approved list - k.RemoveApprovedCertificates(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject -> subject key ID map - k.RemoveApprovedCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject key ID -> certificates map - k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) + // remove from revoked noc root certs + k.RemoveRevokedNocRootCertificates(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject with serialNumber map for _, cert := range certificates { k.RemoveUniqueCertificate(ctx, cert.Subject, cert.SerialNumber) @@ -104,16 +103,7 @@ func (k msgServer) RemoveNocX509RootCert(goCtx context.Context, msg *types.MsgRe func (k msgServer) _removeRevokedNocX509RootCert(ctx sdk.Context, certID types.CertificateIdentifier, certificates *types.RevokedNocRootCertificates) { if len(certificates.Certs) == 0 { k.RemoveRevokedNocRootCertificates(ctx, certID.Subject, certID.SubjectKeyId) - k.RemoveRevokedCertificates(ctx, certID.Subject, certID.SubjectKeyId) } else { k.SetRevokedNocRootCertificates(ctx, *certificates) - k.SetRevokedCertificates( - ctx, - types.RevokedCertificates{ - Subject: certificates.Subject, - SubjectKeyId: certificates.SubjectKeyId, - Certs: certificates.Certs, - }, - ) } } diff --git a/x/pki/keeper/msg_server_remove_x_509_cert.go b/x/pki/keeper/msg_server_remove_x_509_cert.go index 811b49315..6570b3ba1 100644 --- a/x/pki/keeper/msg_server_remove_x_509_cert.go +++ b/x/pki/keeper/msg_server_remove_x_509_cert.go @@ -36,7 +36,7 @@ func (k msgServer) RemoveX509Cert(goCtx context.Context, msg *types.MsgRemoveX50 } // Existing certificate must not be NOC certificate - if certificates[0].IsNoc { + if certificates[0].CertificateType == types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNotNocCertButExistingNoc(msg.Subject, msg.SubjectKeyId) } @@ -67,6 +67,11 @@ func (k msgServer) RemoveX509Cert(goCtx context.Context, msg *types.MsgRemoveX50 k.removeOrUpdateRevokedX509Cert(ctx, certID, &revCerts) } } else { + // remove from global certificates map + k.RemoveAllCertificates(ctx, certID.Subject, certID.SubjectKeyId) + // remove from global subject -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + // remove from approved certificates map k.RemoveApprovedCertificates(ctx, certID.Subject, certID.SubjectKeyId) // remove from subject -> subject key ID map k.RemoveApprovedCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) diff --git a/x/pki/keeper/msg_server_revoke_noc_x_509_ica_cert.go b/x/pki/keeper/msg_server_revoke_noc_x_509_ica_cert.go index 03b2b5ff0..a307e0a50 100644 --- a/x/pki/keeper/msg_server_revoke_noc_x_509_ica_cert.go +++ b/x/pki/keeper/msg_server_revoke_noc_x_509_ica_cert.go @@ -22,7 +22,7 @@ func (k msgServer) RevokeNocX509IcaCert(goCtx context.Context, msg *types.MsgRev return nil, pkitypes.NewErrUnauthorizedRole("MsgRevokeNocX509Cert", dclauthtypes.Vendor) } - certificates, _ := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + certificates, _ := k.GetNocCertificates(ctx, msg.Subject, msg.SubjectKeyId) if len(certificates.Certs) == 0 { return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId) } @@ -32,7 +32,7 @@ func (k msgServer) RevokeNocX509IcaCert(goCtx context.Context, msg *types.MsgRev return nil, pkitypes.NewErrMessageExpectedNonRoot(msg.Subject, msg.SubjectKeyId) } // Existing certificate must be NOC certificate - if !cert.IsNoc { + if cert.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(cert.Subject, cert.SubjectKeyId) } @@ -49,12 +49,12 @@ func (k msgServer) RevokeNocX509IcaCert(goCtx context.Context, msg *types.MsgRev return nil, err } } else { - k._revokeNocCertificates(ctx, certificates, cert.Vid) + k._revokeNocIcaCertificates(ctx, certificates, cert.Vid) } if msg.RevokeChild { // Remove certificate identifier from issuer's ChildCertificates record - k.RevokeChildCertificates(ctx, msg.Subject, msg.SubjectKeyId) + k.RevokeNocChildCertificates(ctx, msg.Subject, msg.SubjectKeyId) } return &types.MsgRevokeNocX509IcaCertResponse{}, nil @@ -63,7 +63,7 @@ func (k msgServer) RevokeNocX509IcaCert(goCtx context.Context, msg *types.MsgRev func (k msgServer) _revokeNocCertificate( ctx sdk.Context, serialNumber string, - certificates types.ApprovedCertificates, + certificates types.NocCertificates, vid int32, ) error { cert, found := findCertificate(serialNumber, &certificates.Certs) @@ -73,42 +73,53 @@ func (k msgServer) _revokeNocCertificate( ) } - revCerts := types.ApprovedCertificates{ + revCerts := types.RevokedNocIcaCertificates{ Subject: cert.Subject, SubjectKeyId: cert.SubjectKeyId, Certs: []*types.Certificate{cert}, } - k.AddRevokedCertificates(ctx, revCerts) + k.AddRevokedNocIcaCertificates(ctx, revCerts) removeCertFromList(cert.Issuer, cert.SerialNumber, &certificates.Certs) + if len(certificates.Certs) == 0 { + k.RemoveAllCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveNocCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) k.RemoveNocIcaCertificate(ctx, certificates.Subject, certificates.SubjectKeyId, vid) - k.RemoveApprovedCertificates(ctx, cert.Subject, cert.SubjectKeyId) - k.RemoveApprovedCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) - k.RemoveApprovedCertificatesBySubjectKeyID(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveNocCertificatesByVidAndSkid(ctx, vid, cert.SubjectKeyId) + k.RemoveNocCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, cert.Subject, cert.SubjectKeyId) } else { - k.RemoveNocIcaCertificateBySerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) - k.RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) - k.SetApprovedCertificates(ctx, certificates) + k.RemoveAllCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveNocIcaCertificateBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, vid, serialNumber) + k.RemoveNocCertificatesByVidAndSkidBySerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesBySubjectKeyIDBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) } - // remove from vid, subject key ID -> certificates map - k.RemoveNocCertificateByVidSubjectSkidAndSerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) - return nil } -func (k msgServer) _revokeNocCertificates(ctx sdk.Context, certificates types.ApprovedCertificates, vid int32) { +func (k msgServer) _revokeNocIcaCertificates(ctx sdk.Context, certificates types.NocCertificates, vid int32) { // Add certs into revoked lists - k.AddRevokedCertificates(ctx, certificates) + k.AddRevokedNocIcaCertificates(ctx, types.RevokedNocIcaCertificates{ + Subject: certificates.Subject, + SubjectKeyId: certificates.SubjectKeyId, + Certs: certificates.Certs, + }) + // remove cert from global certs list + k.RemoveAllCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove cert from global certs list -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) // remove cert from NOC certs list + k.RemoveNocCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove cert from NOC ica certs list k.RemoveNocIcaCertificate(ctx, certificates.Subject, certificates.SubjectKeyId, vid) - // remove cert from approved certs list - k.RemoveApprovedCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) // remove from subject -> subject key ID map - k.RemoveApprovedCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveNocCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) // remove from subject key ID -> certificates map - k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, certificates.Subject, certificates.SubjectKeyId) // remove from vid, subject key ID -> certificates map k.RemoveNocCertificateByVidSubjectAndSkid(ctx, vid, certificates.Subject, certificates.SubjectKeyId) } diff --git a/x/pki/keeper/msg_server_revoke_noc_x_509_root_cert.go b/x/pki/keeper/msg_server_revoke_noc_x_509_root_cert.go index 3d19ea6a4..2aac42556 100644 --- a/x/pki/keeper/msg_server_revoke_noc_x_509_root_cert.go +++ b/x/pki/keeper/msg_server_revoke_noc_x_509_root_cert.go @@ -23,7 +23,7 @@ func (k msgServer) RevokeNocX509RootCert(goCtx context.Context, msg *types.MsgRe return nil, pkitypes.NewErrUnauthorizedRole("MsgRevokeNocX509RootCert", dclauthtypes.Vendor) } - certificates, _ := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + certificates, _ := k.GetNocCertificates(ctx, msg.Subject, msg.SubjectKeyId) if len(certificates.Certs) == 0 { return nil, pkitypes.NewErrNocRootCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId) } @@ -33,7 +33,7 @@ func (k msgServer) RevokeNocX509RootCert(goCtx context.Context, msg *types.MsgRe return nil, pkitypes.NewErrMessageExistingCertIsNotRoot(cert.Subject, cert.SubjectKeyId) } // Existing certificate must be NOC certificate - if !cert.IsNoc { + if cert.CertificateType != types.CertificateType_OperationalPKI { return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(cert.Subject, cert.SubjectKeyId) } @@ -59,36 +59,16 @@ func (k msgServer) RevokeNocX509RootCert(goCtx context.Context, msg *types.MsgRe SubjectKeyId: msg.SubjectKeyId, } // Remove certificate identifier from issuer's ChildCertificates record - k.RevokeChildCertificates(ctx, certID.Subject, certID.SubjectKeyId) + k.RevokeNocChildCertificates(ctx, certID.Subject, certID.SubjectKeyId) } return &types.MsgRevokeNocX509RootCertResponse{}, nil } -func (k msgServer) _revokeNocRootCertificates(ctx sdk.Context, certificates types.ApprovedCertificates, vid int32) { - // Add certs into revoked lists - k.AddRevokedCertificates(ctx, certificates) - k.AddRevokedNocRootCertificates(ctx, types.RevokedNocRootCertificates{ - Subject: certificates.Subject, - SubjectKeyId: certificates.SubjectKeyId, - Certs: certificates.Certs, - }) - - // Remove certs from NOC and approved lists - k.RemoveNocRootCertificate(ctx, vid, certificates.Subject, certificates.SubjectKeyId) - k.RemoveApprovedCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) - // remove from subject -> subject key ID map - k.RemoveApprovedCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) - // remove from subject key ID -> certificates map - k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certificates.Subject, certificates.SubjectKeyId) - // remove from vid, subject key ID -> certificates map - k.RemoveNocCertificateByVidSubjectAndSkid(ctx, vid, certificates.Subject, certificates.SubjectKeyId) -} - func (k msgServer) _revokeNocRootCertificate( ctx sdk.Context, serialNumber string, - certificates types.ApprovedCertificates, + certificates types.NocCertificates, vid int32, ) error { cert, found := findCertificate(serialNumber, &certificates.Certs) @@ -98,12 +78,6 @@ func (k msgServer) _revokeNocRootCertificate( ) } - revCerts := types.ApprovedCertificates{ - Subject: cert.Subject, - SubjectKeyId: cert.SubjectKeyId, - Certs: []*types.Certificate{cert}, - } - k.AddRevokedCertificates(ctx, revCerts) revNocCerts := types.RevokedNocRootCertificates{ Subject: certificates.Subject, SubjectKeyId: certificates.SubjectKeyId, @@ -114,18 +88,44 @@ func (k msgServer) _revokeNocRootCertificate( removeCertFromList(cert.Issuer, cert.SerialNumber, &certificates.Certs) if len(certificates.Certs) == 0 { - k.RemoveNocRootCertificate(ctx, vid, certificates.Subject, certificates.SubjectKeyId) - k.RemoveApprovedCertificates(ctx, cert.Subject, cert.SubjectKeyId) - k.RemoveApprovedCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) - k.RemoveApprovedCertificatesBySubjectKeyID(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveAllCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveNocCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + k.RemoveNocRootCertificate(ctx, certificates.Subject, certificates.SubjectKeyId, vid) + k.RemoveNocCertificatesByVidAndSkid(ctx, vid, cert.SubjectKeyId) + k.RemoveNocCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, cert.Subject, cert.SubjectKeyId) } else { - k.RemoveNocRootCertificateBySerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) - k.SetApprovedCertificates(ctx, certificates) - k.RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveAllCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveNocRootCertificateBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, vid, serialNumber) + k.RemoveNocCertificatesByVidAndSkidBySerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) + k.RemoveNocCertificatesBySubjectKeyIDBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) } - // remove from vid, subject key ID -> certificates map - k.RemoveNocCertificateByVidSubjectSkidAndSerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) - return nil } + +func (k msgServer) _revokeNocRootCertificates(ctx sdk.Context, certificates types.NocCertificates, vid int32) { + // Add certs into revoked lists + k.AddRevokedNocRootCertificates(ctx, types.RevokedNocRootCertificates{ + Subject: certificates.Subject, + SubjectKeyId: certificates.SubjectKeyId, + Certs: certificates.Certs, + }) + + // remove cert from global certs list + k.RemoveAllCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove cert from global certs list -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove cert from NOC certs list + k.RemoveNocCertificates(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove cert from NOC ica certs list + k.RemoveNocRootCertificate(ctx, certificates.Subject, certificates.SubjectKeyId, vid) + // remove from subject -> subject key ID map + k.RemoveNocCertificateBySubject(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove from subject key ID -> certificates map + k.RemoveNocCertificatesBySubjectAndSubjectKeyID(ctx, certificates.Subject, certificates.SubjectKeyId) + // remove from vid, subject key ID -> certificates map + k.RemoveNocCertificateByVidSubjectAndSkid(ctx, vid, certificates.Subject, certificates.SubjectKeyId) +} diff --git a/x/pki/keeper/msg_server_revoke_x_509_cert.go b/x/pki/keeper/msg_server_revoke_x_509_cert.go index 6ea9967d9..0aa933891 100644 --- a/x/pki/keeper/msg_server_revoke_x_509_cert.go +++ b/x/pki/keeper/msg_server_revoke_x_509_cert.go @@ -53,7 +53,7 @@ func (k msgServer) RevokeX509Cert(goCtx context.Context, msg *types.MsgRevokeX50 if msg.RevokeChild { // Remove certificate identifier from issuer's ChildCertificates record - k.RevokeChildCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) + k.RevokeApprovedChildCertificates(ctx, certIdentifier.Subject, certIdentifier.SubjectKeyId) } return &types.MsgRevokeX509CertResponse{}, nil @@ -61,7 +61,13 @@ func (k msgServer) RevokeX509Cert(goCtx context.Context, msg *types.MsgRevokeX50 func (k msgServer) _revokeX509Certificates(ctx sdk.Context, certID types.CertificateIdentifier, certificates types.ApprovedCertificates) { // Revoke certificates with given subject/subjectKeyID - k.AddRevokedCertificates(ctx, certificates) + k.AddRevokedCertificates(ctx, types.RevokedCertificates(certificates)) + + // Remove certificate from global list + k.RemoveAllCertificates(ctx, certID.Subject, certID.SubjectKeyId) + // Remove certificate from global list -> subject key ID map + k.RemoveAllCertificateBySubject(ctx, certID.Subject, certID.SubjectKeyId) + // Remove certificate from approved list k.RemoveApprovedCertificates(ctx, certID.Subject, certID.SubjectKeyId) // Remove certificate identifier from issuer's ChildCertificates record k.RemoveChildCertificate(ctx, certificates.Certs[0].Issuer, certificates.Certs[0].AuthorityKeyId, certID) @@ -70,24 +76,27 @@ func (k msgServer) _revokeX509Certificates(ctx sdk.Context, certID types.Certifi // remove from subject key ID -> certificates map k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certID.Subject, certID.SubjectKeyId) } + func (k msgServer) _revokeX509Certificate(ctx sdk.Context, cert *types.Certificate, certID types.CertificateIdentifier, certificates types.ApprovedCertificates) { - certToRevoke := types.ApprovedCertificates{ - Subject: cert.Subject, - SubjectKeyId: cert.SubjectKeyId, - Certs: []*types.Certificate{cert}, + revCerts := types.RevokedCertificates{ + Subject: cert.Subject, + SubjectKeyId: cert.SubjectKeyId, + Certs: []*types.Certificate{cert}, + SchemaVersion: cert.SchemaVersion, } - k.AddRevokedCertificates(ctx, certToRevoke) + k.AddRevokedCertificates(ctx, revCerts) removeCertFromList(cert.Issuer, cert.SerialNumber, &certificates.Certs) if len(certificates.Certs) == 0 { + k.RemoveAllCertificates(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveAllCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) k.RemoveApprovedCertificates(ctx, cert.Subject, cert.SubjectKeyId) - // Remove certificate identifier from issuer's ChildCertificates record - k.RemoveChildCertificate(ctx, cert.Issuer, cert.AuthorityKeyId, certID) - k.RemoveApprovedCertificateBySubject(ctx, cert.Subject, cert.SubjectKeyId) k.RemoveApprovedCertificatesBySubjectKeyID(ctx, cert.Subject, cert.SubjectKeyId) + k.RemoveChildCertificate(ctx, cert.Issuer, cert.AuthorityKeyId, certID) } else { - k.SetApprovedCertificates(ctx, certificates) - k.RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx, cert.Subject, cert.SubjectKeyId, cert.SerialNumber) + k.RemoveAllCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, cert.SerialNumber) + k.RemoveApprovedCertificatesBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, cert.SerialNumber) + k.RemoveApprovedCertificatesBySubjectKeyIDBySerialNumber(ctx, cert.Subject, cert.SubjectKeyId, cert.SerialNumber) } } diff --git a/x/pki/keeper/noc_certificates.go b/x/pki/keeper/noc_certificates.go new file mode 100644 index 000000000..bf136ecd2 --- /dev/null +++ b/x/pki/keeper/noc_certificates.go @@ -0,0 +1,129 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// SetNocCertificates set a specific nocCertificates in the store from its index +func (k Keeper) SetNocCertificates(ctx sdk.Context, nocCertificates types.NocCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + b := k.cdc.MustMarshal(&nocCertificates) + store.Set(types.NocCertificatesKey( + nocCertificates.Subject, + nocCertificates.SubjectKeyId, + ), b) +} + +// Add a NOC certificate to the list of NOC certificates. +func (k Keeper) AddNocCertificate(ctx sdk.Context, nocCertificate types.Certificate) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + + nocCertificatesKeyBytes := store.Get(types.NocCertificatesKey(nocCertificate.Subject, nocCertificate.SubjectKeyId)) + var nocCertificates types.NocCertificates + + if nocCertificatesKeyBytes == nil { + nocCertificates = types.NocCertificates{ + Subject: nocCertificate.Subject, + SubjectKeyId: nocCertificate.SubjectKeyId, + Certs: []*types.Certificate{}, + Tq: 1, + SchemaVersion: nocCertificate.SchemaVersion, + } + } else { + k.cdc.MustUnmarshal(nocCertificatesKeyBytes, &nocCertificates) + } + + nocCertificates.Certs = append(nocCertificates.Certs, &nocCertificate) + + b := k.cdc.MustMarshal(&nocCertificates) + store.Set(types.NocCertificatesKey(nocCertificate.Subject, nocCertificate.SubjectKeyId), b) +} + +// GetNocCertificates returns a nocCertificates from its index +func (k Keeper) GetNocCertificates( + ctx sdk.Context, + subject string, + subjectKeyID string, + +) (val types.NocCertificates, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + + b := store.Get(types.NocCertificatesKey( + subject, + subjectKeyID, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// GetAllNocCertificates returns all nocCertificates +func (k Keeper) GetAllNocCertificates(ctx sdk.Context) (list []types.NocCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.NocCertificates + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// RemoveNocCertificates removes a nocCertificates from the store +func (k Keeper) RemoveNocCertificates( + ctx sdk.Context, + subject string, + subjectKeyID string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + store.Delete(types.NocCertificatesKey( + subject, + subjectKeyID, + )) +} + +func (k Keeper) RemoveNocCertificatesBySerialNumber(ctx sdk.Context, subject, subjectKeyID, serialNumber string) { + k._removeNocCertificatesBySerialNumber(ctx, subject, subjectKeyID, func(cert *types.Certificate) bool { + return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber + }) +} + +func (k Keeper) _removeNocCertificatesBySerialNumber(ctx sdk.Context, subject string, subjectKeyID string, filter func(cert *types.Certificate) bool) { + certs, found := k.GetNocCertificates(ctx, subject, subjectKeyID) + if !found { + return + } + + numCertsBefore := len(certs.Certs) + for i := 0; i < len(certs.Certs); { + cert := certs.Certs[i] + if filter(cert) { + certs.Certs = append(certs.Certs[:i], certs.Certs[i+1:]...) + } else { + i++ + } + } + + if len(certs.Certs) == 0 { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + store.Delete(types.AllCertificatesKey( + subject, + subjectKeyID, + )) + } else if numCertsBefore > len(certs.Certs) { // Update state only if any certificate is removed + k.SetNocCertificates(ctx, certs) + } +} diff --git a/x/pki/keeper/noc_certificates_by_subject.go b/x/pki/keeper/noc_certificates_by_subject.go new file mode 100644 index 000000000..3601919f9 --- /dev/null +++ b/x/pki/keeper/noc_certificates_by_subject.go @@ -0,0 +1,108 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// SetNocCertificatesBySubject set a specific nocCertificatesBySubject in the store from its index +func (k Keeper) SetNocCertificatesBySubject(ctx sdk.Context, nocCertificatesBySubject types.NocCertificatesBySubject) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyPrefix)) + b := k.cdc.MustMarshal(&nocCertificatesBySubject) + store.Set(types.NocCertificatesBySubjectKey( + nocCertificatesBySubject.Subject, + ), b) +} + +// Add a NOC certificate to the list of NOC certificates: subject->subjectKeyId index. +func (k Keeper) AddNocCertificateBySubject(ctx sdk.Context, nocCertificate types.Certificate) { + nocCertificatesBySubject, _ := k.GetNocCertificatesBySubject(ctx, nocCertificate.Subject) + + // Check if cert is already there + for _, existingID := range nocCertificatesBySubject.SubjectKeyIds { + if existingID == nocCertificate.SubjectKeyId { + return + } + } + + nocCertificatesBySubject.Subject = nocCertificate.Subject + nocCertificatesBySubject.SubjectKeyIds = append(nocCertificatesBySubject.SubjectKeyIds, nocCertificate.SubjectKeyId) + + k.SetNocCertificatesBySubject(ctx, nocCertificatesBySubject) +} + +// GetNocCertificatesBySubject returns a nocCertificatesBySubject from its index +func (k Keeper) GetNocCertificatesBySubject( + ctx sdk.Context, + subject string, + +) (val types.NocCertificatesBySubject, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyPrefix)) + + b := store.Get(types.NocCertificatesBySubjectKey( + subject, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// GetAllNocCertificatesBySubject returns all nocCertificatesBySubject +func (k Keeper) GetAllNocCertificatesBySubject(ctx sdk.Context) (list []types.NocCertificatesBySubject) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.NocCertificatesBySubject + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// Remove revoked root certificate from the list. +func (k Keeper) RemoveNocCertificateBySubject(ctx sdk.Context, subject string, subjectKeyID string) { + nocCertificatesBySubject, _ := k.GetNocCertificatesBySubject(ctx, subject) + + certIDIndex := -1 + for i, existingIdentifier := range nocCertificatesBySubject.SubjectKeyIds { + if existingIdentifier == subjectKeyID { + certIDIndex = i + + break + } + } + if certIDIndex == -1 { + return + } + + nocCertificatesBySubject.SubjectKeyIds = append(nocCertificatesBySubject.SubjectKeyIds[:certIDIndex], nocCertificatesBySubject.SubjectKeyIds[certIDIndex+1:]...) + + if len(nocCertificatesBySubject.SubjectKeyIds) > 0 { + k.SetNocCertificatesBySubject(ctx, nocCertificatesBySubject) + } else { + k.RemoveNocCertificatesBySubject(ctx, subject) + } +} + +// RemoveNocCertificatesBySubject removes a nocCertificatesBySubject from the store +func (k Keeper) RemoveNocCertificatesBySubject( + ctx sdk.Context, + subject string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyPrefix)) + store.Delete(types.NocCertificatesBySubjectKey( + subject, + )) +} diff --git a/x/pki/keeper/noc_certificates_by_subject_key_id.go b/x/pki/keeper/noc_certificates_by_subject_key_id.go new file mode 100644 index 000000000..043a9c5e9 --- /dev/null +++ b/x/pki/keeper/noc_certificates_by_subject_key_id.go @@ -0,0 +1,158 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// SetNocCertificatesBySubjectKeyID set a specific nocCertificatesBySubjectKeyId in the store from its index +func (k Keeper) SetNocCertificatesBySubjectKeyID(ctx sdk.Context, nocCertificatesBySubjectKeyID types.NocCertificatesBySubjectKeyID) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + b := k.cdc.MustMarshal(&nocCertificatesBySubjectKeyID) + store.Set(types.NocCertificatesBySubjectKeyIDKey( + nocCertificatesBySubjectKeyID.SubjectKeyId, + ), b) +} + +// Add a noc certificate to the list of noc certificates with the subjectKeyId map. +func (k Keeper) AddNocCertificateBySubjectKeyID(ctx sdk.Context, certificate types.Certificate) { + k._addNocCertificates(ctx, certificate.SubjectKeyId, []*types.Certificate{&certificate}) +} + +// Add a noc certificates list to noc certificates with the subjectKeyId map. +func (k Keeper) AddNocCertificatesBySubjectKeyID(ctx sdk.Context, nocCertificate types.NocCertificates) { + k._addNocCertificates(ctx, nocCertificate.SubjectKeyId, nocCertificate.Certs) +} + +// GetNocCertificatesBySubjectKeyID returns a nocCertificatesBySubjectKeyId from its index +func (k Keeper) GetNocCertificatesBySubjectKeyID( + ctx sdk.Context, + subjectKeyID string, + +) (val types.NocCertificatesBySubjectKeyID, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + + b := store.Get(types.NocCertificatesBySubjectKeyIDKey( + subjectKeyID, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// GetAllNocCertificatesBySubjectKeyID returns all nocCertificatesBySubjectKeyId +func (k Keeper) GetAllNocCertificatesBySubjectKeyID(ctx sdk.Context) (list []types.NocCertificatesBySubjectKeyID) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.NocCertificatesBySubjectKeyID + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// RemoveNocCertificatesBySubjectAndSubjectKeyID removes a nocCertificatesBySubjectKeyId from the store. +func (k Keeper) RemoveNocCertificatesBySubjectAndSubjectKeyID( + ctx sdk.Context, + subject string, + subjectKeyID string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + certs, found := k.GetNocCertificatesBySubjectKeyID(ctx, subjectKeyID) + if !found { + return + } + + for i := 0; i < len(certs.Certs); { + if certs.Certs[i].Subject == subject { + certs.Certs = append(certs.Certs[:i], certs.Certs[i+1:]...) + } else { + i++ + } + } + + if len(certs.Certs) == 0 { + store.Delete(types.NocCertificatesBySubjectKeyIDKey( + subjectKeyID, + )) + } else { + k.SetNocCertificatesBySubjectKeyID(ctx, certs) + } +} + +// RemoveNocCertificatesBySubjectKeyID removes a nocCertificatesBySubjectKeyId from the store +func (k Keeper) RemoveNocCertificatesBySubjectKeyID( + ctx sdk.Context, + subjectKeyID string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + store.Delete(types.NocCertificatesBySubjectKeyIDKey( + subjectKeyID, + )) +} + +func (k Keeper) RemoveNocCertificatesBySubjectKeyIDBySerialNumber(ctx sdk.Context, subject, subjectKeyID, serialNumber string) { + k._removeNocCertificatesBySubjectKeyIDBySerialNumber(ctx, subjectKeyID, func(cert *types.Certificate) bool { + return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber + }) +} + +func (k Keeper) _addNocCertificates(ctx sdk.Context, subjectKeyID string, certs []*types.Certificate) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + + nocCertificatesBytes := store.Get(types.NocCertificatesBySubjectKey( + subjectKeyID, + )) + var nocCertificates types.NocCertificatesBySubjectKeyID + + if nocCertificatesBytes == nil { + nocCertificates = types.NocCertificatesBySubjectKeyID{ + SubjectKeyId: subjectKeyID, + Certs: []*types.Certificate{}, + } + } else { + k.cdc.MustUnmarshal(nocCertificatesBytes, &nocCertificates) + } + + nocCertificates.Certs = append(nocCertificates.Certs, certs...) + + k.SetNocCertificatesBySubjectKeyID(ctx, nocCertificates) +} + +func (k Keeper) _removeNocCertificatesBySubjectKeyIDBySerialNumber(ctx sdk.Context, subjectKeyID string, filter func(cert *types.Certificate) bool) { + certs, found := k.GetNocCertificatesBySubjectKeyID(ctx, subjectKeyID) + if !found { + return + } + + numCertsBefore := len(certs.Certs) + for i := 0; i < len(certs.Certs); { + cert := certs.Certs[i] + if filter(cert) { + certs.Certs = append(certs.Certs[:i], certs.Certs[i+1:]...) + } else { + i++ + } + } + + if len(certs.Certs) == 0 { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesBySubjectKeyIDKeyPrefix)) + store.Delete(types.NocCertificatesBySubjectKeyIDKey( + subjectKeyID, + )) + } else if numCertsBefore > len(certs.Certs) { // Update state only if any certificate is removed + k.SetNocCertificatesBySubjectKeyID(ctx, certs) + } +} diff --git a/x/pki/keeper/noc_certificates_by_subject_key_id_test.go b/x/pki/keeper/noc_certificates_by_subject_key_id_test.go new file mode 100644 index 000000000..7acd0f343 --- /dev/null +++ b/x/pki/keeper/noc_certificates_by_subject_key_id_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNNocCertificatesBySubjectKeyId(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocCertificatesBySubjectKeyID { + items := make([]types.NocCertificatesBySubjectKeyID, n) + for i := range items { + items[i].SubjectKeyId = strconv.Itoa(i) + + keeper.SetNocCertificatesBySubjectKeyID(ctx, items[i]) + } + + return items +} + +func TestNocCertificatesBySubjectKeyIdGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificatesBySubjectKeyId(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetNocCertificatesBySubjectKeyID(ctx, + item.SubjectKeyId, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestNocCertificatesBySubjectKeyIdRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificatesBySubjectKeyId(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveNocCertificatesBySubjectKeyID(ctx, + item.SubjectKeyId, + ) + _, found := keeper.GetNocCertificatesBySubjectKeyID(ctx, + item.SubjectKeyId, + ) + require.False(t, found) + } +} + +func TestNocCertificatesBySubjectKeyIdGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificatesBySubjectKeyId(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllNocCertificatesBySubjectKeyID(ctx)), + ) +} diff --git a/x/pki/keeper/noc_certificates_by_subject_test.go b/x/pki/keeper/noc_certificates_by_subject_test.go new file mode 100644 index 000000000..af2720b11 --- /dev/null +++ b/x/pki/keeper/noc_certificates_by_subject_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNNocCertificatesBySubject(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocCertificatesBySubject { + items := make([]types.NocCertificatesBySubject, n) + for i := range items { + items[i].Subject = strconv.Itoa(i) + + keeper.SetNocCertificatesBySubject(ctx, items[i]) + } + + return items +} + +func TestNocCertificatesBySubjectGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificatesBySubject(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetNocCertificatesBySubject(ctx, + item.Subject, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestNocCertificatesBySubjectRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificatesBySubject(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveNocCertificatesBySubject(ctx, + item.Subject, + ) + _, found := keeper.GetNocCertificatesBySubject(ctx, + item.Subject, + ) + require.False(t, found) + } +} + +func TestNocCertificatesBySubjectGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificatesBySubject(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllNocCertificatesBySubject(ctx)), + ) +} diff --git a/x/pki/keeper/noc_certificates_by_vid_and_skid.go b/x/pki/keeper/noc_certificates_by_vid_and_skid.go index 5b32f58be..0e1368d04 100644 --- a/x/pki/keeper/noc_certificates_by_vid_and_skid.go +++ b/x/pki/keeper/noc_certificates_by_vid_and_skid.go @@ -94,8 +94,8 @@ func (k Keeper) RemoveNocCertificateByVidSubjectAndSkid( ) } -// RemoveNocCertificateByVidSkidSubjectAndSerialNumber removes certificate with specified subject and serial number from the list. -func (k Keeper) RemoveNocCertificateByVidSubjectSkidAndSerialNumber( +// RemoveNocCertificatesByVidAndSkidBySerialNumber removes certificate with specified subject and serial number from the list. +func (k Keeper) RemoveNocCertificatesByVidAndSkidBySerialNumber( ctx sdk.Context, vid int32, subject string, @@ -107,7 +107,7 @@ func (k Keeper) RemoveNocCertificateByVidSubjectSkidAndSerialNumber( vid, subjectKeyID, func(cert *types.Certificate) bool { - return !(cert.Subject == subject && cert.SerialNumber == serialNumber) + return !(cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber) }, ) } diff --git a/x/pki/keeper/noc_certificates_test.go b/x/pki/keeper/noc_certificates_test.go new file mode 100644 index 000000000..2425a3511 --- /dev/null +++ b/x/pki/keeper/noc_certificates_test.go @@ -0,0 +1,72 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNNocCertificates(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocCertificates { + items := make([]types.NocCertificates, n) + for i := range items { + items[i].Subject = strconv.Itoa(i) + items[i].SubjectKeyId = strconv.Itoa(i) + + keeper.SetNocCertificates(ctx, items[i]) + keeper.SetNocCertificatesBySubjectKeyID(ctx, types.NocCertificatesBySubjectKeyID{ + SubjectKeyId: items[i].SubjectKeyId, + Certs: items[i].Certs, + }) + } + + return items +} + +func TestNocCertificatesGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificates(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetNocCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestNocCertificatesRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificates(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveNocCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + _, found := keeper.GetNocCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + require.False(t, found) + } +} + +func TestNocCertificatesGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificates(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllNocCertificates(ctx)), + ) +} diff --git a/x/pki/keeper/noc_ica_certificates.go b/x/pki/keeper/noc_ica_certificates.go index 6a537fc7c..40bb32762 100644 --- a/x/pki/keeper/noc_ica_certificates.go +++ b/x/pki/keeper/noc_ica_certificates.go @@ -91,13 +91,13 @@ func (k Keeper) RemoveNocIcaCertificates(ctx sdk.Context, vid int32) { )) } -func (k Keeper) RemoveNocIcaCertificate(ctx sdk.Context, subject, subjectKeyID string, vid int32) { +func (k Keeper) RemoveNocIcaCertificate(ctx sdk.Context, subject string, subjectKeyID string, vid int32) { k._removeNocIcaCertificates(ctx, vid, func(cert *types.Certificate) bool { return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID }) } -func (k Keeper) RemoveNocIcaCertificateBySerialNumber(ctx sdk.Context, vid int32, subject, subjectKeyID, serialNumber string) { +func (k Keeper) RemoveNocIcaCertificateBySerialNumber(ctx sdk.Context, subject string, subjectKeyID string, vid int32, serialNumber string) { k._removeNocIcaCertificates(ctx, vid, func(cert *types.Certificate) bool { return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber }) diff --git a/x/pki/keeper/noc_root_certificates.go b/x/pki/keeper/noc_root_certificates.go index 078ec5613..ac2c67b42 100644 --- a/x/pki/keeper/noc_root_certificates.go +++ b/x/pki/keeper/noc_root_certificates.go @@ -70,13 +70,13 @@ func (k Keeper) RemoveNocRootCertificates( )) } -func (k Keeper) RemoveNocRootCertificate(ctx sdk.Context, vid int32, subject, subjectKeyID string) { +func (k Keeper) RemoveNocRootCertificate(ctx sdk.Context, subject string, subjectKeyID string, vid int32) { k._removeNocRootCertificates(ctx, vid, func(cert *types.Certificate) bool { return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID }) } -func (k Keeper) RemoveNocRootCertificateBySerialNumber(ctx sdk.Context, vid int32, subject, subjectKeyID, serialNumber string) { +func (k Keeper) RemoveNocRootCertificateBySerialNumber(ctx sdk.Context, subject string, subjectKeyID string, vid int32, serialNumber string) { k._removeNocRootCertificates(ctx, vid, func(cert *types.Certificate) bool { return cert.Subject == subject && cert.SubjectKeyId == subjectKeyID && cert.SerialNumber == serialNumber }) diff --git a/x/pki/keeper/rejected_certificate_test.go b/x/pki/keeper/rejected_certificate_test.go index 8237be2c4..ff8d0d7bd 100644 --- a/x/pki/keeper/rejected_certificate_test.go +++ b/x/pki/keeper/rejected_certificate_test.go @@ -20,7 +20,7 @@ func createNRejectedCertificate(keeper *keeper.Keeper, ctx sdk.Context, n int) [ items := make([]types.RejectedCertificate, n) for i := range items { items[i].Subject = strconv.Itoa(i) - items[i].SubjectKeyId = strconv.Itoa(i) + items[i].SubjectKeyID = strconv.Itoa(i) keeper.SetRejectedCertificate(ctx, items[i]) } @@ -33,7 +33,7 @@ func TestRejectedCertificateGet(t *testing.T) { for _, item := range items { rst, found := keeper.GetRejectedCertificate(ctx, item.Subject, - item.SubjectKeyId, + item.SubjectKeyID, ) require.True(t, found) require.Equal(t, @@ -48,11 +48,11 @@ func TestRejectedCertificateRemove(t *testing.T) { for _, item := range items { keeper.RemoveRejectedCertificate(ctx, item.Subject, - item.SubjectKeyId, + item.SubjectKeyID, ) _, found := keeper.GetRejectedCertificate(ctx, item.Subject, - item.SubjectKeyId, + item.SubjectKeyID, ) require.False(t, found) } diff --git a/x/pki/keeper/revoked_certificates.go b/x/pki/keeper/revoked_certificates.go index f3225d210..d9566d852 100644 --- a/x/pki/keeper/revoked_certificates.go +++ b/x/pki/keeper/revoked_certificates.go @@ -67,8 +67,8 @@ func (k Keeper) GetAllRevokedCertificates(ctx sdk.Context) (list []types.Revoked return } -// Add revoked certificates to the list of revoked certificates for the subject/subjectKeyId map. -func (k Keeper) AddRevokedCertificates(ctx sdk.Context, approvedCertificates types.ApprovedCertificates) { +// AddRevokedCertificates Add revoked certificates to the list of revoked certificates for the subject/subjectKeyId map. +func (k Keeper) AddRevokedCertificates(ctx sdk.Context, approvedCertificates types.RevokedCertificates) { store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.RevokedCertificatesKeyPrefix)) revokedCertificatesBytes := store.Get(types.RevokedCertificatesKey( diff --git a/x/pki/keeper/revoked_noc_ica_certificates.go b/x/pki/keeper/revoked_noc_ica_certificates.go new file mode 100644 index 000000000..dc9578a02 --- /dev/null +++ b/x/pki/keeper/revoked_noc_ica_certificates.go @@ -0,0 +1,99 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// SetRevokedNocIcaCertificates set a specific revokedNocIcaCertificates in the store from its index +func (k Keeper) SetRevokedNocIcaCertificates(ctx sdk.Context, revokedNocIcaCertificates types.RevokedNocIcaCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.RevokedNocIcaCertificatesKeyPrefix)) + b := k.cdc.MustMarshal(&revokedNocIcaCertificates) + store.Set(types.RevokedNocIcaCertificatesKey( + revokedNocIcaCertificates.Subject, + revokedNocIcaCertificates.SubjectKeyId, + ), b) +} + +// AddRevokedNocIcaCertificates adds revoked NOC certificates to the list of revoked NOC certificates for the subject/subjectKeyId map. +func (k Keeper) AddRevokedNocIcaCertificates(ctx sdk.Context, revokedNocIcaCertificates types.RevokedNocIcaCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.RevokedNocIcaCertificatesKeyPrefix)) + + revokedCertsBytes := store.Get(types.RevokedNocIcaCertificatesKey( + revokedNocIcaCertificates.Subject, + revokedNocIcaCertificates.SubjectKeyId, + )) + var revokedCerts types.RevokedNocIcaCertificates + + if revokedCertsBytes == nil { + revokedCerts = types.RevokedNocIcaCertificates{ + Subject: revokedNocIcaCertificates.Subject, + SubjectKeyId: revokedNocIcaCertificates.SubjectKeyId, + Certs: []*types.Certificate{}, + } + } else { + k.cdc.MustUnmarshal(revokedCertsBytes, &revokedCerts) + } + + revokedCerts.Certs = append(revokedCerts.Certs, revokedNocIcaCertificates.Certs...) + + b := k.cdc.MustMarshal(&revokedCerts) + store.Set(types.RevokedNocIcaCertificatesKey( + revokedCerts.Subject, + revokedCerts.SubjectKeyId, + ), b) +} + +// GetRevokedNocIcaCertificates returns a revokedNocIcaCertificates from its index +func (k Keeper) GetRevokedNocIcaCertificates( + ctx sdk.Context, + subject string, + subjectKeyID string, + +) (val types.RevokedNocIcaCertificates, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.RevokedNocIcaCertificatesKeyPrefix)) + + b := store.Get(types.RevokedNocIcaCertificatesKey( + subject, + subjectKeyID, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// RemoveRevokedNocIcaCertificates removes a revokedNocIcaCertificates from the store +func (k Keeper) RemoveRevokedNocIcaCertificates( + ctx sdk.Context, + subject string, + subjectKeyID string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.RevokedNocIcaCertificatesKeyPrefix)) + store.Delete(types.RevokedNocIcaCertificatesKey( + subject, + subjectKeyID, + )) +} + +// GetAllRevokedNocIcaCertificates returns all revokedNocIcaCertificates +func (k Keeper) GetAllRevokedNocIcaCertificates(ctx sdk.Context) (list []types.RevokedNocIcaCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.RevokedNocIcaCertificatesKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.RevokedNocIcaCertificates + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/pki/keeper/revoked_noc_ica_certificates_test.go b/x/pki/keeper/revoked_noc_ica_certificates_test.go new file mode 100644 index 000000000..52cc1b57a --- /dev/null +++ b/x/pki/keeper/revoked_noc_ica_certificates_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNRevokedNocIcaCertificates(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.RevokedNocIcaCertificates { + items := make([]types.RevokedNocIcaCertificates, n) + for i := range items { + items[i].Subject = strconv.Itoa(i) + items[i].SubjectKeyId = strconv.Itoa(i) + + keeper.SetRevokedNocIcaCertificates(ctx, items[i]) + } + + return items +} + +func TestRevokedNocIcaCertificatesGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNRevokedNocIcaCertificates(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetRevokedNocIcaCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestRevokedNocIcaCertificatesRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNRevokedNocIcaCertificates(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveRevokedNocIcaCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + _, found := keeper.GetRevokedNocIcaCertificates(ctx, + item.Subject, + item.SubjectKeyId, + ) + require.False(t, found) + } +} + +func TestRevokedNocIcaCertificatesGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNRevokedNocIcaCertificates(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllRevokedNocIcaCertificates(ctx)), + ) +} diff --git a/x/pki/module.go b/x/pki/module.go index 2d2fe2571..996594468 100644 --- a/x/pki/module.go +++ b/x/pki/module.go @@ -122,6 +122,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { m := keeper.NewMigrator(am.keeper) _ = cfg.RegisterMigration(pkitypes.ModuleName, 1, m.Migrate1to2) _ = cfg.RegisterMigration(pkitypes.ModuleName, 2, m.Migrate2to3) + _ = cfg.RegisterMigration(pkitypes.ModuleName, 3, m.Migrate3to4) } // RegisterInvariants registers the pki module's invariants. @@ -147,7 +148,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 3 } +func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock executes all ABCI BeginBlock logic respective to the pki module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/pki/types/all_certificates.pb.go b/x/pki/types/all_certificates.pb.go new file mode 100644 index 000000000..fbe494543 --- /dev/null +++ b/x/pki/types/all_certificates.pb.go @@ -0,0 +1,472 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type AllCertificates struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` + Certs []*Certificate `protobuf:"bytes,3,rep,name=certs,proto3" json:"certs,omitempty"` + SchemaVersion uint32 `protobuf:"varint,4,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` +} + +func (m *AllCertificates) Reset() { *m = AllCertificates{} } +func (m *AllCertificates) String() string { return proto.CompactTextString(m) } +func (*AllCertificates) ProtoMessage() {} +func (*AllCertificates) Descriptor() ([]byte, []int) { + return fileDescriptor_7c4ab26b4f9fb5bd, []int{0} +} +func (m *AllCertificates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllCertificates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllCertificates.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AllCertificates) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllCertificates.Merge(m, src) +} +func (m *AllCertificates) XXX_Size() int { + return m.Size() +} +func (m *AllCertificates) XXX_DiscardUnknown() { + xxx_messageInfo_AllCertificates.DiscardUnknown(m) +} + +var xxx_messageInfo_AllCertificates proto.InternalMessageInfo + +func (m *AllCertificates) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *AllCertificates) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +func (m *AllCertificates) GetCerts() []*Certificate { + if m != nil { + return m.Certs + } + return nil +} + +func (m *AllCertificates) GetSchemaVersion() uint32 { + if m != nil { + return m.SchemaVersion + } + return 0 +} + +func init() { + proto.RegisterType((*AllCertificates)(nil), "zigbeealliance.distributedcomplianceledger.pki.AllCertificates") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/all_certificates.proto", fileDescriptor_7c4ab26b4f9fb5bd) +} + +var fileDescriptor_7c4ab26b4f9fb5bd = []byte{ + // 276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0xad, 0xca, 0x4c, 0x4f, + 0x4a, 0x4d, 0x4d, 0xcc, 0xc9, 0xc9, 0x4c, 0xcc, 0x4b, 0x4e, 0xd5, 0x4f, 0xc9, 0x2c, 0x2e, 0x29, + 0xca, 0x4c, 0x2a, 0x2d, 0x49, 0x4d, 0x49, 0xce, 0xcf, 0x2d, 0x80, 0x88, 0xe6, 0xa4, 0xa6, 0xa4, + 0xa7, 0x16, 0xe9, 0x17, 0x64, 0x67, 0xea, 0x27, 0xe6, 0xe4, 0xc4, 0x27, 0xa7, 0x16, 0x95, 0x64, + 0xa6, 0x65, 0x26, 0x27, 0x96, 0xa4, 0x16, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xe9, 0xa1, + 0x1a, 0xa3, 0x87, 0xc7, 0x18, 0xbd, 0x82, 0xec, 0x4c, 0x29, 0x07, 0x12, 0xad, 0x45, 0xb2, 0x12, + 0x62, 0xa3, 0xd2, 0x09, 0x46, 0x2e, 0x7e, 0xc7, 0x9c, 0x1c, 0x67, 0x24, 0xb7, 0x08, 0x49, 0x70, + 0xb1, 0x17, 0x97, 0x26, 0x65, 0xa5, 0x26, 0x97, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xc1, + 0xb8, 0x42, 0x4a, 0x5c, 0x3c, 0x50, 0xa6, 0x77, 0x6a, 0xa5, 0x67, 0x8a, 0x04, 0x13, 0x58, 0x1a, + 0x45, 0x4c, 0x28, 0x90, 0x8b, 0x15, 0x64, 0x4d, 0xb1, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, + 0x35, 0x89, 0x7e, 0xd2, 0x43, 0x72, 0x4a, 0x10, 0xc4, 0x24, 0x21, 0x15, 0x2e, 0xde, 0xe2, 0xe4, + 0x8c, 0xd4, 0xdc, 0xc4, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x16, 0x05, 0x46, 0x0d, + 0xde, 0x20, 0x54, 0x41, 0xa7, 0xb8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, + 0x72, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0xb8, 0x46, 0x17, + 0x5b, 0x90, 0xe9, 0x22, 0xdc, 0xa3, 0x0b, 0x0d, 0xb4, 0x0a, 0x70, 0xb0, 0x95, 0x54, 0x16, 0xa4, + 0x16, 0x27, 0xb1, 0x81, 0x43, 0xcc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xcb, 0x54, 0xc8, + 0xec, 0x01, 0x00, 0x00, +} + +func (m *AllCertificates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllCertificates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllCertificates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SchemaVersion != 0 { + i = encodeVarintAllCertificates(dAtA, i, uint64(m.SchemaVersion)) + i-- + dAtA[i] = 0x20 + } + if len(m.Certs) > 0 { + for iNdEx := len(m.Certs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAllCertificates(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintAllCertificates(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintAllCertificates(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintAllCertificates(dAtA []byte, offset int, v uint64) int { + offset -= sovAllCertificates(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AllCertificates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovAllCertificates(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovAllCertificates(uint64(l)) + } + if len(m.Certs) > 0 { + for _, e := range m.Certs { + l = e.Size() + n += 1 + l + sovAllCertificates(uint64(l)) + } + } + if m.SchemaVersion != 0 { + n += 1 + sovAllCertificates(uint64(m.SchemaVersion)) + } + return n +} + +func sovAllCertificates(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAllCertificates(x uint64) (n int) { + return sovAllCertificates(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AllCertificates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllCertificates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllCertificates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAllCertificates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAllCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAllCertificates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAllCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAllCertificates + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAllCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certs = append(m.Certs, &Certificate{}) + if err := m.Certs[len(m.Certs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) + } + m.SchemaVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAllCertificates(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAllCertificates + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAllCertificates(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAllCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthAllCertificates + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAllCertificates + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAllCertificates + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAllCertificates = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAllCertificates = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAllCertificates = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/all_certificates_by_subject.pb.go b/x/pki/types/all_certificates_by_subject.pb.go new file mode 100644 index 000000000..8100adec3 --- /dev/null +++ b/x/pki/types/all_certificates_by_subject.pb.go @@ -0,0 +1,412 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type AllCertificatesBySubject struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyIds []string `protobuf:"bytes,2,rep,name=subjectKeyIds,proto3" json:"subjectKeyIds,omitempty"` + SchemaVersion uint32 `protobuf:"varint,3,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` +} + +func (m *AllCertificatesBySubject) Reset() { *m = AllCertificatesBySubject{} } +func (m *AllCertificatesBySubject) String() string { return proto.CompactTextString(m) } +func (*AllCertificatesBySubject) ProtoMessage() {} +func (*AllCertificatesBySubject) Descriptor() ([]byte, []int) { + return fileDescriptor_35ed20fcb7a53f2f, []int{0} +} +func (m *AllCertificatesBySubject) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllCertificatesBySubject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllCertificatesBySubject.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AllCertificatesBySubject) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllCertificatesBySubject.Merge(m, src) +} +func (m *AllCertificatesBySubject) XXX_Size() int { + return m.Size() +} +func (m *AllCertificatesBySubject) XXX_DiscardUnknown() { + xxx_messageInfo_AllCertificatesBySubject.DiscardUnknown(m) +} + +var xxx_messageInfo_AllCertificatesBySubject proto.InternalMessageInfo + +func (m *AllCertificatesBySubject) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *AllCertificatesBySubject) GetSubjectKeyIds() []string { + if m != nil { + return m.SubjectKeyIds + } + return nil +} + +func (m *AllCertificatesBySubject) GetSchemaVersion() uint32 { + if m != nil { + return m.SchemaVersion + } + return 0 +} + +func init() { + proto.RegisterType((*AllCertificatesBySubject)(nil), "zigbeealliance.distributedcomplianceledger.pki.AllCertificatesBySubject") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/all_certificates_by_subject.proto", fileDescriptor_35ed20fcb7a53f2f) +} + +var fileDescriptor_35ed20fcb7a53f2f = []byte{ + // 255 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x0a, 0xa8, 0xca, 0x4c, 0x4f, + 0x4a, 0x4d, 0x4d, 0xcc, 0xc9, 0xc9, 0x4c, 0xcc, 0x4b, 0x4e, 0xd5, 0x4f, 0xc9, 0x2c, 0x2e, 0x29, + 0xca, 0x4c, 0x2a, 0x2d, 0x49, 0x4d, 0x49, 0xce, 0xcf, 0x2d, 0x80, 0x88, 0xe6, 0xa4, 0xa6, 0xa4, + 0xa7, 0x16, 0xe9, 0x17, 0x64, 0x67, 0xea, 0x27, 0xe6, 0xe4, 0xc4, 0x27, 0xa7, 0x16, 0x95, 0x64, + 0xa6, 0x65, 0x26, 0x27, 0x96, 0xa4, 0x16, 0xc7, 0x27, 0x55, 0xc6, 0x17, 0x97, 0x26, 0x65, 0xa5, + 0x26, 0x97, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xe9, 0xa1, 0x9a, 0xa8, 0x87, 0xc7, 0x44, + 0xbd, 0x82, 0xec, 0x4c, 0xa5, 0x06, 0x46, 0x2e, 0x09, 0xc7, 0x9c, 0x1c, 0x67, 0x24, 0x43, 0x9d, + 0x2a, 0x83, 0x21, 0x46, 0x0a, 0x49, 0x70, 0xb1, 0x43, 0x4d, 0x97, 0x60, 0x54, 0x60, 0xd4, 0xe0, + 0x0c, 0x82, 0x71, 0x85, 0x54, 0xb8, 0x78, 0xa1, 0x4c, 0xef, 0xd4, 0x4a, 0xcf, 0x94, 0x62, 0x09, + 0x26, 0x05, 0x66, 0x0d, 0xce, 0x20, 0x54, 0x41, 0xb0, 0xaa, 0xe4, 0x8c, 0xd4, 0xdc, 0xc4, 0xb0, + 0xd4, 0xa2, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x66, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x54, 0x41, 0xa7, + 0xb8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, + 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x72, 0x49, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0xf8, 0x4b, 0x17, 0x5b, 0x50, 0xe9, 0x22, 0x7c, + 0xa6, 0x0b, 0x0d, 0xac, 0x0a, 0x70, 0x70, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, + 0xc6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x08, 0x2a, 0x95, 0x83, 0x6d, 0x01, 0x00, 0x00, +} + +func (m *AllCertificatesBySubject) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllCertificatesBySubject) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllCertificatesBySubject) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SchemaVersion != 0 { + i = encodeVarintAllCertificatesBySubject(dAtA, i, uint64(m.SchemaVersion)) + i-- + dAtA[i] = 0x18 + } + if len(m.SubjectKeyIds) > 0 { + for iNdEx := len(m.SubjectKeyIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SubjectKeyIds[iNdEx]) + copy(dAtA[i:], m.SubjectKeyIds[iNdEx]) + i = encodeVarintAllCertificatesBySubject(dAtA, i, uint64(len(m.SubjectKeyIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintAllCertificatesBySubject(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintAllCertificatesBySubject(dAtA []byte, offset int, v uint64) int { + offset -= sovAllCertificatesBySubject(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AllCertificatesBySubject) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovAllCertificatesBySubject(uint64(l)) + } + if len(m.SubjectKeyIds) > 0 { + for _, s := range m.SubjectKeyIds { + l = len(s) + n += 1 + l + sovAllCertificatesBySubject(uint64(l)) + } + } + if m.SchemaVersion != 0 { + n += 1 + sovAllCertificatesBySubject(uint64(m.SchemaVersion)) + } + return n +} + +func sovAllCertificatesBySubject(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAllCertificatesBySubject(x uint64) (n int) { + return sovAllCertificatesBySubject(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AllCertificatesBySubject) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllCertificatesBySubject: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllCertificatesBySubject: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAllCertificatesBySubject + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAllCertificatesBySubject + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAllCertificatesBySubject + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAllCertificatesBySubject + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyIds = append(m.SubjectKeyIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) + } + m.SchemaVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAllCertificatesBySubject(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAllCertificatesBySubject + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAllCertificatesBySubject(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAllCertificatesBySubject + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthAllCertificatesBySubject + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAllCertificatesBySubject + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAllCertificatesBySubject + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAllCertificatesBySubject = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAllCertificatesBySubject = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAllCertificatesBySubject = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/certificate.go b/x/pki/types/certificate.go index 68d64418f..bc3d3fa9d 100644 --- a/x/pki/types/certificate.go +++ b/x/pki/types/certificate.go @@ -52,16 +52,16 @@ func NewNocRootCertificate( schemaVersion uint32, ) Certificate { return Certificate{ - PemCert: pemCert, - Subject: subject, - SubjectAsText: subjectAsText, - SubjectKeyId: subjectKeyID, - SerialNumber: serialNumber, - IsRoot: true, - Owner: owner, - Vid: vid, - IsNoc: true, - SchemaVersion: schemaVersion, + PemCert: pemCert, + Subject: subject, + SubjectAsText: subjectAsText, + SubjectKeyId: subjectKeyID, + SerialNumber: serialNumber, + IsRoot: true, + Owner: owner, + Vid: vid, + CertificateType: CertificateType_OperationalPKI, + SchemaVersion: schemaVersion, } } @@ -92,7 +92,7 @@ func NewNocCertificate( Vid: vid, Owner: owner, IsRoot: false, - IsNoc: true, + CertificateType: CertificateType_OperationalPKI, SchemaVersion: schemaVersion, } } diff --git a/x/pki/types/certificate.pb.go b/x/pki/types/certificate.pb.go index a0fc4f01f..1e5295769 100644 --- a/x/pki/types/certificate.pb.go +++ b/x/pki/types/certificate.pb.go @@ -24,23 +24,51 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type CertificateType int32 + +const ( + CertificateType_DeviceAttestationPKI CertificateType = 0 + CertificateType_OperationalPKI CertificateType = 1 + CertificateType_VIDSignerPKI CertificateType = 2 +) + +var CertificateType_name = map[int32]string{ + 0: "DeviceAttestationPKI", + 1: "OperationalPKI", + 2: "VIDSignerPKI", +} + +var CertificateType_value = map[string]int32{ + "DeviceAttestationPKI": 0, + "OperationalPKI": 1, + "VIDSignerPKI": 2, +} + +func (x CertificateType) String() string { + return proto.EnumName(CertificateType_name, int32(x)) +} + +func (CertificateType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0ec8ab7f7382ccfa, []int{0} +} + type Certificate struct { - PemCert string `protobuf:"bytes,1,opt,name=pemCert,proto3" json:"pemCert,omitempty"` - SerialNumber string `protobuf:"bytes,2,opt,name=serialNumber,proto3" json:"serialNumber,omitempty"` - Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` - AuthorityKeyId string `protobuf:"bytes,4,opt,name=authorityKeyId,proto3" json:"authorityKeyId,omitempty"` - RootSubject string `protobuf:"bytes,5,opt,name=rootSubject,proto3" json:"rootSubject,omitempty"` - RootSubjectKeyId string `protobuf:"bytes,6,opt,name=rootSubjectKeyId,proto3" json:"rootSubjectKeyId,omitempty"` - IsRoot bool `protobuf:"varint,7,opt,name=isRoot,proto3" json:"isRoot,omitempty"` - Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` - Subject string `protobuf:"bytes,9,opt,name=subject,proto3" json:"subject,omitempty"` - SubjectKeyId string `protobuf:"bytes,10,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` - Approvals []*Grant `protobuf:"bytes,11,rep,name=approvals,proto3" json:"approvals,omitempty"` - SubjectAsText string `protobuf:"bytes,12,opt,name=subjectAsText,proto3" json:"subjectAsText,omitempty"` - Rejects []*Grant `protobuf:"bytes,13,rep,name=rejects,proto3" json:"rejects,omitempty"` - Vid int32 `protobuf:"varint,14,opt,name=vid,proto3" json:"vid,omitempty" validate:"gte=1,lte=65535"` - IsNoc bool `protobuf:"varint,15,opt,name=isNoc,proto3" json:"isNoc,omitempty"` - SchemaVersion uint32 `protobuf:"varint,16,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` + PemCert string `protobuf:"bytes,1,opt,name=pemCert,proto3" json:"pemCert,omitempty"` + SerialNumber string `protobuf:"bytes,2,opt,name=serialNumber,proto3" json:"serialNumber,omitempty"` + Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` + AuthorityKeyId string `protobuf:"bytes,4,opt,name=authorityKeyId,proto3" json:"authorityKeyId,omitempty"` + RootSubject string `protobuf:"bytes,5,opt,name=rootSubject,proto3" json:"rootSubject,omitempty"` + RootSubjectKeyId string `protobuf:"bytes,6,opt,name=rootSubjectKeyId,proto3" json:"rootSubjectKeyId,omitempty"` + IsRoot bool `protobuf:"varint,7,opt,name=isRoot,proto3" json:"isRoot,omitempty"` + Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` + Subject string `protobuf:"bytes,9,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,10,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` + Approvals []*Grant `protobuf:"bytes,11,rep,name=approvals,proto3" json:"approvals,omitempty"` + SubjectAsText string `protobuf:"bytes,12,opt,name=subjectAsText,proto3" json:"subjectAsText,omitempty"` + Rejects []*Grant `protobuf:"bytes,13,rep,name=rejects,proto3" json:"rejects,omitempty"` + Vid int32 `protobuf:"varint,14,opt,name=vid,proto3" json:"vid,omitempty" validate:"gte=1,lte=65535"` + CertificateType CertificateType `protobuf:"varint,15,opt,name=certificateType,proto3,enum=zigbeealliance.distributedcomplianceledger.pki.CertificateType" json:"certificateType,omitempty"` + SchemaVersion uint32 `protobuf:"varint,16,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` } func (m *Certificate) Reset() { *m = Certificate{} } @@ -174,11 +202,11 @@ func (m *Certificate) GetVid() int32 { return 0 } -func (m *Certificate) GetIsNoc() bool { +func (m *Certificate) GetCertificateType() CertificateType { if m != nil { - return m.IsNoc + return m.CertificateType } - return false + return CertificateType_DeviceAttestationPKI } func (m *Certificate) GetSchemaVersion() uint32 { @@ -189,6 +217,7 @@ func (m *Certificate) GetSchemaVersion() uint32 { } func init() { + proto.RegisterEnum("zigbeealliance.distributedcomplianceledger.pki.CertificateType", CertificateType_name, CertificateType_value) proto.RegisterType((*Certificate)(nil), "zigbeealliance.distributedcomplianceledger.pki.Certificate") } @@ -197,40 +226,44 @@ func init() { } var fileDescriptor_0ec8ab7f7382ccfa = []byte{ - // 520 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xd1, 0x8a, 0xd3, 0x4c, - 0x14, 0x6e, 0xfe, 0xfe, 0x6d, 0xb7, 0xd3, 0xed, 0xba, 0x0c, 0x45, 0xc6, 0x5e, 0xc4, 0x50, 0x44, - 0x8a, 0xd8, 0x44, 0x5d, 0xea, 0xc5, 0xc2, 0x82, 0x5b, 0x05, 0x11, 0x61, 0x85, 0x54, 0xbc, 0xf0, - 0x42, 0x99, 0x24, 0xc7, 0x74, 0xdc, 0x24, 0x13, 0x66, 0x26, 0x75, 0xeb, 0x53, 0x78, 0xeb, 0x7b, - 0xf8, 0x10, 0x5e, 0x2e, 0x5e, 0x79, 0x25, 0xd2, 0xbe, 0x81, 0x4f, 0x20, 0x99, 0xc9, 0xd2, 0x56, - 0x45, 0x58, 0xbc, 0x9b, 0xef, 0x3b, 0xe7, 0x7c, 0xe7, 0x9b, 0x33, 0x67, 0xd0, 0x83, 0xf7, 0x2c, - 0x0e, 0x00, 0x68, 0x92, 0x30, 0x9a, 0x85, 0xe0, 0x45, 0x4c, 0x2a, 0xc1, 0x82, 0x42, 0x41, 0x14, - 0xf2, 0x34, 0x37, 0x6c, 0x02, 0x51, 0x0c, 0xc2, 0xcb, 0x4f, 0x99, 0x17, 0x82, 0x50, 0xec, 0x0d, - 0x0b, 0xa9, 0x02, 0x37, 0x17, 0x5c, 0x71, 0xec, 0x6e, 0x2b, 0xb8, 0x7f, 0x51, 0x70, 0xf3, 0x53, - 0xd6, 0xbf, 0x16, 0x72, 0x99, 0x72, 0xf9, 0x5a, 0x57, 0x7b, 0x06, 0x18, 0xa9, 0x7e, 0x2f, 0xe6, - 0x31, 0x37, 0x7c, 0x79, 0xaa, 0xd8, 0xc3, 0x4b, 0x5a, 0x8c, 0x05, 0xcd, 0x94, 0xa9, 0x1d, 0x7c, - 0x6c, 0xa0, 0xce, 0xc3, 0xb5, 0x65, 0x4c, 0x50, 0x2b, 0x87, 0xb4, 0x64, 0x88, 0xe5, 0x58, 0xc3, - 0xb6, 0x7f, 0x01, 0xf1, 0x00, 0xed, 0x4a, 0x10, 0x8c, 0x26, 0x27, 0x45, 0x1a, 0x80, 0x20, 0xff, - 0xe9, 0xf0, 0x16, 0x87, 0xaf, 0xa2, 0x26, 0x93, 0xb2, 0x00, 0x41, 0xea, 0x3a, 0x5a, 0x21, 0x7c, - 0x13, 0xed, 0xd1, 0x42, 0xcd, 0xb8, 0x60, 0x6a, 0xf1, 0x14, 0x16, 0x4f, 0x22, 0xf2, 0xbf, 0x8e, - 0xff, 0xc2, 0x62, 0x07, 0x75, 0x04, 0xe7, 0x6a, 0x5a, 0x04, 0x6f, 0x21, 0x54, 0xa4, 0xa1, 0x93, - 0x36, 0x29, 0x7c, 0x0b, 0xed, 0x6f, 0x40, 0xa3, 0xd5, 0xd4, 0x69, 0xbf, 0xf1, 0xc6, 0x8d, 0xcf, - 0xb9, 0x22, 0x2d, 0xc7, 0x1a, 0xee, 0xf8, 0x15, 0xc2, 0x2e, 0x6a, 0xf0, 0x77, 0x19, 0x08, 0xb2, - 0x53, 0x16, 0x4e, 0xc8, 0x97, 0x4f, 0xa3, 0x5e, 0x35, 0xe6, 0xe3, 0x28, 0x12, 0x20, 0xe5, 0x54, - 0x09, 0x96, 0xc5, 0xbe, 0x49, 0x2b, 0x67, 0x22, 0x2b, 0x47, 0x6d, 0x33, 0x93, 0x0a, 0xea, 0x99, - 0x6c, 0x3a, 0x41, 0xd5, 0x4c, 0x36, 0x5d, 0x4c, 0x51, 0x9b, 0xe6, 0xb9, 0xe0, 0x73, 0x9a, 0x48, - 0xd2, 0x71, 0xea, 0xc3, 0xce, 0xbd, 0xf1, 0x25, 0x57, 0xc2, 0x7d, 0x5c, 0xbe, 0x98, 0xbf, 0xd6, - 0xc1, 0x37, 0x50, 0xb7, 0x6a, 0x72, 0x2c, 0x9f, 0xc3, 0x99, 0x22, 0xbb, 0xba, 0xf3, 0x36, 0x89, - 0x9f, 0xa1, 0x96, 0x80, 0x12, 0x4b, 0xd2, 0xfd, 0x97, 0xc6, 0x17, 0x2a, 0xf8, 0x0e, 0xaa, 0xcf, - 0x59, 0x44, 0xf6, 0x1c, 0x6b, 0xd8, 0x98, 0xd8, 0x3f, 0xbe, 0x5d, 0xef, 0xcf, 0x69, 0xc2, 0x22, - 0xaa, 0xe0, 0x70, 0x10, 0x2b, 0x38, 0xba, 0x7b, 0x3b, 0x51, 0x70, 0x74, 0x7f, 0x3c, 0x3e, 0x18, - 0x0f, 0xfc, 0x32, 0x15, 0xf7, 0x50, 0x83, 0xc9, 0x13, 0x1e, 0x92, 0x2b, 0xfa, 0x09, 0x0c, 0xd0, - 0xf6, 0xc3, 0x19, 0xa4, 0xf4, 0x05, 0x08, 0xc9, 0x78, 0x46, 0xf6, 0x1d, 0x6b, 0xd8, 0xf5, 0xb7, - 0xc9, 0xc9, 0xab, 0xcf, 0x4b, 0xdb, 0x3a, 0x5f, 0xda, 0xd6, 0xf7, 0xa5, 0x6d, 0x7d, 0x58, 0xd9, - 0xb5, 0xf3, 0x95, 0x5d, 0xfb, 0xba, 0xb2, 0x6b, 0x2f, 0x1f, 0xc5, 0x4c, 0xcd, 0x8a, 0xc0, 0x0d, - 0x79, 0xea, 0x99, 0x1b, 0x8d, 0xfe, 0xb4, 0xfd, 0xa3, 0xf5, 0x9d, 0x46, 0xd5, 0xfe, 0x9f, 0xe9, - 0x1f, 0xa0, 0x16, 0x39, 0xc8, 0xa0, 0xa9, 0xbf, 0xc0, 0xc1, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xb1, 0xd8, 0xc8, 0xf6, 0xe3, 0x03, 0x00, 0x00, + // 583 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcb, 0x6e, 0xd3, 0x4e, + 0x14, 0xc6, 0xe3, 0xf6, 0x9f, 0x5e, 0x26, 0x6d, 0x1a, 0x8d, 0xaa, 0xbf, 0x86, 0x2e, 0x8c, 0x15, + 0x21, 0x64, 0x55, 0xc4, 0x81, 0x56, 0x61, 0x51, 0xa9, 0x82, 0x5e, 0x24, 0x14, 0x55, 0xa2, 0xe0, + 0x54, 0x5d, 0xb0, 0x00, 0x8d, 0xed, 0x83, 0x33, 0xd4, 0xf6, 0x58, 0x33, 0xe3, 0xd0, 0xf0, 0x14, + 0x3c, 0x0c, 0x0f, 0xc1, 0xb2, 0x62, 0xc5, 0x0a, 0xa1, 0x64, 0xcf, 0x82, 0x27, 0x40, 0x1e, 0xbb, + 0xca, 0x05, 0x84, 0x14, 0xb1, 0xcb, 0xf7, 0x9b, 0x33, 0xdf, 0xf9, 0xe6, 0xc4, 0x07, 0x3d, 0xfd, + 0xc0, 0x42, 0x0f, 0x80, 0x46, 0x11, 0xa3, 0x89, 0x0f, 0xed, 0x80, 0x49, 0x25, 0x98, 0x97, 0x29, + 0x08, 0x7c, 0x1e, 0xa7, 0x05, 0x8d, 0x20, 0x08, 0x41, 0xb4, 0xd3, 0x2b, 0xd6, 0xf6, 0x41, 0x28, + 0xf6, 0x96, 0xf9, 0x54, 0x81, 0x93, 0x0a, 0xae, 0x38, 0x76, 0x66, 0x1d, 0x9c, 0xbf, 0x38, 0x38, + 0xe9, 0x15, 0xdb, 0xb9, 0xe3, 0x73, 0x19, 0x73, 0xf9, 0x46, 0xdf, 0x6e, 0x17, 0xa2, 0xb0, 0xda, + 0xd9, 0x0e, 0x79, 0xc8, 0x0b, 0x9e, 0xff, 0x2a, 0xe9, 0xc1, 0x82, 0x11, 0x43, 0x41, 0x13, 0x55, + 0xdc, 0x6d, 0xfe, 0xa8, 0xa2, 0xda, 0xc9, 0x24, 0x32, 0x26, 0x68, 0x35, 0x85, 0x38, 0x27, 0xc4, + 0xb0, 0x0c, 0x7b, 0xdd, 0xbd, 0x95, 0xb8, 0x89, 0x36, 0x24, 0x08, 0x46, 0xa3, 0xe7, 0x59, 0xec, + 0x81, 0x20, 0x4b, 0xfa, 0x78, 0x86, 0xe1, 0xff, 0xd1, 0x0a, 0x93, 0x32, 0x03, 0x41, 0x96, 0xf5, + 0x69, 0xa9, 0xf0, 0x7d, 0x54, 0xa7, 0x99, 0xea, 0x73, 0xc1, 0xd4, 0xf0, 0x0c, 0x86, 0xdd, 0x80, + 0xfc, 0xa7, 0xcf, 0xe7, 0x28, 0xb6, 0x50, 0x4d, 0x70, 0xae, 0x7a, 0x99, 0xf7, 0x0e, 0x7c, 0x45, + 0xaa, 0xba, 0x68, 0x1a, 0xe1, 0x5d, 0xd4, 0x98, 0x92, 0x85, 0xd7, 0x8a, 0x2e, 0xfb, 0x8d, 0x17, + 0x69, 0x5c, 0xce, 0x15, 0x59, 0xb5, 0x0c, 0x7b, 0xcd, 0x2d, 0x15, 0x76, 0x50, 0x95, 0xbf, 0x4f, + 0x40, 0x90, 0xb5, 0xfc, 0xe2, 0x31, 0xf9, 0xf2, 0xa9, 0xb5, 0x5d, 0x8e, 0xf9, 0x28, 0x08, 0x04, + 0x48, 0xd9, 0x53, 0x82, 0x25, 0xa1, 0x5b, 0x94, 0xe5, 0x33, 0x91, 0x65, 0xa2, 0xf5, 0x62, 0x26, + 0xa5, 0xd4, 0x33, 0x99, 0x4e, 0x82, 0xca, 0x99, 0x4c, 0xa7, 0xe8, 0xa1, 0x75, 0x9a, 0xa6, 0x82, + 0x0f, 0x68, 0x24, 0x49, 0xcd, 0x5a, 0xb6, 0x6b, 0x7b, 0x9d, 0x05, 0x3f, 0x09, 0xe7, 0x59, 0xfe, + 0x8f, 0xb9, 0x13, 0x1f, 0x7c, 0x0f, 0x6d, 0x96, 0x4d, 0x8e, 0xe4, 0x05, 0x5c, 0x2b, 0xb2, 0xa1, + 0x3b, 0xcf, 0x42, 0x7c, 0x8e, 0x56, 0x05, 0xe4, 0x5a, 0x92, 0xcd, 0x7f, 0x69, 0x7c, 0xeb, 0x82, + 0x1f, 0xa2, 0xe5, 0x01, 0x0b, 0x48, 0xdd, 0x32, 0xec, 0xea, 0xb1, 0xf9, 0xf3, 0xdb, 0xdd, 0x9d, + 0x01, 0x8d, 0x58, 0x40, 0x15, 0x1c, 0x34, 0x43, 0x05, 0x87, 0x8f, 0x1e, 0x44, 0x0a, 0x0e, 0x1f, + 0x77, 0x3a, 0xfb, 0x9d, 0xa6, 0x9b, 0x97, 0x62, 0x86, 0xb6, 0xa6, 0x36, 0xe2, 0x62, 0x98, 0x02, + 0xd9, 0xb2, 0x0c, 0xbb, 0xbe, 0xf7, 0x64, 0xd1, 0x28, 0x27, 0xb3, 0x36, 0xee, 0xbc, 0xaf, 0x9e, + 0x89, 0xdf, 0x87, 0x98, 0x5e, 0x82, 0x90, 0x8c, 0x27, 0xa4, 0x61, 0x19, 0xf6, 0xa6, 0x3b, 0x0b, + 0x77, 0x5f, 0xa2, 0xad, 0x39, 0x27, 0x4c, 0xd0, 0xf6, 0x29, 0x0c, 0x98, 0x0f, 0x47, 0x4a, 0x81, + 0x54, 0x54, 0x31, 0x9e, 0xbc, 0x38, 0xeb, 0x36, 0x2a, 0x18, 0xa3, 0xfa, 0x79, 0x0a, 0x42, 0x13, + 0x1a, 0xe5, 0xcc, 0xc0, 0x0d, 0xb4, 0x71, 0xd9, 0x3d, 0xed, 0xb1, 0x30, 0x01, 0x91, 0x93, 0xa5, + 0xe3, 0xd7, 0x9f, 0x47, 0xa6, 0x71, 0x33, 0x32, 0x8d, 0xef, 0x23, 0xd3, 0xf8, 0x38, 0x36, 0x2b, + 0x37, 0x63, 0xb3, 0xf2, 0x75, 0x6c, 0x56, 0x5e, 0x9d, 0x86, 0x4c, 0xf5, 0x33, 0xcf, 0xf1, 0x79, + 0xdc, 0x2e, 0x9e, 0xdb, 0xfa, 0xd3, 0x96, 0xb6, 0x26, 0x0f, 0x6e, 0x95, 0x7b, 0x7a, 0xad, 0x37, + 0x55, 0x0d, 0x53, 0x90, 0xde, 0x8a, 0x5e, 0xd5, 0xfd, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x24, + 0x41, 0x8b, 0xd8, 0x8b, 0x04, 0x00, 0x00, } func (m *Certificate) Marshal() (dAtA []byte, err error) { @@ -260,13 +293,8 @@ func (m *Certificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x80 } - if m.IsNoc { - i-- - if m.IsNoc { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if m.CertificateType != 0 { + i = encodeVarintCertificate(dAtA, i, uint64(m.CertificateType)) i-- dAtA[i] = 0x78 } @@ -461,8 +489,8 @@ func (m *Certificate) Size() (n int) { if m.Vid != 0 { n += 1 + sovCertificate(uint64(m.Vid)) } - if m.IsNoc { - n += 2 + if m.CertificateType != 0 { + n += 1 + sovCertificate(uint64(m.CertificateType)) } if m.SchemaVersion != 0 { n += 2 + sovCertificate(uint64(m.SchemaVersion)) @@ -934,9 +962,9 @@ func (m *Certificate) Unmarshal(dAtA []byte) error { } case 15: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsNoc", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CertificateType", wireType) } - var v int + m.CertificateType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCertificate @@ -946,12 +974,11 @@ func (m *Certificate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.CertificateType |= CertificateType(b&0x7F) << shift if b < 0x80 { break } } - m.IsNoc = bool(v != 0) case 16: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) diff --git a/x/pki/types/genesis.go b/x/pki/types/genesis.go index 4ffb857d5..40591b83a 100644 --- a/x/pki/types/genesis.go +++ b/x/pki/types/genesis.go @@ -27,6 +27,12 @@ func DefaultGenesis() *GenesisState { NocIcaCertificatesList: []NocIcaCertificates{}, RevokedNocRootCertificatesList: []RevokedNocRootCertificates{}, NocCertificatesByVidAndSkidList: []NocCertificatesByVidAndSkid{}, + NocCertificatesBySubjectKeyIDList: []NocCertificatesBySubjectKeyID{}, + NocCertificatesList: []NocCertificates{}, + NocCertificatesBySubjectList: []NocCertificatesBySubject{}, + CertificatesList: []AllCertificates{}, + RevokedNocIcaCertificatesList: []RevokedNocIcaCertificates{}, + AllCertificatesBySubjectList: []AllCertificatesBySubject{}, // this line is used by starport scaffolding # genesis/types/default } } @@ -186,6 +192,57 @@ func (gs GenesisState) Validate() error { //nolint:gocyclo,vet } nocCertificatesByVidAndSkidIndexMap[index] = struct{}{} } + // Check for duplicated index in nocCertificatesBySubjectKeyId + nocCertificatesBySubjectKeyIDIndexMap := make(map[string]struct{}) + + for _, elem := range gs.NocCertificatesBySubjectKeyIDList { + index := string(NocCertificatesBySubjectKeyIDKey(elem.SubjectKeyId)) + if _, ok := nocCertificatesBySubjectKeyIDIndexMap[index]; ok { + return fmt.Errorf("duplicated index for nocCertificatesBySubjectKeyId") + } + nocCertificatesBySubjectKeyIDIndexMap[index] = struct{}{} + } + + // Check for duplicated index in nocCertificatesBySubject + nocCertificatesBySubjectIndexMap := make(map[string]struct{}) + + for _, elem := range gs.NocCertificatesBySubjectList { + index := string(NocCertificatesBySubjectKey(elem.Subject)) + if _, ok := nocCertificatesBySubjectIndexMap[index]; ok { + return fmt.Errorf("duplicated index for nocCertificatesBySubject") + } + nocCertificatesBySubjectIndexMap[index] = struct{}{} + } + // Check for duplicated index in certificates + certificatesIndexMap := make(map[string]struct{}) + + for _, elem := range gs.CertificatesList { + index := string(AllCertificatesKey(elem.Subject, elem.SubjectKeyId)) + if _, ok := certificatesIndexMap[index]; ok { + return fmt.Errorf("duplicated index for certificates") + } + certificatesIndexMap[index] = struct{}{} + } + // Check for duplicated index in revokedNocIcaCertificates + revokedNocIcaCertificatesIndexMap := make(map[string]struct{}) + + for _, elem := range gs.RevokedNocIcaCertificatesList { + index := string(RevokedNocIcaCertificatesKey(elem.Subject, elem.SubjectKeyId)) + if _, ok := revokedNocIcaCertificatesIndexMap[index]; ok { + return fmt.Errorf("duplicated index for revokedNocIcaCertificates") + } + revokedNocIcaCertificatesIndexMap[index] = struct{}{} + } + // Check for duplicated index in allCertificatesBySubject + allCertificatesBySubjectIndexMap := make(map[string]struct{}) + + for _, elem := range gs.AllCertificatesBySubjectList { + index := string(AllCertificatesBySubjectKey(elem.Subject)) + if _, ok := allCertificatesBySubjectIndexMap[index]; ok { + return fmt.Errorf("duplicated index for allCertificatesBySubject") + } + allCertificatesBySubjectIndexMap[index] = struct{}{} + } // this line is used by starport scaffolding # genesis/types/validate return nil diff --git a/x/pki/types/genesis.pb.go b/x/pki/types/genesis.pb.go index 7281e955f..142c19ee3 100644 --- a/x/pki/types/genesis.pb.go +++ b/x/pki/types/genesis.pb.go @@ -42,6 +42,12 @@ type GenesisState struct { NocIcaCertificatesList []NocIcaCertificates `protobuf:"bytes,15,rep,name=nocIcaCertificatesList,proto3" json:"nocIcaCertificatesList"` RevokedNocRootCertificatesList []RevokedNocRootCertificates `protobuf:"bytes,16,rep,name=revokedNocRootCertificatesList,proto3" json:"revokedNocRootCertificatesList"` NocCertificatesByVidAndSkidList []NocCertificatesByVidAndSkid `protobuf:"bytes,17,rep,name=nocCertificatesByVidAndSkidList,proto3" json:"nocCertificatesByVidAndSkidList"` + NocCertificatesBySubjectKeyIDList []NocCertificatesBySubjectKeyID `protobuf:"bytes,18,rep,name=NocCertificatesBySubjectKeyIDList,proto3" json:"NocCertificatesBySubjectKeyIDList"` + NocCertificatesList []NocCertificates `protobuf:"bytes,19,rep,name=nocCertificatesList,proto3" json:"nocCertificatesList"` + NocCertificatesBySubjectList []NocCertificatesBySubject `protobuf:"bytes,20,rep,name=nocCertificatesBySubjectList,proto3" json:"nocCertificatesBySubjectList"` + CertificatesList []AllCertificates `protobuf:"bytes,21,rep,name=certificatesList,proto3" json:"certificatesList"` + RevokedNocIcaCertificatesList []RevokedNocIcaCertificates `protobuf:"bytes,22,rep,name=revokedNocIcaCertificatesList,proto3" json:"revokedNocIcaCertificatesList"` + AllCertificatesBySubjectList []AllCertificatesBySubject `protobuf:"bytes,23,rep,name=allCertificatesBySubjectList,proto3" json:"allCertificatesBySubjectList"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -196,6 +202,48 @@ func (m *GenesisState) GetNocCertificatesByVidAndSkidList() []NocCertificatesByV return nil } +func (m *GenesisState) GetNocCertificatesBySubjectKeyIDList() []NocCertificatesBySubjectKeyID { + if m != nil { + return m.NocCertificatesBySubjectKeyIDList + } + return nil +} + +func (m *GenesisState) GetNocCertificatesList() []NocCertificates { + if m != nil { + return m.NocCertificatesList + } + return nil +} + +func (m *GenesisState) GetNocCertificatesBySubjectList() []NocCertificatesBySubject { + if m != nil { + return m.NocCertificatesBySubjectList + } + return nil +} + +func (m *GenesisState) GetCertificatesList() []AllCertificates { + if m != nil { + return m.CertificatesList + } + return nil +} + +func (m *GenesisState) GetRevokedNocIcaCertificatesList() []RevokedNocIcaCertificates { + if m != nil { + return m.RevokedNocIcaCertificatesList + } + return nil +} + +func (m *GenesisState) GetAllCertificatesBySubjectList() []AllCertificatesBySubject { + if m != nil { + return m.AllCertificatesBySubjectList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "zigbeealliance.distributedcomplianceledger.pki.GenesisState") } @@ -205,58 +253,67 @@ func init() { } var fileDescriptor_f53eb28747bee8a8 = []byte{ - // 809 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x3f, 0x6f, 0xd3, 0x40, - 0x18, 0xc6, 0x73, 0xb4, 0x14, 0x70, 0xcb, 0x3f, 0xf3, 0xaf, 0xea, 0x90, 0x96, 0x0e, 0xa8, 0x4b, - 0x13, 0xa9, 0x0c, 0x2c, 0x2c, 0x49, 0x23, 0x95, 0xb4, 0x10, 0xaa, 0x94, 0x76, 0x40, 0x08, 0xcb, - 0x39, 0x1f, 0xe9, 0xe1, 0xd4, 0x67, 0xec, 0x4b, 0x45, 0x90, 0x90, 0x40, 0x20, 0x66, 0x46, 0x24, - 0x26, 0x24, 0x3e, 0x00, 0x1f, 0xa3, 0x63, 0x47, 0x26, 0x84, 0x9a, 0xaf, 0xc1, 0x80, 0xfc, 0xfa, - 0xdc, 0x24, 0xf6, 0x39, 0xa9, 0x4f, 0xde, 0x52, 0xd7, 0x7e, 0x9e, 0xdf, 0xbd, 0xef, 0x73, 0xef, - 0x9d, 0xf6, 0xf0, 0x1d, 0x6d, 0xb7, 0x08, 0x31, 0x3b, 0x1d, 0x6a, 0x3a, 0x98, 0x94, 0x2d, 0xea, - 0x73, 0x8f, 0xb6, 0xba, 0x9c, 0x58, 0x98, 0x1d, 0xb8, 0xe1, 0xd3, 0x0e, 0xb1, 0xda, 0xc4, 0x2b, - 0xbb, 0x36, 0x2d, 0xb7, 0x89, 0x43, 0x7c, 0xea, 0x97, 0x5c, 0x8f, 0x71, 0xa6, 0x97, 0x46, 0xbf, - 0x2e, 0x8d, 0xf9, 0xba, 0xe4, 0xda, 0x74, 0x61, 0x33, 0xa3, 0x9b, 0xe9, 0xba, 0x1e, 0x3b, 0x24, - 0x96, 0x81, 0x89, 0xc7, 0xe9, 0x2b, 0x8a, 0x4d, 0x4e, 0x84, 0xf7, 0x42, 0x3d, 0xa3, 0x96, 0xeb, - 0x31, 0x97, 0xf9, 0xa3, 0x5a, 0x42, 0x6a, 0x23, 0xa3, 0x14, 0xde, 0xa7, 0x1d, 0x29, 0xd3, 0xb3, - 0x1c, 0x98, 0x0c, 0x8f, 0x1c, 0x32, 0x6c, 0x72, 0xca, 0x1c, 0xc5, 0x95, 0x06, 0x02, 0xb6, 0xbc, - 0x68, 0x59, 0x57, 0xda, 0x75, 0xe8, 0x9b, 0x2e, 0x91, 0x94, 0xec, 0xa9, 0x6a, 0x27, 0x3d, 0xc6, - 0xb8, 0x8c, 0xac, 0xa1, 0xb8, 0xc8, 0x34, 0xbd, 0xdd, 0x3c, 0xa2, 0x66, 0xb4, 0x7a, 0x86, 0xdf, - 0x6d, 0xbd, 0x26, 0x98, 0x2b, 0xf7, 0x22, 0xf8, 0x58, 0x9a, 0xba, 0xbd, 0xac, 0x61, 0xb1, 0xe9, - 0x50, 0x36, 0x8c, 0xd3, 0xd7, 0x83, 0x3f, 0x5c, 0x46, 0x9d, 0x08, 0xd1, 0xcd, 0x5b, 0x17, 0xca, - 0x40, 0x7d, 0xbf, 0x4b, 0xbc, 0xa8, 0x1a, 0x86, 0x4d, 0x7a, 0x06, 0xb5, 0x84, 0xe3, 0x8b, 0x9c, - 0x6b, 0x3d, 0xaa, 0x9e, 0x75, 0x68, 0x38, 0x0c, 0xa7, 0xa6, 0xa2, 0xae, 0xa0, 0x45, 0xb1, 0x29, - 0x93, 0x6a, 0x2a, 0x06, 0x76, 0x1c, 0xde, 0xae, 0x02, 0x5e, 0xbc, 0x86, 0x87, 0xd4, 0x32, 0x4c, - 0xc7, 0x32, 0x7c, 0xfb, 0xb4, 0x82, 0x37, 0xdb, 0xac, 0xcd, 0xe0, 0x67, 0x39, 0xf8, 0x15, 0x3e, - 0x5d, 0xfe, 0x77, 0x43, 0x9b, 0xdb, 0x08, 0xc7, 0xf9, 0x0e, 0x37, 0x39, 0xd1, 0xbf, 0x20, 0x6d, - 0x3e, 0x6a, 0xcd, 0xfa, 0x90, 0xea, 0x63, 0xea, 0xf3, 0x79, 0xb4, 0x34, 0xb5, 0x32, 0xbb, 0x56, - 0xcb, 0x38, 0xf1, 0x4b, 0x15, 0x89, 0x5e, 0x75, 0xfa, 0xe8, 0xcf, 0x62, 0xa1, 0x99, 0xea, 0xa5, - 0x7f, 0x42, 0xda, 0x9d, 0x68, 0x34, 0x0e, 0xfd, 0x13, 0x38, 0xce, 0x01, 0xc7, 0x7a, 0x56, 0x8e, - 0xed, 0xa4, 0x9c, 0xc0, 0x48, 0x73, 0xd2, 0xdf, 0x6b, 0xb7, 0x60, 0xd0, 0x27, 0x4a, 0x31, 0x05, - 0x08, 0x95, 0xac, 0x08, 0xeb, 0x71, 0x31, 0x01, 0x20, 0x77, 0xd1, 0x7f, 0x20, 0xed, 0xae, 0x04, - 0xad, 0x79, 0xba, 0x53, 0x81, 0x65, 0x1a, 0x58, 0x9e, 0xe4, 0x50, 0x8e, 0x81, 0xb0, 0xe0, 0x9a, - 0xec, 0x0e, 0x8d, 0x12, 0xb9, 0x4e, 0x54, 0xe9, 0xbc, 0x5a, 0xa3, 0x9a, 0x49, 0xb9, 0xa8, 0x51, - 0x29, 0x4e, 0x41, 0xa3, 0xc2, 0x73, 0x2a, 0x9e, 0x95, 0x19, 0xb5, 0x46, 0xed, 0xc6, 0xc5, 0xa2, - 0x46, 0x49, 0x5d, 0xf4, 0xcf, 0x43, 0xdb, 0xa6, 0xc9, 0x18, 0x1f, 0xe6, 0x9b, 0xbf, 0xb0, 0x84, - 0x56, 0x66, 0xd7, 0x1e, 0xa9, 0x6e, 0x9b, 0xb8, 0x5e, 0x33, 0xd5, 0x49, 0xff, 0x38, 0xe8, 0x45, - 0x82, 0xe2, 0x22, 0x50, 0x6c, 0x28, 0xf6, 0x22, 0x01, 0x91, 0xe6, 0x03, 0x99, 0x95, 0xed, 0xea, - 0x6a, 0x6f, 0x27, 0x9c, 0xec, 0xd0, 0x96, 0x4b, 0x6a, 0x99, 0xad, 0x8c, 0x13, 0x8e, 0x32, 0x3b, - 0xd1, 0x5d, 0x64, 0x36, 0x3c, 0x95, 0xe3, 0x81, 0xd1, 0x54, 0x33, 0x9b, 0x90, 0x1b, 0x64, 0x56, - 0xea, 0xa4, 0xff, 0x44, 0xda, 0xf2, 0xb6, 0x4d, 0x07, 0xfb, 0xa9, 0x36, 0x74, 0xec, 0x6e, 0x07, - 0xa7, 0x2e, 0x00, 0xcd, 0x02, 0x50, 0x23, 0xf3, 0xf6, 0x1e, 0xab, 0x2c, 0xd8, 0xce, 0xe0, 0xaf, - 0xf7, 0x91, 0xf6, 0x60, 0xfc, 0x6b, 0x7e, 0xb5, 0x57, 0x87, 0xab, 0x81, 0xa8, 0xf1, 0x16, 0xe9, - 0xd5, 0x6b, 0xc0, 0x3e, 0x07, 0xec, 0x38, 0x5f, 0x76, 0xa9, 0x9d, 0x58, 0x90, 0x2a, 0xa9, 0xfe, - 0x0b, 0x69, 0xf7, 0xc6, 0x06, 0x27, 0x78, 0xd5, 0x82, 0x45, 0x5d, 0x86, 0x45, 0x35, 0x73, 0xcd, - 0x2e, 0xa8, 0x8b, 0x35, 0x9c, 0x91, 0x03, 0x52, 0xec, 0x30, 0x1c, 0xdf, 0x81, 0xc0, 0x78, 0x45, - 0x2d, 0xc5, 0x8d, 0xa4, 0x5c, 0x94, 0xe2, 0x14, 0x27, 0xfd, 0x03, 0xd2, 0x6e, 0x3b, 0x0c, 0xd7, - 0xb1, 0x99, 0x80, 0xb8, 0x0a, 0x10, 0x55, 0x05, 0x88, 0x98, 0x9a, 0x60, 0x48, 0xf1, 0xd1, 0xbf, - 0x21, 0xad, 0x28, 0xc6, 0x51, 0x23, 0xa5, 0x1e, 0xd7, 0x00, 0x65, 0x53, 0x71, 0xfa, 0xa5, 0x97, - 0x65, 0x82, 0xaf, 0xfe, 0x1d, 0x69, 0x8b, 0x0e, 0xc3, 0xa3, 0x9d, 0xdc, 0xa3, 0x56, 0xc5, 0xb1, - 0x76, 0x6c, 0x1a, 0xe6, 0xe9, 0x3a, 0xb0, 0x6d, 0x29, 0x94, 0x29, 0x4d, 0x56, 0xc0, 0x4d, 0x72, - 0xae, 0xbe, 0x3c, 0x3a, 0x29, 0xa2, 0xe3, 0x93, 0x22, 0xfa, 0x7b, 0x52, 0x44, 0x5f, 0xfb, 0xc5, - 0xc2, 0x71, 0xbf, 0x58, 0xf8, 0xdd, 0x2f, 0x16, 0x9e, 0xd7, 0xda, 0x94, 0xef, 0x77, 0x5b, 0x25, - 0xcc, 0x0e, 0xca, 0x21, 0xd7, 0xaa, 0xec, 0x46, 0xba, 0x3a, 0x20, 0x5b, 0x15, 0x77, 0xd2, 0xb7, - 0x70, 0x2b, 0xe5, 0x3d, 0x97, 0xf8, 0xad, 0x19, 0xb8, 0x65, 0xde, 0xff, 0x1f, 0x00, 0x00, 0xff, - 0xff, 0x9a, 0x61, 0xbf, 0x46, 0x62, 0x10, 0x00, 0x00, + // 956 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0x4f, 0x6f, 0xe3, 0x44, + 0x18, 0xc6, 0x33, 0xec, 0xb2, 0xc0, 0x74, 0x81, 0x65, 0xf6, 0x5f, 0x55, 0x41, 0x76, 0xd9, 0x03, + 0xda, 0x4b, 0x13, 0x69, 0x39, 0x70, 0x41, 0x42, 0x49, 0x83, 0xba, 0xd9, 0x85, 0x10, 0x52, 0x5a, + 0x24, 0x84, 0xb0, 0x9c, 0xf1, 0x90, 0x0e, 0x76, 0x3d, 0xae, 0xed, 0x14, 0x82, 0x84, 0x04, 0x02, + 0x71, 0x46, 0x48, 0x48, 0x48, 0x9c, 0x90, 0xf8, 0x00, 0x7c, 0x8c, 0x9e, 0x50, 0x8f, 0x9c, 0x10, + 0x6a, 0xbe, 0xc8, 0x2a, 0xaf, 0xc7, 0x4d, 0x62, 0xcf, 0x38, 0xf5, 0xc4, 0xb7, 0x34, 0x8d, 0x9f, + 0xe7, 0xf7, 0xbe, 0xef, 0xf3, 0x8e, 0x6d, 0xfc, 0xee, 0xb7, 0x7c, 0x34, 0x64, 0xcc, 0xf6, 0x3c, + 0x6e, 0xfb, 0x94, 0x35, 0x1d, 0x1e, 0xc5, 0x21, 0x1f, 0x8e, 0x63, 0xe6, 0x50, 0x71, 0x14, 0x24, + 0xdf, 0x7a, 0xcc, 0x19, 0xb1, 0xb0, 0x19, 0xb8, 0xbc, 0x39, 0x62, 0x3e, 0x8b, 0x78, 0xd4, 0x08, + 0x42, 0x11, 0x0b, 0xd2, 0x58, 0xbe, 0xba, 0x51, 0x70, 0x75, 0x23, 0x70, 0xf9, 0xd6, 0x93, 0x92, + 0x6e, 0x76, 0x10, 0x84, 0xe2, 0x84, 0x39, 0x16, 0x65, 0x61, 0xcc, 0xbf, 0xe4, 0xd4, 0x8e, 0x99, + 0xf4, 0xde, 0xea, 0x96, 0xd4, 0x0a, 0x42, 0x11, 0x88, 0x68, 0x59, 0x4b, 0x4a, 0xed, 0x96, 0x94, + 0xa2, 0x87, 0xdc, 0x53, 0x32, 0x7d, 0x52, 0x01, 0x93, 0x15, 0xb2, 0x13, 0x41, 0xed, 0x98, 0x0b, + 0xdf, 0xb0, 0xd2, 0x99, 0x80, 0xab, 0x6e, 0x5a, 0xd9, 0x4a, 0xc7, 0x3e, 0x3f, 0x1e, 0x33, 0x45, + 0xcb, 0x3e, 0x32, 0x9d, 0x64, 0x28, 0x44, 0xac, 0x22, 0xeb, 0x19, 0x16, 0xa9, 0xd3, 0xdb, 0xaf, + 0x22, 0x6a, 0xd6, 0x70, 0x62, 0x45, 0xe3, 0xe1, 0x57, 0x8c, 0xc6, 0xc6, 0xb3, 0x98, 0x5d, 0xac, + 0x4c, 0xdd, 0x41, 0xd9, 0xb0, 0xb8, 0x7c, 0x21, 0x1b, 0xd6, 0xc5, 0xcf, 0x67, 0x7f, 0x04, 0x82, + 0xfb, 0x29, 0x62, 0x50, 0xb5, 0x2e, 0xb4, 0x81, 0x47, 0xd1, 0x98, 0x85, 0x69, 0x37, 0x2c, 0x97, + 0x4d, 0x2c, 0xee, 0x48, 0xc7, 0xcf, 0x2b, 0xee, 0xf5, 0xb2, 0x7a, 0xd9, 0x43, 0xc3, 0x17, 0x54, + 0x9b, 0x8a, 0xae, 0x81, 0x16, 0xa7, 0xb6, 0x4a, 0x6a, 0x60, 0x18, 0xd8, 0x22, 0xbc, 0x8f, 0xd7, + 0xd0, 0xd4, 0x60, 0xbe, 0x6f, 0x50, 0xb1, 0x42, 0xe6, 0xd3, 0x35, 0x65, 0xb4, 0xd3, 0xdd, 0xaf, + 0x40, 0xf8, 0x84, 0x3b, 0x96, 0xed, 0x3b, 0x56, 0xe4, 0x5e, 0xc8, 0xf6, 0xab, 0xe3, 0x35, 0x6c, + 0xa4, 0xed, 0x79, 0xaa, 0x46, 0xf6, 0xd7, 0x94, 0xc9, 0x83, 0xdd, 0x1a, 0x89, 0x91, 0x80, 0x8f, + 0xcd, 0xd9, 0xa7, 0xe4, 0xdb, 0x07, 0xff, 0x6c, 0xe1, 0xeb, 0xbb, 0xc9, 0xcd, 0x7a, 0x2f, 0xb6, + 0x63, 0x46, 0x7e, 0x46, 0x78, 0x33, 0x5d, 0xbc, 0x9d, 0x05, 0xc1, 0x0f, 0x78, 0x14, 0x6f, 0xa2, + 0xfb, 0x57, 0x1e, 0x6e, 0x3c, 0xea, 0x94, 0xbc, 0x9f, 0x37, 0x5a, 0x0a, 0xbd, 0xf6, 0xd5, 0xd3, + 0xff, 0xee, 0xd5, 0x06, 0x5a, 0x2f, 0xf2, 0x23, 0xc2, 0x77, 0xd3, 0x1b, 0xdf, 0xc2, 0x3f, 0x81, + 0xe3, 0x39, 0xe0, 0xd8, 0x29, 0xcb, 0xd1, 0xcf, 0xcb, 0x49, 0x0c, 0x9d, 0x13, 0xf9, 0x0e, 0xdf, + 0x86, 0xdb, 0x78, 0xae, 0x15, 0x57, 0x00, 0xa1, 0x55, 0x16, 0x61, 0x27, 0x2b, 0x26, 0x01, 0xd4, + 0x2e, 0xe4, 0x4f, 0x84, 0xdf, 0x54, 0xa0, 0x0d, 0x2e, 0xce, 0x61, 0x60, 0xb9, 0x0a, 0x2c, 0x1f, + 0x56, 0xd0, 0x8e, 0xb9, 0xb0, 0xe4, 0x5a, 0xed, 0x0e, 0x83, 0x92, 0x27, 0x4c, 0xae, 0x4b, 0xcf, + 0x9b, 0x0d, 0x6a, 0x90, 0x97, 0x4b, 0x07, 0xa5, 0x71, 0x9a, 0x0d, 0x2a, 0x79, 0x0a, 0xc9, 0x66, + 0xe5, 0x9a, 0xd9, 0xa0, 0xf6, 0xb3, 0x62, 0xe9, 0xa0, 0x94, 0x2e, 0xe4, 0xa7, 0x85, 0xb5, 0x19, + 0x08, 0x11, 0x2f, 0xf2, 0x6d, 0xbe, 0x70, 0x1f, 0x3d, 0xdc, 0x78, 0xf4, 0xd8, 0x74, 0x6d, 0xb2, + 0x7a, 0x03, 0xad, 0x13, 0xf9, 0x61, 0x3e, 0x8b, 0x1c, 0xc5, 0x8b, 0x40, 0xb1, 0x6b, 0x38, 0x8b, + 0x1c, 0x84, 0xce, 0x07, 0x32, 0xab, 0xda, 0xea, 0xf6, 0x64, 0x2f, 0x39, 0x90, 0x60, 0x2c, 0x2f, + 0x99, 0x65, 0xb6, 0x55, 0x24, 0x9c, 0x66, 0x76, 0xa5, 0xbb, 0xcc, 0x6c, 0xf2, 0xcc, 0x95, 0x0d, + 0x0c, 0x36, 0xcd, 0x6c, 0x4e, 0x6e, 0x9e, 0x59, 0xa5, 0x13, 0xf9, 0x0b, 0xe1, 0x07, 0x7d, 0x97, + 0xcf, 0xf7, 0xa9, 0xb3, 0xf0, 0x50, 0xd5, 0x9f, 0x3d, 0x53, 0x01, 0xd0, 0x06, 0x00, 0xf5, 0x4a, + 0xaf, 0x77, 0xa1, 0xb2, 0x64, 0xbb, 0x84, 0x3f, 0x99, 0x22, 0xfc, 0x4e, 0xf1, 0xcf, 0xa2, 0xf6, + 0xa4, 0x0b, 0x0f, 0x7e, 0xb2, 0xc7, 0x4f, 0xd9, 0xa4, 0xdb, 0x01, 0xf6, 0xeb, 0xc0, 0x4e, 0xab, + 0x65, 0x57, 0xda, 0xc9, 0x82, 0x4c, 0x49, 0xc9, 0xdf, 0x08, 0xbf, 0x55, 0x18, 0x9c, 0xd9, 0x4f, + 0x1d, 0x28, 0xea, 0x65, 0x28, 0x6a, 0x50, 0x69, 0x76, 0x41, 0x5d, 0xd6, 0x70, 0x49, 0x0e, 0x48, + 0xb1, 0x2f, 0x68, 0x76, 0x03, 0x81, 0xf1, 0x15, 0xb3, 0x14, 0xf7, 0xf2, 0x72, 0x69, 0x8a, 0x35, + 0x4e, 0xe4, 0x7b, 0x84, 0xef, 0xf8, 0x82, 0x76, 0xa9, 0x9d, 0x83, 0x78, 0x15, 0x20, 0xda, 0x06, + 0x10, 0x19, 0x35, 0xc9, 0xa0, 0xf1, 0x21, 0xbf, 0x23, 0x5c, 0x97, 0xc7, 0x51, 0x4f, 0xd3, 0x8f, + 0x1b, 0x80, 0xf2, 0xc4, 0xf0, 0xf4, 0xd3, 0xb7, 0x65, 0x85, 0x2f, 0xf9, 0x03, 0xe1, 0x7b, 0xbe, + 0xa0, 0xcb, 0x93, 0x3c, 0xe0, 0x4e, 0xcb, 0x77, 0xf6, 0x5c, 0x9e, 0xe4, 0xe9, 0x35, 0x60, 0x7b, + 0x6a, 0xd0, 0x26, 0x9d, 0xac, 0x84, 0x5b, 0xe5, 0x0c, 0x67, 0x75, 0x4e, 0x26, 0xb7, 0xc4, 0xc4, + 0xec, 0xac, 0x2e, 0x14, 0x4e, 0xcf, 0xea, 0x95, 0xee, 0xe4, 0x6b, 0x7c, 0x33, 0x53, 0x06, 0x40, + 0xdd, 0x04, 0xa8, 0xf7, 0xd6, 0x85, 0x4a, 0x30, 0x54, 0x0e, 0xe4, 0x57, 0x84, 0x5f, 0xf7, 0x35, + 0x78, 0x80, 0x70, 0x0b, 0x10, 0x1e, 0x57, 0xd5, 0x17, 0xc9, 0x52, 0xe8, 0x49, 0x8e, 0xf1, 0x0d, + 0x9a, 0x6d, 0xc5, 0x6d, 0xb3, 0x56, 0xb4, 0x3c, 0x4f, 0xd1, 0x8a, 0x9c, 0x3c, 0xf9, 0x0d, 0xe1, + 0x37, 0xe6, 0x29, 0x57, 0xed, 0xf9, 0x1d, 0x00, 0xe8, 0x9a, 0x2f, 0x97, 0x7a, 0xdd, 0x8b, 0x5d, + 0x61, 0x3e, 0x76, 0xa6, 0x86, 0xa5, 0xf9, 0xdc, 0x35, 0x9b, 0x4f, 0x4b, 0xa3, 0x99, 0xce, 0xa7, + 0xc8, 0xb3, 0xfd, 0xc5, 0xe9, 0x79, 0x1d, 0x9d, 0x9d, 0xd7, 0xd1, 0xff, 0xe7, 0x75, 0xf4, 0xcb, + 0xb4, 0x5e, 0x3b, 0x9b, 0xd6, 0x6b, 0xff, 0x4e, 0xeb, 0xb5, 0xcf, 0x3a, 0x23, 0x1e, 0x1f, 0x8e, + 0x87, 0x0d, 0x2a, 0x8e, 0x9a, 0x09, 0xd1, 0xb6, 0xea, 0xf5, 0x6e, 0x7b, 0xce, 0xb4, 0x2d, 0x5f, + 0xf0, 0xbe, 0x81, 0x57, 0xbc, 0x78, 0x12, 0xb0, 0x68, 0x78, 0x0d, 0xde, 0xdb, 0xde, 0x7e, 0x16, + 0x00, 0x00, 0xff, 0xff, 0x96, 0xaf, 0x2b, 0x83, 0x92, 0x15, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -279,6 +336,102 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AllCertificatesBySubjectList) > 0 { + for iNdEx := len(m.AllCertificatesBySubjectList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllCertificatesBySubjectList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xba + } + } + if len(m.RevokedNocIcaCertificatesList) > 0 { + for iNdEx := len(m.RevokedNocIcaCertificatesList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RevokedNocIcaCertificatesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 + } + } + if len(m.CertificatesList) > 0 { + for iNdEx := len(m.CertificatesList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CertificatesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa + } + } + if len(m.NocCertificatesBySubjectList) > 0 { + for iNdEx := len(m.NocCertificatesBySubjectList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocCertificatesBySubjectList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 + } + } + if len(m.NocCertificatesList) > 0 { + for iNdEx := len(m.NocCertificatesList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocCertificatesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } + } + if len(m.NocCertificatesBySubjectKeyIDList) > 0 { + for iNdEx := len(m.NocCertificatesBySubjectKeyIDList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocCertificatesBySubjectKeyIDList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + } if len(m.NocCertificatesByVidAndSkidList) > 0 { for iNdEx := len(m.NocCertificatesByVidAndSkidList) - 1; iNdEx >= 0; iNdEx-- { { @@ -635,6 +788,42 @@ func (m *GenesisState) Size() (n int) { n += 2 + l + sovGenesis(uint64(l)) } } + if len(m.NocCertificatesBySubjectKeyIDList) > 0 { + for _, e := range m.NocCertificatesBySubjectKeyIDList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } + if len(m.NocCertificatesList) > 0 { + for _, e := range m.NocCertificatesList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } + if len(m.NocCertificatesBySubjectList) > 0 { + for _, e := range m.NocCertificatesBySubjectList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } + if len(m.CertificatesList) > 0 { + for _, e := range m.CertificatesList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } + if len(m.RevokedNocIcaCertificatesList) > 0 { + for _, e := range m.RevokedNocIcaCertificatesList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } + if len(m.AllCertificatesBySubjectList) > 0 { + for _, e := range m.AllCertificatesBySubjectList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } return n } @@ -1255,6 +1444,210 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesBySubjectKeyIDList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NocCertificatesBySubjectKeyIDList = append(m.NocCertificatesBySubjectKeyIDList, NocCertificatesBySubjectKeyID{}) + if err := m.NocCertificatesBySubjectKeyIDList[len(m.NocCertificatesBySubjectKeyIDList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NocCertificatesList = append(m.NocCertificatesList, NocCertificates{}) + if err := m.NocCertificatesList[len(m.NocCertificatesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 20: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesBySubjectList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NocCertificatesBySubjectList = append(m.NocCertificatesBySubjectList, NocCertificatesBySubject{}) + if err := m.NocCertificatesBySubjectList[len(m.NocCertificatesBySubjectList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CertificatesList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CertificatesList = append(m.CertificatesList, AllCertificates{}) + if err := m.CertificatesList[len(m.CertificatesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocIcaCertificatesList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RevokedNocIcaCertificatesList = append(m.RevokedNocIcaCertificatesList, RevokedNocIcaCertificates{}) + if err := m.RevokedNocIcaCertificatesList[len(m.RevokedNocIcaCertificatesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllCertificatesBySubjectList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllCertificatesBySubjectList = append(m.AllCertificatesBySubjectList, AllCertificatesBySubject{}) + if err := m.AllCertificatesBySubjectList[len(m.AllCertificatesBySubjectList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/pki/types/genesis_test.go b/x/pki/types/genesis_test.go index ac59a8e3b..14804de12 100644 --- a/x/pki/types/genesis_test.go +++ b/x/pki/types/genesis_test.go @@ -25,21 +25,21 @@ func TestGenesisState_Validate(t *testing.T) { ApprovedCertificatesList: []types.ApprovedCertificates{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "1", - SubjectKeyId: "1", + SubjectKeyID: "1", }, }, ProposedCertificateList: []types.ProposedCertificate{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "1", - SubjectKeyId: "1", + SubjectKeyID: "1", }, }, ChildCertificatesList: []types.ChildCertificates{ @@ -55,21 +55,21 @@ func TestGenesisState_Validate(t *testing.T) { ProposedCertificateRevocationList: []types.ProposedCertificateRevocation{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "1", - SubjectKeyId: "1", + SubjectKeyID: "1", }, }, RevokedCertificatesList: []types.RevokedCertificates{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "1", - SubjectKeyId: "1", + SubjectKeyID: "1", }, }, UniqueCertificateList: []types.UniqueCertificate{ @@ -99,11 +99,11 @@ func TestGenesisState_Validate(t *testing.T) { RejectedCertificateList: []types.RejectedCertificate{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "1", - SubjectKeyId: "1", + SubjectKeyID: "1", }, }, PKIRevocationDistributionPointList: []types.PKIRevocationDistributionPoint{ @@ -145,21 +145,77 @@ NocCertificatesList: []types.NocCertificates{ RevokedNocRootCertificatesList: []types.RevokedNocRootCertificates{ { Subject: "0", -SubjectKeyId: "0", +SubjectKeyID: "0", }, { Subject: "1", -SubjectKeyId: "1", +SubjectKeyID: "1", }, }, NocCertificatesByVidAndSkidList: []types.NocCertificatesByVidAndSkid{ { Vid: 0, -SubjectKeyId: "0", +SubjectKeyID: "0", }, { Vid: 1, -SubjectKeyId: "1", +SubjectKeyID: "1", +}, +}, +NocCertificatesBySubjectKeyIDList: []types.NocCertificatesBySubjectKeyID{ + { + Vid: 0, +SubjectKeyID: "0", +}, + { + Vid: 1, +SubjectKeyID: "1", +}, +}, +NocCertificatesList: []types.NocCertificates{ + { + Subject: "0", +SubjectKeyID: "0", +}, + { + Subject: "1", +SubjectKeyID: "1", +}, +}, +NocCertificatesBySubjectList: []types.NocCertificatesBySubject{ + { + Subject: "0", +}, + { + Subject: "1", +}, +}, +CertificatesList: []types.AllCertificates{ + { + Subject: "0", +SubjectKeyID: "0", +}, + { + Subject: "1", +SubjectKeyID: "1", +}, +}, +RevokedNocIcaCertificatesList: []types.RevokedNocIcaCertificates{ + { + Subject: "0", +SubjectKeyID: "0", +}, + { + Subject: "1", +SubjectKeyID: "1", +}, +}, +AllCertificatesBySubjectList: []types.AllCertificatesBySubject{ + { + Subject: "0", +}, + { + Subject: "1", }, }, // this line is used by starport scaffolding # types/genesis/validField @@ -172,11 +228,11 @@ SubjectKeyId: "1", ApprovedCertificatesList: []types.ApprovedCertificates{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, }, }, @@ -188,11 +244,11 @@ SubjectKeyId: "1", ProposedCertificateList: []types.ProposedCertificate{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, }, }, @@ -220,11 +276,11 @@ SubjectKeyId: "1", ProposedCertificateRevocationList: []types.ProposedCertificateRevocation{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, }, }, @@ -236,11 +292,11 @@ SubjectKeyId: "1", RevokedCertificatesList: []types.RevokedCertificates{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, }, }, @@ -282,11 +338,11 @@ SubjectKeyId: "1", RejectedCertificateList: []types.RejectedCertificate{ { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, { Subject: "0", - SubjectKeyId: "0", + SubjectKeyID: "0", }, }, }, @@ -358,11 +414,11 @@ IssuerSubjectKeyID: "0", RevokedNocRootCertificatesList: []types.RevokedNocRootCertificates{ { Subject: "0", -SubjectKeyId: "0", +SubjectKeyID: "0", }, { Subject: "0", -SubjectKeyId: "0", +SubjectKeyID: "0", }, }, }, @@ -374,11 +430,103 @@ SubjectKeyId: "0", NocCertificatesByVidAndSkidList: []types.NocCertificatesByVidAndSkid{ { Vid: 0, -SubjectKeyId: "0", +SubjectKeyID: "0", }, { Vid: 0, -SubjectKeyId: "0", +SubjectKeyID: "0", +}, + }, + }, + valid: false, +}, +{ + desc: "duplicated nocCertificatesBySubjectKeyId", + genState: &types.GenesisState{ + NocCertificatesBySubjectKeyIDList: []types.NocCertificatesBySubjectKeyID{ + { + Vid: 0, +SubjectKeyID: "0", +}, + { + Vid: 0, +SubjectKeyID: "0", +}, + }, + }, + valid: false, +}, +{ + desc: "duplicated nocCertificates", + genState: &types.GenesisState{ + NocCertificatesList: []types.NocCertificates{ + { + Subject: "0", +SubjectKeyID: "0", +}, + { + Subject: "0", +SubjectKeyID: "0", +}, + }, + }, + valid: false, +}, +{ + desc: "duplicated nocCertificatesBySubject", + genState: &types.GenesisState{ + NocCertificatesBySubjectList: []types.NocCertificatesBySubject{ + { + Subject: "0", +}, + { + Subject: "0", +}, + }, + }, + valid: false, +}, +{ + desc: "duplicated certificates", + genState: &types.GenesisState{ + CertificatesList: []types.AllCertificates{ + { + Subject: "0", +SubjectKeyID: "0", +}, + { + Subject: "0", +SubjectKeyID: "0", +}, + }, + }, + valid: false, +}, +{ + desc: "duplicated revokedNocIcaCertificates", + genState: &types.GenesisState{ + RevokedNocIcaCertificatesList: []types.RevokedNocIcaCertificates{ + { + Subject: "0", +SubjectKeyID: "0", +}, + { + Subject: "0", +SubjectKeyID: "0", +}, + }, + }, + valid: false, +}, +{ + desc: "duplicated allCertificatesBySubject", + genState: &types.GenesisState{ + AllCertificatesBySubjectList: []types.AllCertificatesBySubject{ + { + Subject: "0", +}, + { + Subject: "0", }, }, }, diff --git a/x/pki/types/key_all_certificates.go b/x/pki/types/key_all_certificates.go new file mode 100644 index 000000000..1f750b70b --- /dev/null +++ b/x/pki/types/key_all_certificates.go @@ -0,0 +1,28 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // AllCertificatesKeyPrefix is the prefix to retrieve all Certificates + AllCertificatesKeyPrefix = "AllCertificates/value/" +) + +// AllCertificatesKey returns the store key to retrieve a Certificates from the index fields +func AllCertificatesKey( + subject string, + subjectKeyID string, +) []byte { + var key []byte + + subjectBytes := []byte(subject) + key = append(key, subjectBytes...) + key = append(key, []byte("/")...) + + subjectKeyIDBytes := []byte(subjectKeyID) + key = append(key, subjectKeyIDBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/key_all_certificates_by_subject.go b/x/pki/types/key_all_certificates_by_subject.go new file mode 100644 index 000000000..9fc4b8bef --- /dev/null +++ b/x/pki/types/key_all_certificates_by_subject.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // AllCertificatesBySubjectKeyPrefix is the prefix to retrieve all AllCertificatesBySubject + AllCertificatesBySubjectKeyPrefix = "AllCertificatesBySubject/value/" +) + +// AllCertificatesBySubjectKey returns the store key to retrieve a AllCertificatesBySubject from the index fields +func AllCertificatesBySubjectKey( + subject string, +) []byte { + var key []byte + + subjectBytes := []byte(subject) + key = append(key, subjectBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/key_noc_certificates.go b/x/pki/types/key_noc_certificates.go new file mode 100644 index 000000000..182ea86b9 --- /dev/null +++ b/x/pki/types/key_noc_certificates.go @@ -0,0 +1,28 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // NocCertificatesKeyPrefix is the prefix to retrieve all NocCertificates + NocCertificatesKeyPrefix = "NocCertificates/value/" +) + +// NocCertificatesKey returns the store key to retrieve a NocCertificates from the index fields +func NocCertificatesKey( + subject string, + subjectKeyID string, +) []byte { + var key []byte + + subjectBytes := []byte(subject) + key = append(key, subjectBytes...) + key = append(key, []byte("/")...) + + subjectKeyIDBytes := []byte(subjectKeyID) + key = append(key, subjectKeyIDBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/key_noc_certificates_by_subject.go b/x/pki/types/key_noc_certificates_by_subject.go new file mode 100644 index 000000000..816fa567a --- /dev/null +++ b/x/pki/types/key_noc_certificates_by_subject.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // NocCertificatesBySubjectKeyPrefix is the prefix to retrieve all NocCertificatesBySubject + NocCertificatesBySubjectKeyPrefix = "NocCertificatesBySubject/value/" +) + +// NocCertificatesBySubjectKey returns the store key to retrieve a NocCertificatesBySubject from the index fields +func NocCertificatesBySubjectKey( + subject string, +) []byte { + var key []byte + + subjectBytes := []byte(subject) + key = append(key, subjectBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/key_noc_certificates_by_subject_key_id.go b/x/pki/types/key_noc_certificates_by_subject_key_id.go new file mode 100644 index 000000000..34f9edcae --- /dev/null +++ b/x/pki/types/key_noc_certificates_by_subject_key_id.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // NocCertificatesBySubjectKeyIDKeyPrefix is the prefix to retrieve all NocCertificatesBySubjectKeyID + NocCertificatesBySubjectKeyIDKeyPrefix = "NocCertificatesBySubjectKeyID/value/" +) + +// NocCertificatesBySubjectKeyIDKey returns the store key to retrieve a NocCertificatesBySubjectKeyID from the index fields +func NocCertificatesBySubjectKeyIDKey( + subjectKeyID string, +) []byte { + var key []byte + + subjectKeyIDBytes := []byte(subjectKeyID) + key = append(key, subjectKeyIDBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/key_revoked_noc_ica_certificates.go b/x/pki/types/key_revoked_noc_ica_certificates.go new file mode 100644 index 000000000..d6ef6c86d --- /dev/null +++ b/x/pki/types/key_revoked_noc_ica_certificates.go @@ -0,0 +1,28 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // RevokedNocIcaCertificatesKeyPrefix is the prefix to retrieve all RevokedNocIcaCertificates + RevokedNocIcaCertificatesKeyPrefix = "RevokedNocIcaCertificates/value/" +) + +// RevokedNocIcaCertificatesKey returns the store key to retrieve a RevokedNocIcaCertificates from the index fields +func RevokedNocIcaCertificatesKey( + subject string, + subjectKeyID string, +) []byte { + var key []byte + + subjectBytes := []byte(subject) + key = append(key, subjectBytes...) + key = append(key, []byte("/")...) + + subjectKeyIDBytes := []byte(subjectKeyID) + key = append(key, subjectKeyIDBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/message_approve_add_x_509_root_cert_test.go b/x/pki/types/message_approve_add_x_509_root_cert_test.go index 18cdff2fc..504c2ba90 100644 --- a/x/pki/types/message_approve_add_x_509_root_cert_test.go +++ b/x/pki/types/message_approve_add_x_509_root_cert_test.go @@ -36,7 +36,7 @@ func TestMsgApproveAddX509RootCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgApproveAddX509RootCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_approve_revoke_x_509_root_cert_test.go b/x/pki/types/message_approve_revoke_x_509_root_cert_test.go index d6a5cbee5..36c31931b 100644 --- a/x/pki/types/message_approve_revoke_x_509_root_cert_test.go +++ b/x/pki/types/message_approve_revoke_x_509_root_cert_test.go @@ -36,7 +36,7 @@ func TestMsgApproveRevokeX509RootCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgApproveRevokeX509RootCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_assign_vid_test.go b/x/pki/types/message_assign_vid_test.go index b9d0b85e9..d7d82acec 100644 --- a/x/pki/types/message_assign_vid_test.go +++ b/x/pki/types/message_assign_vid_test.go @@ -35,7 +35,7 @@ func TestMsgAssignVid_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgAssignVid{ Signer: sample.AccAddress(), Subject: testconstants.PAACertWithNumericVidSubject, diff --git a/x/pki/types/message_propose_revoke_x_509_root_cert_test.go b/x/pki/types/message_propose_revoke_x_509_root_cert_test.go index 64f1c2ee8..e92c9d8d5 100644 --- a/x/pki/types/message_propose_revoke_x_509_root_cert_test.go +++ b/x/pki/types/message_propose_revoke_x_509_root_cert_test.go @@ -36,7 +36,7 @@ func TestMsgProposeRevokeX509RootCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgProposeRevokeX509RootCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_reject_add_x_509_root_cert_test.go b/x/pki/types/message_reject_add_x_509_root_cert_test.go index 24d08854e..4b5c22531 100644 --- a/x/pki/types/message_reject_add_x_509_root_cert_test.go +++ b/x/pki/types/message_reject_add_x_509_root_cert_test.go @@ -37,7 +37,7 @@ func TestMsgRejectAddX509RootCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRejectAddX509RootCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_remove_noc_x_509_ica_cert_test.go b/x/pki/types/message_remove_noc_x_509_ica_cert_test.go index 5f8579dff..a4d1035b6 100644 --- a/x/pki/types/message_remove_noc_x_509_ica_cert_test.go +++ b/x/pki/types/message_remove_noc_x_509_ica_cert_test.go @@ -37,7 +37,7 @@ func TestMsgRemoveNocX509IcaCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRemoveNocX509IcaCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_remove_noc_x_509_root_cert_test.go b/x/pki/types/message_remove_noc_x_509_root_cert_test.go index 13578eba6..22ebd2116 100644 --- a/x/pki/types/message_remove_noc_x_509_root_cert_test.go +++ b/x/pki/types/message_remove_noc_x_509_root_cert_test.go @@ -37,7 +37,7 @@ func TestMsgRemoveNocX509RootCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRemoveNocX509RootCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_remove_x_509_cert_test.go b/x/pki/types/message_remove_x_509_cert_test.go index 7c9835f1a..47dc0d2fe 100644 --- a/x/pki/types/message_remove_x_509_cert_test.go +++ b/x/pki/types/message_remove_x_509_cert_test.go @@ -37,7 +37,7 @@ func TestMsgRemoveX509Cert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRemoveX509Cert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_revoke_noc_x_509_ica_cert_test.go b/x/pki/types/message_revoke_noc_x_509_ica_cert_test.go index fd9685f29..7739e27e1 100644 --- a/x/pki/types/message_revoke_noc_x_509_ica_cert_test.go +++ b/x/pki/types/message_revoke_noc_x_509_ica_cert_test.go @@ -35,7 +35,7 @@ func TestMsgRevokeNocX509IcaCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRevokeNocX509IcaCert{ Signer: sample.AccAddress(), Subject: testconstants.NocCert1Subject, diff --git a/x/pki/types/message_revoke_noc_x_509_root_cert_test.go b/x/pki/types/message_revoke_noc_x_509_root_cert_test.go index 6596068c0..7a93feb76 100644 --- a/x/pki/types/message_revoke_noc_x_509_root_cert_test.go +++ b/x/pki/types/message_revoke_noc_x_509_root_cert_test.go @@ -35,7 +35,7 @@ func TestMsgRevokeNocX509RootCert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRevokeNocX509RootCert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/message_revoke_x_509_cert_test.go b/x/pki/types/message_revoke_x_509_cert_test.go index 447ac1454..08656268b 100644 --- a/x/pki/types/message_revoke_x_509_cert_test.go +++ b/x/pki/types/message_revoke_x_509_cert_test.go @@ -36,7 +36,7 @@ func TestMsgRevokeX509Cert_ValidateBasic(t *testing.T) { err: validator.ErrRequiredFieldMissing, }, { - name: "empty SubjectKeyId", + name: "empty SubjectKeyID", msg: MsgRevokeX509Cert{ Signer: sample.AccAddress(), Subject: testconstants.RootSubject, diff --git a/x/pki/types/noc_certificates.pb.go b/x/pki/types/noc_certificates.pb.go new file mode 100644 index 000000000..9320a687f --- /dev/null +++ b/x/pki/types/noc_certificates.pb.go @@ -0,0 +1,502 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto + +package types + +import ( + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NocCertificates struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` + Certs []*Certificate `protobuf:"bytes,3,rep,name=certs,proto3" json:"certs,omitempty"` + Tq float32 `protobuf:"fixed32,4,opt,name=tq,proto3" json:"tq,omitempty"` + SchemaVersion uint32 `protobuf:"varint,5,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` +} + +func (m *NocCertificates) Reset() { *m = NocCertificates{} } +func (m *NocCertificates) String() string { return proto.CompactTextString(m) } +func (*NocCertificates) ProtoMessage() {} +func (*NocCertificates) Descriptor() ([]byte, []int) { + return fileDescriptor_6896cb7aed24b3d0, []int{0} +} +func (m *NocCertificates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NocCertificates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NocCertificates.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NocCertificates) XXX_Merge(src proto.Message) { + xxx_messageInfo_NocCertificates.Merge(m, src) +} +func (m *NocCertificates) XXX_Size() int { + return m.Size() +} +func (m *NocCertificates) XXX_DiscardUnknown() { + xxx_messageInfo_NocCertificates.DiscardUnknown(m) +} + +var xxx_messageInfo_NocCertificates proto.InternalMessageInfo + +func (m *NocCertificates) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *NocCertificates) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +func (m *NocCertificates) GetCerts() []*Certificate { + if m != nil { + return m.Certs + } + return nil +} + +func (m *NocCertificates) GetTq() float32 { + if m != nil { + return m.Tq + } + return 0 +} + +func (m *NocCertificates) GetSchemaVersion() uint32 { + if m != nil { + return m.SchemaVersion + } + return 0 +} + +func init() { + proto.RegisterType((*NocCertificates)(nil), "zigbeealliance.distributedcomplianceledger.pki.NocCertificates") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/noc_certificates.proto", fileDescriptor_6896cb7aed24b3d0) +} + +var fileDescriptor_6896cb7aed24b3d0 = []byte{ + // 292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0xad, 0xca, 0x4c, 0x4f, + 0x4a, 0x4d, 0x4d, 0xcc, 0xc9, 0xc9, 0x4c, 0xcc, 0x4b, 0x4e, 0xd5, 0x4f, 0xc9, 0x2c, 0x2e, 0x29, + 0xca, 0x4c, 0x2a, 0x2d, 0x49, 0x4d, 0x49, 0xce, 0xcf, 0x2d, 0x80, 0x88, 0xe6, 0xa4, 0xa6, 0xa4, + 0xa7, 0x16, 0xe9, 0x17, 0x64, 0x67, 0xea, 0xe7, 0xe5, 0x27, 0xc7, 0x27, 0xa7, 0x16, 0x95, 0x64, + 0xa6, 0x65, 0x26, 0x27, 0x96, 0xa4, 0x16, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xe9, 0xa1, + 0x1a, 0xa3, 0x87, 0xc7, 0x18, 0xbd, 0x82, 0xec, 0x4c, 0x29, 0x07, 0x12, 0xad, 0x45, 0xb2, 0x12, + 0x62, 0xa3, 0xd2, 0x0d, 0x46, 0x2e, 0x7e, 0xbf, 0xfc, 0x64, 0x67, 0x24, 0xb7, 0x08, 0x49, 0x70, + 0xb1, 0x17, 0x97, 0x26, 0x65, 0xa5, 0x26, 0x97, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xc1, + 0xb8, 0x42, 0x4a, 0x5c, 0x3c, 0x50, 0xa6, 0x77, 0x6a, 0xa5, 0x67, 0x8a, 0x04, 0x13, 0x58, 0x1a, + 0x45, 0x4c, 0x28, 0x90, 0x8b, 0x15, 0x64, 0x4d, 0xb1, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, + 0x35, 0x89, 0x7e, 0xd2, 0x43, 0x72, 0x4a, 0x10, 0xc4, 0x24, 0x21, 0x3e, 0x2e, 0xa6, 0x92, 0x42, + 0x09, 0x16, 0x05, 0x46, 0x0d, 0xa6, 0x20, 0xa6, 0x92, 0x42, 0x21, 0x15, 0x2e, 0xde, 0xe2, 0xe4, + 0x8c, 0xd4, 0xdc, 0xc4, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x56, 0x05, 0x46, 0x0d, + 0xde, 0x20, 0x54, 0x41, 0xa7, 0xb8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, + 0x72, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0xb8, 0x4e, 0x17, + 0x5b, 0x10, 0xea, 0x22, 0xdc, 0xa7, 0x0b, 0x0d, 0xc4, 0x0a, 0x70, 0x30, 0x96, 0x54, 0x16, 0xa4, + 0x16, 0x27, 0xb1, 0x81, 0x43, 0xd0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x12, 0xf1, 0x39, 0x8d, + 0xfc, 0x01, 0x00, 0x00, +} + +func (m *NocCertificates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NocCertificates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NocCertificates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SchemaVersion != 0 { + i = encodeVarintNocCertificates(dAtA, i, uint64(m.SchemaVersion)) + i-- + dAtA[i] = 0x28 + } + if m.Tq != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Tq)))) + i-- + dAtA[i] = 0x25 + } + if len(m.Certs) > 0 { + for iNdEx := len(m.Certs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNocCertificates(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintNocCertificates(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintNocCertificates(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintNocCertificates(dAtA []byte, offset int, v uint64) int { + offset -= sovNocCertificates(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NocCertificates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovNocCertificates(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovNocCertificates(uint64(l)) + } + if len(m.Certs) > 0 { + for _, e := range m.Certs { + l = e.Size() + n += 1 + l + sovNocCertificates(uint64(l)) + } + } + if m.Tq != 0 { + n += 5 + } + if m.SchemaVersion != 0 { + n += 1 + sovNocCertificates(uint64(m.SchemaVersion)) + } + return n +} + +func sovNocCertificates(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNocCertificates(x uint64) (n int) { + return sovNocCertificates(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NocCertificates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NocCertificates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NocCertificates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNocCertificates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNocCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNocCertificates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNocCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNocCertificates + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNocCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certs = append(m.Certs, &Certificate{}) + if err := m.Certs[len(m.Certs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Tq", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Tq = float32(math.Float32frombits(v)) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) + } + m.SchemaVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNocCertificates(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNocCertificates + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNocCertificates(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNocCertificates + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNocCertificates + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNocCertificates + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNocCertificates = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNocCertificates = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNocCertificates = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/noc_certificates_by_subject.pb.go b/x/pki/types/noc_certificates_by_subject.pb.go new file mode 100644 index 000000000..9fde9e804 --- /dev/null +++ b/x/pki/types/noc_certificates_by_subject.pb.go @@ -0,0 +1,412 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NocCertificatesBySubject struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyIds []string `protobuf:"bytes,2,rep,name=subjectKeyIds,proto3" json:"subjectKeyIds,omitempty"` + SchemaVersion uint32 `protobuf:"varint,3,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` +} + +func (m *NocCertificatesBySubject) Reset() { *m = NocCertificatesBySubject{} } +func (m *NocCertificatesBySubject) String() string { return proto.CompactTextString(m) } +func (*NocCertificatesBySubject) ProtoMessage() {} +func (*NocCertificatesBySubject) Descriptor() ([]byte, []int) { + return fileDescriptor_2078106889495039, []int{0} +} +func (m *NocCertificatesBySubject) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NocCertificatesBySubject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NocCertificatesBySubject.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NocCertificatesBySubject) XXX_Merge(src proto.Message) { + xxx_messageInfo_NocCertificatesBySubject.Merge(m, src) +} +func (m *NocCertificatesBySubject) XXX_Size() int { + return m.Size() +} +func (m *NocCertificatesBySubject) XXX_DiscardUnknown() { + xxx_messageInfo_NocCertificatesBySubject.DiscardUnknown(m) +} + +var xxx_messageInfo_NocCertificatesBySubject proto.InternalMessageInfo + +func (m *NocCertificatesBySubject) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *NocCertificatesBySubject) GetSubjectKeyIds() []string { + if m != nil { + return m.SubjectKeyIds + } + return nil +} + +func (m *NocCertificatesBySubject) GetSchemaVersion() uint32 { + if m != nil { + return m.SchemaVersion + } + return 0 +} + +func init() { + proto.RegisterType((*NocCertificatesBySubject)(nil), "zigbeealliance.distributedcomplianceledger.pki.NocCertificatesBySubject") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject.proto", fileDescriptor_2078106889495039) +} + +var fileDescriptor_2078106889495039 = []byte{ + // 255 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x0a, 0xa8, 0xca, 0x4c, 0x4f, + 0x4a, 0x4d, 0x4d, 0xcc, 0xc9, 0xc9, 0x4c, 0xcc, 0x4b, 0x4e, 0xd5, 0x4f, 0xc9, 0x2c, 0x2e, 0x29, + 0xca, 0x4c, 0x2a, 0x2d, 0x49, 0x4d, 0x49, 0xce, 0xcf, 0x2d, 0x80, 0x88, 0xe6, 0xa4, 0xa6, 0xa4, + 0xa7, 0x16, 0xe9, 0x17, 0x64, 0x67, 0xea, 0xe7, 0xe5, 0x27, 0xc7, 0x27, 0xa7, 0x16, 0x95, 0x64, + 0xa6, 0x65, 0x26, 0x27, 0x96, 0xa4, 0x16, 0xc7, 0x27, 0x55, 0xc6, 0x17, 0x97, 0x26, 0x65, 0xa5, + 0x26, 0x97, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xe9, 0xa1, 0x9a, 0xa8, 0x87, 0xc7, 0x44, + 0xbd, 0x82, 0xec, 0x4c, 0xa5, 0x06, 0x46, 0x2e, 0x09, 0xbf, 0xfc, 0x64, 0x67, 0x24, 0x43, 0x9d, + 0x2a, 0x83, 0x21, 0x46, 0x0a, 0x49, 0x70, 0xb1, 0x43, 0x4d, 0x97, 0x60, 0x54, 0x60, 0xd4, 0xe0, + 0x0c, 0x82, 0x71, 0x85, 0x54, 0xb8, 0x78, 0xa1, 0x4c, 0xef, 0xd4, 0x4a, 0xcf, 0x94, 0x62, 0x09, + 0x26, 0x05, 0x66, 0x0d, 0xce, 0x20, 0x54, 0x41, 0xb0, 0xaa, 0xe4, 0x8c, 0xd4, 0xdc, 0xc4, 0xb0, + 0xd4, 0xa2, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x66, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x54, 0x41, 0xa7, + 0xb8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, + 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x72, 0x49, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0xf8, 0x4b, 0x17, 0x5b, 0x50, 0xe9, 0x22, 0x7c, + 0xa6, 0x0b, 0x0d, 0xac, 0x0a, 0x70, 0x70, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, + 0xc6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x50, 0x20, 0xc6, 0x6d, 0x01, 0x00, 0x00, +} + +func (m *NocCertificatesBySubject) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NocCertificatesBySubject) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NocCertificatesBySubject) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SchemaVersion != 0 { + i = encodeVarintNocCertificatesBySubject(dAtA, i, uint64(m.SchemaVersion)) + i-- + dAtA[i] = 0x18 + } + if len(m.SubjectKeyIds) > 0 { + for iNdEx := len(m.SubjectKeyIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SubjectKeyIds[iNdEx]) + copy(dAtA[i:], m.SubjectKeyIds[iNdEx]) + i = encodeVarintNocCertificatesBySubject(dAtA, i, uint64(len(m.SubjectKeyIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintNocCertificatesBySubject(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintNocCertificatesBySubject(dAtA []byte, offset int, v uint64) int { + offset -= sovNocCertificatesBySubject(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NocCertificatesBySubject) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovNocCertificatesBySubject(uint64(l)) + } + if len(m.SubjectKeyIds) > 0 { + for _, s := range m.SubjectKeyIds { + l = len(s) + n += 1 + l + sovNocCertificatesBySubject(uint64(l)) + } + } + if m.SchemaVersion != 0 { + n += 1 + sovNocCertificatesBySubject(uint64(m.SchemaVersion)) + } + return n +} + +func sovNocCertificatesBySubject(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNocCertificatesBySubject(x uint64) (n int) { + return sovNocCertificatesBySubject(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NocCertificatesBySubject) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NocCertificatesBySubject: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NocCertificatesBySubject: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNocCertificatesBySubject + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNocCertificatesBySubject + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNocCertificatesBySubject + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNocCertificatesBySubject + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyIds = append(m.SubjectKeyIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) + } + m.SchemaVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNocCertificatesBySubject(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNocCertificatesBySubject + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNocCertificatesBySubject(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificatesBySubject + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNocCertificatesBySubject + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNocCertificatesBySubject + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNocCertificatesBySubject + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNocCertificatesBySubject = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNocCertificatesBySubject = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNocCertificatesBySubject = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/noc_certificates_by_subject_key_id.pb.go b/x/pki/types/noc_certificates_by_subject_key_id.pb.go new file mode 100644 index 000000000..fa8059184 --- /dev/null +++ b/x/pki/types/noc_certificates_by_subject_key_id.pb.go @@ -0,0 +1,451 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.proto + +package types + +import ( + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NocCertificatesBySubjectKeyID struct { + SubjectKeyId string `protobuf:"bytes,1,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` + Certs []*Certificate `protobuf:"bytes,2,rep,name=certs,proto3" json:"certs,omitempty"` + Tq float32 `protobuf:"fixed32,3,opt,name=tq,proto3" json:"tq,omitempty"` + SchemaVersion uint32 `protobuf:"varint,4,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` +} + +func (m *NocCertificatesBySubjectKeyID) Reset() { *m = NocCertificatesBySubjectKeyID{} } +func (m *NocCertificatesBySubjectKeyID) String() string { return proto.CompactTextString(m) } +func (*NocCertificatesBySubjectKeyID) ProtoMessage() {} +func (*NocCertificatesBySubjectKeyID) Descriptor() ([]byte, []int) { + return fileDescriptor_ddfbe52eed1184ea, []int{0} +} +func (m *NocCertificatesBySubjectKeyID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NocCertificatesBySubjectKeyID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NocCertificatesBySubjectKeyID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NocCertificatesBySubjectKeyID) XXX_Merge(src proto.Message) { + xxx_messageInfo_NocCertificatesBySubjectKeyID.Merge(m, src) +} +func (m *NocCertificatesBySubjectKeyID) XXX_Size() int { + return m.Size() +} +func (m *NocCertificatesBySubjectKeyID) XXX_DiscardUnknown() { + xxx_messageInfo_NocCertificatesBySubjectKeyID.DiscardUnknown(m) +} + +var xxx_messageInfo_NocCertificatesBySubjectKeyID proto.InternalMessageInfo + +func (m *NocCertificatesBySubjectKeyID) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +func (m *NocCertificatesBySubjectKeyID) GetCerts() []*Certificate { + if m != nil { + return m.Certs + } + return nil +} + +func (m *NocCertificatesBySubjectKeyID) GetTq() float32 { + if m != nil { + return m.Tq + } + return 0 +} + +func (m *NocCertificatesBySubjectKeyID) GetSchemaVersion() uint32 { + if m != nil { + return m.SchemaVersion + } + return 0 +} + +func init() { + proto.RegisterType((*NocCertificatesBySubjectKeyID)(nil), "zigbeealliance.distributedcomplianceledger.pki.NocCertificatesBySubjectKeyID") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/noc_certificates_by_subject_key_id.proto", fileDescriptor_ddfbe52eed1184ea) +} + +var fileDescriptor_ddfbe52eed1184ea = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0x3f, 0x4b, 0xc3, 0x40, + 0x18, 0x87, 0x7b, 0xa9, 0x0a, 0x9e, 0xd6, 0x21, 0x53, 0x10, 0x3c, 0x42, 0x71, 0xc8, 0xd2, 0x0b, + 0xe8, 0xe8, 0x22, 0xb5, 0x8b, 0x08, 0x82, 0x11, 0x14, 0x1c, 0x0c, 0xb9, 0xcb, 0x6b, 0x7a, 0xe6, + 0xcf, 0xa5, 0xb9, 0x0b, 0x18, 0x3f, 0x85, 0x1f, 0xcb, 0xc1, 0xa1, 0xa3, 0xa3, 0x24, 0x5f, 0x44, + 0x6c, 0x84, 0x26, 0x20, 0x42, 0xc7, 0xfb, 0x0d, 0xcf, 0xfb, 0xdc, 0x83, 0xef, 0x5f, 0x45, 0xc4, + 0x00, 0x82, 0x24, 0x11, 0x41, 0xc6, 0xc1, 0x0d, 0x85, 0xd2, 0x85, 0x60, 0xa5, 0x86, 0x90, 0xcb, + 0x34, 0x6f, 0xd7, 0x04, 0xc2, 0x08, 0x0a, 0x37, 0x8f, 0x85, 0x9b, 0x49, 0xee, 0x73, 0x28, 0xb4, + 0x78, 0x12, 0x3c, 0xd0, 0xa0, 0x7c, 0x56, 0xf9, 0xaa, 0x64, 0xcf, 0xc0, 0xb5, 0x1f, 0x43, 0xe5, + 0x8b, 0x90, 0xe6, 0x85, 0xd4, 0xd2, 0xa4, 0x7d, 0x30, 0xfd, 0x07, 0x4c, 0xf3, 0x58, 0x1c, 0x9e, + 0x6f, 0x28, 0xd2, 0x91, 0x68, 0x2f, 0x8e, 0x3f, 0x10, 0x3e, 0xba, 0x96, 0xfc, 0xa2, 0x63, 0x37, + 0xad, 0x6e, 0x5b, 0xb7, 0x2b, 0xa8, 0x2e, 0x67, 0xe6, 0x18, 0xef, 0xab, 0xf5, 0x3b, 0xb4, 0x90, + 0x8d, 0x9c, 0x5d, 0xaf, 0xb7, 0x99, 0x37, 0x78, 0xfb, 0x07, 0xad, 0x2c, 0xc3, 0x1e, 0x3a, 0x7b, + 0x27, 0x67, 0x1b, 0xfe, 0x83, 0x76, 0xce, 0x7b, 0x2d, 0xc9, 0x3c, 0xc0, 0x86, 0x5e, 0x58, 0x43, + 0x1b, 0x39, 0x86, 0x67, 0xe8, 0x85, 0x79, 0x8c, 0x47, 0x8a, 0xcf, 0x21, 0x0d, 0xee, 0xa0, 0x50, + 0x42, 0x66, 0xd6, 0x96, 0x8d, 0x9c, 0x91, 0xd7, 0x1f, 0xa7, 0x8f, 0xef, 0x35, 0x41, 0xcb, 0x9a, + 0xa0, 0xaf, 0x9a, 0xa0, 0xb7, 0x86, 0x0c, 0x96, 0x0d, 0x19, 0x7c, 0x36, 0x64, 0xf0, 0x30, 0x8b, + 0x84, 0x9e, 0x97, 0x8c, 0x72, 0x99, 0xba, 0xad, 0xdd, 0xe4, 0xaf, 0x6c, 0x93, 0xb5, 0xdf, 0xe4, + 0x37, 0xdc, 0xcb, 0x2a, 0x9d, 0xae, 0x72, 0x50, 0x6c, 0x67, 0x55, 0xed, 0xf4, 0x3b, 0x00, 0x00, + 0xff, 0xff, 0x29, 0xbe, 0xa1, 0xd2, 0x02, 0x02, 0x00, 0x00, +} + +func (m *NocCertificatesBySubjectKeyID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NocCertificatesBySubjectKeyID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NocCertificatesBySubjectKeyID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SchemaVersion != 0 { + i = encodeVarintNocCertificatesBySubjectKeyId(dAtA, i, uint64(m.SchemaVersion)) + i-- + dAtA[i] = 0x20 + } + if m.Tq != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Tq)))) + i-- + dAtA[i] = 0x1d + } + if len(m.Certs) > 0 { + for iNdEx := len(m.Certs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNocCertificatesBySubjectKeyId(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintNocCertificatesBySubjectKeyId(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintNocCertificatesBySubjectKeyId(dAtA []byte, offset int, v uint64) int { + offset -= sovNocCertificatesBySubjectKeyId(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NocCertificatesBySubjectKeyID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovNocCertificatesBySubjectKeyId(uint64(l)) + } + if len(m.Certs) > 0 { + for _, e := range m.Certs { + l = e.Size() + n += 1 + l + sovNocCertificatesBySubjectKeyId(uint64(l)) + } + } + if m.Tq != 0 { + n += 5 + } + if m.SchemaVersion != 0 { + n += 1 + sovNocCertificatesBySubjectKeyId(uint64(m.SchemaVersion)) + } + return n +} + +func sovNocCertificatesBySubjectKeyId(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNocCertificatesBySubjectKeyId(x uint64) (n int) { + return sovNocCertificatesBySubjectKeyId(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NocCertificatesBySubjectKeyID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NocCertificatesBySubjectKeyID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NocCertificatesBySubjectKeyID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNocCertificatesBySubjectKeyId + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNocCertificatesBySubjectKeyId + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNocCertificatesBySubjectKeyId + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNocCertificatesBySubjectKeyId + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certs = append(m.Certs, &Certificate{}) + if err := m.Certs[len(m.Certs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Tq", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Tq = float32(math.Float32frombits(v)) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) + } + m.SchemaVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNocCertificatesBySubjectKeyId(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNocCertificatesBySubjectKeyId + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNocCertificatesBySubjectKeyId(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificatesBySubjectKeyId + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNocCertificatesBySubjectKeyId + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNocCertificatesBySubjectKeyId + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNocCertificatesBySubjectKeyId + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNocCertificatesBySubjectKeyId = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNocCertificatesBySubjectKeyId = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNocCertificatesBySubjectKeyId = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/query.pb.go b/x/pki/types/query.pb.go index 8af0085bc..3f95a9cf2 100644 --- a/x/pki/types/query.pb.go +++ b/x/pki/types/query.pb.go @@ -31,6 +31,290 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type QueryAllCertificatesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllCertificatesRequest) Reset() { *m = QueryAllCertificatesRequest{} } +func (m *QueryAllCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllCertificatesRequest) ProtoMessage() {} +func (*QueryAllCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{0} +} +func (m *QueryAllCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllCertificatesRequest.Merge(m, src) +} +func (m *QueryAllCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllCertificatesRequest proto.InternalMessageInfo + +func (m *QueryAllCertificatesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllCertificatesResponse struct { + Certificates []AllCertificates `protobuf:"bytes,1,rep,name=certificates,proto3" json:"certificates"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllCertificatesResponse) Reset() { *m = QueryAllCertificatesResponse{} } +func (m *QueryAllCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllCertificatesResponse) ProtoMessage() {} +func (*QueryAllCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{1} +} +func (m *QueryAllCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllCertificatesResponse.Merge(m, src) +} +func (m *QueryAllCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllCertificatesResponse proto.InternalMessageInfo + +func (m *QueryAllCertificatesResponse) GetCertificates() []AllCertificates { + if m != nil { + return m.Certificates + } + return nil +} + +func (m *QueryAllCertificatesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetAllCertificatesBySubjectRequest struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` +} + +func (m *QueryGetAllCertificatesBySubjectRequest) Reset() { + *m = QueryGetAllCertificatesBySubjectRequest{} +} +func (m *QueryGetAllCertificatesBySubjectRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetAllCertificatesBySubjectRequest) ProtoMessage() {} +func (*QueryGetAllCertificatesBySubjectRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{2} +} +func (m *QueryGetAllCertificatesBySubjectRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAllCertificatesBySubjectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAllCertificatesBySubjectRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetAllCertificatesBySubjectRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAllCertificatesBySubjectRequest.Merge(m, src) +} +func (m *QueryGetAllCertificatesBySubjectRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAllCertificatesBySubjectRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAllCertificatesBySubjectRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAllCertificatesBySubjectRequest proto.InternalMessageInfo + +func (m *QueryGetAllCertificatesBySubjectRequest) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +type QueryGetAllCertificatesBySubjectResponse struct { + AllCertificatesBySubject AllCertificatesBySubject `protobuf:"bytes,1,opt,name=allCertificatesBySubject,proto3" json:"allCertificatesBySubject"` +} + +func (m *QueryGetAllCertificatesBySubjectResponse) Reset() { + *m = QueryGetAllCertificatesBySubjectResponse{} +} +func (m *QueryGetAllCertificatesBySubjectResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetAllCertificatesBySubjectResponse) ProtoMessage() {} +func (*QueryGetAllCertificatesBySubjectResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{3} +} +func (m *QueryGetAllCertificatesBySubjectResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAllCertificatesBySubjectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAllCertificatesBySubjectResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetAllCertificatesBySubjectResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAllCertificatesBySubjectResponse.Merge(m, src) +} +func (m *QueryGetAllCertificatesBySubjectResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAllCertificatesBySubjectResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAllCertificatesBySubjectResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAllCertificatesBySubjectResponse proto.InternalMessageInfo + +func (m *QueryGetAllCertificatesBySubjectResponse) GetAllCertificatesBySubject() AllCertificatesBySubject { + if m != nil { + return m.AllCertificatesBySubject + } + return AllCertificatesBySubject{} +} + +type QueryGetCertificatesRequest struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` +} + +func (m *QueryGetCertificatesRequest) Reset() { *m = QueryGetCertificatesRequest{} } +func (m *QueryGetCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetCertificatesRequest) ProtoMessage() {} +func (*QueryGetCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{4} +} +func (m *QueryGetCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCertificatesRequest.Merge(m, src) +} +func (m *QueryGetCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetCertificatesRequest proto.InternalMessageInfo + +func (m *QueryGetCertificatesRequest) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *QueryGetCertificatesRequest) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +type QueryGetCertificatesResponse struct { + Certificates AllCertificates `protobuf:"bytes,1,opt,name=certificates,proto3" json:"certificates"` +} + +func (m *QueryGetCertificatesResponse) Reset() { *m = QueryGetCertificatesResponse{} } +func (m *QueryGetCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetCertificatesResponse) ProtoMessage() {} +func (*QueryGetCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{5} +} +func (m *QueryGetCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCertificatesResponse.Merge(m, src) +} +func (m *QueryGetCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetCertificatesResponse proto.InternalMessageInfo + +func (m *QueryGetCertificatesResponse) GetCertificates() AllCertificates { + if m != nil { + return m.Certificates + } + return AllCertificates{} +} + type QueryGetApprovedCertificatesRequest struct { Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` @@ -40,7 +324,7 @@ func (m *QueryGetApprovedCertificatesRequest) Reset() { *m = QueryGetApp func (m *QueryGetApprovedCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetApprovedCertificatesRequest) ProtoMessage() {} func (*QueryGetApprovedCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{0} + return fileDescriptor_db6ffa8ae459ba1c, []int{6} } func (m *QueryGetApprovedCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -91,7 +375,7 @@ func (m *QueryGetApprovedCertificatesResponse) Reset() { *m = QueryGetAp func (m *QueryGetApprovedCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetApprovedCertificatesResponse) ProtoMessage() {} func (*QueryGetApprovedCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{1} + return fileDescriptor_db6ffa8ae459ba1c, []int{7} } func (m *QueryGetApprovedCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -136,7 +420,7 @@ func (m *QueryAllApprovedCertificatesRequest) Reset() { *m = QueryAllApp func (m *QueryAllApprovedCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllApprovedCertificatesRequest) ProtoMessage() {} func (*QueryAllApprovedCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{2} + return fileDescriptor_db6ffa8ae459ba1c, []int{8} } func (m *QueryAllApprovedCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -188,7 +472,7 @@ func (m *QueryAllApprovedCertificatesResponse) Reset() { *m = QueryAllAp func (m *QueryAllApprovedCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllApprovedCertificatesResponse) ProtoMessage() {} func (*QueryAllApprovedCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{3} + return fileDescriptor_db6ffa8ae459ba1c, []int{9} } func (m *QueryAllApprovedCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -240,7 +524,7 @@ func (m *QueryGetProposedCertificateRequest) Reset() { *m = QueryGetProp func (m *QueryGetProposedCertificateRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetProposedCertificateRequest) ProtoMessage() {} func (*QueryGetProposedCertificateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{4} + return fileDescriptor_db6ffa8ae459ba1c, []int{10} } func (m *QueryGetProposedCertificateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -291,7 +575,7 @@ func (m *QueryGetProposedCertificateResponse) Reset() { *m = QueryGetPro func (m *QueryGetProposedCertificateResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetProposedCertificateResponse) ProtoMessage() {} func (*QueryGetProposedCertificateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{5} + return fileDescriptor_db6ffa8ae459ba1c, []int{11} } func (m *QueryGetProposedCertificateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -335,7 +619,7 @@ func (m *QueryAllProposedCertificateRequest) Reset() { *m = QueryAllProp func (m *QueryAllProposedCertificateRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllProposedCertificateRequest) ProtoMessage() {} func (*QueryAllProposedCertificateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{6} + return fileDescriptor_db6ffa8ae459ba1c, []int{12} } func (m *QueryAllProposedCertificateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -380,7 +664,7 @@ func (m *QueryAllProposedCertificateResponse) Reset() { *m = QueryAllPro func (m *QueryAllProposedCertificateResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllProposedCertificateResponse) ProtoMessage() {} func (*QueryAllProposedCertificateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{7} + return fileDescriptor_db6ffa8ae459ba1c, []int{13} } func (m *QueryAllProposedCertificateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -432,7 +716,7 @@ func (m *QueryGetChildCertificatesRequest) Reset() { *m = QueryGetChildC func (m *QueryGetChildCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetChildCertificatesRequest) ProtoMessage() {} func (*QueryGetChildCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{8} + return fileDescriptor_db6ffa8ae459ba1c, []int{14} } func (m *QueryGetChildCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -483,7 +767,7 @@ func (m *QueryGetChildCertificatesResponse) Reset() { *m = QueryGetChild func (m *QueryGetChildCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetChildCertificatesResponse) ProtoMessage() {} func (*QueryGetChildCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{9} + return fileDescriptor_db6ffa8ae459ba1c, []int{15} } func (m *QueryGetChildCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -533,7 +817,7 @@ func (m *QueryGetProposedCertificateRevocationRequest) String() string { } func (*QueryGetProposedCertificateRevocationRequest) ProtoMessage() {} func (*QueryGetProposedCertificateRevocationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{10} + return fileDescriptor_db6ffa8ae459ba1c, []int{16} } func (m *QueryGetProposedCertificateRevocationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -595,7 +879,7 @@ func (m *QueryGetProposedCertificateRevocationResponse) String() string { } func (*QueryGetProposedCertificateRevocationResponse) ProtoMessage() {} func (*QueryGetProposedCertificateRevocationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{11} + return fileDescriptor_db6ffa8ae459ba1c, []int{17} } func (m *QueryGetProposedCertificateRevocationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -643,7 +927,7 @@ func (m *QueryAllProposedCertificateRevocationRequest) String() string { } func (*QueryAllProposedCertificateRevocationRequest) ProtoMessage() {} func (*QueryAllProposedCertificateRevocationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{12} + return fileDescriptor_db6ffa8ae459ba1c, []int{18} } func (m *QueryAllProposedCertificateRevocationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -692,7 +976,7 @@ func (m *QueryAllProposedCertificateRevocationResponse) String() string { } func (*QueryAllProposedCertificateRevocationResponse) ProtoMessage() {} func (*QueryAllProposedCertificateRevocationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{13} + return fileDescriptor_db6ffa8ae459ba1c, []int{19} } func (m *QueryAllProposedCertificateRevocationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -744,7 +1028,7 @@ func (m *QueryGetRevokedCertificatesRequest) Reset() { *m = QueryGetRevo func (m *QueryGetRevokedCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetRevokedCertificatesRequest) ProtoMessage() {} func (*QueryGetRevokedCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{14} + return fileDescriptor_db6ffa8ae459ba1c, []int{20} } func (m *QueryGetRevokedCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -795,7 +1079,7 @@ func (m *QueryGetRevokedCertificatesResponse) Reset() { *m = QueryGetRev func (m *QueryGetRevokedCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetRevokedCertificatesResponse) ProtoMessage() {} func (*QueryGetRevokedCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{15} + return fileDescriptor_db6ffa8ae459ba1c, []int{21} } func (m *QueryGetRevokedCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -839,7 +1123,7 @@ func (m *QueryAllRevokedCertificatesRequest) Reset() { *m = QueryAllRevo func (m *QueryAllRevokedCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllRevokedCertificatesRequest) ProtoMessage() {} func (*QueryAllRevokedCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{16} + return fileDescriptor_db6ffa8ae459ba1c, []int{22} } func (m *QueryAllRevokedCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -884,7 +1168,7 @@ func (m *QueryAllRevokedCertificatesResponse) Reset() { *m = QueryAllRev func (m *QueryAllRevokedCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllRevokedCertificatesResponse) ProtoMessage() {} func (*QueryAllRevokedCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{17} + return fileDescriptor_db6ffa8ae459ba1c, []int{23} } func (m *QueryAllRevokedCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -936,7 +1220,7 @@ func (m *QueryGetApprovedRootCertificatesRequest) Reset() { func (m *QueryGetApprovedRootCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetApprovedRootCertificatesRequest) ProtoMessage() {} func (*QueryGetApprovedRootCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{18} + return fileDescriptor_db6ffa8ae459ba1c, []int{24} } func (m *QueryGetApprovedRootCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -975,7 +1259,7 @@ func (m *QueryGetApprovedRootCertificatesResponse) Reset() { func (m *QueryGetApprovedRootCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetApprovedRootCertificatesResponse) ProtoMessage() {} func (*QueryGetApprovedRootCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{19} + return fileDescriptor_db6ffa8ae459ba1c, []int{25} } func (m *QueryGetApprovedRootCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1020,7 +1304,7 @@ func (m *QueryGetRevokedRootCertificatesRequest) Reset() { func (m *QueryGetRevokedRootCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetRevokedRootCertificatesRequest) ProtoMessage() {} func (*QueryGetRevokedRootCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{20} + return fileDescriptor_db6ffa8ae459ba1c, []int{26} } func (m *QueryGetRevokedRootCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1059,7 +1343,7 @@ func (m *QueryGetRevokedRootCertificatesResponse) Reset() { func (m *QueryGetRevokedRootCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetRevokedRootCertificatesResponse) ProtoMessage() {} func (*QueryGetRevokedRootCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{21} + return fileDescriptor_db6ffa8ae459ba1c, []int{27} } func (m *QueryGetRevokedRootCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1107,7 +1391,7 @@ func (m *QueryGetApprovedCertificatesBySubjectRequest) String() string { } func (*QueryGetApprovedCertificatesBySubjectRequest) ProtoMessage() {} func (*QueryGetApprovedCertificatesBySubjectRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{22} + return fileDescriptor_db6ffa8ae459ba1c, []int{28} } func (m *QueryGetApprovedCertificatesBySubjectRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1155,7 +1439,7 @@ func (m *QueryGetApprovedCertificatesBySubjectResponse) String() string { } func (*QueryGetApprovedCertificatesBySubjectResponse) ProtoMessage() {} func (*QueryGetApprovedCertificatesBySubjectResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{23} + return fileDescriptor_db6ffa8ae459ba1c, []int{29} } func (m *QueryGetApprovedCertificatesBySubjectResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1200,7 +1484,7 @@ func (m *QueryGetRejectedCertificatesRequest) Reset() { *m = QueryGetRej func (m *QueryGetRejectedCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetRejectedCertificatesRequest) ProtoMessage() {} func (*QueryGetRejectedCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{24} + return fileDescriptor_db6ffa8ae459ba1c, []int{30} } func (m *QueryGetRejectedCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1251,7 +1535,7 @@ func (m *QueryGetRejectedCertificatesResponse) Reset() { *m = QueryGetRe func (m *QueryGetRejectedCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetRejectedCertificatesResponse) ProtoMessage() {} func (*QueryGetRejectedCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{25} + return fileDescriptor_db6ffa8ae459ba1c, []int{31} } func (m *QueryGetRejectedCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1295,7 +1579,7 @@ func (m *QueryAllRejectedCertificatesRequest) Reset() { *m = QueryAllRej func (m *QueryAllRejectedCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllRejectedCertificatesRequest) ProtoMessage() {} func (*QueryAllRejectedCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{26} + return fileDescriptor_db6ffa8ae459ba1c, []int{32} } func (m *QueryAllRejectedCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1340,7 +1624,7 @@ func (m *QueryAllRejectedCertificatesResponse) Reset() { *m = QueryAllRe func (m *QueryAllRejectedCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllRejectedCertificatesResponse) ProtoMessage() {} func (*QueryAllRejectedCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{27} + return fileDescriptor_db6ffa8ae459ba1c, []int{33} } func (m *QueryAllRejectedCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1397,7 +1681,7 @@ func (m *QueryGetPkiRevocationDistributionPointRequest) String() string { } func (*QueryGetPkiRevocationDistributionPointRequest) ProtoMessage() {} func (*QueryGetPkiRevocationDistributionPointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{28} + return fileDescriptor_db6ffa8ae459ba1c, []int{34} } func (m *QueryGetPkiRevocationDistributionPointRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1459,7 +1743,7 @@ func (m *QueryGetPkiRevocationDistributionPointResponse) String() string { } func (*QueryGetPkiRevocationDistributionPointResponse) ProtoMessage() {} func (*QueryGetPkiRevocationDistributionPointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{29} + return fileDescriptor_db6ffa8ae459ba1c, []int{35} } func (m *QueryGetPkiRevocationDistributionPointResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1507,7 +1791,7 @@ func (m *QueryAllPkiRevocationDistributionPointRequest) String() string { } func (*QueryAllPkiRevocationDistributionPointRequest) ProtoMessage() {} func (*QueryAllPkiRevocationDistributionPointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{30} + return fileDescriptor_db6ffa8ae459ba1c, []int{36} } func (m *QueryAllPkiRevocationDistributionPointRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1556,7 +1840,7 @@ func (m *QueryAllPkiRevocationDistributionPointResponse) String() string { } func (*QueryAllPkiRevocationDistributionPointResponse) ProtoMessage() {} func (*QueryAllPkiRevocationDistributionPointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{31} + return fileDescriptor_db6ffa8ae459ba1c, []int{37} } func (m *QueryAllPkiRevocationDistributionPointResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1611,7 +1895,7 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Str } func (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) ProtoMessage() {} func (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{32} + return fileDescriptor_db6ffa8ae459ba1c, []int{38} } func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1659,7 +1943,7 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) St } func (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) ProtoMessage() {} func (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{33} + return fileDescriptor_db6ffa8ae459ba1c, []int{39} } func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1703,7 +1987,7 @@ func (m *QueryGetNocRootCertificatesRequest) Reset() { *m = QueryGetNocR func (m *QueryGetNocRootCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetNocRootCertificatesRequest) ProtoMessage() {} func (*QueryGetNocRootCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{34} + return fileDescriptor_db6ffa8ae459ba1c, []int{40} } func (m *QueryGetNocRootCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1747,7 +2031,7 @@ func (m *QueryGetNocRootCertificatesResponse) Reset() { *m = QueryGetNoc func (m *QueryGetNocRootCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetNocRootCertificatesResponse) ProtoMessage() {} func (*QueryGetNocRootCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{35} + return fileDescriptor_db6ffa8ae459ba1c, []int{41} } func (m *QueryGetNocRootCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1791,7 +2075,7 @@ func (m *QueryAllNocRootCertificatesRequest) Reset() { *m = QueryAllNocR func (m *QueryAllNocRootCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllNocRootCertificatesRequest) ProtoMessage() {} func (*QueryAllNocRootCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{36} + return fileDescriptor_db6ffa8ae459ba1c, []int{42} } func (m *QueryAllNocRootCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1836,7 +2120,7 @@ func (m *QueryAllNocRootCertificatesResponse) Reset() { *m = QueryAllNoc func (m *QueryAllNocRootCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllNocRootCertificatesResponse) ProtoMessage() {} func (*QueryAllNocRootCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{37} + return fileDescriptor_db6ffa8ae459ba1c, []int{43} } func (m *QueryAllNocRootCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1887,7 +2171,7 @@ func (m *QueryGetNocIcaCertificatesRequest) Reset() { *m = QueryGetNocIc func (m *QueryGetNocIcaCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetNocIcaCertificatesRequest) ProtoMessage() {} func (*QueryGetNocIcaCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{38} + return fileDescriptor_db6ffa8ae459ba1c, []int{44} } func (m *QueryGetNocIcaCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1931,7 +2215,7 @@ func (m *QueryGetNocIcaCertificatesResponse) Reset() { *m = QueryGetNocI func (m *QueryGetNocIcaCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetNocIcaCertificatesResponse) ProtoMessage() {} func (*QueryGetNocIcaCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{39} + return fileDescriptor_db6ffa8ae459ba1c, []int{45} } func (m *QueryGetNocIcaCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1975,7 +2259,7 @@ func (m *QueryAllNocIcaCertificatesRequest) Reset() { *m = QueryAllNocIc func (m *QueryAllNocIcaCertificatesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllNocIcaCertificatesRequest) ProtoMessage() {} func (*QueryAllNocIcaCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{40} + return fileDescriptor_db6ffa8ae459ba1c, []int{46} } func (m *QueryAllNocIcaCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2020,7 +2304,7 @@ func (m *QueryAllNocIcaCertificatesResponse) Reset() { *m = QueryAllNocI func (m *QueryAllNocIcaCertificatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllNocIcaCertificatesResponse) ProtoMessage() {} func (*QueryAllNocIcaCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{41} + return fileDescriptor_db6ffa8ae459ba1c, []int{47} } func (m *QueryAllNocIcaCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2076,7 +2360,7 @@ func (m *QueryGetRevokedNocRootCertificatesRequest) String() string { } func (*QueryGetRevokedNocRootCertificatesRequest) ProtoMessage() {} func (*QueryGetRevokedNocRootCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{42} + return fileDescriptor_db6ffa8ae459ba1c, []int{48} } func (m *QueryGetRevokedNocRootCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2131,7 +2415,7 @@ func (m *QueryGetRevokedNocRootCertificatesResponse) String() string { } func (*QueryGetRevokedNocRootCertificatesResponse) ProtoMessage() {} func (*QueryGetRevokedNocRootCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{43} + return fileDescriptor_db6ffa8ae459ba1c, []int{49} } func (m *QueryGetRevokedNocRootCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2179,7 +2463,7 @@ func (m *QueryAllRevokedNocRootCertificatesRequest) String() string { } func (*QueryAllRevokedNocRootCertificatesRequest) ProtoMessage() {} func (*QueryAllRevokedNocRootCertificatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{44} + return fileDescriptor_db6ffa8ae459ba1c, []int{50} } func (m *QueryAllRevokedNocRootCertificatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2228,7 +2512,7 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) String() string { } func (*QueryAllRevokedNocRootCertificatesResponse) ProtoMessage() {} func (*QueryAllRevokedNocRootCertificatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{45} + return fileDescriptor_db6ffa8ae459ba1c, []int{51} } func (m *QueryAllRevokedNocRootCertificatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2271,6 +2555,210 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) GetPagination() *query.Page return nil } +type QueryGetRevokedNocIcaCertificatesRequest struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` +} + +func (m *QueryGetRevokedNocIcaCertificatesRequest) Reset() { + *m = QueryGetRevokedNocIcaCertificatesRequest{} +} +func (m *QueryGetRevokedNocIcaCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetRevokedNocIcaCertificatesRequest) ProtoMessage() {} +func (*QueryGetRevokedNocIcaCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{52} +} +func (m *QueryGetRevokedNocIcaCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRevokedNocIcaCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRevokedNocIcaCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetRevokedNocIcaCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRevokedNocIcaCertificatesRequest.Merge(m, src) +} +func (m *QueryGetRevokedNocIcaCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRevokedNocIcaCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRevokedNocIcaCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRevokedNocIcaCertificatesRequest proto.InternalMessageInfo + +func (m *QueryGetRevokedNocIcaCertificatesRequest) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *QueryGetRevokedNocIcaCertificatesRequest) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +type QueryGetRevokedNocIcaCertificatesResponse struct { + RevokedNocIcaCertificates RevokedNocIcaCertificates `protobuf:"bytes,1,opt,name=revokedNocIcaCertificates,proto3" json:"revokedNocIcaCertificates"` +} + +func (m *QueryGetRevokedNocIcaCertificatesResponse) Reset() { + *m = QueryGetRevokedNocIcaCertificatesResponse{} +} +func (m *QueryGetRevokedNocIcaCertificatesResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetRevokedNocIcaCertificatesResponse) ProtoMessage() {} +func (*QueryGetRevokedNocIcaCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{53} +} +func (m *QueryGetRevokedNocIcaCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRevokedNocIcaCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRevokedNocIcaCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetRevokedNocIcaCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRevokedNocIcaCertificatesResponse.Merge(m, src) +} +func (m *QueryGetRevokedNocIcaCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRevokedNocIcaCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRevokedNocIcaCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRevokedNocIcaCertificatesResponse proto.InternalMessageInfo + +func (m *QueryGetRevokedNocIcaCertificatesResponse) GetRevokedNocIcaCertificates() RevokedNocIcaCertificates { + if m != nil { + return m.RevokedNocIcaCertificates + } + return RevokedNocIcaCertificates{} +} + +type QueryAllRevokedNocIcaCertificatesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRevokedNocIcaCertificatesRequest) Reset() { + *m = QueryAllRevokedNocIcaCertificatesRequest{} +} +func (m *QueryAllRevokedNocIcaCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRevokedNocIcaCertificatesRequest) ProtoMessage() {} +func (*QueryAllRevokedNocIcaCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{54} +} +func (m *QueryAllRevokedNocIcaCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRevokedNocIcaCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRevokedNocIcaCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllRevokedNocIcaCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRevokedNocIcaCertificatesRequest.Merge(m, src) +} +func (m *QueryAllRevokedNocIcaCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRevokedNocIcaCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRevokedNocIcaCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRevokedNocIcaCertificatesRequest proto.InternalMessageInfo + +func (m *QueryAllRevokedNocIcaCertificatesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllRevokedNocIcaCertificatesResponse struct { + RevokedNocIcaCertificates []RevokedNocIcaCertificates `protobuf:"bytes,1,rep,name=revokedNocIcaCertificates,proto3" json:"revokedNocIcaCertificates"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRevokedNocIcaCertificatesResponse) Reset() { + *m = QueryAllRevokedNocIcaCertificatesResponse{} +} +func (m *QueryAllRevokedNocIcaCertificatesResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryAllRevokedNocIcaCertificatesResponse) ProtoMessage() {} +func (*QueryAllRevokedNocIcaCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{55} +} +func (m *QueryAllRevokedNocIcaCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRevokedNocIcaCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRevokedNocIcaCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllRevokedNocIcaCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRevokedNocIcaCertificatesResponse.Merge(m, src) +} +func (m *QueryAllRevokedNocIcaCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRevokedNocIcaCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRevokedNocIcaCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRevokedNocIcaCertificatesResponse proto.InternalMessageInfo + +func (m *QueryAllRevokedNocIcaCertificatesResponse) GetRevokedNocIcaCertificates() []RevokedNocIcaCertificates { + if m != nil { + return m.RevokedNocIcaCertificates + } + return nil +} + +func (m *QueryAllRevokedNocIcaCertificatesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + type QueryGetNocCertificatesByVidAndSkidRequest struct { Vid int32 `protobuf:"varint,1,opt,name=vid,proto3" json:"vid,omitempty"` SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` @@ -2284,7 +2772,7 @@ func (m *QueryGetNocCertificatesByVidAndSkidRequest) String() string { } func (*QueryGetNocCertificatesByVidAndSkidRequest) ProtoMessage() {} func (*QueryGetNocCertificatesByVidAndSkidRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{46} + return fileDescriptor_db6ffa8ae459ba1c, []int{56} } func (m *QueryGetNocCertificatesByVidAndSkidRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2339,7 +2827,7 @@ func (m *QueryGetNocCertificatesByVidAndSkidResponse) String() string { } func (*QueryGetNocCertificatesByVidAndSkidResponse) ProtoMessage() {} func (*QueryGetNocCertificatesByVidAndSkidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_db6ffa8ae459ba1c, []int{47} + return fileDescriptor_db6ffa8ae459ba1c, []int{57} } func (m *QueryGetNocCertificatesByVidAndSkidResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2375,235 +2863,580 @@ func (m *QueryGetNocCertificatesByVidAndSkidResponse) GetNocCertificatesByVidAnd return NocCertificatesByVidAndSkid{} } -func init() { - proto.RegisterType((*QueryGetApprovedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesRequest") - proto.RegisterType((*QueryGetApprovedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesResponse") - proto.RegisterType((*QueryAllApprovedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllApprovedCertificatesRequest") - proto.RegisterType((*QueryAllApprovedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllApprovedCertificatesResponse") - proto.RegisterType((*QueryGetProposedCertificateRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateRequest") - proto.RegisterType((*QueryGetProposedCertificateResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateResponse") - proto.RegisterType((*QueryAllProposedCertificateRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateRequest") - proto.RegisterType((*QueryAllProposedCertificateResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateResponse") - proto.RegisterType((*QueryGetChildCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetChildCertificatesRequest") - proto.RegisterType((*QueryGetChildCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetChildCertificatesResponse") - proto.RegisterType((*QueryGetProposedCertificateRevocationRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateRevocationRequest") - proto.RegisterType((*QueryGetProposedCertificateRevocationResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateRevocationResponse") - proto.RegisterType((*QueryAllProposedCertificateRevocationRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateRevocationRequest") - proto.RegisterType((*QueryAllProposedCertificateRevocationResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateRevocationResponse") - proto.RegisterType((*QueryGetRevokedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedCertificatesRequest") - proto.RegisterType((*QueryGetRevokedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedCertificatesResponse") - proto.RegisterType((*QueryAllRevokedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedCertificatesRequest") - proto.RegisterType((*QueryAllRevokedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedCertificatesResponse") - proto.RegisterType((*QueryGetApprovedRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedRootCertificatesRequest") - proto.RegisterType((*QueryGetApprovedRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedRootCertificatesResponse") - proto.RegisterType((*QueryGetRevokedRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedRootCertificatesRequest") - proto.RegisterType((*QueryGetRevokedRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedRootCertificatesResponse") - proto.RegisterType((*QueryGetApprovedCertificatesBySubjectRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesBySubjectRequest") - proto.RegisterType((*QueryGetApprovedCertificatesBySubjectResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesBySubjectResponse") - proto.RegisterType((*QueryGetRejectedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRejectedCertificatesRequest") - proto.RegisterType((*QueryGetRejectedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRejectedCertificatesResponse") - proto.RegisterType((*QueryAllRejectedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRejectedCertificatesRequest") - proto.RegisterType((*QueryAllRejectedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRejectedCertificatesResponse") - proto.RegisterType((*QueryGetPkiRevocationDistributionPointRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointRequest") - proto.RegisterType((*QueryGetPkiRevocationDistributionPointResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointResponse") - proto.RegisterType((*QueryAllPkiRevocationDistributionPointRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllPkiRevocationDistributionPointRequest") - proto.RegisterType((*QueryAllPkiRevocationDistributionPointResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllPkiRevocationDistributionPointResponse") - proto.RegisterType((*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest") - proto.RegisterType((*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse") - proto.RegisterType((*QueryGetNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesRequest") - proto.RegisterType((*QueryGetNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesResponse") - proto.RegisterType((*QueryAllNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesRequest") - proto.RegisterType((*QueryAllNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesResponse") - proto.RegisterType((*QueryGetNocIcaCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocIcaCertificatesRequest") - proto.RegisterType((*QueryGetNocIcaCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocIcaCertificatesResponse") - proto.RegisterType((*QueryAllNocIcaCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocIcaCertificatesRequest") - proto.RegisterType((*QueryAllNocIcaCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocIcaCertificatesResponse") - proto.RegisterType((*QueryGetRevokedNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocRootCertificatesRequest") - proto.RegisterType((*QueryGetRevokedNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocRootCertificatesResponse") - proto.RegisterType((*QueryAllRevokedNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocRootCertificatesRequest") - proto.RegisterType((*QueryAllRevokedNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocRootCertificatesResponse") - proto.RegisterType((*QueryGetNocCertificatesByVidAndSkidRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesByVidAndSkidRequest") - proto.RegisterType((*QueryGetNocCertificatesByVidAndSkidResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesByVidAndSkidResponse") +type QueryNocCertificatesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` } -func init() { - proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/query.proto", fileDescriptor_db6ffa8ae459ba1c) +func (m *QueryNocCertificatesRequest) Reset() { *m = QueryNocCertificatesRequest{} } +func (m *QueryNocCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNocCertificatesRequest) ProtoMessage() {} +func (*QueryNocCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{58} +} +func (m *QueryNocCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNocCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNocCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNocCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNocCertificatesRequest.Merge(m, src) +} +func (m *QueryNocCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNocCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNocCertificatesRequest.DiscardUnknown(m) } -var fileDescriptor_db6ffa8ae459ba1c = []byte{ - // 2131 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5b, 0x4d, 0x8c, 0x23, 0x47, - 0x15, 0xde, 0x6a, 0xb3, 0x41, 0x14, 0x08, 0x91, 0xda, 0xcd, 0xee, 0xe0, 0x64, 0xbc, 0xbb, 0x95, - 0xcd, 0xec, 0xec, 0x6c, 0xc6, 0x9d, 0xc9, 0x2a, 0xbb, 0x80, 0x14, 0x56, 0xf3, 0x03, 0x93, 0xd9, - 0x88, 0x61, 0xc6, 0x93, 0x6c, 0xc8, 0x12, 0x62, 0xb5, 0xdb, 0x8d, 0xb7, 0x71, 0x8f, 0xbb, 0xd3, - 0xdd, 0x1e, 0x62, 0x46, 0x83, 0x04, 0x12, 0x09, 0xe2, 0x80, 0x16, 0xc2, 0x01, 0x50, 0xc4, 0x81, - 0x48, 0x11, 0x77, 0x0e, 0x1c, 0x39, 0x70, 0x89, 0xc4, 0x81, 0x48, 0x1c, 0x82, 0x84, 0x84, 0xd0, - 0x0e, 0x08, 0x50, 0x22, 0x21, 0x2e, 0x20, 0x2e, 0x10, 0x75, 0xf7, 0xf3, 0x74, 0xdb, 0x5d, 0x55, - 0x6e, 0x97, 0xcb, 0x93, 0x9b, 0xdd, 0x55, 0xfd, 0x5e, 0xbd, 0xef, 0x7d, 0xf5, 0xde, 0xab, 0x7a, - 0x36, 0xfe, 0xcc, 0x37, 0xec, 0x56, 0xc3, 0xb2, 0x0c, 0xc7, 0xb1, 0x8d, 0x8e, 0x69, 0xe9, 0x4d, - 0x3b, 0x08, 0x7d, 0xbb, 0xd1, 0x0d, 0xad, 0xa6, 0xe9, 0xee, 0x7a, 0xc9, 0x53, 0xc7, 0x6a, 0xb6, - 0x2c, 0x5f, 0xf7, 0xda, 0xb6, 0xfe, 0x52, 0xd7, 0xf2, 0x7b, 0x55, 0xcf, 0x77, 0x43, 0x97, 0x54, - 0x07, 0xdf, 0xad, 0x0a, 0xde, 0xad, 0x7a, 0x6d, 0xbb, 0xfc, 0x50, 0xcb, 0x75, 0x5b, 0x8e, 0xa5, - 0x1b, 0x9e, 0xad, 0x1b, 0x9d, 0x8e, 0x1b, 0x1a, 0xa1, 0xed, 0x76, 0x82, 0x44, 0x5a, 0x79, 0xc1, - 0x74, 0x83, 0x5d, 0x37, 0xd0, 0x1b, 0x46, 0x60, 0x25, 0x6a, 0xf4, 0xbd, 0xa5, 0x86, 0x15, 0x1a, - 0x4b, 0xba, 0x67, 0xb4, 0xec, 0x4e, 0x3c, 0x19, 0xe6, 0xde, 0x1c, 0x73, 0xd5, 0x86, 0xe7, 0xf9, - 0xee, 0x9e, 0xd5, 0xac, 0x9b, 0x96, 0x1f, 0xda, 0x5f, 0xb5, 0x4d, 0x23, 0xb4, 0xfa, 0x7a, 0x37, - 0xc6, 0x94, 0xe5, 0xf9, 0xae, 0xe7, 0x06, 0x83, 0xb2, 0x40, 0xd4, 0xfa, 0x98, 0xa2, 0xcc, 0x3b, - 0xb6, 0xc3, 0x5c, 0xd3, 0x33, 0x0a, 0xd6, 0x54, 0xf7, 0xad, 0x3d, 0xd7, 0xcc, 0xa2, 0x36, 0xae, - 0xa5, 0x91, 0x80, 0x36, 0x1b, 0xb4, 0x2f, 0xca, 0x3a, 0xc0, 0x77, 0xdd, 0x90, 0x25, 0x70, 0x53, - 0x72, 0x6d, 0x3c, 0x79, 0xcf, 0xaa, 0x60, 0x48, 0xbd, 0xd1, 0xab, 0x07, 0xdd, 0xc6, 0xd7, 0x2c, - 0x33, 0x94, 0x86, 0x30, 0x7a, 0x99, 0x49, 0x96, 0x5b, 0xe3, 0xfa, 0xb8, 0x6d, 0x67, 0x5c, 0x5a, - 0x3f, 0x9a, 0x1e, 0x7d, 0xf1, 0x5c, 0xbb, 0xd3, 0x5f, 0xa2, 0xa7, 0x5a, 0x6e, 0x0c, 0x83, 0x1d, - 0x04, 0x5d, 0xcb, 0xef, 0xa3, 0x51, 0x6f, 0x5b, 0xbd, 0xba, 0xdd, 0x94, 0xdc, 0x8d, 0x1d, 0xd7, - 0xe4, 0xfa, 0x6d, 0x43, 0x42, 0x96, 0x6d, 0x1a, 0x2c, 0x51, 0x35, 0x49, 0x4a, 0x89, 0x96, 0xf7, - 0xac, 0xc4, 0xf2, 0x86, 0x19, 0xb5, 0x67, 0x37, 0xeb, 0x46, 0xa7, 0x59, 0x0f, 0xda, 0x47, 0x08, - 0x9e, 0x6e, 0xb9, 0x2d, 0x37, 0xfe, 0xa8, 0x47, 0x9f, 0xe0, 0xe9, 0x27, 0x93, 0x88, 0x58, 0x4f, - 0x06, 0x92, 0x2f, 0xc9, 0x10, 0x35, 0xf1, 0xc3, 0xdb, 0x51, 0x88, 0x5c, 0xb7, 0xc2, 0x65, 0x60, - 0xee, 0x6a, 0x46, 0x4d, 0xcd, 0x7a, 0xa9, 0x6b, 0x05, 0x21, 0x99, 0xc1, 0x1f, 0x06, 0x8f, 0xcd, - 0xa0, 0xf3, 0x68, 0xfe, 0x23, 0xb5, 0xfe, 0x57, 0x42, 0xf1, 0xc7, 0xe0, 0xe3, 0xd3, 0x56, 0x6f, - 0xa3, 0x39, 0xa3, 0xc5, 0xc3, 0x03, 0xcf, 0xe8, 0x9b, 0x08, 0x5f, 0x14, 0x6b, 0x09, 0x3c, 0xb7, - 0x13, 0x58, 0xe4, 0x9b, 0xf8, 0xb4, 0xc1, 0x18, 0x8f, 0x75, 0x7e, 0xf4, 0xf1, 0xb5, 0x31, 0xf3, - 0x44, 0x95, 0xa5, 0x6b, 0xe5, 0x43, 0x6f, 0xfd, 0xe9, 0xdc, 0x89, 0x1a, 0x53, 0x0f, 0xfd, 0x01, - 0x02, 0x38, 0x96, 0x1d, 0x47, 0x04, 0xc7, 0xe7, 0x31, 0x4e, 0x53, 0x09, 0xac, 0x6e, 0xae, 0x0a, - 0xc0, 0x46, 0x79, 0xa7, 0x9a, 0xa4, 0x37, 0xc8, 0x3b, 0xd5, 0x2d, 0xa3, 0x65, 0xc1, 0xbb, 0xb5, - 0xcc, 0x9b, 0x85, 0xc0, 0xfb, 0x67, 0x1f, 0x3c, 0xee, 0x9a, 0x46, 0x82, 0x57, 0x3a, 0x0e, 0xf0, - 0xc8, 0xfa, 0x00, 0x28, 0x5a, 0x0c, 0xca, 0xa5, 0x91, 0xa0, 0x24, 0x8b, 0xcf, 0xa2, 0x42, 0x1b, - 0x98, 0xf6, 0xd9, 0xb2, 0x05, 0xf9, 0x28, 0xa3, 0x48, 0x0d, 0x25, 0x7f, 0x8e, 0x52, 0xe2, 0x33, - 0x95, 0x00, 0xa8, 0xfb, 0xf8, 0x94, 0x97, 0x1f, 0x06, 0x97, 0xaf, 0x8e, 0x8b, 0x29, 0x43, 0x13, - 0x40, 0xca, 0xd2, 0x42, 0x1d, 0x00, 0x62, 0xd9, 0x71, 0x04, 0x40, 0x28, 0x22, 0x23, 0x7d, 0x37, - 0x43, 0x7e, 0x29, 0x48, 0x4a, 0xd3, 0x87, 0x44, 0x25, 0xc9, 0xce, 0xf7, 0xfd, 0xbf, 0x1a, 0x55, - 0x4f, 0xac, 0x6d, 0x7e, 0x06, 0xdf, 0x97, 0xa4, 0x2b, 0x60, 0x18, 0x7c, 0x23, 0x73, 0xf8, 0xe3, - 0x46, 0x37, 0xbc, 0xe3, 0xfa, 0x76, 0xd8, 0xcb, 0x52, 0x6c, 0xe8, 0x29, 0xfd, 0x29, 0xc2, 0x17, - 0x04, 0x4a, 0x00, 0xcf, 0x2e, 0xbe, 0xdf, 0x1c, 0x1e, 0x04, 0x37, 0x2e, 0x8f, 0x8b, 0x66, 0x4e, - 0x0b, 0x60, 0x99, 0xd7, 0x40, 0xef, 0x22, 0xfc, 0xa8, 0x70, 0x07, 0xf4, 0x33, 0xb9, 0x92, 0x0d, - 0x17, 0xcf, 0xb1, 0x7c, 0xdb, 0x70, 0x36, 0xbb, 0xbb, 0x0d, 0xcb, 0x9f, 0x29, 0xc1, 0x9c, 0xcc, - 0x33, 0xfa, 0x5b, 0x84, 0x17, 0x0b, 0x2e, 0x09, 0xb0, 0xfb, 0x09, 0xc2, 0xb3, 0x9e, 0x68, 0x26, - 0x00, 0xf9, 0x05, 0x05, 0xb4, 0x4c, 0x85, 0x02, 0xa8, 0x62, 0xcd, 0x74, 0x0f, 0xf0, 0xe5, 0x6d, - 0xa7, 0x61, 0x7c, 0x55, 0xed, 0xe3, 0x1f, 0x69, 0x80, 0xe2, 0x68, 0xc5, 0x63, 0xa0, 0x58, 0xfa, - 0x60, 0x50, 0x9c, 0x4a, 0x56, 0xa9, 0x25, 0x05, 0x9a, 0xfa, 0x42, 0x27, 0x9b, 0x55, 0x98, 0x4a, - 0xd2, 0x10, 0xea, 0xe7, 0x87, 0x65, 0xb3, 0x0a, 0x43, 0x53, 0x3f, 0x84, 0x32, 0xb4, 0x64, 0xb3, - 0x8a, 0x00, 0x88, 0x69, 0x64, 0x15, 0x29, 0x48, 0x4a, 0xd3, 0x87, 0x44, 0x1d, 0xc9, 0x2e, 0xe3, - 0x4b, 0xc3, 0x85, 0x6e, 0xcd, 0x75, 0x43, 0x06, 0xc0, 0xf4, 0x57, 0x08, 0xcf, 0x8f, 0x9e, 0x0b, - 0xe8, 0x7c, 0x0f, 0xe1, 0x19, 0x83, 0x33, 0x09, 0x9c, 0xf3, 0x94, 0x6c, 0x81, 0x37, 0x2c, 0x0f, - 0x80, 0xe2, 0xea, 0xa3, 0xf3, 0x78, 0x6e, 0x88, 0xe4, 0x3c, 0x1b, 0x7f, 0x89, 0x52, 0x3c, 0xb8, - 0x53, 0xc1, 0xc4, 0x57, 0x11, 0x3e, 0xeb, 0xb3, 0xe7, 0x80, 0x85, 0xeb, 0x92, 0x2c, 0xe0, 0x18, - 0xc8, 0xd3, 0x46, 0x9f, 0x4a, 0x13, 0x23, 0xb3, 0x08, 0xee, 0xed, 0x24, 0x7b, 0x7e, 0x64, 0xcc, - 0x18, 0x48, 0x68, 0x23, 0x44, 0x65, 0x42, 0xb1, 0x21, 0x9a, 0x29, 0x9b, 0xd0, 0x84, 0xea, 0xfb, - 0xa1, 0x58, 0xa8, 0x39, 0x7b, 0x56, 0xac, 0xc1, 0x75, 0x84, 0xfa, 0x10, 0xfa, 0x46, 0xe6, 0xac, - 0xc8, 0xd6, 0x92, 0x0d, 0x18, 0xb9, 0x71, 0xf9, 0x18, 0x9a, 0x13, 0x95, 0x06, 0x8c, 0xdc, 0x10, - 0xdd, 0xcd, 0x06, 0x35, 0x3e, 0x14, 0xaa, 0x82, 0xe8, 0x7b, 0x99, 0x33, 0xa0, 0x1c, 0x28, 0xa5, - 0xe9, 0x83, 0xa2, 0x2e, 0x8a, 0xbe, 0x9a, 0xad, 0x03, 0xdb, 0x76, 0x5a, 0x0d, 0xac, 0x65, 0xee, - 0x94, 0xb6, 0x5c, 0xbb, 0x73, 0xb4, 0x05, 0x3f, 0x81, 0x4b, 0x7b, 0x76, 0x33, 0x46, 0xf8, 0x64, - 0x2d, 0xfa, 0x48, 0x4e, 0xe3, 0x93, 0x8e, 0xd1, 0xb0, 0x1c, 0x20, 0x59, 0xf2, 0x85, 0x54, 0x31, - 0x49, 0x6a, 0xf8, 0x9d, 0x94, 0x73, 0x6b, 0x50, 0x8b, 0x32, 0x46, 0xe8, 0xef, 0x10, 0xae, 0x16, - 0x5d, 0x09, 0xb8, 0xe0, 0x75, 0x84, 0x2b, 0xe2, 0xa9, 0x40, 0x84, 0xcd, 0xb1, 0xab, 0x29, 0xa1, - 0x54, 0xf0, 0xcc, 0x08, 0xdd, 0xf4, 0xeb, 0x99, 0xe2, 0xb0, 0x10, 0xb4, 0xaa, 0x38, 0xfc, 0x63, - 0x0d, 0xa0, 0x2c, 0xa0, 0x79, 0x1c, 0x28, 0x4b, 0x1f, 0x14, 0x94, 0xea, 0xf8, 0x1e, 0xe2, 0x95, - 0x62, 0x24, 0x0b, 0x56, 0x7a, 0x1b, 0x39, 0x92, 0xf6, 0x1d, 0xc5, 0xe6, 0x36, 0xe2, 0x72, 0xfb, - 0x0d, 0x0d, 0xaf, 0x4e, 0xa4, 0x16, 0xbc, 0xf4, 0x47, 0x84, 0xaf, 0x7a, 0xe3, 0xbf, 0x0f, 0x54, - 0x32, 0xd5, 0xba, 0x8e, 0xa9, 0x0a, 0xfc, 0x29, 0xb3, 0x4a, 0x7a, 0x2d, 0x3d, 0x36, 0x6c, 0xba, - 0x26, 0xa7, 0xd0, 0xc9, 0xc7, 0x9f, 0x81, 0xa3, 0x00, 0xf3, 0xc5, 0x34, 0x62, 0x77, 0xf2, 0xc3, - 0xb2, 0x69, 0x8c, 0xa1, 0xa9, 0x1f, 0xb1, 0x19, 0x5a, 0xb2, 0x47, 0x01, 0x81, 0x71, 0xd3, 0x38, - 0x0a, 0x48, 0x41, 0x52, 0x9a, 0x3e, 0x24, 0xea, 0x36, 0xf5, 0x13, 0xe9, 0xdd, 0xcf, 0xa6, 0x6b, - 0x6e, 0x98, 0x46, 0x31, 0xde, 0xfc, 0x0c, 0x0d, 0x10, 0x2e, 0xf7, 0x1e, 0x60, 0xf4, 0x32, 0x26, - 0x9d, 0xdc, 0x28, 0xf8, 0x66, 0x45, 0x02, 0xa2, 0x21, 0x49, 0x80, 0x10, 0x43, 0x07, 0x6d, 0x83, - 0x5d, 0x89, 0x13, 0x39, 0x76, 0xa9, 0xa2, 0xcc, 0xdf, 0xd0, 0x00, 0x43, 0xc7, 0x45, 0xa3, 0x34, - 0x6d, 0x34, 0xd4, 0xd1, 0xc5, 0xc6, 0x97, 0x87, 0x4e, 0x4a, 0x82, 0x1d, 0x39, 0x59, 0x89, 0xfd, - 0x6b, 0x84, 0x17, 0x8a, 0xe8, 0x02, 0x70, 0xef, 0x22, 0x5c, 0xf6, 0xb9, 0xd3, 0xc0, 0xb9, 0x37, - 0x25, 0xcf, 0x66, 0xfc, 0xdd, 0x29, 0xd0, 0x49, 0x03, 0x00, 0x2b, 0xbd, 0x53, 0x38, 0x86, 0xf0, - 0xf5, 0x5d, 0x0d, 0x60, 0x1b, 0xa1, 0xb5, 0x28, 0x6c, 0xa5, 0xe3, 0x86, 0x4d, 0xe5, 0x5d, 0xda, - 0x42, 0x26, 0x46, 0x0d, 0x9e, 0x16, 0x6f, 0xd9, 0xcd, 0xe5, 0x4e, 0x73, 0xa7, 0x6d, 0x37, 0xf9, - 0xc5, 0x79, 0x11, 0x96, 0xfe, 0x06, 0xe1, 0x2b, 0x85, 0x94, 0x00, 0xde, 0xaf, 0x21, 0xfc, 0x60, - 0x87, 0x3f, 0x0f, 0x1c, 0xff, 0xb4, 0x44, 0x34, 0xe0, 0x89, 0x04, 0xc4, 0x45, 0x5a, 0x1f, 0x7f, - 0xe7, 0x31, 0x7c, 0x32, 0xb6, 0x82, 0xfc, 0x17, 0xe1, 0xd3, 0xac, 0x43, 0x38, 0xd9, 0x19, 0x77, - 0x49, 0x05, 0x1a, 0xb6, 0xe5, 0x67, 0xd4, 0x0a, 0x4d, 0x30, 0xa6, 0xd7, 0xbe, 0xfd, 0xfb, 0xbf, - 0xbc, 0xa6, 0x3d, 0x46, 0xaa, 0x7a, 0xd3, 0x74, 0x92, 0x5f, 0x9e, 0x64, 0xa6, 0xe9, 0xfb, 0xe0, - 0xc0, 0x83, 0xa3, 0x4f, 0xb1, 0x2b, 0x0f, 0xc8, 0x21, 0xc2, 0x67, 0x59, 0x82, 0x97, 0x1d, 0x47, - 0xd2, 0x7c, 0x71, 0x83, 0x56, 0xd2, 0xfc, 0x11, 0x1d, 0x56, 0x3a, 0x1b, 0x9b, 0x7f, 0x96, 0x3c, - 0xc0, 0x34, 0x9f, 0xfc, 0x1f, 0xe1, 0x53, 0x8c, 0x1b, 0x6f, 0x52, 0x93, 0xf5, 0x05, 0xbf, 0xe9, - 0x57, 0xde, 0x51, 0x2a, 0x13, 0xec, 0xbb, 0x11, 0xdb, 0xf7, 0x69, 0x72, 0xfd, 0xc8, 0xbe, 0xfe, - 0xdd, 0xfc, 0x62, 0x31, 0x3f, 0xff, 0x03, 0xe1, 0x33, 0x0c, 0x05, 0x91, 0x9b, 0x6b, 0xb2, 0x1e, - 0x51, 0x0e, 0x82, 0xb8, 0xbd, 0x49, 0xe7, 0x62, 0x10, 0xce, 0x93, 0x8a, 0x18, 0x04, 0xf2, 0x1f, - 0x84, 0xef, 0xcf, 0xb5, 0xdb, 0xc8, 0x96, 0xac, 0x5f, 0x78, 0x4d, 0xc8, 0xf2, 0xb6, 0x42, 0x89, - 0x60, 0xe2, 0x93, 0xb1, 0x89, 0xd7, 0xc9, 0x13, 0x29, 0x8f, 0xa3, 0xb9, 0x43, 0x4e, 0x4e, 0x8e, - 0x8c, 0x07, 0xfa, 0xfe, 0x60, 0x57, 0xf3, 0x80, 0xfc, 0x42, 0xc3, 0xb3, 0xc2, 0xce, 0x0e, 0x79, - 0x41, 0x29, 0x3b, 0x87, 0x1a, 0x65, 0xe5, 0xaf, 0x4c, 0x49, 0x3a, 0xa0, 0x73, 0x33, 0x46, 0x67, - 0x8d, 0xac, 0xe4, 0x09, 0x90, 0xfe, 0xbc, 0xa9, 0xe0, 0x86, 0xf8, 0xa1, 0x86, 0xcf, 0x0b, 0xb5, - 0x46, 0x5b, 0xe3, 0x05, 0xa5, 0x34, 0x56, 0x83, 0x56, 0xd1, 0xde, 0x21, 0x5d, 0x8a, 0xd1, 0xba, - 0x42, 0x2e, 0x17, 0x46, 0x8b, 0xfc, 0x0f, 0xe1, 0x53, 0x8c, 0x06, 0x8d, 0x7c, 0x9c, 0xe4, 0xb7, - 0xb1, 0xe4, 0xe3, 0xa4, 0xa0, 0x57, 0x45, 0x3f, 0x1b, 0xdb, 0xfc, 0x29, 0x72, 0xed, 0xc8, 0x66, - 0x28, 0xba, 0x0a, 0xb2, 0xe2, 0xef, 0x08, 0x9f, 0x61, 0xc8, 0x9f, 0x28, 0x4c, 0x2a, 0xc7, 0x40, - 0xdc, 0xaf, 0xa3, 0x8f, 0xc4, 0x18, 0x9c, 0x23, 0xb3, 0x42, 0x0c, 0xc8, 0xbf, 0x10, 0x9e, 0xe1, - 0x35, 0x9a, 0xc8, 0x73, 0x93, 0x16, 0x29, 0x9c, 0x92, 0xbf, 0xfc, 0x25, 0xf5, 0x82, 0xc1, 0x6c, - 0x1a, 0x9b, 0xfd, 0x10, 0x29, 0xa7, 0x66, 0xbb, 0x6e, 0x38, 0x68, 0xf3, 0xbf, 0x11, 0x3e, 0xcb, - 0x69, 0x3d, 0x91, 0x5b, 0x13, 0xf2, 0x91, 0x67, 0xf1, 0x73, 0xca, 0xe5, 0x82, 0xc1, 0x0b, 0xb1, - 0xc1, 0x17, 0x09, 0xcd, 0xf9, 0x39, 0x6f, 0xf8, 0x77, 0x34, 0x3c, 0x2b, 0xec, 0x33, 0xc9, 0x27, - 0x86, 0x22, 0x8d, 0x38, 0xf9, 0xc4, 0x50, 0xa8, 0x37, 0x47, 0x2f, 0xc5, 0x50, 0x5c, 0x20, 0xe7, - 0x46, 0x54, 0xbf, 0xe4, 0x5b, 0x5a, 0x14, 0xe0, 0xf2, 0x0d, 0x92, 0x09, 0x82, 0x11, 0xb7, 0xc7, - 0x24, 0x5f, 0xe9, 0x8b, 0x1a, 0x49, 0x8c, 0x52, 0xb0, 0xdf, 0xf1, 0x29, 0x18, 0xe3, 0xde, 0x8d, - 0x63, 0x5c, 0x4e, 0xc3, 0x44, 0x15, 0xbf, 0x7a, 0x18, 0x46, 0xf4, 0xd3, 0x18, 0xc5, 0x20, 0x13, - 0x06, 0xf2, 0xa6, 0x36, 0xaa, 0x53, 0x41, 0xe4, 0xab, 0x96, 0x22, 0x6d, 0x9a, 0xf2, 0x8b, 0xd3, - 0x12, 0x0f, 0x48, 0x7c, 0x2e, 0x46, 0xe2, 0x06, 0x79, 0x72, 0x20, 0x0e, 0x40, 0x7a, 0x4f, 0x7e, - 0xde, 0xdd, 0x2f, 0x19, 0xb3, 0xf7, 0xe7, 0x07, 0xfa, 0xfe, 0x9e, 0xdd, 0x3c, 0xd0, 0xf7, 0xe3, - 0xfe, 0xdb, 0x01, 0x79, 0x45, 0xc3, 0x17, 0xc4, 0x1a, 0x23, 0x86, 0xc8, 0xd7, 0x2c, 0x53, 0xc4, - 0xaa, 0x70, 0xdf, 0x8a, 0x95, 0x24, 0x86, 0xb1, 0x22, 0xef, 0x68, 0xf8, 0xaa, 0x44, 0x2b, 0x83, - 0xf8, 0xd3, 0xf1, 0xb3, 0xa8, 0xb3, 0x54, 0x0e, 0x8e, 0x55, 0x27, 0x80, 0x78, 0x3d, 0x06, 0x71, - 0x89, 0xe8, 0x63, 0x12, 0x8e, 0xbc, 0x87, 0xf0, 0x29, 0xd6, 0xed, 0x97, 0x74, 0x79, 0xc9, 0xbf, - 0x5b, 0x94, 0x2f, 0x2f, 0x05, 0x37, 0x87, 0xf4, 0xd1, 0xd8, 0xf2, 0x39, 0x72, 0xf1, 0xc8, 0xf2, - 0x8e, 0x6b, 0xe6, 0xd3, 0x6d, 0xb2, 0xb3, 0xc8, 0xf7, 0x35, 0xfc, 0xa0, 0xe0, 0x92, 0x8a, 0xdc, - 0x9e, 0x60, 0x89, 0x23, 0x6e, 0xf6, 0xca, 0x5f, 0x9e, 0x8a, 0x6c, 0xee, 0x65, 0x53, 0x04, 0x43, - 0x1e, 0x01, 0xd6, 0x25, 0x04, 0x03, 0xde, 0x89, 0xaa, 0x6b, 0xe5, 0x14, 0x10, 0xb7, 0xc0, 0x18, - 0x79, 0x87, 0x49, 0x81, 0xe8, 0x24, 0x41, 0xf2, 0xfd, 0x0a, 0xb2, 0x3d, 0x81, 0x5f, 0xd8, 0x1d, - 0x9d, 0x72, 0x4d, 0xa5, 0x48, 0xb0, 0xf2, 0x4a, 0x6c, 0xe5, 0x23, 0xe4, 0xe1, 0x01, 0x2b, 0x6d, - 0xd3, 0x60, 0xf1, 0xfc, 0xaf, 0x08, 0x3f, 0x90, 0x97, 0x15, 0x79, 0x75, 0x7b, 0x02, 0x0f, 0x28, - 0xb5, 0x56, 0xd8, 0xa4, 0x62, 0x9c, 0x98, 0x58, 0xd6, 0x92, 0xd7, 0x35, 0x5c, 0xe6, 0xdf, 0xf2, - 0x93, 0xe7, 0x27, 0x2c, 0xf4, 0x05, 0x4c, 0xbe, 0x3d, 0x0d, 0xd1, 0x60, 0xfc, 0x7a, 0x6c, 0xfc, - 0x32, 0xb9, 0x91, 0x3b, 0x46, 0x70, 0x62, 0x1b, 0xaf, 0xae, 0x7c, 0x45, 0xc3, 0xb3, 0x7c, 0x7d, - 0x11, 0x1d, 0x9e, 0x9f, 0xf0, 0xb8, 0xab, 0x1c, 0xa1, 0x42, 0xfd, 0x22, 0x5a, 0x8d, 0x11, 0x9a, - 0x27, 0x73, 0xc5, 0x10, 0x5a, 0x79, 0xf1, 0xad, 0x7b, 0x15, 0xf4, 0xf6, 0xbd, 0x0a, 0xfa, 0xf3, - 0xbd, 0x0a, 0xba, 0x7b, 0x58, 0x39, 0xf1, 0xf6, 0x61, 0xe5, 0xc4, 0x1f, 0x0e, 0x2b, 0x27, 0x6e, - 0xaf, 0xb5, 0xec, 0xf0, 0x4e, 0xb7, 0x51, 0x35, 0xdd, 0x5d, 0x3d, 0x59, 0xef, 0x22, 0xeb, 0x7f, - 0x66, 0x8b, 0xe9, 0x8a, 0x17, 0xe1, 0x9f, 0x66, 0x2f, 0xc7, 0x7a, 0xc3, 0x9e, 0x67, 0x05, 0x8d, - 0xfb, 0xe2, 0x3f, 0x88, 0x5d, 0x7d, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x89, 0x78, 0x22, 0xeb, 0xd9, - 0x3b, 0x00, 0x00, +var xxx_messageInfo_QueryNocCertificatesRequest proto.InternalMessageInfo + +func (m *QueryNocCertificatesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +func (m *QueryNocCertificatesRequest) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} -// 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.SupportPackageIsVersion4 +type QueryNocCertificatesResponse struct { + NocCertificates []NocCertificates `protobuf:"bytes,1,rep,name=nocCertificates,proto3" json:"nocCertificates"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Queries a ApprovedCertificates by index. - ApprovedCertificates(ctx context.Context, in *QueryGetApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesResponse, error) - // Queries a list of ApprovedCertificates items. - ApprovedCertificatesAll(ctx context.Context, in *QueryAllApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryAllApprovedCertificatesResponse, error) - // Queries a ProposedCertificate by index. - ProposedCertificate(ctx context.Context, in *QueryGetProposedCertificateRequest, opts ...grpc.CallOption) (*QueryGetProposedCertificateResponse, error) - // Queries a list of ProposedCertificate items. - ProposedCertificateAll(ctx context.Context, in *QueryAllProposedCertificateRequest, opts ...grpc.CallOption) (*QueryAllProposedCertificateResponse, error) - // Queries a ChildCertificates by index. - ChildCertificates(ctx context.Context, in *QueryGetChildCertificatesRequest, opts ...grpc.CallOption) (*QueryGetChildCertificatesResponse, error) - // Queries a ProposedCertificateRevocation by index. - ProposedCertificateRevocation(ctx context.Context, in *QueryGetProposedCertificateRevocationRequest, opts ...grpc.CallOption) (*QueryGetProposedCertificateRevocationResponse, error) - // Queries a list of ProposedCertificateRevocation items. - ProposedCertificateRevocationAll(ctx context.Context, in *QueryAllProposedCertificateRevocationRequest, opts ...grpc.CallOption) (*QueryAllProposedCertificateRevocationResponse, error) - // Queries a RevokedCertificates by index. - RevokedCertificates(ctx context.Context, in *QueryGetRevokedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedCertificatesResponse, error) - // Queries a list of RevokedCertificates items. - RevokedCertificatesAll(ctx context.Context, in *QueryAllRevokedCertificatesRequest, opts ...grpc.CallOption) (*QueryAllRevokedCertificatesResponse, error) - // Queries a ApprovedRootCertificates by index. - ApprovedRootCertificates(ctx context.Context, in *QueryGetApprovedRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetApprovedRootCertificatesResponse, error) - // Queries a RevokedRootCertificates by index. - RevokedRootCertificates(ctx context.Context, in *QueryGetRevokedRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedRootCertificatesResponse, error) +func (m *QueryNocCertificatesResponse) Reset() { *m = QueryNocCertificatesResponse{} } +func (m *QueryNocCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNocCertificatesResponse) ProtoMessage() {} +func (*QueryNocCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{59} +} +func (m *QueryNocCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNocCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNocCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNocCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNocCertificatesResponse.Merge(m, src) +} +func (m *QueryNocCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNocCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNocCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNocCertificatesResponse proto.InternalMessageInfo + +func (m *QueryNocCertificatesResponse) GetNocCertificates() []NocCertificates { + if m != nil { + return m.NocCertificates + } + return nil +} + +func (m *QueryNocCertificatesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetNocCertificatesBySubjectRequest struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` +} + +func (m *QueryGetNocCertificatesBySubjectRequest) Reset() { + *m = QueryGetNocCertificatesBySubjectRequest{} +} +func (m *QueryGetNocCertificatesBySubjectRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetNocCertificatesBySubjectRequest) ProtoMessage() {} +func (*QueryGetNocCertificatesBySubjectRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{60} +} +func (m *QueryGetNocCertificatesBySubjectRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocCertificatesBySubjectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocCertificatesBySubjectRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNocCertificatesBySubjectRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocCertificatesBySubjectRequest.Merge(m, src) +} +func (m *QueryGetNocCertificatesBySubjectRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocCertificatesBySubjectRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocCertificatesBySubjectRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocCertificatesBySubjectRequest proto.InternalMessageInfo + +func (m *QueryGetNocCertificatesBySubjectRequest) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +type QueryGetNocCertificatesBySubjectResponse struct { + NocCertificatesBySubject NocCertificatesBySubject `protobuf:"bytes,1,opt,name=nocCertificatesBySubject,proto3" json:"nocCertificatesBySubject"` +} + +func (m *QueryGetNocCertificatesBySubjectResponse) Reset() { + *m = QueryGetNocCertificatesBySubjectResponse{} +} +func (m *QueryGetNocCertificatesBySubjectResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetNocCertificatesBySubjectResponse) ProtoMessage() {} +func (*QueryGetNocCertificatesBySubjectResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{61} +} +func (m *QueryGetNocCertificatesBySubjectResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocCertificatesBySubjectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocCertificatesBySubjectResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNocCertificatesBySubjectResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocCertificatesBySubjectResponse.Merge(m, src) +} +func (m *QueryGetNocCertificatesBySubjectResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocCertificatesBySubjectResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocCertificatesBySubjectResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocCertificatesBySubjectResponse proto.InternalMessageInfo + +func (m *QueryGetNocCertificatesBySubjectResponse) GetNocCertificatesBySubject() NocCertificatesBySubject { + if m != nil { + return m.NocCertificatesBySubject + } + return NocCertificatesBySubject{} +} + +type QueryGetNocCertificatesRequest struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` +} + +func (m *QueryGetNocCertificatesRequest) Reset() { *m = QueryGetNocCertificatesRequest{} } +func (m *QueryGetNocCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetNocCertificatesRequest) ProtoMessage() {} +func (*QueryGetNocCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{62} +} +func (m *QueryGetNocCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNocCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocCertificatesRequest.Merge(m, src) +} +func (m *QueryGetNocCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocCertificatesRequest proto.InternalMessageInfo + +func (m *QueryGetNocCertificatesRequest) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *QueryGetNocCertificatesRequest) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +type QueryGetNocCertificatesResponse struct { + NocCertificates NocCertificates `protobuf:"bytes,1,opt,name=nocCertificates,proto3" json:"nocCertificates"` +} + +func (m *QueryGetNocCertificatesResponse) Reset() { *m = QueryGetNocCertificatesResponse{} } +func (m *QueryGetNocCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetNocCertificatesResponse) ProtoMessage() {} +func (*QueryGetNocCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_db6ffa8ae459ba1c, []int{63} +} +func (m *QueryGetNocCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNocCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocCertificatesResponse.Merge(m, src) +} +func (m *QueryGetNocCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocCertificatesResponse proto.InternalMessageInfo + +func (m *QueryGetNocCertificatesResponse) GetNocCertificates() NocCertificates { + if m != nil { + return m.NocCertificates + } + return NocCertificates{} +} + +func init() { + proto.RegisterType((*QueryAllCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllCertificatesRequest") + proto.RegisterType((*QueryAllCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllCertificatesResponse") + proto.RegisterType((*QueryGetAllCertificatesBySubjectRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetAllCertificatesBySubjectRequest") + proto.RegisterType((*QueryGetAllCertificatesBySubjectResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetAllCertificatesBySubjectResponse") + proto.RegisterType((*QueryGetCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetCertificatesRequest") + proto.RegisterType((*QueryGetCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetCertificatesResponse") + proto.RegisterType((*QueryGetApprovedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesRequest") + proto.RegisterType((*QueryGetApprovedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesResponse") + proto.RegisterType((*QueryAllApprovedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllApprovedCertificatesRequest") + proto.RegisterType((*QueryAllApprovedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllApprovedCertificatesResponse") + proto.RegisterType((*QueryGetProposedCertificateRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateRequest") + proto.RegisterType((*QueryGetProposedCertificateResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateResponse") + proto.RegisterType((*QueryAllProposedCertificateRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateRequest") + proto.RegisterType((*QueryAllProposedCertificateResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateResponse") + proto.RegisterType((*QueryGetChildCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetChildCertificatesRequest") + proto.RegisterType((*QueryGetChildCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetChildCertificatesResponse") + proto.RegisterType((*QueryGetProposedCertificateRevocationRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateRevocationRequest") + proto.RegisterType((*QueryGetProposedCertificateRevocationResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetProposedCertificateRevocationResponse") + proto.RegisterType((*QueryAllProposedCertificateRevocationRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateRevocationRequest") + proto.RegisterType((*QueryAllProposedCertificateRevocationResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllProposedCertificateRevocationResponse") + proto.RegisterType((*QueryGetRevokedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedCertificatesRequest") + proto.RegisterType((*QueryGetRevokedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedCertificatesResponse") + proto.RegisterType((*QueryAllRevokedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedCertificatesRequest") + proto.RegisterType((*QueryAllRevokedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedCertificatesResponse") + proto.RegisterType((*QueryGetApprovedRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedRootCertificatesRequest") + proto.RegisterType((*QueryGetApprovedRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedRootCertificatesResponse") + proto.RegisterType((*QueryGetRevokedRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedRootCertificatesRequest") + proto.RegisterType((*QueryGetRevokedRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedRootCertificatesResponse") + proto.RegisterType((*QueryGetApprovedCertificatesBySubjectRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesBySubjectRequest") + proto.RegisterType((*QueryGetApprovedCertificatesBySubjectResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesBySubjectResponse") + proto.RegisterType((*QueryGetRejectedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRejectedCertificatesRequest") + proto.RegisterType((*QueryGetRejectedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRejectedCertificatesResponse") + proto.RegisterType((*QueryAllRejectedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRejectedCertificatesRequest") + proto.RegisterType((*QueryAllRejectedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRejectedCertificatesResponse") + proto.RegisterType((*QueryGetPkiRevocationDistributionPointRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointRequest") + proto.RegisterType((*QueryGetPkiRevocationDistributionPointResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointResponse") + proto.RegisterType((*QueryAllPkiRevocationDistributionPointRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllPkiRevocationDistributionPointRequest") + proto.RegisterType((*QueryAllPkiRevocationDistributionPointResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllPkiRevocationDistributionPointResponse") + proto.RegisterType((*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest") + proto.RegisterType((*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse") + proto.RegisterType((*QueryGetNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesRequest") + proto.RegisterType((*QueryGetNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesResponse") + proto.RegisterType((*QueryAllNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesRequest") + proto.RegisterType((*QueryAllNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesResponse") + proto.RegisterType((*QueryGetNocIcaCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocIcaCertificatesRequest") + proto.RegisterType((*QueryGetNocIcaCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocIcaCertificatesResponse") + proto.RegisterType((*QueryAllNocIcaCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocIcaCertificatesRequest") + proto.RegisterType((*QueryAllNocIcaCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocIcaCertificatesResponse") + proto.RegisterType((*QueryGetRevokedNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocRootCertificatesRequest") + proto.RegisterType((*QueryGetRevokedNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocRootCertificatesResponse") + proto.RegisterType((*QueryAllRevokedNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocRootCertificatesRequest") + proto.RegisterType((*QueryAllRevokedNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocRootCertificatesResponse") + proto.RegisterType((*QueryGetRevokedNocIcaCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocIcaCertificatesRequest") + proto.RegisterType((*QueryGetRevokedNocIcaCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetRevokedNocIcaCertificatesResponse") + proto.RegisterType((*QueryAllRevokedNocIcaCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocIcaCertificatesRequest") + proto.RegisterType((*QueryAllRevokedNocIcaCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllRevokedNocIcaCertificatesResponse") + proto.RegisterType((*QueryGetNocCertificatesByVidAndSkidRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesByVidAndSkidRequest") + proto.RegisterType((*QueryGetNocCertificatesByVidAndSkidResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesByVidAndSkidResponse") + proto.RegisterType((*QueryNocCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryNocCertificatesRequest") + proto.RegisterType((*QueryNocCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryNocCertificatesResponse") + proto.RegisterType((*QueryGetNocCertificatesBySubjectRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesBySubjectRequest") + proto.RegisterType((*QueryGetNocCertificatesBySubjectResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesBySubjectResponse") + proto.RegisterType((*QueryGetNocCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesRequest") + proto.RegisterType((*QueryGetNocCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesResponse") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/query.proto", fileDescriptor_db6ffa8ae459ba1c) +} + +var fileDescriptor_db6ffa8ae459ba1c = []byte{ + // 2629 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5c, 0x5f, 0x6c, 0x5c, 0x47, + 0xf5, 0xce, 0xec, 0xfe, 0xd2, 0x9f, 0x3a, 0x8d, 0x08, 0x9d, 0xa4, 0x89, 0xb3, 0x89, 0x1d, 0x67, + 0xda, 0xd8, 0x8e, 0x83, 0x77, 0x9b, 0x84, 0x26, 0x50, 0xa9, 0x4d, 0xed, 0xb8, 0x75, 0x9d, 0x80, + 0x6b, 0xaf, 0xdb, 0x34, 0x49, 0x4b, 0x56, 0x77, 0xef, 0x5e, 0x9c, 0x8b, 0xaf, 0xf7, 0x6e, 0x77, + 0xd7, 0xa6, 0xc6, 0x32, 0x12, 0x15, 0xb4, 0x04, 0x09, 0x29, 0xb4, 0x3c, 0x14, 0x54, 0xf1, 0x40, + 0xa5, 0x8a, 0x77, 0x1e, 0x78, 0xe0, 0x81, 0x07, 0x5e, 0x2a, 0xf1, 0xd0, 0x0a, 0x24, 0xa8, 0x84, + 0x84, 0x50, 0x42, 0x05, 0xa8, 0x95, 0xf8, 0xf3, 0x00, 0x82, 0x07, 0x40, 0x77, 0xee, 0xb9, 0xbb, + 0xf7, 0xcf, 0xcc, 0xec, 0xdd, 0xb9, 0xb3, 0xce, 0xdb, 0xee, 0xde, 0xd9, 0x73, 0xe6, 0xfb, 0xce, + 0x37, 0x67, 0xce, 0xcc, 0x1e, 0x1b, 0x3f, 0xfa, 0x15, 0x7b, 0xa5, 0x6a, 0x59, 0x86, 0xe3, 0xd8, + 0x46, 0xdd, 0xb4, 0x4a, 0x35, 0xbb, 0xd5, 0x6e, 0xda, 0xd5, 0xf5, 0xb6, 0x55, 0x33, 0xdd, 0xb5, + 0x86, 0xff, 0xa9, 0x63, 0xd5, 0x56, 0xac, 0x66, 0xa9, 0xb1, 0x6a, 0x97, 0x5e, 0x5a, 0xb7, 0x9a, + 0x9b, 0xc5, 0x46, 0xd3, 0x6d, 0xbb, 0xa4, 0x18, 0xfd, 0x6e, 0x51, 0xf2, 0xdd, 0x62, 0x63, 0xd5, + 0x2e, 0x1c, 0x59, 0x71, 0xdd, 0x15, 0xc7, 0x2a, 0x19, 0x0d, 0xbb, 0x64, 0xd4, 0xeb, 0x6e, 0xdb, + 0x68, 0xdb, 0x6e, 0xbd, 0xe5, 0x5b, 0x2b, 0x4c, 0x9a, 0x6e, 0x6b, 0xcd, 0x6d, 0x95, 0xaa, 0x46, + 0xcb, 0xf2, 0xdd, 0x94, 0x36, 0x4e, 0x55, 0xad, 0xb6, 0x71, 0xaa, 0xd4, 0x30, 0x56, 0xec, 0x3a, + 0x1b, 0x0c, 0x63, 0x2f, 0xf6, 0x39, 0x6b, 0xa3, 0xd1, 0x68, 0xba, 0x1b, 0x56, 0xad, 0x62, 0x5a, + 0xcd, 0xb6, 0xfd, 0x45, 0xdb, 0x34, 0xda, 0x56, 0xe0, 0x77, 0xbe, 0x4f, 0x5b, 0x8d, 0xa6, 0xdb, + 0x70, 0x5b, 0x51, 0x5b, 0x60, 0x6a, 0xae, 0x4f, 0x53, 0xe6, 0x0d, 0xdb, 0xe1, 0xce, 0xe9, 0x59, + 0x0d, 0x73, 0xaa, 0x34, 0xad, 0x0d, 0xd7, 0x0c, 0xb3, 0xd6, 0x2f, 0x52, 0xcf, 0xc0, 0x2a, 0x9f, + 0xb4, 0x67, 0x54, 0x03, 0xd0, 0x74, 0xdd, 0x36, 0xcf, 0xe0, 0x82, 0xe2, 0xdc, 0x44, 0xf6, 0x9e, + 0xd3, 0xa1, 0x90, 0x4a, 0x75, 0xb3, 0xd2, 0x5a, 0xaf, 0x7e, 0xc9, 0x32, 0xdb, 0xca, 0x14, 0x7a, + 0x5f, 0xe6, 0x8a, 0xe5, 0x72, 0xbf, 0x31, 0x5e, 0xb5, 0x43, 0x21, 0xad, 0x74, 0x86, 0x7b, 0x6f, + 0x1a, 0xae, 0x5d, 0x0f, 0xa6, 0xd8, 0xd0, 0x6d, 0x97, 0xd1, 0x60, 0xb7, 0x5a, 0xeb, 0x56, 0x33, + 0x60, 0xa3, 0xb2, 0x6a, 0x6d, 0x56, 0xec, 0x1a, 0x78, 0x7c, 0xb2, 0x5f, 0xae, 0x1d, 0x87, 0x17, + 0xb2, 0xc5, 0x8c, 0x66, 0x92, 0xd1, 0xea, 0x77, 0x62, 0x75, 0xd7, 0xe4, 0x4d, 0xec, 0xa2, 0x82, + 0x19, 0x91, 0x2e, 0xe7, 0x15, 0x6c, 0xd9, 0xa6, 0xc1, 0x33, 0x55, 0x56, 0x5c, 0x32, 0xb2, 0xe9, + 0x2d, 0x65, 0xb0, 0x29, 0x98, 0xe6, 0x73, 0x19, 0x83, 0xe0, 0x85, 0x75, 0xc3, 0xae, 0x55, 0x8c, + 0x7a, 0xad, 0xd2, 0x5a, 0xed, 0x88, 0x6e, 0x51, 0x83, 0xd9, 0xa8, 0x5a, 0xf6, 0xaf, 0xb8, 0x2b, + 0x2e, 0x7b, 0x59, 0xf2, 0x5e, 0xc1, 0xa7, 0x87, 0xfc, 0x6d, 0xa9, 0xe2, 0x3f, 0xf0, 0xdf, 0xf8, + 0x8f, 0xa8, 0x85, 0x0f, 0x2f, 0x79, 0xfb, 0xd4, 0xb4, 0xe3, 0x5c, 0x08, 0x59, 0x2e, 0x5b, 0x2f, + 0xad, 0x5b, 0xad, 0x36, 0x79, 0x0a, 0xe3, 0xee, 0xc6, 0x35, 0x84, 0x46, 0xd1, 0xc4, 0x7d, 0xa7, + 0xc7, 0x8a, 0x60, 0xc1, 0xdb, 0xe5, 0x8a, 0xfe, 0x66, 0x0a, 0xbb, 0x5c, 0x71, 0xd1, 0x58, 0xb1, + 0xe0, 0xbb, 0xe5, 0xd0, 0x37, 0xe9, 0x2f, 0x11, 0x3e, 0xc2, 0xf7, 0xd3, 0x6a, 0xb8, 0xf5, 0x96, + 0x45, 0x6c, 0xbc, 0x27, 0x8c, 0x6c, 0x08, 0x8d, 0xe6, 0x27, 0xee, 0x3b, 0x7d, 0xbe, 0xcf, 0xed, + 0xb9, 0x18, 0x33, 0x3f, 0xf3, 0x7f, 0xef, 0xfe, 0xee, 0xe8, 0xae, 0x72, 0xc4, 0x34, 0x99, 0x8b, + 0x60, 0xca, 0x31, 0x4c, 0xe3, 0x3d, 0x31, 0xf9, 0xf3, 0x8c, 0x80, 0xba, 0x80, 0xc7, 0x19, 0xa6, + 0x39, 0xab, 0x1d, 0xf7, 0xbb, 0xb9, 0xec, 0x87, 0x25, 0xe0, 0x71, 0x08, 0xff, 0x3f, 0x04, 0x8a, + 0x91, 0x78, 0x6f, 0x39, 0x78, 0x4b, 0x7f, 0x82, 0xf0, 0x44, 0x6f, 0x2b, 0xc0, 0xd2, 0xb7, 0x10, + 0x1e, 0x32, 0x04, 0x83, 0x20, 0x3a, 0x4f, 0x67, 0xa5, 0x2c, 0xb0, 0x07, 0xdc, 0x09, 0xfd, 0xd1, + 0x17, 0x40, 0x3a, 0x73, 0x56, 0x9b, 0x27, 0x1d, 0x21, 0x64, 0x42, 0xf1, 0x1e, 0x78, 0x79, 0xc9, + 0xda, 0x9c, 0xaf, 0xb1, 0x10, 0xdc, 0x5b, 0x8e, 0x7c, 0x46, 0x6f, 0x06, 0x82, 0x49, 0x58, 0x17, + 0x0a, 0x06, 0x0d, 0x48, 0x30, 0xd4, 0xc4, 0x0f, 0x76, 0x22, 0x04, 0x5b, 0xac, 0x7e, 0xc0, 0xef, + 0x20, 0xfc, 0x90, 0xdc, 0x0b, 0x00, 0xff, 0x2a, 0xde, 0x6f, 0x70, 0x9e, 0x03, 0x01, 0xb3, 0x7d, + 0x13, 0xc0, 0xb1, 0x05, 0x2c, 0x70, 0xfd, 0xd0, 0xef, 0x20, 0xa0, 0x63, 0xda, 0x71, 0x64, 0x74, + 0x68, 0x4a, 0x1d, 0xa9, 0xc8, 0xfb, 0x4b, 0x40, 0x9e, 0x70, 0x4e, 0x3d, 0xc9, 0xcb, 0xef, 0x04, + 0x79, 0xfa, 0x72, 0x4f, 0x15, 0xd3, 0x40, 0x2d, 0x8b, 0x50, 0x38, 0x87, 0x1c, 0xe9, 0x91, 0xe4, + 0x0f, 0x51, 0x57, 0xf8, 0x5c, 0x27, 0x40, 0xea, 0x16, 0xde, 0xd7, 0x48, 0x3e, 0x86, 0x90, 0x5f, + 0xe8, 0x97, 0x53, 0x8e, 0x27, 0xa0, 0x94, 0xe7, 0x85, 0x3a, 0x40, 0xc4, 0xb4, 0xe3, 0x48, 0x88, + 0xd0, 0xb5, 0x8f, 0x7d, 0x14, 0x12, 0xbf, 0x12, 0x25, 0xf9, 0xc1, 0x53, 0xa2, 0x53, 0x64, 0xa3, + 0x9d, 0x1c, 0xec, 0x1d, 0xf3, 0x78, 0xcb, 0xfc, 0x00, 0xbe, 0xc7, 0xaf, 0xab, 0x41, 0x61, 0xf0, + 0x8e, 0x8c, 0xe1, 0x4f, 0x18, 0xeb, 0xed, 0x1b, 0x6e, 0xd3, 0x6e, 0x6f, 0x86, 0x25, 0x16, 0xfb, + 0x94, 0x7e, 0x1f, 0xe1, 0x63, 0x12, 0x27, 0xc0, 0xe7, 0x3a, 0xbe, 0xdf, 0x8c, 0x3f, 0x84, 0x30, + 0x4e, 0xf7, 0xcb, 0x66, 0xc2, 0x0b, 0x70, 0x99, 0xf4, 0x40, 0x6f, 0x21, 0xfc, 0x29, 0xe9, 0x0a, + 0x08, 0x8e, 0x1c, 0x5a, 0x16, 0x1c, 0x1b, 0x63, 0x35, 0x6d, 0xc3, 0x59, 0x58, 0x5f, 0xab, 0x5a, + 0xcd, 0xa1, 0x3c, 0x8c, 0x09, 0x7d, 0x46, 0x7f, 0x81, 0xf0, 0x54, 0xca, 0x29, 0x01, 0x77, 0xdf, + 0x43, 0x78, 0xb8, 0x21, 0x1b, 0x09, 0x44, 0x7e, 0x5e, 0x83, 0x2c, 0xbb, 0x46, 0x81, 0x54, 0xb9, + 0x67, 0xba, 0x01, 0xfc, 0x8a, 0x96, 0x53, 0x9c, 0x5f, 0x5d, 0xeb, 0xf8, 0xbb, 0x39, 0x60, 0xb1, + 0xb7, 0xe3, 0x3e, 0x58, 0xcc, 0xdf, 0x1d, 0x16, 0x07, 0xb2, 0xab, 0x94, 0xfd, 0x53, 0x91, 0xfe, + 0x42, 0x27, 0xbc, 0xab, 0x70, 0x9d, 0x74, 0x53, 0x68, 0x33, 0xf9, 0x58, 0x75, 0x57, 0xe1, 0x78, + 0x0a, 0x52, 0x28, 0xc7, 0x4b, 0x78, 0x57, 0x91, 0x10, 0x31, 0x88, 0x5d, 0x45, 0x89, 0x92, 0xfc, + 0xe0, 0x29, 0xd1, 0x27, 0xb2, 0x13, 0xa1, 0x63, 0x13, 0xd4, 0x48, 0x65, 0xd7, 0xe5, 0x9d, 0x21, + 0xa2, 0x87, 0x23, 0xe1, 0xd8, 0xf0, 0xe1, 0x48, 0x30, 0x48, 0xf9, 0x70, 0x24, 0xb0, 0xd7, 0x39, + 0x1c, 0x09, 0x9e, 0xd3, 0x09, 0x3c, 0x16, 0x13, 0xb9, 0x08, 0xe3, 0x8f, 0x51, 0x97, 0x0f, 0xe1, + 0x50, 0x80, 0xf8, 0x1a, 0xc2, 0x07, 0x9b, 0xfc, 0x31, 0x80, 0x70, 0x4e, 0x51, 0x05, 0x02, 0x80, + 0x22, 0x6f, 0xf4, 0xe9, 0xee, 0xc6, 0xc8, 0x2d, 0x82, 0xd3, 0x1f, 0x80, 0xc3, 0x1b, 0x5a, 0x0f, + 0x53, 0xa1, 0x54, 0x6c, 0xc8, 0x46, 0xaa, 0x6e, 0x68, 0x52, 0xf7, 0x41, 0x2a, 0x96, 0x7a, 0x0e, + 0x9f, 0x15, 0xcb, 0x70, 0x6f, 0xaa, 0x3f, 0x85, 0xbe, 0x1d, 0x3a, 0x2b, 0xf2, 0xbd, 0x84, 0x13, + 0x46, 0xe2, 0xb9, 0x7a, 0x0e, 0x4d, 0x98, 0xea, 0x26, 0x8c, 0xc4, 0x23, 0xba, 0x16, 0x4e, 0x6a, + 0x62, 0x2a, 0x74, 0x25, 0xd1, 0x8f, 0x43, 0x67, 0x40, 0x35, 0x52, 0xf2, 0x83, 0x27, 0x45, 0x5f, + 0x16, 0x7d, 0x2d, 0x5c, 0x07, 0xae, 0xda, 0xdd, 0x6a, 0x60, 0x36, 0x74, 0xf9, 0xbd, 0xe8, 0xda, + 0xf5, 0xce, 0x12, 0xfc, 0x24, 0xce, 0x6f, 0xd8, 0x35, 0xc6, 0xf0, 0xee, 0xb2, 0xf7, 0x92, 0xec, + 0xc7, 0xbb, 0x1d, 0xa3, 0x6a, 0x39, 0x20, 0x32, 0xff, 0x0d, 0x29, 0x62, 0xe2, 0xd7, 0xf0, 0xcb, + 0x5d, 0xcd, 0xcd, 0x42, 0x2d, 0xca, 0x79, 0x42, 0xdf, 0x43, 0xb8, 0x98, 0x76, 0x26, 0x10, 0x82, + 0xb7, 0x10, 0x1e, 0x91, 0x0f, 0x05, 0x21, 0x2c, 0xf4, 0x5d, 0x4d, 0x49, 0xad, 0x42, 0x64, 0x7a, + 0xf8, 0xa6, 0x5f, 0x0e, 0x15, 0x87, 0xa9, 0xa8, 0xd5, 0xa5, 0xe1, 0x37, 0x73, 0x40, 0x65, 0x0a, + 0xcf, 0xfd, 0x50, 0x99, 0xbf, 0x5b, 0x54, 0xea, 0xd3, 0x7b, 0x1b, 0xcf, 0xa4, 0x13, 0x59, 0x6b, + 0x66, 0x73, 0x3e, 0x21, 0xd2, 0x20, 0x50, 0x7c, 0x6d, 0x23, 0xa1, 0xb6, 0xdf, 0xce, 0xe1, 0x0b, + 0x99, 0xdc, 0x42, 0x94, 0x7e, 0x8b, 0xf0, 0x99, 0x46, 0xff, 0xdf, 0x07, 0x29, 0x99, 0x7a, 0x43, + 0xc7, 0x75, 0x05, 0xf1, 0x54, 0x99, 0x25, 0x3d, 0xdb, 0x3d, 0x36, 0x2c, 0xb8, 0xa6, 0xa0, 0xd0, + 0x49, 0xe6, 0x9f, 0xc8, 0x51, 0x80, 0xfb, 0xc5, 0x6e, 0xc6, 0xae, 0x27, 0x1f, 0xab, 0x6e, 0x63, + 0x1c, 0x4f, 0x41, 0xc6, 0xe6, 0x78, 0x09, 0x1f, 0x05, 0x24, 0xe0, 0x06, 0x71, 0x14, 0x50, 0xa2, + 0x24, 0x3f, 0x78, 0x4a, 0xf4, 0x2d, 0xea, 0x47, 0xba, 0x77, 0x3f, 0x0b, 0xae, 0x39, 0x6f, 0x1a, + 0xe9, 0x74, 0xf3, 0x03, 0x14, 0x11, 0x5c, 0xe2, 0x7b, 0xc0, 0xd1, 0xcb, 0x98, 0xd4, 0x13, 0x4f, + 0x21, 0x36, 0x33, 0x0a, 0x14, 0xc5, 0x2c, 0x01, 0x43, 0x1c, 0x1f, 0x74, 0x15, 0x70, 0xf9, 0x41, + 0x14, 0xe0, 0xd2, 0x25, 0x99, 0x3f, 0xa2, 0x88, 0x42, 0xfb, 0x65, 0x23, 0x3f, 0x68, 0x36, 0xf4, + 0xc9, 0xc5, 0xc6, 0x27, 0x62, 0x27, 0x25, 0xc9, 0x8a, 0xcc, 0x56, 0x62, 0xff, 0x0c, 0xe1, 0xc9, + 0x34, 0xbe, 0x80, 0xdc, 0x5b, 0x08, 0x17, 0x9a, 0xc2, 0x61, 0x10, 0xdc, 0x8b, 0x8a, 0x67, 0x33, + 0xf1, 0xea, 0x94, 0xf8, 0xa4, 0x2d, 0x20, 0xab, 0x7b, 0xa7, 0xb0, 0x03, 0xe9, 0xeb, 0x9b, 0x39, + 0xa0, 0xad, 0x87, 0xd7, 0xb4, 0xb4, 0xe5, 0x77, 0x9a, 0x36, 0x7d, 0x62, 0xbd, 0xd1, 0xbd, 0xba, + 0xe8, 0x4e, 0x48, 0x90, 0x0a, 0xb2, 0x69, 0xf5, 0xa7, 0x88, 0xb7, 0x2e, 0x44, 0x79, 0xe0, 0xdb, + 0x08, 0x1f, 0x6a, 0x8a, 0x46, 0x41, 0xe8, 0xe7, 0xd5, 0x29, 0xe7, 0xa7, 0x05, 0xb1, 0x47, 0xda, + 0x04, 0x9e, 0x22, 0x8a, 0x19, 0x70, 0xca, 0xfc, 0x7a, 0x8e, 0xb7, 0x38, 0x54, 0x19, 0xcb, 0xef, + 0x2c, 0x63, 0x3a, 0xaf, 0x7b, 0x27, 0x43, 0xdb, 0x68, 0xf4, 0x42, 0xe3, 0xb2, 0x5d, 0x9b, 0xae, + 0xd7, 0x96, 0x57, 0xed, 0x9a, 0xf8, 0xfc, 0x98, 0x46, 0x9c, 0x3f, 0x47, 0xf8, 0x64, 0x2a, 0x27, + 0x40, 0xf6, 0x1b, 0x08, 0x1f, 0xae, 0x8b, 0xc7, 0x41, 0xd0, 0x2f, 0x29, 0x6c, 0x58, 0x22, 0x93, + 0x40, 0xb8, 0xcc, 0x2b, 0xbd, 0x89, 0xa0, 0xd9, 0x21, 0x66, 0xe7, 0x6e, 0xfc, 0xd8, 0xfd, 0x41, + 0xd0, 0x1a, 0x91, 0x98, 0x0b, 0x50, 0xe8, 0xe2, 0xbd, 0x31, 0x2c, 0xaa, 0xed, 0x34, 0x71, 0xd6, + 0x7c, 0xa6, 0xe2, 0xd6, 0x07, 0xd2, 0x51, 0x93, 0x08, 0x98, 0x52, 0x47, 0x8d, 0xd8, 0x4a, 0xe8, + 0xd2, 0xb8, 0x2e, 0x18, 0xa4, 0x7a, 0x69, 0x2c, 0x72, 0x1a, 0x5c, 0x1a, 0x8b, 0xfc, 0xd1, 0xeb, + 0x78, 0x44, 0x30, 0x71, 0x3d, 0x1b, 0xc5, 0xeb, 0x08, 0x1f, 0x15, 0x3a, 0x90, 0x89, 0x07, 0x0d, + 0x4e, 0x3c, 0xa7, 0x6f, 0x3e, 0x81, 0x77, 0xb3, 0x49, 0x91, 0xf7, 0x10, 0xde, 0x1b, 0x7e, 0x34, + 0xed, 0x38, 0xa4, 0xef, 0x85, 0x2e, 0xe9, 0x66, 0x2b, 0x7c, 0x4e, 0x8f, 0x31, 0x9f, 0x29, 0x7a, + 0xec, 0x95, 0x5f, 0xfd, 0xe1, 0x8d, 0xdc, 0x61, 0x72, 0xa8, 0x54, 0x33, 0x9d, 0xa0, 0x9b, 0x73, + 0x2a, 0xd2, 0x6a, 0xf6, 0x6f, 0x84, 0x87, 0x44, 0xfd, 0x55, 0xe4, 0x79, 0xa5, 0xd9, 0xf4, 0x6e, + 0x36, 0x2b, 0x5c, 0xd1, 0x6f, 0x18, 0x20, 0x9f, 0x64, 0x90, 0x8f, 0x93, 0x07, 0x85, 0x90, 0x4b, + 0x5b, 0xa0, 0xb8, 0x6d, 0xf2, 0x21, 0xc2, 0x7b, 0x22, 0x69, 0xe2, 0x92, 0xea, 0xbc, 0xf4, 0xc5, + 0x52, 0xd0, 0x4d, 0x46, 0x1f, 0x65, 0xc0, 0x3e, 0x4d, 0x4e, 0xa7, 0x00, 0xd6, 0x79, 0xc5, 0x16, + 0xd5, 0x36, 0xb9, 0x83, 0xf0, 0x41, 0xde, 0x2f, 0x07, 0x9e, 0x7c, 0x97, 0x55, 0x15, 0x27, 0xe9, + 0xac, 0x2a, 0x3c, 0xab, 0xd7, 0x28, 0x50, 0x30, 0xcc, 0x28, 0x38, 0x48, 0x1e, 0xe8, 0x50, 0x10, + 0x91, 0xf2, 0x37, 0x72, 0x78, 0x58, 0xfa, 0xfb, 0x08, 0x79, 0x51, 0x59, 0x76, 0x29, 0x7e, 0x40, + 0x2a, 0x7c, 0x61, 0x40, 0xd6, 0x01, 0xfd, 0x38, 0x43, 0x7f, 0x8c, 0x1c, 0xe5, 0xa2, 0x0f, 0xa9, + 0xfa, 0x5f, 0x08, 0xef, 0xe7, 0x99, 0x54, 0x0c, 0xb5, 0xbc, 0xa7, 0x50, 0x31, 0xd4, 0x3d, 0x5a, + 0x08, 0xe9, 0x59, 0x06, 0xf6, 0x61, 0x52, 0xec, 0x01, 0x36, 0xae, 0xf4, 0xff, 0x22, 0xbc, 0x8f, + 0xd3, 0xae, 0x40, 0xca, 0xaa, 0xb3, 0x14, 0x77, 0x6c, 0x15, 0x96, 0xb5, 0xda, 0x04, 0xe0, 0xe7, + 0x19, 0xf0, 0xcf, 0x92, 0x73, 0x1d, 0xe0, 0x41, 0x63, 0x45, 0xca, 0xb5, 0xfe, 0x67, 0x84, 0x0f, + 0x70, 0x1c, 0x78, 0x4b, 0xbd, 0xac, 0xba, 0x2a, 0xb5, 0x93, 0x20, 0xef, 0x4d, 0xa3, 0x63, 0x8c, + 0x84, 0x51, 0x32, 0x22, 0x27, 0x81, 0xfc, 0x13, 0xe1, 0xfb, 0x13, 0xbd, 0x52, 0x64, 0x51, 0x39, + 0xef, 0x0a, 0x3a, 0xc8, 0x0a, 0x4b, 0x1a, 0x2d, 0x02, 0xc4, 0xc7, 0x18, 0xc4, 0x73, 0xe4, 0x91, + 0xae, 0xc0, 0xbd, 0xb1, 0xb1, 0x20, 0xfb, 0xf7, 0xfd, 0xdb, 0xa5, 0xad, 0x68, 0x4b, 0xda, 0x36, + 0xf9, 0x51, 0x0e, 0x0f, 0x4b, 0xdb, 0x72, 0xd4, 0x73, 0x5d, 0x9a, 0x2e, 0x27, 0xf5, 0x5c, 0x97, + 0xaa, 0x95, 0x89, 0x5e, 0x64, 0xec, 0xcc, 0x92, 0x99, 0xa4, 0x00, 0xba, 0x7f, 0x44, 0x93, 0x72, + 0x41, 0xbc, 0x9e, 0xc3, 0xa3, 0x52, 0xaf, 0xde, 0xd2, 0x78, 0x51, 0xab, 0x8c, 0xf5, 0xb0, 0x95, + 0xb6, 0xf1, 0x8b, 0x9e, 0x62, 0x6c, 0x9d, 0x24, 0x27, 0x52, 0xb3, 0x45, 0xfe, 0x83, 0xf0, 0x3e, + 0x4e, 0x77, 0x8d, 0x7a, 0x9e, 0x14, 0xf7, 0x20, 0xa9, 0xe7, 0x49, 0x49, 0xa3, 0x11, 0x7d, 0x9c, + 0x61, 0xfe, 0x0c, 0x39, 0xdb, 0xc1, 0x0c, 0xb7, 0x11, 0x29, 0x55, 0xf1, 0x27, 0x84, 0x0f, 0x70, + 0xec, 0x67, 0x4a, 0x93, 0xda, 0x39, 0x90, 0x37, 0x5b, 0xd1, 0xe3, 0x8c, 0x83, 0xa3, 0x64, 0x58, + 0xca, 0x01, 0xf9, 0x9b, 0x57, 0xe2, 0x0b, 0xba, 0x80, 0x32, 0x94, 0xf8, 0xf2, 0xc6, 0xa8, 0x0c, + 0x25, 0x7e, 0x8f, 0x2e, 0x2a, 0x4a, 0x19, 0xec, 0x23, 0xa4, 0xd0, 0x85, 0xed, 0xba, 0xed, 0x28, + 0xe6, 0x7f, 0x20, 0x7c, 0x50, 0xd0, 0x37, 0x44, 0x2e, 0x67, 0xd4, 0xa3, 0x08, 0xf1, 0xf3, 0xda, + 0xed, 0x02, 0xe0, 0x49, 0x06, 0xf8, 0x21, 0x42, 0x13, 0x71, 0x4e, 0x02, 0xff, 0x5a, 0xce, 0x5b, + 0xd8, 0xc9, 0xae, 0x8e, 0x0c, 0x8b, 0x50, 0xd8, 0x18, 0xa3, 0x5e, 0xfb, 0xc9, 0xba, 0x5f, 0x38, + 0x25, 0x50, 0xd0, 0xa6, 0x92, 0x72, 0x6d, 0x7f, 0xc4, 0xd6, 0x76, 0xc2, 0x43, 0xa6, 0xd3, 0x8e, + 0x7e, 0x1a, 0x7a, 0x34, 0x01, 0x71, 0x8a, 0x20, 0x2e, 0x0d, 0xe4, 0x9d, 0x5c, 0xaf, 0xf6, 0x0a, + 0xa2, 0xbe, 0x5b, 0xa7, 0xe9, 0x2d, 0x29, 0x5c, 0x1f, 0x94, 0x79, 0x60, 0xe2, 0x49, 0xc6, 0xc4, + 0x79, 0xf2, 0x58, 0x44, 0xff, 0xb0, 0xad, 0xf9, 0x7f, 0x3c, 0x1b, 0x94, 0x4a, 0xe1, 0x1f, 0xfd, + 0xb7, 0x4b, 0x5b, 0x1b, 0x76, 0x6d, 0xbb, 0xb4, 0xc5, 0x9a, 0x86, 0xb6, 0xc9, 0xab, 0x39, 0x7c, + 0x4c, 0xee, 0xd1, 0x53, 0x88, 0xfa, 0x5e, 0x3d, 0x40, 0xae, 0x52, 0x37, 0xdb, 0xf0, 0x92, 0x63, + 0x9c, 0x2b, 0xf2, 0x9b, 0x1c, 0x3e, 0xa3, 0xd0, 0x7f, 0x41, 0x9a, 0x83, 0x89, 0xb3, 0xac, 0x1d, + 0xa6, 0xd0, 0xda, 0x51, 0x9f, 0x40, 0xe2, 0x39, 0x46, 0xe2, 0x29, 0x52, 0xea, 0x53, 0x70, 0xe4, + 0xd7, 0x08, 0x93, 0xd8, 0xa5, 0xa2, 0xfa, 0x15, 0x21, 0xff, 0x82, 0x55, 0xf1, 0x5a, 0x49, 0x70, + 0x99, 0xca, 0xa9, 0x21, 0x0c, 0xc7, 0x99, 0xaa, 0xbb, 0x66, 0xa2, 0x5e, 0x1c, 0x12, 0x5d, 0x1a, + 0xab, 0xd7, 0x10, 0x3d, 0x6e, 0xd0, 0xd5, 0x6b, 0x88, 0x5e, 0x97, 0xea, 0xb4, 0xc4, 0x60, 0x9f, + 0x20, 0xe3, 0x52, 0xd8, 0xa1, 0x4b, 0x95, 0xbf, 0x23, 0xbc, 0x37, 0x66, 0x95, 0x2c, 0x68, 0x9a, + 0x5e, 0x00, 0xf7, 0x19, 0x6d, 0xf6, 0x84, 0x45, 0xb2, 0x1c, 0x25, 0xe7, 0xe8, 0x74, 0x58, 0xf2, + 0xb3, 0x14, 0xb9, 0xa6, 0x2d, 0x3e, 0x89, 0xdf, 0xf2, 0x0a, 0x2f, 0x0c, 0xc4, 0xb6, 0xf0, 0x32, + 0xd5, 0x23, 0x65, 0xc3, 0x8e, 0x57, 0x18, 0xfe, 0xfe, 0x11, 0x25, 0xe5, 0xaf, 0x08, 0xef, 0xe3, + 0xfd, 0x2c, 0x5f, 0xce, 0x30, 0x61, 0x51, 0x49, 0xb9, 0xac, 0xd5, 0x26, 0x80, 0x7f, 0x98, 0x81, + 0x9f, 0x24, 0x13, 0x09, 0xf0, 0x89, 0x72, 0xd2, 0x67, 0x80, 0xdd, 0x29, 0x71, 0x2c, 0x66, 0x3a, + 0x2c, 0x69, 0x47, 0x2d, 0x6f, 0x47, 0xe3, 0x94, 0x53, 0x1e, 0xea, 0x64, 0x01, 0xfd, 0xb1, 0x9f, + 0xc2, 0xe3, 0xbf, 0x68, 0x2f, 0x65, 0x88, 0x04, 0xbf, 0x55, 0xa0, 0x50, 0xd6, 0x69, 0x52, 0x98, + 0xd7, 0x82, 0xd8, 0xda, 0xa6, 0xc1, 0x0b, 0xed, 0x87, 0x08, 0x3f, 0x90, 0xb4, 0xe7, 0x45, 0x76, + 0x29, 0x43, 0x14, 0xb4, 0x22, 0x96, 0x36, 0x8d, 0x71, 0x36, 0x30, 0x0f, 0x71, 0x1c, 0x2d, 0x79, + 0x2b, 0x87, 0x0b, 0xe2, 0xae, 0x1b, 0x72, 0x35, 0xe3, 0xd9, 0x4d, 0xa2, 0xe6, 0x6b, 0x83, 0x30, + 0x0d, 0xe0, 0xe7, 0x18, 0xf8, 0x69, 0x72, 0x3e, 0x71, 0x32, 0xe4, 0x8a, 0x5b, 0x9c, 0xe9, 0x5f, + 0xcd, 0xe1, 0x61, 0xb1, 0x3f, 0x4f, 0x0e, 0x57, 0x33, 0xde, 0x60, 0x68, 0x67, 0x28, 0x55, 0xff, + 0x16, 0x2d, 0x32, 0x86, 0x26, 0xc8, 0x58, 0x3a, 0x86, 0xc8, 0x9b, 0x39, 0x7c, 0x48, 0xd8, 0xf8, + 0x42, 0xae, 0x64, 0x8f, 0xa5, 0x60, 0x69, 0x5c, 0x1d, 0x80, 0x65, 0xa0, 0xe0, 0x29, 0x46, 0xc1, + 0x13, 0xe4, 0x71, 0x2e, 0x05, 0xc9, 0xbc, 0x20, 0xd2, 0xc8, 0x2b, 0x39, 0x7c, 0x44, 0xe8, 0xcd, + 0x93, 0xc8, 0x95, 0xec, 0x71, 0xd4, 0xca, 0x4e, 0x9a, 0xd6, 0x29, 0x3a, 0xc5, 0xd8, 0x19, 0x27, + 0xc7, 0x53, 0xb1, 0x33, 0x73, 0xfd, 0xdd, 0xdb, 0x23, 0xe8, 0xfd, 0xdb, 0x23, 0xe8, 0xf7, 0xb7, + 0x47, 0xd0, 0xad, 0x3b, 0x23, 0xbb, 0xde, 0xbf, 0x33, 0xb2, 0xeb, 0x83, 0x3b, 0x23, 0xbb, 0xae, + 0xcd, 0xae, 0xd8, 0xed, 0x1b, 0xeb, 0xd5, 0xa2, 0xe9, 0xae, 0x95, 0xfc, 0xd9, 0x4e, 0xf1, 0xfe, + 0x6d, 0xce, 0x54, 0x77, 0xbe, 0x53, 0xf0, 0x8f, 0x73, 0x5e, 0x66, 0x6e, 0xdb, 0x9b, 0x0d, 0xab, + 0x55, 0xbd, 0x87, 0xfd, 0xd3, 0x9b, 0x33, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x88, 0x3d, 0x13, + 0x23, 0x32, 0x4e, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Queries a list of Certificates items. + CertificatesAll(ctx context.Context, in *QueryAllCertificatesRequest, opts ...grpc.CallOption) (*QueryAllCertificatesResponse, error) + // Queries a AllCertificatesBySubject by index. + AllCertificatesBySubject(ctx context.Context, in *QueryGetAllCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetAllCertificatesBySubjectResponse, error) + // Queries a Certificates by index. + Certificates(ctx context.Context, in *QueryGetCertificatesRequest, opts ...grpc.CallOption) (*QueryGetCertificatesResponse, error) + // Queries a list of ApprovedCertificates items. + ApprovedCertificatesAll(ctx context.Context, in *QueryAllApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryAllApprovedCertificatesResponse, error) // Queries a ApprovedCertificatesBySubject by index. ApprovedCertificatesBySubject(ctx context.Context, in *QueryGetApprovedCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesBySubjectResponse, error) + // Queries a ApprovedCertificates by index. + ApprovedCertificates(ctx context.Context, in *QueryGetApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesResponse, error) + // Queries a ProposedCertificate by index. + ProposedCertificate(ctx context.Context, in *QueryGetProposedCertificateRequest, opts ...grpc.CallOption) (*QueryGetProposedCertificateResponse, error) + // Queries a list of ProposedCertificate items. + ProposedCertificateAll(ctx context.Context, in *QueryAllProposedCertificateRequest, opts ...grpc.CallOption) (*QueryAllProposedCertificateResponse, error) + // Queries a ChildCertificates by index. + ChildCertificates(ctx context.Context, in *QueryGetChildCertificatesRequest, opts ...grpc.CallOption) (*QueryGetChildCertificatesResponse, error) + // Queries a ProposedCertificateRevocation by index. + ProposedCertificateRevocation(ctx context.Context, in *QueryGetProposedCertificateRevocationRequest, opts ...grpc.CallOption) (*QueryGetProposedCertificateRevocationResponse, error) + // Queries a list of ProposedCertificateRevocation items. + ProposedCertificateRevocationAll(ctx context.Context, in *QueryAllProposedCertificateRevocationRequest, opts ...grpc.CallOption) (*QueryAllProposedCertificateRevocationResponse, error) + // Queries a RevokedCertificates by index. + RevokedCertificates(ctx context.Context, in *QueryGetRevokedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedCertificatesResponse, error) + // Queries a list of RevokedCertificates items. + RevokedCertificatesAll(ctx context.Context, in *QueryAllRevokedCertificatesRequest, opts ...grpc.CallOption) (*QueryAllRevokedCertificatesResponse, error) + // Queries a ApprovedRootCertificates by index. + ApprovedRootCertificates(ctx context.Context, in *QueryGetApprovedRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetApprovedRootCertificatesResponse, error) + // Queries a RevokedRootCertificates by index. + RevokedRootCertificates(ctx context.Context, in *QueryGetRevokedRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedRootCertificatesResponse, error) // Queries a RejectedCertificate by index. RejectedCertificate(ctx context.Context, in *QueryGetRejectedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRejectedCertificatesResponse, error) // Queries a list of RejectedCertificate items. @@ -2614,10 +3447,16 @@ type QueryClient interface { PkiRevocationDistributionPointAll(ctx context.Context, in *QueryAllPkiRevocationDistributionPointRequest, opts ...grpc.CallOption) (*QueryAllPkiRevocationDistributionPointResponse, error) // Queries a PkiRevocationDistributionPointsByIssuerSubjectKeyID by index. PkiRevocationDistributionPointsByIssuerSubjectKeyID(ctx context.Context, in *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest, opts ...grpc.CallOption) (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse, error) - // Queries a NocRootCertificates by index. - NocRootCertificates(ctx context.Context, in *QueryGetNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesResponse, error) + // Queries a list of NocCertificates items. + NocCertificatesAll(ctx context.Context, in *QueryNocCertificatesRequest, opts ...grpc.CallOption) (*QueryNocCertificatesResponse, error) + // Queries a NocCertificatesBySubject by index. + NocCertificatesBySubject(ctx context.Context, in *QueryGetNocCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesBySubjectResponse, error) + // Queries a NocCertificates by index. + NocCertificates(ctx context.Context, in *QueryGetNocCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesResponse, error) // Queries a NocCertificatesByVidAndSkid by index. NocCertificatesByVidAndSkid(ctx context.Context, in *QueryGetNocCertificatesByVidAndSkidRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesByVidAndSkidResponse, error) + // Queries a NocRootCertificates by index. + NocRootCertificates(ctx context.Context, in *QueryGetNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesResponse, error) // Queries a list of NocRootCertificates items. NocRootCertificatesAll(ctx context.Context, in *QueryAllNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryAllNocRootCertificatesResponse, error) // Queries a NocIcaCertificates by index. @@ -2628,6 +3467,10 @@ type QueryClient interface { RevokedNocRootCertificates(ctx context.Context, in *QueryGetRevokedNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedNocRootCertificatesResponse, error) // Queries a list of RevokedNocRootCertificates items. RevokedNocRootCertificatesAll(ctx context.Context, in *QueryAllRevokedNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryAllRevokedNocRootCertificatesResponse, error) + // Queries a RevokedNocIcaCertificates by index. + RevokedNocIcaCertificates(ctx context.Context, in *QueryGetRevokedNocIcaCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedNocIcaCertificatesResponse, error) + // Queries a list of RevokedNocIcaCertificates items. + RevokedNocIcaCertificatesAll(ctx context.Context, in *QueryAllRevokedNocIcaCertificatesRequest, opts ...grpc.CallOption) (*QueryAllRevokedNocIcaCertificatesResponse, error) } type queryClient struct { @@ -2638,36 +3481,72 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) ApprovedCertificates(ctx context.Context, in *QueryGetApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesResponse, error) { - out := new(QueryGetApprovedCertificatesResponse) - err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificates", in, out, opts...) +func (c *queryClient) CertificatesAll(ctx context.Context, in *QueryAllCertificatesRequest, opts ...grpc.CallOption) (*QueryAllCertificatesResponse, error) { + out := new(QueryAllCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/CertificatesAll", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ApprovedCertificatesAll(ctx context.Context, in *QueryAllApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryAllApprovedCertificatesResponse, error) { - out := new(QueryAllApprovedCertificatesResponse) - err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificatesAll", in, out, opts...) +func (c *queryClient) AllCertificatesBySubject(ctx context.Context, in *QueryGetAllCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetAllCertificatesBySubjectResponse, error) { + out := new(QueryGetAllCertificatesBySubjectResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/AllCertificatesBySubject", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ProposedCertificate(ctx context.Context, in *QueryGetProposedCertificateRequest, opts ...grpc.CallOption) (*QueryGetProposedCertificateResponse, error) { - out := new(QueryGetProposedCertificateResponse) - err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ProposedCertificate", in, out, opts...) +func (c *queryClient) Certificates(ctx context.Context, in *QueryGetCertificatesRequest, opts ...grpc.CallOption) (*QueryGetCertificatesResponse, error) { + out := new(QueryGetCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/Certificates", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ProposedCertificateAll(ctx context.Context, in *QueryAllProposedCertificateRequest, opts ...grpc.CallOption) (*QueryAllProposedCertificateResponse, error) { - out := new(QueryAllProposedCertificateResponse) - err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ProposedCertificateAll", in, out, opts...) +func (c *queryClient) ApprovedCertificatesAll(ctx context.Context, in *QueryAllApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryAllApprovedCertificatesResponse, error) { + out := new(QueryAllApprovedCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificatesAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ApprovedCertificatesBySubject(ctx context.Context, in *QueryGetApprovedCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesBySubjectResponse, error) { + out := new(QueryGetApprovedCertificatesBySubjectResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificatesBySubject", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ApprovedCertificates(ctx context.Context, in *QueryGetApprovedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesResponse, error) { + out := new(QueryGetApprovedCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ProposedCertificate(ctx context.Context, in *QueryGetProposedCertificateRequest, opts ...grpc.CallOption) (*QueryGetProposedCertificateResponse, error) { + out := new(QueryGetProposedCertificateResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ProposedCertificate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ProposedCertificateAll(ctx context.Context, in *QueryAllProposedCertificateRequest, opts ...grpc.CallOption) (*QueryAllProposedCertificateResponse, error) { + out := new(QueryAllProposedCertificateResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ProposedCertificateAll", in, out, opts...) if err != nil { return nil, err } @@ -2737,15 +3616,6 @@ func (c *queryClient) RevokedRootCertificates(ctx context.Context, in *QueryGetR return out, nil } -func (c *queryClient) ApprovedCertificatesBySubject(ctx context.Context, in *QueryGetApprovedCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetApprovedCertificatesBySubjectResponse, error) { - out := new(QueryGetApprovedCertificatesBySubjectResponse) - err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificatesBySubject", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) RejectedCertificate(ctx context.Context, in *QueryGetRejectedCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRejectedCertificatesResponse, error) { out := new(QueryGetRejectedCertificatesResponse) err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/RejectedCertificate", in, out, opts...) @@ -2791,9 +3661,27 @@ func (c *queryClient) PkiRevocationDistributionPointsByIssuerSubjectKeyID(ctx co return out, nil } -func (c *queryClient) NocRootCertificates(ctx context.Context, in *QueryGetNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesResponse, error) { - out := new(QueryGetNocRootCertificatesResponse) - err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificates", in, out, opts...) +func (c *queryClient) NocCertificatesAll(ctx context.Context, in *QueryNocCertificatesRequest, opts ...grpc.CallOption) (*QueryNocCertificatesResponse, error) { + out := new(QueryNocCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificatesAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NocCertificatesBySubject(ctx context.Context, in *QueryGetNocCertificatesBySubjectRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesBySubjectResponse, error) { + out := new(QueryGetNocCertificatesBySubjectResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificatesBySubject", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NocCertificates(ctx context.Context, in *QueryGetNocCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesResponse, error) { + out := new(QueryGetNocCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificates", in, out, opts...) if err != nil { return nil, err } @@ -2809,6 +3697,15 @@ func (c *queryClient) NocCertificatesByVidAndSkid(ctx context.Context, in *Query return out, nil } +func (c *queryClient) NocRootCertificates(ctx context.Context, in *QueryGetNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesResponse, error) { + out := new(QueryGetNocRootCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) NocRootCertificatesAll(ctx context.Context, in *QueryAllNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryAllNocRootCertificatesResponse, error) { out := new(QueryAllNocRootCertificatesResponse) err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificatesAll", in, out, opts...) @@ -2854,12 +3751,38 @@ func (c *queryClient) RevokedNocRootCertificatesAll(ctx context.Context, in *Que return out, nil } +func (c *queryClient) RevokedNocIcaCertificates(ctx context.Context, in *QueryGetRevokedNocIcaCertificatesRequest, opts ...grpc.CallOption) (*QueryGetRevokedNocIcaCertificatesResponse, error) { + out := new(QueryGetRevokedNocIcaCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/RevokedNocIcaCertificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RevokedNocIcaCertificatesAll(ctx context.Context, in *QueryAllRevokedNocIcaCertificatesRequest, opts ...grpc.CallOption) (*QueryAllRevokedNocIcaCertificatesResponse, error) { + out := new(QueryAllRevokedNocIcaCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/RevokedNocIcaCertificatesAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { - // Queries a ApprovedCertificates by index. - ApprovedCertificates(context.Context, *QueryGetApprovedCertificatesRequest) (*QueryGetApprovedCertificatesResponse, error) + // Queries a list of Certificates items. + CertificatesAll(context.Context, *QueryAllCertificatesRequest) (*QueryAllCertificatesResponse, error) + // Queries a AllCertificatesBySubject by index. + AllCertificatesBySubject(context.Context, *QueryGetAllCertificatesBySubjectRequest) (*QueryGetAllCertificatesBySubjectResponse, error) + // Queries a Certificates by index. + Certificates(context.Context, *QueryGetCertificatesRequest) (*QueryGetCertificatesResponse, error) // Queries a list of ApprovedCertificates items. ApprovedCertificatesAll(context.Context, *QueryAllApprovedCertificatesRequest) (*QueryAllApprovedCertificatesResponse, error) + // Queries a ApprovedCertificatesBySubject by index. + ApprovedCertificatesBySubject(context.Context, *QueryGetApprovedCertificatesBySubjectRequest) (*QueryGetApprovedCertificatesBySubjectResponse, error) + // Queries a ApprovedCertificates by index. + ApprovedCertificates(context.Context, *QueryGetApprovedCertificatesRequest) (*QueryGetApprovedCertificatesResponse, error) // Queries a ProposedCertificate by index. ProposedCertificate(context.Context, *QueryGetProposedCertificateRequest) (*QueryGetProposedCertificateResponse, error) // Queries a list of ProposedCertificate items. @@ -2878,8 +3801,6 @@ type QueryServer interface { ApprovedRootCertificates(context.Context, *QueryGetApprovedRootCertificatesRequest) (*QueryGetApprovedRootCertificatesResponse, error) // Queries a RevokedRootCertificates by index. RevokedRootCertificates(context.Context, *QueryGetRevokedRootCertificatesRequest) (*QueryGetRevokedRootCertificatesResponse, error) - // Queries a ApprovedCertificatesBySubject by index. - ApprovedCertificatesBySubject(context.Context, *QueryGetApprovedCertificatesBySubjectRequest) (*QueryGetApprovedCertificatesBySubjectResponse, error) // Queries a RejectedCertificate by index. RejectedCertificate(context.Context, *QueryGetRejectedCertificatesRequest) (*QueryGetRejectedCertificatesResponse, error) // Queries a list of RejectedCertificate items. @@ -2890,10 +3811,16 @@ type QueryServer interface { PkiRevocationDistributionPointAll(context.Context, *QueryAllPkiRevocationDistributionPointRequest) (*QueryAllPkiRevocationDistributionPointResponse, error) // Queries a PkiRevocationDistributionPointsByIssuerSubjectKeyID by index. PkiRevocationDistributionPointsByIssuerSubjectKeyID(context.Context, *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse, error) - // Queries a NocRootCertificates by index. - NocRootCertificates(context.Context, *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) + // Queries a list of NocCertificates items. + NocCertificatesAll(context.Context, *QueryNocCertificatesRequest) (*QueryNocCertificatesResponse, error) + // Queries a NocCertificatesBySubject by index. + NocCertificatesBySubject(context.Context, *QueryGetNocCertificatesBySubjectRequest) (*QueryGetNocCertificatesBySubjectResponse, error) + // Queries a NocCertificates by index. + NocCertificates(context.Context, *QueryGetNocCertificatesRequest) (*QueryGetNocCertificatesResponse, error) // Queries a NocCertificatesByVidAndSkid by index. NocCertificatesByVidAndSkid(context.Context, *QueryGetNocCertificatesByVidAndSkidRequest) (*QueryGetNocCertificatesByVidAndSkidResponse, error) + // Queries a NocRootCertificates by index. + NocRootCertificates(context.Context, *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) // Queries a list of NocRootCertificates items. NocRootCertificatesAll(context.Context, *QueryAllNocRootCertificatesRequest) (*QueryAllNocRootCertificatesResponse, error) // Queries a NocIcaCertificates by index. @@ -2904,18 +3831,34 @@ type QueryServer interface { RevokedNocRootCertificates(context.Context, *QueryGetRevokedNocRootCertificatesRequest) (*QueryGetRevokedNocRootCertificatesResponse, error) // Queries a list of RevokedNocRootCertificates items. RevokedNocRootCertificatesAll(context.Context, *QueryAllRevokedNocRootCertificatesRequest) (*QueryAllRevokedNocRootCertificatesResponse, error) + // Queries a RevokedNocIcaCertificates by index. + RevokedNocIcaCertificates(context.Context, *QueryGetRevokedNocIcaCertificatesRequest) (*QueryGetRevokedNocIcaCertificatesResponse, error) + // Queries a list of RevokedNocIcaCertificates items. + RevokedNocIcaCertificatesAll(context.Context, *QueryAllRevokedNocIcaCertificatesRequest) (*QueryAllRevokedNocIcaCertificatesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) ApprovedCertificates(ctx context.Context, req *QueryGetApprovedCertificatesRequest) (*QueryGetApprovedCertificatesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApprovedCertificates not implemented") +func (*UnimplementedQueryServer) CertificatesAll(ctx context.Context, req *QueryAllCertificatesRequest) (*QueryAllCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CertificatesAll not implemented") +} +func (*UnimplementedQueryServer) AllCertificatesBySubject(ctx context.Context, req *QueryGetAllCertificatesBySubjectRequest) (*QueryGetAllCertificatesBySubjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllCertificatesBySubject not implemented") +} +func (*UnimplementedQueryServer) Certificates(ctx context.Context, req *QueryGetCertificatesRequest) (*QueryGetCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Certificates not implemented") } func (*UnimplementedQueryServer) ApprovedCertificatesAll(ctx context.Context, req *QueryAllApprovedCertificatesRequest) (*QueryAllApprovedCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ApprovedCertificatesAll not implemented") } +func (*UnimplementedQueryServer) ApprovedCertificatesBySubject(ctx context.Context, req *QueryGetApprovedCertificatesBySubjectRequest) (*QueryGetApprovedCertificatesBySubjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApprovedCertificatesBySubject not implemented") +} +func (*UnimplementedQueryServer) ApprovedCertificates(ctx context.Context, req *QueryGetApprovedCertificatesRequest) (*QueryGetApprovedCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApprovedCertificates not implemented") +} func (*UnimplementedQueryServer) ProposedCertificate(ctx context.Context, req *QueryGetProposedCertificateRequest) (*QueryGetProposedCertificateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProposedCertificate not implemented") } @@ -2943,9 +3886,6 @@ func (*UnimplementedQueryServer) ApprovedRootCertificates(ctx context.Context, r func (*UnimplementedQueryServer) RevokedRootCertificates(ctx context.Context, req *QueryGetRevokedRootCertificatesRequest) (*QueryGetRevokedRootCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RevokedRootCertificates not implemented") } -func (*UnimplementedQueryServer) ApprovedCertificatesBySubject(ctx context.Context, req *QueryGetApprovedCertificatesBySubjectRequest) (*QueryGetApprovedCertificatesBySubjectResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApprovedCertificatesBySubject not implemented") -} func (*UnimplementedQueryServer) RejectedCertificate(ctx context.Context, req *QueryGetRejectedCertificatesRequest) (*QueryGetRejectedCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RejectedCertificate not implemented") } @@ -2961,12 +3901,21 @@ func (*UnimplementedQueryServer) PkiRevocationDistributionPointAll(ctx context.C func (*UnimplementedQueryServer) PkiRevocationDistributionPointsByIssuerSubjectKeyID(ctx context.Context, req *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PkiRevocationDistributionPointsByIssuerSubjectKeyID not implemented") } -func (*UnimplementedQueryServer) NocRootCertificates(ctx context.Context, req *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificates not implemented") +func (*UnimplementedQueryServer) NocCertificatesAll(ctx context.Context, req *QueryNocCertificatesRequest) (*QueryNocCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocCertificatesAll not implemented") +} +func (*UnimplementedQueryServer) NocCertificatesBySubject(ctx context.Context, req *QueryGetNocCertificatesBySubjectRequest) (*QueryGetNocCertificatesBySubjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocCertificatesBySubject not implemented") +} +func (*UnimplementedQueryServer) NocCertificates(ctx context.Context, req *QueryGetNocCertificatesRequest) (*QueryGetNocCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocCertificates not implemented") } func (*UnimplementedQueryServer) NocCertificatesByVidAndSkid(ctx context.Context, req *QueryGetNocCertificatesByVidAndSkidRequest) (*QueryGetNocCertificatesByVidAndSkidResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NocCertificatesByVidAndSkid not implemented") } +func (*UnimplementedQueryServer) NocRootCertificates(ctx context.Context, req *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificates not implemented") +} func (*UnimplementedQueryServer) NocRootCertificatesAll(ctx context.Context, req *QueryAllNocRootCertificatesRequest) (*QueryAllNocRootCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificatesAll not implemented") } @@ -2982,25 +3931,67 @@ func (*UnimplementedQueryServer) RevokedNocRootCertificates(ctx context.Context, func (*UnimplementedQueryServer) RevokedNocRootCertificatesAll(ctx context.Context, req *QueryAllRevokedNocRootCertificatesRequest) (*QueryAllRevokedNocRootCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RevokedNocRootCertificatesAll not implemented") } +func (*UnimplementedQueryServer) RevokedNocIcaCertificates(ctx context.Context, req *QueryGetRevokedNocIcaCertificatesRequest) (*QueryGetRevokedNocIcaCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevokedNocIcaCertificates not implemented") +} +func (*UnimplementedQueryServer) RevokedNocIcaCertificatesAll(ctx context.Context, req *QueryAllRevokedNocIcaCertificatesRequest) (*QueryAllRevokedNocIcaCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevokedNocIcaCertificatesAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_ApprovedCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetApprovedCertificatesRequest) +func _Query_CertificatesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllCertificatesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ApprovedCertificates(ctx, in) + return srv.(QueryServer).CertificatesAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificates", + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/CertificatesAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ApprovedCertificates(ctx, req.(*QueryGetApprovedCertificatesRequest)) + return srv.(QueryServer).CertificatesAll(ctx, req.(*QueryAllCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllCertificatesBySubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetAllCertificatesBySubjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllCertificatesBySubject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/AllCertificatesBySubject", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllCertificatesBySubject(ctx, req.(*QueryGetAllCertificatesBySubjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Certificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Certificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/Certificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Certificates(ctx, req.(*QueryGetCertificatesRequest)) } return interceptor(ctx, in, info, handler) } @@ -3023,6 +4014,42 @@ func _Query_ApprovedCertificatesAll_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _Query_ApprovedCertificatesBySubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetApprovedCertificatesBySubjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ApprovedCertificatesBySubject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificatesBySubject", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ApprovedCertificatesBySubject(ctx, req.(*QueryGetApprovedCertificatesBySubjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ApprovedCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetApprovedCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ApprovedCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ApprovedCertificates(ctx, req.(*QueryGetApprovedCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_ProposedCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryGetProposedCertificateRequest) if err := dec(in); err != nil { @@ -3185,24 +4212,6 @@ func _Query_RevokedRootCertificates_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _Query_ApprovedCertificatesBySubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetApprovedCertificatesBySubjectRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ApprovedCertificatesBySubject(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/ApprovedCertificatesBySubject", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ApprovedCertificatesBySubject(ctx, req.(*QueryGetApprovedCertificatesBySubjectRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_RejectedCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryGetRejectedCertificatesRequest) if err := dec(in); err != nil { @@ -3293,20 +4302,56 @@ func _Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_Handler(srv inte return interceptor(ctx, in, info, handler) } -func _Query_NocRootCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetNocRootCertificatesRequest) +func _Query_NocCertificatesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNocCertificatesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).NocRootCertificates(ctx, in) + return srv.(QueryServer).NocCertificatesAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificates", + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificatesAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NocRootCertificates(ctx, req.(*QueryGetNocRootCertificatesRequest)) + return srv.(QueryServer).NocCertificatesAll(ctx, req.(*QueryNocCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NocCertificatesBySubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNocCertificatesBySubjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NocCertificatesBySubject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificatesBySubject", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NocCertificatesBySubject(ctx, req.(*QueryGetNocCertificatesBySubjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NocCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNocCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NocCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NocCertificates(ctx, req.(*QueryGetNocCertificatesRequest)) } return interceptor(ctx, in, info, handler) } @@ -3329,6 +4374,24 @@ func _Query_NocCertificatesByVidAndSkid_Handler(srv interface{}, ctx context.Con return interceptor(ctx, in, info, handler) } +func _Query_NocRootCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNocRootCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NocRootCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NocRootCertificates(ctx, req.(*QueryGetNocRootCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_NocRootCertificatesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAllNocRootCertificatesRequest) if err := dec(in); err != nil { @@ -3419,18 +4482,70 @@ func _Query_RevokedNocRootCertificatesAll_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zigbeealliance.distributedcomplianceledger.pki.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ApprovedCertificates", - Handler: _Query_ApprovedCertificates_Handler, +func _Query_RevokedNocIcaCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRevokedNocIcaCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RevokedNocIcaCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/RevokedNocIcaCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RevokedNocIcaCertificates(ctx, req.(*QueryGetRevokedNocIcaCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RevokedNocIcaCertificatesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRevokedNocIcaCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RevokedNocIcaCertificatesAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/RevokedNocIcaCertificatesAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RevokedNocIcaCertificatesAll(ctx, req.(*QueryAllRevokedNocIcaCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "zigbeealliance.distributedcomplianceledger.pki.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CertificatesAll", + Handler: _Query_CertificatesAll_Handler, + }, + { + MethodName: "AllCertificatesBySubject", + Handler: _Query_AllCertificatesBySubject_Handler, + }, + { + MethodName: "Certificates", + Handler: _Query_Certificates_Handler, }, { MethodName: "ApprovedCertificatesAll", Handler: _Query_ApprovedCertificatesAll_Handler, }, + { + MethodName: "ApprovedCertificatesBySubject", + Handler: _Query_ApprovedCertificatesBySubject_Handler, + }, + { + MethodName: "ApprovedCertificates", + Handler: _Query_ApprovedCertificates_Handler, + }, { MethodName: "ProposedCertificate", Handler: _Query_ProposedCertificate_Handler, @@ -3467,10 +4582,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "RevokedRootCertificates", Handler: _Query_RevokedRootCertificates_Handler, }, - { - MethodName: "ApprovedCertificatesBySubject", - Handler: _Query_ApprovedCertificatesBySubject_Handler, - }, { MethodName: "RejectedCertificate", Handler: _Query_RejectedCertificate_Handler, @@ -3492,13 +4603,25 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_Handler, }, { - MethodName: "NocRootCertificates", - Handler: _Query_NocRootCertificates_Handler, + MethodName: "NocCertificatesAll", + Handler: _Query_NocCertificatesAll_Handler, + }, + { + MethodName: "NocCertificatesBySubject", + Handler: _Query_NocCertificatesBySubject_Handler, + }, + { + MethodName: "NocCertificates", + Handler: _Query_NocCertificates_Handler, }, { MethodName: "NocCertificatesByVidAndSkid", Handler: _Query_NocCertificatesByVidAndSkid_Handler, }, + { + MethodName: "NocRootCertificates", + Handler: _Query_NocRootCertificates_Handler, + }, { MethodName: "NocRootCertificatesAll", Handler: _Query_NocRootCertificatesAll_Handler, @@ -3519,11 +4642,236 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "RevokedNocRootCertificatesAll", Handler: _Query_RevokedNocRootCertificatesAll_Handler, }, + { + MethodName: "RevokedNocIcaCertificates", + Handler: _Query_RevokedNocIcaCertificates_Handler, + }, + { + MethodName: "RevokedNocIcaCertificatesAll", + Handler: _Query_RevokedNocIcaCertificatesAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "zigbeealliance/distributedcomplianceledger/pki/query.proto", } +func (m *QueryAllCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Certificates) > 0 { + for iNdEx := len(m.Certificates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certificates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetAllCertificatesBySubjectRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetAllCertificatesBySubjectRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAllCertificatesBySubjectRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetAllCertificatesBySubjectResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetAllCertificatesBySubjectResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAllCertificatesBySubjectResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.AllCertificatesBySubject.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Certificates.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *QueryGetApprovedCertificatesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5219,7 +6567,7 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) MarshalToSizedBuffer(dAtA [ return len(dAtA) - i, nil } -func (m *QueryGetNocCertificatesByVidAndSkidRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetRevokedNocIcaCertificatesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5229,12 +6577,12 @@ func (m *QueryGetNocCertificatesByVidAndSkidRequest) Marshal() (dAtA []byte, err return dAtA[:n], nil } -func (m *QueryGetNocCertificatesByVidAndSkidRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetRevokedNocIcaCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetNocCertificatesByVidAndSkidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetRevokedNocIcaCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -5246,15 +6594,17 @@ func (m *QueryGetNocCertificatesByVidAndSkidRequest) MarshalToSizedBuffer(dAtA [ i-- dAtA[i] = 0x12 } - if m.Vid != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Vid)) + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subject))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryGetNocCertificatesByVidAndSkidResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetRevokedNocIcaCertificatesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5264,18 +6614,18 @@ func (m *QueryGetNocCertificatesByVidAndSkidResponse) Marshal() (dAtA []byte, er return dAtA[:n], nil } -func (m *QueryGetNocCertificatesByVidAndSkidResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetRevokedNocIcaCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetNocCertificatesByVidAndSkidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetRevokedNocIcaCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.NocCertificatesByVidAndSkid.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RevokedNocIcaCertificates.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -5287,262 +6637,394 @@ func (m *QueryGetNocCertificatesByVidAndSkidResponse) MarshalToSizedBuffer(dAtA return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryGetApprovedCertificatesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryAllRevokedNocIcaCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryGetApprovedCertificatesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ApprovedCertificates.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryAllRevokedNocIcaCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllApprovedCertificatesRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryAllRevokedNocIcaCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryAllApprovedCertificatesResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAllRevokedNocIcaCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryAllRevokedNocIcaCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRevokedNocIcaCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.ApprovedCertificates) > 0 { - for _, e := range m.ApprovedCertificates { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.RevokedNocIcaCertificates) > 0 { + for iNdEx := len(m.RevokedNocIcaCertificates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RevokedNocIcaCertificates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryGetProposedCertificateRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesByVidAndSkidRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryGetNocCertificatesByVidAndSkidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocCertificatesByVidAndSkidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Vid != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Vid)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryGetProposedCertificateResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesByVidAndSkidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = m.ProposedCertificate.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return dAtA[:n], nil } -func (m *QueryAllProposedCertificateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryGetNocCertificatesByVidAndSkidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllProposedCertificateResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGetNocCertificatesByVidAndSkidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.ProposedCertificate) > 0 { - for _, e := range m.ProposedCertificate { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.NocCertificatesByVidAndSkid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryGetChildCertificatesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Issuer) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.AuthorityKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryNocCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryGetChildCertificatesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ChildCertificates.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryNocCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetProposedCertificateRevocationRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryNocCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 } - l = len(m.SerialNumber) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryGetProposedCertificateRevocationResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryNocCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryNocCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNocCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.ProposedCertificateRevocation.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NocCertificates) > 0 { + for iNdEx := len(m.NocCertificates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocCertificates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (m *QueryAllProposedCertificateRevocationRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesBySubjectRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryGetNocCertificatesBySubjectRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocCertificatesBySubjectRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryAllProposedCertificateRevocationResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesBySubjectResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryGetNocCertificatesBySubjectResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocCertificatesBySubjectResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.ProposedCertificateRevocation) > 0 { - for _, e := range m.ProposedCertificateRevocation { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.NocCertificatesBySubject.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryGetRevokedCertificatesRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryGetNocCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryGetRevokedCertificatesResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryGetNocCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.RevokedCertificates.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + { + size, err := m.NocCertificates.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryAllRevokedCertificatesRequest) Size() (n int) { +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryAllCertificatesRequest) Size() (n int) { if m == nil { return 0 } @@ -5555,14 +7037,14 @@ func (m *QueryAllRevokedCertificatesRequest) Size() (n int) { return n } -func (m *QueryAllRevokedCertificatesResponse) Size() (n int) { +func (m *QueryAllCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.RevokedCertificates) > 0 { - for _, e := range m.RevokedCertificates { + if len(m.Certificates) > 0 { + for _, e := range m.Certificates { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -5574,47 +7056,59 @@ func (m *QueryAllRevokedCertificatesResponse) Size() (n int) { return n } -func (m *QueryGetApprovedRootCertificatesRequest) Size() (n int) { +func (m *QueryGetAllCertificatesBySubjectRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryGetApprovedRootCertificatesResponse) Size() (n int) { +func (m *QueryGetAllCertificatesBySubjectResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.ApprovedRootCertificates.Size() + l = m.AllCertificatesBySubject.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryGetRevokedRootCertificatesRequest) Size() (n int) { +func (m *QueryGetCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryGetRevokedRootCertificatesResponse) Size() (n int) { +func (m *QueryGetCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.RevokedRootCertificates.Size() + l = m.Certificates.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryGetApprovedCertificatesBySubjectRequest) Size() (n int) { +func (m *QueryGetApprovedCertificatesRequest) Size() (n int) { if m == nil { return 0 } @@ -5624,28 +7118,32 @@ func (m *QueryGetApprovedCertificatesBySubjectRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryGetApprovedCertificatesBySubjectResponse) Size() (n int) { +func (m *QueryGetApprovedCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.ApprovedCertificatesBySubject.Size() + l = m.ApprovedCertificates.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryGetRejectedCertificatesRequest) Size() (n int) { +func (m *QueryAllApprovedCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Subject) - if l > 0 { + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } l = len(m.SubjectKeyId) @@ -5655,18 +7153,54 @@ func (m *QueryGetRejectedCertificatesRequest) Size() (n int) { return n } -func (m *QueryGetRejectedCertificatesResponse) Size() (n int) { +func (m *QueryAllApprovedCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.RejectedCertificate.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} + if len(m.ApprovedCertificates) > 0 { + for _, e := range m.ApprovedCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} -func (m *QueryAllRejectedCertificatesRequest) Size() (n int) { +func (m *QueryGetProposedCertificateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetProposedCertificateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ProposedCertificate.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllProposedCertificateRequest) Size() (n int) { if m == nil { return 0 } @@ -5679,14 +7213,14 @@ func (m *QueryAllRejectedCertificatesRequest) Size() (n int) { return n } -func (m *QueryAllRejectedCertificatesResponse) Size() (n int) { +func (m *QueryAllProposedCertificateResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.RejectedCertificate) > 0 { - for _, e := range m.RejectedCertificate { + if len(m.ProposedCertificate) > 0 { + for _, e := range m.ProposedCertificate { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -5698,38 +7232,67 @@ func (m *QueryAllRejectedCertificatesResponse) Size() (n int) { return n } -func (m *QueryGetPkiRevocationDistributionPointRequest) Size() (n int) { +func (m *QueryGetChildCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Vid != 0 { - n += 1 + sovQuery(uint64(m.Vid)) + l = len(m.Issuer) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - l = len(m.Label) + l = len(m.AuthorityKeyId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.IssuerSubjectKeyID) + return n +} + +func (m *QueryGetChildCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ChildCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetProposedCertificateRevocationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SerialNumber) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetPkiRevocationDistributionPointResponse) Size() (n int) { +func (m *QueryGetProposedCertificateRevocationResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.PkiRevocationDistributionPoint.Size() + l = m.ProposedCertificateRevocation.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllPkiRevocationDistributionPointRequest) Size() (n int) { +func (m *QueryAllProposedCertificateRevocationRequest) Size() (n int) { if m == nil { return 0 } @@ -5742,14 +7305,14 @@ func (m *QueryAllPkiRevocationDistributionPointRequest) Size() (n int) { return n } -func (m *QueryAllPkiRevocationDistributionPointResponse) Size() (n int) { +func (m *QueryAllProposedCertificateRevocationResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.PkiRevocationDistributionPoint) > 0 { - for _, e := range m.PkiRevocationDistributionPoint { + if len(m.ProposedCertificateRevocation) > 0 { + for _, e := range m.ProposedCertificateRevocation { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -5761,109 +7324,159 @@ func (m *QueryAllPkiRevocationDistributionPointResponse) Size() (n int) { return n } -func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Size() (n int) { +func (m *QueryGetRevokedCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.IssuerSubjectKeyID) + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Size() (n int) { +func (m *QueryGetRevokedCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.PkiRevocationDistributionPointsByIssuerSubjectKeyID.Size() + l = m.RevokedCertificates.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryGetNocRootCertificatesRequest) Size() (n int) { +func (m *QueryAllRevokedCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Vid != 0 { - n += 1 + sovQuery(uint64(m.Vid)) + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetNocRootCertificatesResponse) Size() (n int) { +func (m *QueryAllRevokedCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.NocRootCertificates.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.RevokedCertificates) > 0 { + for _, e := range m.RevokedCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryAllNocRootCertificatesRequest) Size() (n int) { +func (m *QueryGetApprovedRootCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetApprovedRootCertificatesResponse) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l + l = m.ApprovedRootCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllNocRootCertificatesResponse) Size() (n int) { +func (m *QueryGetRevokedRootCertificatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.NocRootCertificates) > 0 { - for _, e := range m.NocRootCertificates { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + return n +} + +func (m *QueryGetRevokedRootCertificatesResponse) Size() (n int) { + if m == nil { + return 0 } - if m.Pagination != nil { - l = m.Pagination.Size() + var l int + _ = l + l = m.RevokedRootCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetApprovedCertificatesBySubjectRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetNocIcaCertificatesRequest) Size() (n int) { +func (m *QueryGetApprovedCertificatesBySubjectResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Vid != 0 { - n += 1 + sovQuery(uint64(m.Vid)) + l = m.ApprovedCertificatesBySubject.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRejectedCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetNocIcaCertificatesResponse) Size() (n int) { +func (m *QueryGetRejectedCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.NocIcaCertificates.Size() + l = m.RejectedCertificate.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllNocIcaCertificatesRequest) Size() (n int) { +func (m *QueryAllRejectedCertificatesRequest) Size() (n int) { if m == nil { return 0 } @@ -5876,14 +7489,14 @@ func (m *QueryAllNocIcaCertificatesRequest) Size() (n int) { return n } -func (m *QueryAllNocIcaCertificatesResponse) Size() (n int) { +func (m *QueryAllRejectedCertificatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.NocIcaCertificates) > 0 { - for _, e := range m.NocIcaCertificates { + if len(m.RejectedCertificate) > 0 { + for _, e := range m.RejectedCertificate { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -5895,35 +7508,38 @@ func (m *QueryAllNocIcaCertificatesResponse) Size() (n int) { return n } -func (m *QueryGetRevokedNocRootCertificatesRequest) Size() (n int) { +func (m *QueryGetPkiRevocationDistributionPointRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Subject) + if m.Vid != 0 { + n += 1 + sovQuery(uint64(m.Vid)) + } + l = len(m.Label) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.SubjectKeyId) + l = len(m.IssuerSubjectKeyID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetRevokedNocRootCertificatesResponse) Size() (n int) { +func (m *QueryGetPkiRevocationDistributionPointResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.RevokedNocRootCertificates.Size() + l = m.PkiRevocationDistributionPoint.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllRevokedNocRootCertificatesRequest) Size() (n int) { +func (m *QueryAllPkiRevocationDistributionPointRequest) Size() (n int) { if m == nil { return 0 } @@ -5936,14 +7552,14 @@ func (m *QueryAllRevokedNocRootCertificatesRequest) Size() (n int) { return n } -func (m *QueryAllRevokedNocRootCertificatesResponse) Size() (n int) { +func (m *QueryAllPkiRevocationDistributionPointResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.RevokedNocRootCertificates) > 0 { - for _, e := range m.RevokedNocRootCertificates { + if len(m.PkiRevocationDistributionPoint) > 0 { + for _, e := range m.PkiRevocationDistributionPoint { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -5955,40 +7571,1985 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) Size() (n int) { return n } -func (m *QueryGetNocCertificatesByVidAndSkidRequest) Size() (n int) { +func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Vid != 0 { - n += 1 + sovQuery(uint64(m.Vid)) - } - l = len(m.SubjectKeyId) + l = len(m.IssuerSubjectKeyID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - return n -} + return n +} + +func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.PkiRevocationDistributionPointsByIssuerSubjectKeyID.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetNocRootCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vid != 0 { + n += 1 + sovQuery(uint64(m.Vid)) + } + return n +} + +func (m *QueryGetNocRootCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocRootCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllNocRootCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllNocRootCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.NocRootCertificates) > 0 { + for _, e := range m.NocRootCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNocIcaCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vid != 0 { + n += 1 + sovQuery(uint64(m.Vid)) + } + return n +} + +func (m *QueryGetNocIcaCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocIcaCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllNocIcaCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllNocIcaCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.NocIcaCertificates) > 0 { + for _, e := range m.NocIcaCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRevokedNocRootCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRevokedNocRootCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RevokedNocRootCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllRevokedNocRootCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRevokedNocRootCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RevokedNocRootCertificates) > 0 { + for _, e := range m.RevokedNocRootCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRevokedNocIcaCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRevokedNocIcaCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RevokedNocIcaCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllRevokedNocIcaCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRevokedNocIcaCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RevokedNocIcaCertificates) > 0 { + for _, e := range m.RevokedNocIcaCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNocCertificatesByVidAndSkidRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vid != 0 { + n += 1 + sovQuery(uint64(m.Vid)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNocCertificatesByVidAndSkidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocCertificatesByVidAndSkid.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryNocCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryNocCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.NocCertificates) > 0 { + for _, e := range m.NocCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNocCertificatesBySubjectRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNocCertificatesBySubjectResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocCertificatesBySubject.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetNocCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNocCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryAllCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certificates = append(m.Certificates, AllCertificates{}) + if err := m.Certificates[len(m.Certificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetAllCertificatesBySubjectRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetAllCertificatesBySubjectRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAllCertificatesBySubjectRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetAllCertificatesBySubjectResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetAllCertificatesBySubjectResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAllCertificatesBySubjectResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllCertificatesBySubject", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AllCertificatesBySubject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Certificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetApprovedCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetApprovedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetApprovedCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetApprovedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApprovedCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ApprovedCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllApprovedCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllApprovedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllApprovedCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllApprovedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApprovedCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ApprovedCertificates = append(m.ApprovedCertificates, ApprovedCertificates{}) + if err := m.ApprovedCertificates[len(m.ApprovedCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetProposedCertificateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetProposedCertificateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetProposedCertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetProposedCertificateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetProposedCertificateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetProposedCertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProposedCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllProposedCertificateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllProposedCertificateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllProposedCertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllProposedCertificateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllProposedCertificateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllProposedCertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProposedCertificate = append(m.ProposedCertificate, ProposedCertificate{}) + if err := m.ProposedCertificate[len(m.ProposedCertificate)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetChildCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetChildCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetChildCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Issuer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthorityKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetChildCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetChildCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetChildCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChildCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChildCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *QueryGetNocCertificatesByVidAndSkidResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.NocCertificatesByVidAndSkid.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *QueryGetApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6011,10 +9572,10 @@ func (m *QueryGetApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetProposedCertificateRevocationRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetProposedCertificateRevocationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6081,6 +9642,38 @@ func (m *QueryGetApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { } m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SerialNumber", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SerialNumber = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6102,7 +9695,7 @@ func (m *QueryGetApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6125,15 +9718,15 @@ func (m *QueryGetApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetProposedCertificateRevocationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetProposedCertificateRevocationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApprovedCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificateRevocation", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6160,7 +9753,7 @@ func (m *QueryGetApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ApprovedCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ProposedCertificateRevocation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6185,7 +9778,7 @@ func (m *QueryGetApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6208,10 +9801,10 @@ func (m *QueryAllApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllApprovedCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllProposedCertificateRevocationRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllApprovedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllProposedCertificateRevocationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6250,38 +9843,6 @@ func (m *QueryAllApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6303,7 +9864,7 @@ func (m *QueryAllApprovedCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6326,15 +9887,15 @@ func (m *QueryAllApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllApprovedCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllProposedCertificateRevocationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllApprovedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllProposedCertificateRevocationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApprovedCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificateRevocation", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6361,8 +9922,8 @@ func (m *QueryAllApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ApprovedCertificates = append(m.ApprovedCertificates, ApprovedCertificates{}) - if err := m.ApprovedCertificates[len(m.ApprovedCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ProposedCertificateRevocation = append(m.ProposedCertificateRevocation, ProposedCertificateRevocation{}) + if err := m.ProposedCertificateRevocation[len(m.ProposedCertificateRevocation)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6423,7 +9984,7 @@ func (m *QueryAllApprovedCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetProposedCertificateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6446,10 +10007,10 @@ func (m *QueryGetProposedCertificateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetProposedCertificateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetProposedCertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6537,7 +10098,7 @@ func (m *QueryGetProposedCertificateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetProposedCertificateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6560,15 +10121,15 @@ func (m *QueryGetProposedCertificateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetProposedCertificateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetProposedCertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RevokedCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6595,7 +10156,7 @@ func (m *QueryGetProposedCertificateResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ProposedCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RevokedCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6620,7 +10181,7 @@ func (m *QueryGetProposedCertificateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllProposedCertificateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6643,10 +10204,10 @@ func (m *QueryAllProposedCertificateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllProposedCertificateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRevokedCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllProposedCertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRevokedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6706,7 +10267,7 @@ func (m *QueryAllProposedCertificateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllProposedCertificateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6729,15 +10290,15 @@ func (m *QueryAllProposedCertificateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllProposedCertificateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRevokedCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllProposedCertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRevokedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RevokedCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6764,8 +10325,8 @@ func (m *QueryAllProposedCertificateResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProposedCertificate = append(m.ProposedCertificate, ProposedCertificate{}) - if err := m.ProposedCertificate[len(m.ProposedCertificate)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RevokedCertificates = append(m.RevokedCertificates, RevokedCertificates{}) + if err := m.RevokedCertificates[len(m.RevokedCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6825,100 +10386,36 @@ func (m *QueryAllProposedCertificateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } return nil -} -func (m *QueryGetChildCertificatesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetChildCertificatesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetChildCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Issuer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorityKeyId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery +} +func (m *QueryGetApprovedRootCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.AuthorityKeyId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetApprovedRootCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetApprovedRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6940,7 +10437,7 @@ func (m *QueryGetChildCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetChildCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetApprovedRootCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6963,15 +10460,15 @@ func (m *QueryGetChildCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetChildCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetApprovedRootCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetChildCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetApprovedRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChildCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ApprovedRootCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6998,7 +10495,7 @@ func (m *QueryGetChildCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ChildCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ApprovedRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7023,7 +10520,7 @@ func (m *QueryGetChildCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedRootCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7046,108 +10543,12 @@ func (m *QueryGetProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) er fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetProposedCertificateRevocationRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedRootCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetProposedCertificateRevocationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SerialNumber", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SerialNumber = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7169,7 +10570,7 @@ func (m *QueryGetProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) er } return nil } -func (m *QueryGetProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedRootCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7192,15 +10593,15 @@ func (m *QueryGetProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) e fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetProposedCertificateRevocationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedRootCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetProposedCertificateRevocationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificateRevocation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RevokedRootCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7227,7 +10628,7 @@ func (m *QueryGetProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) e if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ProposedCertificateRevocation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RevokedRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7252,7 +10653,7 @@ func (m *QueryGetProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) e } return nil } -func (m *QueryAllProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetApprovedCertificatesBySubjectRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7275,17 +10676,17 @@ func (m *QueryAllProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) er fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllProposedCertificateRevocationRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllProposedCertificateRevocationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -7295,27 +10696,23 @@ func (m *QueryAllProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) er } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Subject = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -7338,7 +10735,7 @@ func (m *QueryAllProposedCertificateRevocationRequest) Unmarshal(dAtA []byte) er } return nil } -func (m *QueryAllProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetApprovedCertificatesBySubjectResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7361,49 +10758,15 @@ func (m *QueryAllProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) e fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllProposedCertificateRevocationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllProposedCertificateRevocationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedCertificateRevocation", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProposedCertificateRevocation = append(m.ProposedCertificateRevocation, ProposedCertificateRevocation{}) - if err := m.ProposedCertificateRevocation[len(m.ProposedCertificateRevocation)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ApprovedCertificatesBySubject", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7430,10 +10793,7 @@ func (m *QueryAllProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) e if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ApprovedCertificatesBySubject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7458,7 +10818,7 @@ func (m *QueryAllProposedCertificateRevocationResponse) Unmarshal(dAtA []byte) e } return nil } -func (m *QueryGetRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7481,10 +10841,10 @@ func (m *QueryGetRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRevokedCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRejectedCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRevokedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRejectedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7572,7 +10932,7 @@ func (m *QueryGetRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7595,15 +10955,15 @@ func (m *QueryGetRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRevokedCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRejectedCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRevokedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRejectedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RevokedCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RejectedCertificate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7630,7 +10990,7 @@ func (m *QueryGetRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.RevokedCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RejectedCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7655,7 +11015,7 @@ func (m *QueryGetRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7678,10 +11038,10 @@ func (m *QueryAllRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRevokedCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRejectedCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRevokedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRejectedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7741,7 +11101,7 @@ func (m *QueryAllRevokedCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7764,15 +11124,15 @@ func (m *QueryAllRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRevokedCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRejectedCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRevokedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRejectedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RevokedCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RejectedCertificate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7799,8 +11159,8 @@ func (m *QueryAllRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RevokedCertificates = append(m.RevokedCertificates, RevokedCertificates{}) - if err := m.RevokedCertificates[len(m.RevokedCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RejectedCertificate = append(m.RejectedCertificate, RejectedCertificate{}) + if err := m.RejectedCertificate[len(m.RejectedCertificate)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7861,7 +11221,7 @@ func (m *QueryAllRevokedCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetApprovedRootCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7884,12 +11244,95 @@ func (m *QueryGetApprovedRootCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetApprovedRootCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetApprovedRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + } + m.Vid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Vid |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuerSubjectKeyID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuerSubjectKeyID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7911,7 +11354,7 @@ func (m *QueryGetApprovedRootCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetApprovedRootCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7934,15 +11377,15 @@ func (m *QueryGetApprovedRootCertificatesResponse) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetApprovedRootCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetApprovedRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApprovedRootCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PkiRevocationDistributionPoint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7969,7 +11412,7 @@ func (m *QueryGetApprovedRootCertificatesResponse) Unmarshal(dAtA []byte) error if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ApprovedRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PkiRevocationDistributionPoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7994,7 +11437,7 @@ func (m *QueryGetApprovedRootCertificatesResponse) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryGetRevokedRootCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8017,12 +11460,48 @@ func (m *QueryGetRevokedRootCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRevokedRootCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRevokedRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -8044,7 +11523,7 @@ func (m *QueryGetRevokedRootCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetRevokedRootCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8067,15 +11546,15 @@ func (m *QueryGetRevokedRootCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRevokedRootCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRevokedRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RevokedRootCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PkiRevocationDistributionPoint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8102,7 +11581,44 @@ func (m *QueryGetRevokedRootCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.RevokedRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PkiRevocationDistributionPoint = append(m.PkiRevocationDistributionPoint, PkiRevocationDistributionPoint{}) + if err := m.PkiRevocationDistributionPoint[len(m.PkiRevocationDistributionPoint)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8127,7 +11643,7 @@ func (m *QueryGetRevokedRootCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetApprovedCertificatesBySubjectRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8150,15 +11666,15 @@ func (m *QueryGetApprovedCertificatesBySubjectRequest) Unmarshal(dAtA []byte) er fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IssuerSubjectKeyID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8186,7 +11702,7 @@ func (m *QueryGetApprovedCertificatesBySubjectRequest) Unmarshal(dAtA []byte) er if postIndex > l { return io.ErrUnexpectedEOF } - m.Subject = string(dAtA[iNdEx:postIndex]) + m.IssuerSubjectKeyID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -8209,7 +11725,7 @@ func (m *QueryGetApprovedCertificatesBySubjectRequest) Unmarshal(dAtA []byte) er } return nil } -func (m *QueryGetApprovedCertificatesBySubjectResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8232,15 +11748,15 @@ func (m *QueryGetApprovedCertificatesBySubjectResponse) Unmarshal(dAtA []byte) e fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetApprovedCertificatesBySubjectResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApprovedCertificatesBySubject", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PkiRevocationDistributionPointsByIssuerSubjectKeyID", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8267,7 +11783,7 @@ func (m *QueryGetApprovedCertificatesBySubjectResponse) Unmarshal(dAtA []byte) e if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ApprovedCertificatesBySubject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PkiRevocationDistributionPointsByIssuerSubjectKeyID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8292,7 +11808,7 @@ func (m *QueryGetApprovedCertificatesBySubjectResponse) Unmarshal(dAtA []byte) e } return nil } -func (m *QueryGetRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8305,59 +11821,27 @@ func (m *QueryGetRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { if iNdEx >= l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetRejectedCertificatesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRejectedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNocRootCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) } - var stringLen uint64 + m.Vid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -8367,24 +11851,11 @@ func (m *QueryGetRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Vid |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -8406,7 +11877,7 @@ func (m *QueryGetRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8429,15 +11900,15 @@ func (m *QueryGetRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRejectedCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocRootCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRejectedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RejectedCertificate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocRootCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8464,7 +11935,7 @@ func (m *QueryGetRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.RejectedCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NocRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8489,7 +11960,7 @@ func (m *QueryGetRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8512,10 +11983,10 @@ func (m *QueryAllRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRejectedCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllNocRootCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRejectedCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -8575,7 +12046,7 @@ func (m *QueryAllRejectedCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8598,15 +12069,15 @@ func (m *QueryAllRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRejectedCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllNocRootCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRejectedCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RejectedCertificate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocRootCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8633,8 +12104,8 @@ func (m *QueryAllRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RejectedCertificate = append(m.RejectedCertificate, RejectedCertificate{}) - if err := m.RejectedCertificate[len(m.RejectedCertificate)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.NocRootCertificates = append(m.NocRootCertificates, NocRootCertificates{}) + if err := m.NocRootCertificates[len(m.NocRootCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8695,7 +12166,7 @@ func (m *QueryAllRejectedCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8718,10 +12189,10 @@ func (m *QueryGetPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocIcaCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocIcaCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -8743,43 +12214,61 @@ func (m *QueryGetPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e break } } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNocIcaCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNocIcaCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IssuerSubjectKeyID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocIcaCertificates", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -8789,23 +12278,24 @@ func (m *QueryGetPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.IssuerSubjectKeyID = string(dAtA[iNdEx:postIndex]) + if err := m.NocIcaCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -8828,7 +12318,7 @@ func (m *QueryGetPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e } return nil } -func (m *QueryGetPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8851,15 +12341,15 @@ func (m *QueryGetPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllNocIcaCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllNocIcaCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PkiRevocationDistributionPoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8886,7 +12376,10 @@ func (m *QueryGetPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PkiRevocationDistributionPoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8911,7 +12404,7 @@ func (m *QueryGetPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) } return nil } -func (m *QueryAllPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8934,13 +12427,47 @@ func (m *QueryAllPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllNocIcaCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllNocIcaCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocIcaCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NocIcaCertificates = append(m.NocIcaCertificates, NocIcaCertificates{}) + if err := m.NocIcaCertificates[len(m.NocIcaCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -8970,7 +12497,7 @@ func (m *QueryAllPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e return io.ErrUnexpectedEOF } if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + m.Pagination = &query.PageResponse{} } if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8997,7 +12524,7 @@ func (m *QueryAllPkiRevocationDistributionPointRequest) Unmarshal(dAtA []byte) e } return nil } -func (m *QueryAllPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9020,17 +12547,17 @@ func (m *QueryAllPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPkiRevocationDistributionPointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PkiRevocationDistributionPoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9040,31 +12567,29 @@ func (m *QueryAllPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.PkiRevocationDistributionPoint = append(m.PkiRevocationDistributionPoint, PkiRevocationDistributionPoint{}) - if err := m.PkiRevocationDistributionPoint[len(m.PkiRevocationDistributionPoint)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Subject = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9074,27 +12599,23 @@ func (m *QueryAllPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -9117,7 +12638,7 @@ func (m *QueryAllPkiRevocationDistributionPointResponse) Unmarshal(dAtA []byte) } return nil } -func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9140,17 +12661,17 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Unm fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IssuerSubjectKeyID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocRootCertificates", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9160,23 +12681,24 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Unm } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.IssuerSubjectKeyID = string(dAtA[iNdEx:postIndex]) + if err := m.RevokedNocRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -9199,7 +12721,7 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) Unm } return nil } -func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9222,15 +12744,15 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Un fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PkiRevocationDistributionPointsByIssuerSubjectKeyID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9257,7 +12779,10 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Un if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PkiRevocationDistributionPointsByIssuerSubjectKeyID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -9282,7 +12807,7 @@ func (m *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse) Un } return nil } -func (m *QueryGetNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9305,17 +12830,17 @@ func (m *QueryGetNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNocRootCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocRootCertificates", wireType) } - m.Vid = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9325,11 +12850,62 @@ func (m *QueryGetNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Vid |= int32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RevokedNocRootCertificates = append(m.RevokedNocRootCertificates, RevokedNocRootCertificates{}) + if err := m.RevokedNocRootCertificates[len(m.RevokedNocRootCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -9351,7 +12927,7 @@ func (m *QueryGetNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9374,17 +12950,17 @@ func (m *QueryGetNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNocRootCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedNocIcaCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedNocIcaCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NocRootCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9394,24 +12970,55 @@ func (m *QueryGetNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NocRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -9434,7 +13041,7 @@ func (m *QueryGetNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetRevokedNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9457,15 +13064,15 @@ func (m *QueryAllNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllNocRootCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRevokedNocIcaCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRevokedNocIcaCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocIcaCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9492,10 +13099,7 @@ func (m *QueryAllNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RevokedNocIcaCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -9520,7 +13124,7 @@ func (m *QueryAllNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllRevokedNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9543,47 +13147,13 @@ func (m *QueryAllNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllNocRootCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRevokedNocIcaCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRevokedNocIcaCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NocRootCertificates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NocRootCertificates = append(m.NocRootCertificates, NocRootCertificates{}) - if err := m.NocRootCertificates[len(m.NocRootCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -9613,7 +13183,7 @@ func (m *QueryAllNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + m.Pagination = &query.PageRequest{} } if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9640,7 +13210,7 @@ func (m *QueryAllNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllRevokedNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9663,17 +13233,17 @@ func (m *QueryGetNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNocIcaCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRevokedNocIcaCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNocIcaCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRevokedNocIcaCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocIcaCertificates", wireType) } - m.Vid = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9683,64 +13253,29 @@ func (m *QueryGetNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Vid |= int32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetNocIcaCertificatesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNocIcaCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + } + m.RevokedNocIcaCertificates = append(m.RevokedNocIcaCertificates, RevokedNocIcaCertificates{}) + if err := m.RevokedNocIcaCertificates[len(m.RevokedNocIcaCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NocIcaCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9767,7 +13302,10 @@ func (m *QueryGetNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NocIcaCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -9792,7 +13330,7 @@ func (m *QueryGetNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocCertificatesByVidAndSkidRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9815,17 +13353,36 @@ func (m *QueryAllNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllNocIcaCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllNocIcaCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + } + m.Vid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Vid |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -9835,27 +13392,23 @@ func (m *QueryAllNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -9878,7 +13431,7 @@ func (m *QueryAllNocIcaCertificatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocCertificatesByVidAndSkidResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9901,49 +13454,15 @@ func (m *QueryAllNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllNocIcaCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllNocIcaCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NocIcaCertificates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NocIcaCertificates = append(m.NocIcaCertificates, NocIcaCertificates{}) - if err := m.NocIcaCertificates[len(m.NocIcaCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesByVidAndSkid", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -9970,10 +13489,7 @@ func (m *QueryAllNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NocCertificatesByVidAndSkid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -9998,7 +13514,7 @@ func (m *QueryAllNocIcaCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryNocCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10021,17 +13537,17 @@ func (m *QueryGetRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNocCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNocCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -10041,23 +13557,27 @@ func (m *QueryGetRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Subject = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { @@ -10112,7 +13632,7 @@ func (m *QueryGetRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryGetRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryNocCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10135,15 +13655,15 @@ func (m *QueryGetRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNocCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRevokedNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNocCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocRootCertificates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -10170,7 +13690,44 @@ func (m *QueryGetRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.RevokedNocRootCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.NocCertificates = append(m.NocCertificates, NocCertificates{}) + if err := m.NocCertificates[len(m.NocCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -10195,7 +13752,7 @@ func (m *QueryGetRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryAllRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocCertificatesBySubjectRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10218,17 +13775,17 @@ func (m *QueryAllRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocCertificatesBySubjectRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocCertificatesBySubjectRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -10238,27 +13795,23 @@ func (m *QueryAllRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Subject = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -10281,7 +13834,7 @@ func (m *QueryAllRevokedNocRootCertificatesRequest) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryAllRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocCertificatesBySubjectResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10304,49 +13857,15 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocCertificatesBySubjectResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRevokedNocRootCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocCertificatesBySubjectResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RevokedNocRootCertificates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RevokedNocRootCertificates = append(m.RevokedNocRootCertificates, RevokedNocRootCertificates{}) - if err := m.RevokedNocRootCertificates[len(m.RevokedNocRootCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesBySubject", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -10373,10 +13892,7 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NocCertificatesBySubject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -10401,7 +13917,7 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryGetNocCertificatesByVidAndSkidRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocCertificatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10424,17 +13940,17 @@ func (m *QueryGetNocCertificatesByVidAndSkidRequest) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocCertificatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) } - m.Vid = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -10444,11 +13960,24 @@ func (m *QueryGetNocCertificatesByVidAndSkidRequest) Unmarshal(dAtA []byte) erro } b := dAtA[iNdEx] iNdEx++ - m.Vid |= int32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) @@ -10502,7 +14031,7 @@ func (m *QueryGetNocCertificatesByVidAndSkidRequest) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryGetNocCertificatesByVidAndSkidResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetNocCertificatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -10525,15 +14054,15 @@ func (m *QueryGetNocCertificatesByVidAndSkidResponse) Unmarshal(dAtA []byte) err fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNocCertificatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNocCertificatesByVidAndSkidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNocCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesByVidAndSkid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -10560,7 +14089,7 @@ func (m *QueryGetNocCertificatesByVidAndSkidResponse) Unmarshal(dAtA []byte) err if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NocCertificatesByVidAndSkid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NocCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/pki/types/query.pb.gw.go b/x/pki/types/query.pb.gw.go index 154327dae..67ac490bb 100644 --- a/x/pki/types/query.pb.gw.go +++ b/x/pki/types/query.pb.gw.go @@ -33,8 +33,98 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_ApprovedCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetApprovedCertificatesRequest +var ( + filter_Query_CertificatesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_CertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CertificatesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CertificatesAll(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AllCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAllCertificatesBySubjectRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + msg, err := client.AllCertificatesBySubject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAllCertificatesBySubjectRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + msg, err := server.AllCertificatesBySubject(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Certificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetCertificatesRequest var metadata runtime.ServerMetadata var ( @@ -66,13 +156,13 @@ func request_Query_ApprovedCertificates_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) } - msg, err := client.ApprovedCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Certificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ApprovedCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetApprovedCertificatesRequest +func local_request_Query_Certificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetCertificatesRequest var metadata runtime.ServerMetadata var ( @@ -104,7 +194,7 @@ func local_request_Query_ApprovedCertificates_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) } - msg, err := server.ApprovedCertificates(ctx, &protoReq) + msg, err := server.Certificates(ctx, &protoReq) return msg, metadata, err } @@ -145,6 +235,136 @@ func local_request_Query_ApprovedCertificatesAll_0(ctx context.Context, marshale } +func request_Query_ApprovedCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetApprovedCertificatesBySubjectRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + msg, err := client.ApprovedCertificatesBySubject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ApprovedCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetApprovedCertificatesBySubjectRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + msg, err := server.ApprovedCertificatesBySubject(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ApprovedCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetApprovedCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + val, ok = pathParams["subjectKeyId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") + } + + protoReq.SubjectKeyId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) + } + + msg, err := client.ApprovedCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ApprovedCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetApprovedCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + val, ok = pathParams["subjectKeyId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") + } + + protoReq.SubjectKeyId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) + } + + msg, err := server.ApprovedCertificates(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_ProposedCertificate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGetProposedCertificateRequest var metadata runtime.ServerMetadata @@ -611,8 +831,8 @@ func local_request_Query_RevokedRootCertificates_0(ctx context.Context, marshale } -func request_Query_ApprovedCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetApprovedCertificatesBySubjectRequest +func request_Query_RejectedCertificate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRejectedCertificatesRequest var metadata runtime.ServerMetadata var ( @@ -633,39 +853,23 @@ func request_Query_ApprovedCertificatesBySubject_0(ctx context.Context, marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) } - msg, err := client.ApprovedCertificatesBySubject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ApprovedCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetApprovedCertificatesBySubjectRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["subject"] + val, ok = pathParams["subjectKeyId"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") } - protoReq.Subject, err = runtime.String(val) + protoReq.SubjectKeyId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) } - msg, err := server.ApprovedCertificatesBySubject(ctx, &protoReq) + msg, err := client.RejectedCertificate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func request_Query_RejectedCertificate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_RejectedCertificate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGetRejectedCertificatesRequest var metadata runtime.ServerMetadata @@ -698,55 +902,17 @@ func request_Query_RejectedCertificate_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) } - msg, err := client.RejectedCertificate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.RejectedCertificate(ctx, &protoReq) return msg, metadata, err } -func local_request_Query_RejectedCertificate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetRejectedCertificatesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["subject"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") - } - - protoReq.Subject, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) - } - - val, ok = pathParams["subjectKeyId"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") - } - - protoReq.SubjectKeyId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) - } - - msg, err := server.RejectedCertificate(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_RejectedCertificateAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_RejectedCertificateAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllRejectedCertificatesRequest +var ( + filter_Query_RejectedCertificateAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RejectedCertificateAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRejectedCertificatesRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -965,8 +1131,44 @@ func local_request_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(c } -func request_Query_NocRootCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetNocRootCertificatesRequest +var ( + filter_Query_NocCertificatesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_NocCertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNocCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NocCertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.NocCertificatesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NocCertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNocCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NocCertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.NocCertificatesAll(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_NocCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocCertificatesBySubjectRequest var metadata runtime.ServerMetadata var ( @@ -976,24 +1178,24 @@ func request_Query_NocRootCertificates_0(ctx context.Context, marshaler runtime. _ = err ) - val, ok = pathParams["vid"] + val, ok = pathParams["subject"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "vid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") } - protoReq.Vid, err = runtime.Int32(val) + protoReq.Subject, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "vid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) } - msg, err := client.NocRootCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.NocCertificatesBySubject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_NocRootCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetNocRootCertificatesRequest +func local_request_Query_NocCertificatesBySubject_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocCertificatesBySubjectRequest var metadata runtime.ServerMetadata var ( @@ -1003,18 +1205,94 @@ func local_request_Query_NocRootCertificates_0(ctx context.Context, marshaler ru _ = err ) - val, ok = pathParams["vid"] + val, ok = pathParams["subject"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "vid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") } - protoReq.Vid, err = runtime.Int32(val) + protoReq.Subject, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "vid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) } - msg, err := server.NocRootCertificates(ctx, &protoReq) + msg, err := server.NocCertificatesBySubject(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_NocCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + val, ok = pathParams["subjectKeyId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") + } + + protoReq.SubjectKeyId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) + } + + msg, err := client.NocCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NocCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + val, ok = pathParams["subjectKeyId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") + } + + protoReq.SubjectKeyId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) + } + + msg, err := server.NocCertificates(ctx, &protoReq) return msg, metadata, err } @@ -1095,6 +1373,60 @@ func local_request_Query_NocCertificatesByVidAndSkid_0(ctx context.Context, mars } +func request_Query_NocRootCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocRootCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["vid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "vid") + } + + protoReq.Vid, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "vid", err) + } + + msg, err := client.NocRootCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NocRootCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocRootCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["vid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "vid") + } + + protoReq.Vid, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "vid", err) + } + + msg, err := server.NocRootCertificates(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_NocRootCertificatesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -1333,13 +1665,125 @@ func local_request_Query_RevokedNocRootCertificatesAll_0(ctx context.Context, ma } +func request_Query_RevokedNocIcaCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRevokedNocIcaCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + val, ok = pathParams["subjectKeyId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") + } + + protoReq.SubjectKeyId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) + } + + msg, err := client.RevokedNocIcaCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RevokedNocIcaCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRevokedNocIcaCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subject"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject") + } + + protoReq.Subject, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err) + } + + val, ok = pathParams["subjectKeyId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subjectKeyId") + } + + protoReq.SubjectKeyId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subjectKeyId", err) + } + + msg, err := server.RevokedNocIcaCertificates(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RevokedNocIcaCertificatesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RevokedNocIcaCertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRevokedNocIcaCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RevokedNocIcaCertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RevokedNocIcaCertificatesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RevokedNocIcaCertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRevokedNocIcaCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RevokedNocIcaCertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RevokedNocIcaCertificatesAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer 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 RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_ApprovedCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1350,7 +1794,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ApprovedCertificates_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CertificatesAll_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 { @@ -1358,7 +1802,53 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ApprovedCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllCertificatesBySubject_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_Query_AllCertificatesBySubject_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_Query_AllCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Certificates_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_Query_Certificates_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_Query_Certificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1385,6 +1875,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ApprovedCertificatesBySubject_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_Query_ApprovedCertificatesBySubject_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_Query_ApprovedCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ApprovedCertificates_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_Query_ApprovedCertificates_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_Query_ApprovedCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_ProposedCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1592,7 +2128,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ApprovedCertificatesBySubject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RejectedCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1603,7 +2139,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ApprovedCertificatesBySubject_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RejectedCertificate_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 { @@ -1611,11 +2147,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ApprovedCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RejectedCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RejectedCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RejectedCertificateAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1626,7 +2162,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RejectedCertificate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RejectedCertificateAll_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 { @@ -1634,11 +2170,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_RejectedCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RejectedCertificateAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RejectedCertificateAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PkiRevocationDistributionPoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1649,7 +2185,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RejectedCertificateAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_PkiRevocationDistributionPoint_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 { @@ -1657,11 +2193,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_RejectedCertificateAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PkiRevocationDistributionPoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PkiRevocationDistributionPoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1672,7 +2208,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_PkiRevocationDistributionPoint_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_PkiRevocationDistributionPointAll_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 { @@ -1680,11 +2216,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PkiRevocationDistributionPoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PkiRevocationDistributionPointAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1695,7 +2231,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_PkiRevocationDistributionPointAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_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 { @@ -1703,11 +2239,103 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PkiRevocationDistributionPointAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificatesAll_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_Query_NocCertificatesAll_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_Query_NocCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificatesBySubject_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_Query_NocCertificatesBySubject_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_Query_NocCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificates_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_Query_NocCertificates_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_Query_NocCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificatesByVidAndSkid_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_Query_NocCertificatesByVidAndSkid_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_Query_NocCertificatesByVidAndSkid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NocRootCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1718,7 +2346,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_NocRootCertificates_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 { @@ -1726,11 +2354,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NocRootCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NocRootCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NocRootCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1741,7 +2369,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NocRootCertificates_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_NocRootCertificatesAll_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 { @@ -1749,11 +2377,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NocRootCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NocRootCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NocCertificatesByVidAndSkid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NocIcaCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1764,7 +2392,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NocCertificatesByVidAndSkid_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_NocIcaCertificates_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 { @@ -1772,11 +2400,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NocCertificatesByVidAndSkid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NocIcaCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NocRootCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NocIcaCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1787,7 +2415,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NocRootCertificatesAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_NocIcaCertificatesAll_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 { @@ -1795,11 +2423,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NocRootCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NocIcaCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NocIcaCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RevokedNocRootCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1810,7 +2438,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NocIcaCertificates_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RevokedNocRootCertificates_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 { @@ -1818,11 +2446,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NocIcaCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RevokedNocRootCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NocIcaCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RevokedNocRootCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1833,7 +2461,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NocIcaCertificatesAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RevokedNocRootCertificatesAll_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 { @@ -1841,11 +2469,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NocIcaCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RevokedNocRootCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RevokedNocRootCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RevokedNocIcaCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1856,7 +2484,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RevokedNocRootCertificates_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RevokedNocIcaCertificates_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 { @@ -1864,11 +2492,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_RevokedNocRootCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RevokedNocIcaCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RevokedNocRootCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RevokedNocIcaCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1879,7 +2507,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RevokedNocRootCertificatesAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RevokedNocIcaCertificatesAll_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 { @@ -1887,7 +2515,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_RevokedNocRootCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RevokedNocIcaCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1932,7 +2560,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_ApprovedCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CertificatesAll_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) @@ -1941,14 +2569,54 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ApprovedCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CertificatesAll_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ApprovedCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllCertificatesBySubject_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_Query_AllCertificatesBySubject_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Certificates_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_Query_Certificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Certificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1972,6 +2640,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ApprovedCertificatesBySubject_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_Query_ApprovedCertificatesBySubject_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ApprovedCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ApprovedCertificates_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_Query_ApprovedCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ApprovedCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_ProposedCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2152,7 +2860,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ApprovedCertificatesBySubject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RejectedCertificate_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) @@ -2161,18 +2869,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ApprovedCertificatesBySubject_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RejectedCertificate_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ApprovedCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RejectedCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RejectedCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RejectedCertificateAll_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) @@ -2181,18 +2889,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_RejectedCertificate_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RejectedCertificateAll_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RejectedCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RejectedCertificateAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RejectedCertificateAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PkiRevocationDistributionPoint_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) @@ -2201,18 +2909,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_RejectedCertificateAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_PkiRevocationDistributionPoint_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RejectedCertificateAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PkiRevocationDistributionPoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PkiRevocationDistributionPoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointAll_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) @@ -2221,18 +2929,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_PkiRevocationDistributionPoint_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_PkiRevocationDistributionPointAll_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_PkiRevocationDistributionPoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PkiRevocationDistributionPointAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_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) @@ -2241,18 +2949,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_PkiRevocationDistributionPointAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_PkiRevocationDistributionPointAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NocCertificatesAll_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) @@ -2261,18 +2969,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_NocCertificatesAll_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NocCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NocRootCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NocCertificatesBySubject_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) @@ -2281,14 +2989,34 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_NocRootCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_NocCertificatesBySubject_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_NocRootCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NocCertificatesBySubject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificates_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_Query_NocCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NocCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -2312,6 +3040,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_NocRootCertificates_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_Query_NocRootCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NocRootCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_NocRootCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2412,14 +3160,62 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_RevokedNocIcaCertificates_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_Query_RevokedNocIcaCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RevokedNocIcaCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RevokedNocIcaCertificatesAll_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_Query_RevokedNocIcaCertificatesAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RevokedNocIcaCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( - pattern_Query_ApprovedCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "all-certificates"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllCertificatesBySubject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "all-certificates", "subject"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Certificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "all-certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ApprovedCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "certificates"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ApprovedCertificatesBySubject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "certificates", "subject"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ApprovedCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ProposedCertificate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "proposed-certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ProposedCertificateAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "proposed-certificates"}, "", runtime.AssumeColonVerbOpt(false))) @@ -2438,8 +3234,6 @@ var ( pattern_Query_RevokedRootCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "revoked-root-certificates"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ApprovedCertificatesBySubject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "certificates", "subject"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_RejectedCertificate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "rejected-certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RejectedCertificateAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "rejected-certificates"}, "", runtime.AssumeColonVerbOpt(false))) @@ -2450,26 +3244,44 @@ var ( pattern_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "revocation-points", "issuerSubjectKeyID"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NocRootCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "noc-root-certificates", "vid"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NocCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "all-noc-certificates"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NocCertificatesBySubject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "all-noc-certificates", "subject"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NocCertificatesByVidAndSkid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "noc-certificates", "vid", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NocCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "all-noc-certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NocCertificatesByVidAndSkid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "noc-vid-certificates", "vid", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NocRootCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "noc-vid-root-certificates", "vid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_NocRootCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "noc-root-certificates"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NocIcaCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "noc-ica-certificates", "vid"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NocIcaCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "noc-vid-ica-certificates", "vid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_NocIcaCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "noc-ica-certificates"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RevokedNocRootCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "revoked-noc-root-certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RevokedNocRootCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "revoked-noc-root-certificates"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RevokedNocIcaCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dcl", "pki", "revoked-noc-ica-certificates", "subject", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RevokedNocIcaCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "revoked-noc-ica-certificates"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_ApprovedCertificates_0 = runtime.ForwardResponseMessage + forward_Query_CertificatesAll_0 = runtime.ForwardResponseMessage + + forward_Query_AllCertificatesBySubject_0 = runtime.ForwardResponseMessage + + forward_Query_Certificates_0 = runtime.ForwardResponseMessage forward_Query_ApprovedCertificatesAll_0 = runtime.ForwardResponseMessage + forward_Query_ApprovedCertificatesBySubject_0 = runtime.ForwardResponseMessage + + forward_Query_ApprovedCertificates_0 = runtime.ForwardResponseMessage + forward_Query_ProposedCertificate_0 = runtime.ForwardResponseMessage forward_Query_ProposedCertificateAll_0 = runtime.ForwardResponseMessage @@ -2488,8 +3300,6 @@ var ( forward_Query_RevokedRootCertificates_0 = runtime.ForwardResponseMessage - forward_Query_ApprovedCertificatesBySubject_0 = runtime.ForwardResponseMessage - forward_Query_RejectedCertificate_0 = runtime.ForwardResponseMessage forward_Query_RejectedCertificateAll_0 = runtime.ForwardResponseMessage @@ -2500,10 +3310,16 @@ var ( forward_Query_PkiRevocationDistributionPointsByIssuerSubjectKeyID_0 = runtime.ForwardResponseMessage - forward_Query_NocRootCertificates_0 = runtime.ForwardResponseMessage + forward_Query_NocCertificatesAll_0 = runtime.ForwardResponseMessage + + forward_Query_NocCertificatesBySubject_0 = runtime.ForwardResponseMessage + + forward_Query_NocCertificates_0 = runtime.ForwardResponseMessage forward_Query_NocCertificatesByVidAndSkid_0 = runtime.ForwardResponseMessage + forward_Query_NocRootCertificates_0 = runtime.ForwardResponseMessage + forward_Query_NocRootCertificatesAll_0 = runtime.ForwardResponseMessage forward_Query_NocIcaCertificates_0 = runtime.ForwardResponseMessage @@ -2513,4 +3329,8 @@ var ( forward_Query_RevokedNocRootCertificates_0 = runtime.ForwardResponseMessage forward_Query_RevokedNocRootCertificatesAll_0 = runtime.ForwardResponseMessage + + forward_Query_RevokedNocIcaCertificates_0 = runtime.ForwardResponseMessage + + forward_Query_RevokedNocIcaCertificatesAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/pki/types/revoked_noc_ica_certificates.pb.go b/x/pki/types/revoked_noc_ica_certificates.pb.go new file mode 100644 index 000000000..ce123681d --- /dev/null +++ b/x/pki/types/revoked_noc_ica_certificates.pb.go @@ -0,0 +1,473 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type RevokedNocIcaCertificates struct { + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + SubjectKeyId string `protobuf:"bytes,2,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty"` + Certs []*Certificate `protobuf:"bytes,3,rep,name=certs,proto3" json:"certs,omitempty"` + SchemaVersion uint32 `protobuf:"varint,4,opt,name=schemaVersion,proto3" json:"schemaVersion,omitempty"` +} + +func (m *RevokedNocIcaCertificates) Reset() { *m = RevokedNocIcaCertificates{} } +func (m *RevokedNocIcaCertificates) String() string { return proto.CompactTextString(m) } +func (*RevokedNocIcaCertificates) ProtoMessage() {} +func (*RevokedNocIcaCertificates) Descriptor() ([]byte, []int) { + return fileDescriptor_3d8baf15dcea807e, []int{0} +} +func (m *RevokedNocIcaCertificates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RevokedNocIcaCertificates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RevokedNocIcaCertificates.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RevokedNocIcaCertificates) XXX_Merge(src proto.Message) { + xxx_messageInfo_RevokedNocIcaCertificates.Merge(m, src) +} +func (m *RevokedNocIcaCertificates) XXX_Size() int { + return m.Size() +} +func (m *RevokedNocIcaCertificates) XXX_DiscardUnknown() { + xxx_messageInfo_RevokedNocIcaCertificates.DiscardUnknown(m) +} + +var xxx_messageInfo_RevokedNocIcaCertificates proto.InternalMessageInfo + +func (m *RevokedNocIcaCertificates) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *RevokedNocIcaCertificates) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +func (m *RevokedNocIcaCertificates) GetCerts() []*Certificate { + if m != nil { + return m.Certs + } + return nil +} + +func (m *RevokedNocIcaCertificates) GetSchemaVersion() uint32 { + if m != nil { + return m.SchemaVersion + } + return 0 +} + +func init() { + proto.RegisterType((*RevokedNocIcaCertificates)(nil), "zigbeealliance.distributedcomplianceledger.pki.RevokedNocIcaCertificates") +} + +func init() { + proto.RegisterFile("zigbeealliance/distributedcomplianceledger/pki/revoked_noc_ica_certificates.proto", fileDescriptor_3d8baf15dcea807e) +} + +var fileDescriptor_3d8baf15dcea807e = []byte{ + // 294 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0x3f, 0x4b, 0xfc, 0x30, + 0x1c, 0xc6, 0x2f, 0xbf, 0xfb, 0xa9, 0x18, 0xbd, 0xa5, 0x53, 0x75, 0x08, 0xe5, 0x70, 0xe8, 0xd2, + 0x14, 0x74, 0x74, 0x11, 0x75, 0x39, 0x04, 0xe1, 0x3a, 0x38, 0x38, 0x58, 0xd2, 0xf4, 0x6b, 0x2f, + 0xf6, 0x4f, 0x4a, 0x92, 0x8a, 0xe7, 0xab, 0xf0, 0x65, 0x39, 0x1e, 0x4e, 0x8e, 0xd2, 0xbe, 0x11, + 0xb1, 0x3d, 0xb1, 0x05, 0x11, 0x6e, 0x4b, 0x9e, 0xc0, 0xf3, 0x7c, 0xf2, 0xc1, 0xf3, 0x67, 0x91, + 0x44, 0x00, 0x2c, 0xcb, 0x04, 0x2b, 0x38, 0xf8, 0xb1, 0xd0, 0x46, 0x89, 0xa8, 0x32, 0x10, 0x73, + 0x99, 0x97, 0x5d, 0x9a, 0x41, 0x9c, 0x80, 0xf2, 0xcb, 0x54, 0xf8, 0x0a, 0x1e, 0x65, 0x0a, 0x71, + 0x58, 0x48, 0x1e, 0x0a, 0xce, 0x42, 0x0e, 0xca, 0x88, 0x7b, 0xc1, 0x99, 0x01, 0x4d, 0x4b, 0x25, + 0x8d, 0xb4, 0xe8, 0xb0, 0x92, 0xfe, 0x51, 0x49, 0xcb, 0x54, 0x1c, 0x9e, 0x6d, 0x88, 0xd0, 0x9b, + 0xec, 0x16, 0xa7, 0x6f, 0x08, 0x1f, 0x04, 0x1d, 0xd8, 0xb5, 0xe4, 0x33, 0xce, 0x2e, 0x7a, 0x54, + 0x96, 0x8d, 0x77, 0x74, 0x15, 0x3d, 0x00, 0x37, 0x36, 0x72, 0x90, 0xbb, 0x1b, 0x7c, 0x5f, 0xad, + 0x29, 0xde, 0x5f, 0x1f, 0xaf, 0x60, 0x39, 0x8b, 0xed, 0x7f, 0xed, 0xf3, 0x20, 0xb3, 0xe6, 0x78, + 0xeb, 0x6b, 0x50, 0xdb, 0x63, 0x67, 0xec, 0xee, 0x1d, 0x9f, 0x6e, 0xf8, 0x3b, 0xda, 0x43, 0x09, + 0xba, 0x26, 0xeb, 0x08, 0x4f, 0x34, 0x5f, 0x40, 0xce, 0x6e, 0x40, 0x69, 0x21, 0x0b, 0xfb, 0xbf, + 0x83, 0xdc, 0x49, 0x30, 0x0c, 0xcf, 0xef, 0x5e, 0x6b, 0x82, 0x56, 0x35, 0x41, 0x1f, 0x35, 0x41, + 0x2f, 0x0d, 0x19, 0xad, 0x1a, 0x32, 0x7a, 0x6f, 0xc8, 0xe8, 0xf6, 0x32, 0x11, 0x66, 0x51, 0x45, + 0x94, 0xcb, 0xdc, 0xef, 0x68, 0xbc, 0xdf, 0xe4, 0x79, 0x3f, 0x3c, 0xde, 0x5a, 0xdf, 0x53, 0x2b, + 0xd0, 0x2c, 0x4b, 0xd0, 0xd1, 0x76, 0xeb, 0xee, 0xe4, 0x33, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x5c, + 0x64, 0x75, 0x02, 0x02, 0x00, 0x00, +} + +func (m *RevokedNocIcaCertificates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RevokedNocIcaCertificates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RevokedNocIcaCertificates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SchemaVersion != 0 { + i = encodeVarintRevokedNocIcaCertificates(dAtA, i, uint64(m.SchemaVersion)) + i-- + dAtA[i] = 0x20 + } + if len(m.Certs) > 0 { + for iNdEx := len(m.Certs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRevokedNocIcaCertificates(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintRevokedNocIcaCertificates(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintRevokedNocIcaCertificates(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRevokedNocIcaCertificates(dAtA []byte, offset int, v uint64) int { + offset -= sovRevokedNocIcaCertificates(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RevokedNocIcaCertificates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovRevokedNocIcaCertificates(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovRevokedNocIcaCertificates(uint64(l)) + } + if len(m.Certs) > 0 { + for _, e := range m.Certs { + l = e.Size() + n += 1 + l + sovRevokedNocIcaCertificates(uint64(l)) + } + } + if m.SchemaVersion != 0 { + n += 1 + sovRevokedNocIcaCertificates(uint64(m.SchemaVersion)) + } + return n +} + +func sovRevokedNocIcaCertificates(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRevokedNocIcaCertificates(x uint64) (n int) { + return sovRevokedNocIcaCertificates(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RevokedNocIcaCertificates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RevokedNocIcaCertificates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RevokedNocIcaCertificates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certs = append(m.Certs, &Certificate{}) + if err := m.Certs[len(m.Certs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaVersion", wireType) + } + m.SchemaVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SchemaVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRevokedNocIcaCertificates(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRevokedNocIcaCertificates + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRevokedNocIcaCertificates(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRevokedNocIcaCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRevokedNocIcaCertificates + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRevokedNocIcaCertificates + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRevokedNocIcaCertificates + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRevokedNocIcaCertificates = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRevokedNocIcaCertificates = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRevokedNocIcaCertificates = fmt.Errorf("proto: unexpected end of group") +)