From bd08dd39a6b948630b7733a07ebee9e17f50c8ed Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Tue, 16 Apr 2024 20:10:11 +0500 Subject: [PATCH 1/7] Implement query NOC Root certificates by VID and SKID --- proto/pki/genesis.proto | 2 + ...oc_root_certificates_by_vid_and_skid.proto | 16 + proto/pki/query.proto | 16 + .../index.ts | 681 ++++++++--------- .../module/index.ts | 54 +- .../module/rest.ts | 36 +- .../module/types/pki/genesis.ts | 50 +- .../noc_root_certificates_by_vid_and_skid.ts | 136 ++++ .../module/types/pki/query.ts | 148 ++++ x/pki/client/cli/query_noc_certificates.go | 14 + x/pki/genesis.go | 5 + x/pki/genesis_test.go | 11 + ...y_noc_root_certificates_by_vid_and_skid.go | 28 + ..._root_certificates_by_vid_and_skid_test.go | 72 ++ x/pki/keeper/keeper.go | 11 + .../msg_server_add_noc_x_509_root_cert.go | 3 + .../msg_server_revoke_noc_x_509_root_cert.go | 37 + .../noc_root_certificates_by_vid_and_skid.go | 93 +++ ..._root_certificates_by_vid_and_skid_test.go | 67 ++ x/pki/types/genesis.go | 11 + x/pki/types/genesis.pb.go | 163 +++-- x/pki/types/genesis_test.go | 26 + ...y_noc_root_certificates_by_vid_and_skid.go | 29 + ...oc_root_certificates_by_vid_and_skid.pb.go | 455 ++++++++++++ x/pki/types/query.pb.go | 685 ++++++++++++++---- x/pki/types/query.pb.gw.go | 123 ++++ 26 files changed, 2428 insertions(+), 544 deletions(-) create mode 100644 proto/pki/noc_root_certificates_by_vid_and_skid.proto create mode 100644 vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_root_certificates_by_vid_and_skid.ts create mode 100644 x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go create mode 100644 x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go create mode 100644 x/pki/keeper/noc_root_certificates_by_vid_and_skid.go create mode 100644 x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go create mode 100644 x/pki/types/key_noc_root_certificates_by_vid_and_skid.go create mode 100644 x/pki/types/noc_root_certificates_by_vid_and_skid.pb.go diff --git a/proto/pki/genesis.proto b/proto/pki/genesis.proto index b0f814372..ffc2bd523 100644 --- a/proto/pki/genesis.proto +++ b/proto/pki/genesis.proto @@ -17,6 +17,7 @@ import "pki/approved_certificates_by_subject_key_id.proto"; import "pki/noc_root_certificates.proto"; import "pki/noc_ica_certificates.proto"; import "pki/revoked_noc_root_certificates.proto"; +import "pki/noc_root_certificates_by_vid_and_skid.proto"; // this line is used by starport scaffolding # genesis/proto/import import "gogoproto/gogo.proto"; @@ -40,5 +41,6 @@ message GenesisState { repeated NocRootCertificates nocRootCertificatesList = 14 [(gogoproto.nullable) = false]; repeated NocIcaCertificates nocIcaCertificatesList = 15 [(gogoproto.nullable) = false]; repeated RevokedNocRootCertificates revokedNocRootCertificatesList = 16 [(gogoproto.nullable) = false]; + repeated NocRootCertificatesByVidAndSkid nocRootCertificatesByVidAndSkidList = 17 [(gogoproto.nullable) = false]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/pki/noc_root_certificates_by_vid_and_skid.proto b/proto/pki/noc_root_certificates_by_vid_and_skid.proto new file mode 100644 index 000000000..0a248e851 --- /dev/null +++ b/proto/pki/noc_root_certificates_by_vid_and_skid.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +import "gogoproto/gogo.proto"; +import "pki/certificate.proto"; + +message NocRootCertificatesByVidAndSkid { + int32 vid = 1 [(gogoproto.moretags) = "validate:\"gte=1,lte=65535\""]; + string subjectKeyId = 2; + repeated Certificate certs = 3; + float tq = 4; + +} + diff --git a/proto/pki/query.proto b/proto/pki/query.proto index 4bfcb6730..9ecc12c9f 100644 --- a/proto/pki/query.proto +++ b/proto/pki/query.proto @@ -17,6 +17,7 @@ import "pki/pki_revocation_distribution_points_by_issuer_subject_key_id.proto"; import "pki/noc_root_certificates.proto"; import "pki/noc_ica_certificates.proto"; import "pki/revoked_noc_root_certificates.proto"; +import "pki/noc_root_certificates_by_vid_and_skid.proto"; // this line is used by starport scaffolding # 1 import "gogoproto/gogo.proto"; @@ -117,6 +118,11 @@ service Query { option (google.api.http).get = "/dcl/pki/noc-root-certificates/{vid}"; } + // Queries a NocRootCertificatesByVidAndSkid by index. + rpc NocRootCertificatesByVidAndSkid(QueryGetNocRootCertificatesByVidAndSkidRequest) returns (QueryGetNocRootCertificatesByVidAndSkidResponse) { + option (google.api.http).get = "/dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}"; + } + // Queries a list of NocRootCertificates items. rpc NocRootCertificatesAll(QueryAllNocRootCertificatesRequest) returns (QueryAllNocRootCertificatesResponse) { option (google.api.http).get = "/dcl/pki/noc-root-certificates"; @@ -352,4 +358,14 @@ message QueryAllRevokedNocRootCertificatesResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +message QueryGetNocRootCertificatesByVidAndSkidRequest { + int32 vid = 1; + string subjectKeyId = 2; + +} + +message QueryGetNocRootCertificatesByVidAndSkidResponse { + NocRootCertificatesByVidAndSkid nocRootCertificatesByVidAndSkid = 1 [(gogoproto.nullable) = false]; +} + // this line is used by starport scaffolding # 3 diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts index 6e6ea6b22..6fb633922 100755 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts @@ -12,6 +12,7 @@ import { ChildCertificates } from "./module/types/pki/child_certificates" import { Grant } from "./module/types/pki/grant" import { NocIcaCertificates } from "./module/types/pki/noc_ica_certificates" import { NocRootCertificates } from "./module/types/pki/noc_root_certificates" +import { NocRootCertificatesByVidAndSkid } from "./module/types/pki/noc_root_certificates_by_vid_and_skid" import { PkiRevocationDistributionPoint } from "./module/types/pki/pki_revocation_distribution_point" import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from "./module/types/pki/pki_revocation_distribution_points_by_issuer_subject_key_id" import { ProposedCertificate } from "./module/types/pki/proposed_certificate" @@ -23,7 +24,7 @@ import { RevokedRootCertificates } from "./module/types/pki/revoked_root_certifi import { UniqueCertificate } from "./module/types/pki/unique_certificate" -export { ApprovedCertificates, ApprovedCertificatesBySubject, ApprovedCertificatesBySubjectKeyId, ApprovedRootCertificates, Certificate, CertificateIdentifier, ChildCertificates, Grant, NocIcaCertificates, NocRootCertificates, PkiRevocationDistributionPoint, PkiRevocationDistributionPointsByIssuerSubjectKeyID, ProposedCertificate, ProposedCertificateRevocation, RejectedCertificate, RevokedCertificates, RevokedNocRootCertificates, RevokedRootCertificates, UniqueCertificate }; +export { ApprovedCertificates, ApprovedCertificatesBySubject, ApprovedCertificatesBySubjectKeyId, ApprovedRootCertificates, Certificate, CertificateIdentifier, ChildCertificates, Grant, NocIcaCertificates, NocRootCertificates, NocRootCertificatesByVidAndSkid, PkiRevocationDistributionPoint, PkiRevocationDistributionPointsByIssuerSubjectKeyID, ProposedCertificate, ProposedCertificateRevocation, RejectedCertificate, RevokedCertificates, RevokedNocRootCertificates, RevokedRootCertificates, UniqueCertificate }; async function initTxClient(vuexGetters) { return await txClient(vuexGetters['common/wallet/signer'], { @@ -79,6 +80,7 @@ const getDefaultState = () => { PkiRevocationDistributionPointAll: {}, PkiRevocationDistributionPointsByIssuerSubjectKeyID: {}, NocRootCertificates: {}, + NocRootCertificatesByVidAndSkid: {}, NocRootCertificatesAll: {}, NocIcaCertificates: {}, NocIcaCertificatesAll: {}, @@ -96,6 +98,7 @@ const getDefaultState = () => { Grant: getStructure(Grant.fromPartial({})), NocIcaCertificates: getStructure(NocIcaCertificates.fromPartial({})), NocRootCertificates: getStructure(NocRootCertificates.fromPartial({})), + NocRootCertificatesByVidAndSkid: getStructure(NocRootCertificatesByVidAndSkid.fromPartial({})), PkiRevocationDistributionPoint: getStructure(PkiRevocationDistributionPoint.fromPartial({})), PkiRevocationDistributionPointsByIssuerSubjectKeyID: getStructure(PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial({})), ProposedCertificate: getStructure(ProposedCertificate.fromPartial({})), @@ -105,7 +108,7 @@ const getDefaultState = () => { RevokedNocRootCertificates: getStructure(RevokedNocRootCertificates.fromPartial({})), RevokedRootCertificates: getStructure(RevokedRootCertificates.fromPartial({})), UniqueCertificate: getStructure(UniqueCertificate.fromPartial({})), - + }, _Registry: registry, _Subscriptions: new Set(), @@ -240,6 +243,12 @@ export default { ( params).query=null } return state.NocRootCertificates[JSON.stringify(params)] ?? {} + }, + getNocRootCertificatesByVidAndSkid: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NocRootCertificatesByVidAndSkid[JSON.stringify(params)] ?? {} }, getNocRootCertificatesAll: (state) => (params = { params: {}}) => { if (!( params).query) { @@ -271,7 +280,7 @@ export default { } return state.RevokedNocRootCertificatesAll[JSON.stringify(params)] ?? {} }, - + getTypeStructure: (state) => (type) => { return state._Structure[type].fields }, @@ -304,19 +313,19 @@ export default { } }) }, - - - - - - + + + + + + async QueryApprovedCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryApprovedCertificates( key.subject, key.subjectKeyId)).data - - + + commit('QUERY', { query: 'ApprovedCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryApprovedCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getApprovedCertificates']( { params: {...key}, query}) ?? {} @@ -325,20 +334,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryApprovedCertificatesAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryApprovedCertificatesAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryApprovedCertificatesAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -351,20 +360,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryProposedCertificate({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryProposedCertificate( key.subject, key.subjectKeyId)).data - - + + commit('QUERY', { query: 'ProposedCertificate', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposedCertificate', payload: { options: { all }, params: {...key},query }}) return getters['getProposedCertificate']( { params: {...key}, query}) ?? {} @@ -373,20 +382,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryProposedCertificateAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryProposedCertificateAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryProposedCertificateAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -399,20 +408,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryChildCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryChildCertificates( key.issuer, key.authorityKeyId)).data - - + + commit('QUERY', { query: 'ChildCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryChildCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getChildCertificates']( { params: {...key}, query}) ?? {} @@ -421,20 +430,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryProposedCertificateRevocation({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryProposedCertificateRevocation( key.subject, key.subjectKeyId, query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryProposedCertificateRevocation( key.subject, key.subjectKeyId, {...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -447,20 +456,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryProposedCertificateRevocationAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryProposedCertificateRevocationAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryProposedCertificateRevocationAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -473,20 +482,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRevokedCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRevokedCertificates( key.subject, key.subjectKeyId)).data - - + + commit('QUERY', { query: 'RevokedCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryRevokedCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getRevokedCertificates']( { params: {...key}, query}) ?? {} @@ -495,20 +504,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRevokedCertificatesAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRevokedCertificatesAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryRevokedCertificatesAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -521,20 +530,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryApprovedRootCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryApprovedRootCertificates()).data - - + + commit('QUERY', { query: 'ApprovedRootCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryApprovedRootCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getApprovedRootCertificates']( { params: {...key}, query}) ?? {} @@ -543,20 +552,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRevokedRootCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRevokedRootCertificates()).data - - + + commit('QUERY', { query: 'RevokedRootCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryRevokedRootCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getRevokedRootCertificates']( { params: {...key}, query}) ?? {} @@ -565,20 +574,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryApprovedCertificatesBySubject({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryApprovedCertificatesBySubject( key.subject)).data - - + + commit('QUERY', { query: 'ApprovedCertificatesBySubject', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryApprovedCertificatesBySubject', payload: { options: { all }, params: {...key},query }}) return getters['getApprovedCertificatesBySubject']( { params: {...key}, query}) ?? {} @@ -587,20 +596,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRejectedCertificate({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRejectedCertificate( key.subject, key.subjectKeyId)).data - - + + commit('QUERY', { query: 'RejectedCertificate', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryRejectedCertificate', payload: { options: { all }, params: {...key},query }}) return getters['getRejectedCertificate']( { params: {...key}, query}) ?? {} @@ -609,20 +618,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRejectedCertificateAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRejectedCertificateAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryRejectedCertificateAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -635,20 +644,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryPkiRevocationDistributionPoint({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPkiRevocationDistributionPoint( key.issuerSubjectKeyID, key.vid, key.label)).data - - + + commit('QUERY', { query: 'PkiRevocationDistributionPoint', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPkiRevocationDistributionPoint', payload: { options: { all }, params: {...key},query }}) return getters['getPkiRevocationDistributionPoint']( { params: {...key}, query}) ?? {} @@ -657,20 +666,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryPkiRevocationDistributionPointAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPkiRevocationDistributionPointAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryPkiRevocationDistributionPointAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -683,20 +692,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryPkiRevocationDistributionPointsByIssuerSubjectKeyID({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPkiRevocationDistributionPointsByIssuerSubjectKeyID( key.issuerSubjectKeyID)).data - - + + commit('QUERY', { query: 'PkiRevocationDistributionPointsByIssuerSubjectKeyID', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPkiRevocationDistributionPointsByIssuerSubjectKeyID', payload: { options: { all }, params: {...key},query }}) return getters['getPkiRevocationDistributionPointsByIssuerSubjectKeyID']( { params: {...key}, query}) ?? {} @@ -705,42 +714,64 @@ export default { } }, - - - - - - - + + + + + + + async QueryNocRootCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryNocRootCertificates( key.vid)).data - - + + commit('QUERY', { query: 'NocRootCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryNocRootCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getNocRootCertificates']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryNocRootCertificates', 'API Node Unavailable. Could not perform query: ' + e.message) - + } }, - - - - - - - + + + + + + + + async QueryNocRootCertificatesByVidAndSkid({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryNocRootCertificatesByVidAndSkid( key.vid, key.subjectKeyId)).data + + + commit('QUERY', { query: 'NocRootCertificatesByVidAndSkid', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNocRootCertificatesByVidAndSkid', payload: { options: { all }, params: {...key},query }}) + return getters['getNocRootCertificatesByVidAndSkid']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new SpVuexError('QueryClient:QueryNocRootCertificatesByVidAndSkid', 'API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + async QueryNocRootCertificatesAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryNocRootCertificatesAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryNocRootCertificatesAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -753,13 +784,13 @@ export default { } }, - - - - - - - + + + + + + + async QueryNocIcaCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; @@ -775,13 +806,13 @@ export default { } }, - - - - - - - + + + + + + + async QueryNocIcaCertificatesAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; @@ -801,20 +832,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRevokedNocRootCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRevokedNocRootCertificates( key.subject, key.subjectKeyId)).data - - + + commit('QUERY', { query: 'RevokedNocRootCertificates', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryRevokedNocRootCertificates', payload: { options: { all }, params: {...key},query }}) return getters['getRevokedNocRootCertificates']( { params: {...key}, query}) ?? {} @@ -823,20 +854,20 @@ export default { } }, - - - - - - - + + + + + + + async QueryRevokedNocRootCertificatesAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryRevokedNocRootCertificatesAll(query)).data - - + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryRevokedNocRootCertificatesAll({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); @@ -851,6 +882,21 @@ export default { }, + async sendMsgUpdatePkiRevocationDistributionPoint({ rootGetters }, { value, fee = [], memo = '' }) { + try { + const txClient=await initTxClient(rootGetters) + const msg = await txClient.msgUpdatePkiRevocationDistributionPoint(value) + const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, + gas: "200000" }, memo}) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') + }else{ + throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Send', 'Could not broadcast Tx: '+ e.message) + } + } + }, async sendMsgAddNocX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) @@ -866,63 +912,63 @@ export default { } } }, - async sendMsgDeletePkiRevocationDistributionPoint({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgApproveAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgDeletePkiRevocationDistributionPoint(value) + const msg = await txClient.msgApproveAddX509RootCert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgAssignVid({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgRevokeNocX509IcaCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgAssignVid(value) + const msg = await txClient.msgRevokeNocX509IcaCert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgAssignVid:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgAssignVid:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgApproveRevokeX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgRevokeX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgApproveRevokeX509RootCert(value) + const msg = await txClient.msgRevokeX509Cert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRevokeX509Cert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgRevokeX509Cert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgUpdatePkiRevocationDistributionPoint({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgAssignVid({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgUpdatePkiRevocationDistributionPoint(value) + const msg = await txClient.msgAssignVid(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgAssignVid:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgAssignVid:Send', 'Could not broadcast Tx: '+ e.message) } } }, @@ -956,142 +1002,140 @@ export default { } } }, - async sendMsgRevokeNocX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgRejectAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRevokeNocX509RootCert(value) + const msg = await txClient.msgRejectAddX509RootCert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgApproveAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgDeletePkiRevocationDistributionPoint({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgApproveAddX509RootCert(value) - const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, + const msg = await txClient.msgDeletePkiRevocationDistributionPoint(value) + const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgRevokeX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgProposeAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRevokeX509Cert(value) + const msg = await txClient.msgProposeAddX509RootCert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRevokeX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRevokeX509Cert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgRejectAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgProposeRevokeX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRejectAddX509RootCert(value) + const msg = await txClient.msgProposeRevokeX509RootCert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgProposeRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgProposeRevokeX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgAddX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgApproveRevokeX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgAddX509Cert(value) - const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, + const msg = await txClient.msgApproveRevokeX509RootCert(value) + const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgAddX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgAddX509Cert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgProposeAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgAddX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgProposeAddX509RootCert(value) + const msg = await txClient.msgAddX509Cert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgAddX509Cert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgAddX509Cert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgRemoveX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgRevokeNocX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRemoveX509Cert(value) + const msg = await txClient.msgRevokeNocX509RootCert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRemoveX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRemoveX509Cert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgProposeRevokeX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + async sendMsgRemoveX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgProposeRevokeX509RootCert(value) + const msg = await txClient.msgRemoveX509Cert(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgProposeRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRemoveX509Cert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgProposeRevokeX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgRemoveX509Cert:Send', 'Could not broadcast Tx: '+ e.message) } } }, - async sendMsgRevokeNocX509IcaCert({ rootGetters }, { value, fee = [], memo = '' }) { + + async MsgUpdatePkiRevocationDistributionPoint({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRevokeNocX509IcaCert(value) - const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, - gas: "200000" }, memo}) - return result + const msg = await txClient.msgUpdatePkiRevocationDistributionPoint(value) + return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Send', 'Could not broadcast Tx: '+ e.message) + throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Create', 'Could not create message: ' + e.message) } } }, - async MsgAddNocX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) @@ -1105,55 +1149,55 @@ export default { } } }, - async MsgDeletePkiRevocationDistributionPoint({ rootGetters }, { value }) { + async MsgApproveAddX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgDeletePkiRevocationDistributionPoint(value) + const msg = await txClient.msgApproveAddX509RootCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgAssignVid({ rootGetters }, { value }) { + async MsgRevokeNocX509IcaCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgAssignVid(value) + const msg = await txClient.msgRevokeNocX509IcaCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgAssignVid:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgAssignVid:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgApproveRevokeX509RootCert({ rootGetters }, { value }) { + async MsgRevokeX509Cert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgApproveRevokeX509RootCert(value) + const msg = await txClient.msgRevokeX509Cert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRevokeX509Cert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgRevokeX509Cert:Create', 'Could not create message: ' + e.message) } } }, - async MsgUpdatePkiRevocationDistributionPoint({ rootGetters }, { value }) { + async MsgAssignVid({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgUpdatePkiRevocationDistributionPoint(value) + const msg = await txClient.msgAssignVid(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgAssignVid:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgUpdatePkiRevocationDistributionPoint:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgAssignVid:Create', 'Could not create message: ' + e.message) } } }, @@ -1183,120 +1227,107 @@ export default { } } }, - async MsgRevokeNocX509RootCert({ rootGetters }, { value }) { - try { - const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRevokeNocX509RootCert(value) - return msg - } catch (e) { - if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') - }else{ - throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Create', 'Could not create message: ' + e.message) - } - } - }, - async MsgApproveAddX509RootCert({ rootGetters }, { value }) { + async MsgRejectAddX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgApproveAddX509RootCert(value) + const msg = await txClient.msgRejectAddX509RootCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgApproveAddX509RootCert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgRevokeX509Cert({ rootGetters }, { value }) { + async MsgDeletePkiRevocationDistributionPoint({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRevokeX509Cert(value) + const msg = await txClient.msgDeletePkiRevocationDistributionPoint(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new Error('TxClient:MsgRevokeX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new Error('TxClient:MsgRevokeX509Cert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgDeletePkiRevocationDistributionPoint:Create', 'Could not create message: ' + e.message) } } }, - async MsgRejectAddX509RootCert({ rootGetters }, { value }) { + async MsgProposeAddX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRejectAddX509RootCert(value) + const msg = await txClient.msgProposeAddX509RootCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRejectAddX509RootCert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgAddX509Cert({ rootGetters }, { value }) { + async MsgProposeRevokeX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgAddX509Cert(value) + const msg = await txClient.msgProposeRevokeX509RootCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgAddX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgProposeRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgAddX509Cert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgProposeRevokeX509RootCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgProposeAddX509RootCert({ rootGetters }, { value }) { + async MsgApproveRevokeX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgProposeAddX509RootCert(value) + const msg = await txClient.msgApproveRevokeX509RootCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgApproveRevokeX509RootCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgRemoveX509Cert({ rootGetters }, { value }) { + async MsgAddX509Cert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRemoveX509Cert(value) + const msg = await txClient.msgAddX509Cert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRemoveX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgAddX509Cert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRemoveX509Cert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgAddX509Cert:Create', 'Could not create message: ' + e.message) } } }, - async MsgProposeRevokeX509RootCert({ rootGetters }, { value }) { + async MsgRevokeNocX509RootCert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgProposeRevokeX509RootCert(value) + const msg = await txClient.msgRevokeNocX509RootCert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new Error('TxClient:MsgProposeRevokeX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new Error('TxClient:MsgProposeRevokeX509RootCert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgRevokeNocX509RootCert:Create', 'Could not create message: ' + e.message) } } }, - async MsgRevokeNocX509IcaCert({ rootGetters }, { value }) { + async MsgRemoveX509Cert({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) - const msg = await txClient.msgRevokeNocX509IcaCert(value) + const msg = await txClient.msgRemoveX509Cert(value) return msg } catch (e) { if (e == MissingWalletError) { - throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Init', 'Could not initialize signing client. Wallet is required.') + throw new SpVuexError('TxClient:MsgRemoveX509Cert:Init', 'Could not initialize signing client. Wallet is required.') }else{ - throw new SpVuexError('TxClient:MsgRevokeNocX509IcaCert:Create', 'Could not create message: ' + e.message) + throw new SpVuexError('TxClient:MsgRemoveX509Cert:Create', 'Could not create message: ' + e.message) } } }, diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts index f3e8d8f92..d60e33156 100755 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts @@ -4,41 +4,41 @@ import { StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgUpdatePkiRevocationDistributionPoint } from "./types/pki/tx"; import { MsgAddNocX509RootCert } from "./types/pki/tx"; -import { MsgDeletePkiRevocationDistributionPoint } from "./types/pki/tx"; +import { MsgApproveAddX509RootCert } from "./types/pki/tx"; +import { MsgRevokeNocX509IcaCert } from "./types/pki/tx"; +import { MsgRevokeX509Cert } from "./types/pki/tx"; import { MsgAssignVid } from "./types/pki/tx"; -import { MsgApproveRevokeX509RootCert } from "./types/pki/tx"; -import { MsgUpdatePkiRevocationDistributionPoint } from "./types/pki/tx"; import { MsgAddPkiRevocationDistributionPoint } from "./types/pki/tx"; import { MsgAddNocX509IcaCert } from "./types/pki/tx"; -import { MsgRevokeNocX509RootCert } from "./types/pki/tx"; -import { MsgApproveAddX509RootCert } from "./types/pki/tx"; -import { MsgRevokeX509Cert } from "./types/pki/tx"; import { MsgRejectAddX509RootCert } from "./types/pki/tx"; -import { MsgAddX509Cert } from "./types/pki/tx"; +import { MsgDeletePkiRevocationDistributionPoint } from "./types/pki/tx"; import { MsgProposeAddX509RootCert } from "./types/pki/tx"; -import { MsgRemoveX509Cert } from "./types/pki/tx"; import { MsgProposeRevokeX509RootCert } from "./types/pki/tx"; -import { MsgRevokeNocX509IcaCert } from "./types/pki/tx"; +import { MsgApproveRevokeX509RootCert } from "./types/pki/tx"; +import { MsgAddX509Cert } from "./types/pki/tx"; +import { MsgRevokeNocX509RootCert } from "./types/pki/tx"; +import { MsgRemoveX509Cert } from "./types/pki/tx"; const types = [ + ["/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", MsgUpdatePkiRevocationDistributionPoint], ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCert", MsgAddNocX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", MsgDeletePkiRevocationDistributionPoint], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", MsgApproveAddX509RootCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", MsgRevokeNocX509IcaCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", MsgRevokeX509Cert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid", MsgAssignVid], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", MsgApproveRevokeX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", MsgUpdatePkiRevocationDistributionPoint], ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddPkiRevocationDistributionPoint", MsgAddPkiRevocationDistributionPoint], ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509IcaCert", MsgAddNocX509IcaCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", MsgRevokeNocX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", MsgApproveAddX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", MsgRevokeX509Cert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgRejectAddX509RootCert", MsgRejectAddX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", MsgAddX509Cert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", MsgDeletePkiRevocationDistributionPoint], ["/zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert", MsgProposeAddX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", MsgRemoveX509Cert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", MsgProposeRevokeX509RootCert], - ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", MsgRevokeNocX509IcaCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", MsgApproveRevokeX509RootCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", MsgAddX509Cert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", MsgRevokeNocX509RootCert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", MsgRemoveX509Cert], ]; export const MissingWalletError = new Error("wallet is required"); @@ -71,22 +71,22 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = return { signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo), + msgUpdatePkiRevocationDistributionPoint: (data: MsgUpdatePkiRevocationDistributionPoint): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", value: MsgUpdatePkiRevocationDistributionPoint.fromPartial( data ) }), msgAddNocX509RootCert: (data: MsgAddNocX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCert", value: MsgAddNocX509RootCert.fromPartial( data ) }), - msgDeletePkiRevocationDistributionPoint: (data: MsgDeletePkiRevocationDistributionPoint): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", value: MsgDeletePkiRevocationDistributionPoint.fromPartial( data ) }), + msgApproveAddX509RootCert: (data: MsgApproveAddX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", value: MsgApproveAddX509RootCert.fromPartial( data ) }), + msgRevokeNocX509IcaCert: (data: MsgRevokeNocX509IcaCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", value: MsgRevokeNocX509IcaCert.fromPartial( data ) }), + msgRevokeX509Cert: (data: MsgRevokeX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", value: MsgRevokeX509Cert.fromPartial( data ) }), msgAssignVid: (data: MsgAssignVid): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid", value: MsgAssignVid.fromPartial( data ) }), - msgApproveRevokeX509RootCert: (data: MsgApproveRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", value: MsgApproveRevokeX509RootCert.fromPartial( data ) }), - msgUpdatePkiRevocationDistributionPoint: (data: MsgUpdatePkiRevocationDistributionPoint): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgUpdatePkiRevocationDistributionPoint", value: MsgUpdatePkiRevocationDistributionPoint.fromPartial( data ) }), msgAddPkiRevocationDistributionPoint: (data: MsgAddPkiRevocationDistributionPoint): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddPkiRevocationDistributionPoint", value: MsgAddPkiRevocationDistributionPoint.fromPartial( data ) }), msgAddNocX509IcaCert: (data: MsgAddNocX509IcaCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509IcaCert", value: MsgAddNocX509IcaCert.fromPartial( data ) }), - msgRevokeNocX509RootCert: (data: MsgRevokeNocX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", value: MsgRevokeNocX509RootCert.fromPartial( data ) }), - msgApproveAddX509RootCert: (data: MsgApproveAddX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveAddX509RootCert", value: MsgApproveAddX509RootCert.fromPartial( data ) }), - msgRevokeX509Cert: (data: MsgRevokeX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeX509Cert", value: MsgRevokeX509Cert.fromPartial( data ) }), msgRejectAddX509RootCert: (data: MsgRejectAddX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRejectAddX509RootCert", value: MsgRejectAddX509RootCert.fromPartial( data ) }), - msgAddX509Cert: (data: MsgAddX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", value: MsgAddX509Cert.fromPartial( data ) }), + msgDeletePkiRevocationDistributionPoint: (data: MsgDeletePkiRevocationDistributionPoint): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPoint", value: MsgDeletePkiRevocationDistributionPoint.fromPartial( data ) }), msgProposeAddX509RootCert: (data: MsgProposeAddX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert", value: MsgProposeAddX509RootCert.fromPartial( data ) }), - msgRemoveX509Cert: (data: MsgRemoveX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", value: MsgRemoveX509Cert.fromPartial( data ) }), msgProposeRevokeX509RootCert: (data: MsgProposeRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", value: MsgProposeRevokeX509RootCert.fromPartial( data ) }), - msgRevokeNocX509IcaCert: (data: MsgRevokeNocX509IcaCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509IcaCert", value: MsgRevokeNocX509IcaCert.fromPartial( data ) }), + msgApproveRevokeX509RootCert: (data: MsgApproveRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", value: MsgApproveRevokeX509RootCert.fromPartial( data ) }), + msgAddX509Cert: (data: MsgAddX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", value: MsgAddX509Cert.fromPartial( data ) }), + msgRevokeNocX509RootCert: (data: MsgRevokeNocX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRevokeNocX509RootCert", value: MsgRevokeNocX509RootCert.fromPartial( data ) }), + msgRemoveX509Cert: (data: MsgRemoveX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", value: MsgRemoveX509Cert.fromPartial( data ) }), }; }; 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 7c23c75ba..edf63f901 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 @@ -45,6 +45,16 @@ export interface PkiNocRootCertificates { certs?: PkiCertificate[]; } +export interface PkiNocRootCertificatesByVidAndSkid { + /** @format int32 */ + vid?: number; + subjectKeyId?: string; + certs?: PkiCertificate[]; + + /** @format float */ + tq?: number; +} + export interface PkiPkiRevocationDistributionPoint { /** @format int32 */ vid?: number; @@ -69,7 +79,6 @@ export interface PkiPkiRevocationDistributionPoint { /** @format int64 */ schemaVersion?: number; - crlSignerDelegator?: string; } @@ -132,9 +141,6 @@ export interface PkiRevokedNocRootCertificates { subject?: string; subjectKeyId?: string; certs?: PkiCertificate[]; - - /** @format int64 */ - schemaVersion?: number; } export interface PkiRevokedRootCertificates { @@ -364,6 +370,10 @@ export interface PkiQueryGetNocIcaCertificatesResponse { nocIcaCertificates?: PkiNocIcaCertificates; } +export interface PkiQueryGetNocRootCertificatesByVidAndSkidResponse { + nocRootCertificatesByVidAndSkid?: PkiNocRootCertificatesByVidAndSkid; +} + export interface PkiQueryGetNocRootCertificatesResponse { nocRootCertificates?: PkiNocRootCertificates; } @@ -750,7 +760,7 @@ export class Api extends HttpClient extends HttpClient + this.request({ + path: `/dcl/pki/noc_root_certificates/${vid}/${subjectKeyId}`, + method: "GET", + format: "json", + ...params, + }); + /** * No description * diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts index b5f915be3..df445344c 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts @@ -15,6 +15,7 @@ import { ApprovedCertificatesBySubjectKeyId } from '../pki/approved_certificates import { NocRootCertificates } from '../pki/noc_root_certificates' import { NocIcaCertificates } from '../pki/noc_ica_certificates' import { RevokedNocRootCertificates } from '../pki/revoked_noc_root_certificates' +import { NocRootCertificatesByVidAndSkid } from '../pki/noc_root_certificates_by_vid_and_skid' import { Writer, Reader } from 'protobufjs/minimal' export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki' @@ -36,8 +37,9 @@ export interface GenesisState { approvedCertificatesBySubjectKeyIdList: ApprovedCertificatesBySubjectKeyId[] nocRootCertificatesList: NocRootCertificates[] nocIcaCertificatesList: NocIcaCertificates[] - /** this line is used by starport scaffolding # genesis/proto/state */ revokedNocRootCertificatesList: RevokedNocRootCertificates[] + /** this line is used by starport scaffolding # genesis/proto/state */ + nocRootCertificatesByVidAndSkidList: NocRootCertificatesByVidAndSkid[] } const baseGenesisState: object = {} @@ -92,6 +94,9 @@ 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() + } return writer }, @@ -108,11 +113,12 @@ export const GenesisState = { message.approvedCertificatesBySubjectList = [] message.rejectedCertificateList = [] message.PkiRevocationDistributionPointList = [] - message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] + message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] message.approvedCertificatesBySubjectKeyIdList = [] message.nocRootCertificatesList = [] message.nocIcaCertificatesList = [] message.revokedNocRootCertificatesList = [] + message.nocRootCertificatesByVidAndSkidList = [] while (reader.pos < end) { const tag = reader.uint32() switch (tag >>> 3) { @@ -150,7 +156,7 @@ export const GenesisState = { message.PkiRevocationDistributionPointList.push(PkiRevocationDistributionPoint.decode(reader, reader.uint32())) break case 12: - message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList.push( + message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList.push( PkiRevocationDistributionPointsByIssuerSubjectKeyID.decode(reader, reader.uint32()) ) break @@ -166,6 +172,9 @@ export const GenesisState = { case 16: message.revokedNocRootCertificatesList.push(RevokedNocRootCertificates.decode(reader, reader.uint32())) break + case 17: + message.nocRootCertificatesByVidAndSkidList.push(NocRootCertificatesByVidAndSkid.decode(reader, reader.uint32())) + break default: reader.skipType(tag & 7) break @@ -185,11 +194,12 @@ export const GenesisState = { message.approvedCertificatesBySubjectList = [] message.rejectedCertificateList = [] message.PkiRevocationDistributionPointList = [] - message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] + message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] message.approvedCertificatesBySubjectKeyIdList = [] message.nocRootCertificatesList = [] message.nocIcaCertificatesList = [] message.revokedNocRootCertificatesList = [] + message.nocRootCertificatesByVidAndSkidList = [] if (object.approvedCertificatesList !== undefined && object.approvedCertificatesList !== null) { for (const e of object.approvedCertificatesList) { message.approvedCertificatesList.push(ApprovedCertificates.fromJSON(e)) @@ -250,7 +260,7 @@ export const GenesisState = { object.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList !== null ) { for (const e of object.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList) { - message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList.push(PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromJSON(e)) + message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList.push(PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromJSON(e)) } } if (object.approvedCertificatesBySubjectKeyIdList !== undefined && object.approvedCertificatesBySubjectKeyIdList !== null) { @@ -273,6 +283,11 @@ export const GenesisState = { message.revokedNocRootCertificatesList.push(RevokedNocRootCertificates.fromJSON(e)) } } + if (object.nocRootCertificatesByVidAndSkidList !== undefined && object.nocRootCertificatesByVidAndSkidList !== null) { + for (const e of object.nocRootCertificatesByVidAndSkidList) { + message.nocRootCertificatesByVidAndSkidList.push(NocRootCertificatesByVidAndSkid.fromJSON(e)) + } + } return message }, @@ -327,7 +342,7 @@ export const GenesisState = { } else { obj.PkiRevocationDistributionPointList = [] } - if (message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList) { + if (message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList) { obj.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList = message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList.map((e) => e ? PkiRevocationDistributionPointsByIssuerSubjectKeyID.toJSON(e) : undefined ) @@ -356,6 +371,13 @@ export const GenesisState = { } else { obj.revokedNocRootCertificatesList = [] } + if (message.nocRootCertificatesByVidAndSkidList) { + obj.nocRootCertificatesByVidAndSkidList = message.nocRootCertificatesByVidAndSkidList.map((e) => + e ? NocRootCertificatesByVidAndSkid.toJSON(e) : undefined + ) + } else { + obj.nocRootCertificatesByVidAndSkidList = [] + } return obj }, @@ -370,11 +392,12 @@ export const GenesisState = { message.approvedCertificatesBySubjectList = [] message.rejectedCertificateList = [] message.PkiRevocationDistributionPointList = [] - message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] + message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] message.approvedCertificatesBySubjectKeyIdList = [] message.nocRootCertificatesList = [] message.nocIcaCertificatesList = [] message.revokedNocRootCertificatesList = [] + message.nocRootCertificatesByVidAndSkidList = [] if (object.approvedCertificatesList !== undefined && object.approvedCertificatesList !== null) { for (const e of object.approvedCertificatesList) { message.approvedCertificatesList.push(ApprovedCertificates.fromPartial(e)) @@ -431,11 +454,11 @@ export const GenesisState = { } } if ( - object.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList !== undefined && - object.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList !== null + object.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList !== undefined && + object.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList !== null ) { - for (const e of object.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList) { - message.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList.push(PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial(e)) + for (const e of object.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList) { + message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList.push(PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial(e)) } } if (object.approvedCertificatesBySubjectKeyIdList !== undefined && object.approvedCertificatesBySubjectKeyIdList !== null) { @@ -458,6 +481,11 @@ export const GenesisState = { message.revokedNocRootCertificatesList.push(RevokedNocRootCertificates.fromPartial(e)) } } + if (object.nocRootCertificatesByVidAndSkidList !== undefined && object.nocRootCertificatesByVidAndSkidList !== null) { + for (const e of object.nocRootCertificatesByVidAndSkidList) { + message.nocRootCertificatesByVidAndSkidList.push(NocRootCertificatesByVidAndSkid.fromPartial(e)) + } + } return message } } diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_root_certificates_by_vid_and_skid.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_root_certificates_by_vid_and_skid.ts new file mode 100644 index 000000000..8bd24e20a --- /dev/null +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_root_certificates_by_vid_and_skid.ts @@ -0,0 +1,136 @@ +/* eslint-disable */ +import { Certificate } from '../pki/certificate' +import { Writer, Reader } from 'protobufjs/minimal' + +export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki' + +export interface NocRootCertificatesByVidAndSkid { + vid: number + subjectKeyId: string + certs: Certificate[] + tq: number +} + +const baseNocRootCertificatesByVidAndSkid: object = { vid: 0, subjectKeyId: '', tq: 0 } + +export const NocRootCertificatesByVidAndSkid = { + encode(message: NocRootCertificatesByVidAndSkid, writer: Writer = Writer.create()): 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) + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): NocRootCertificatesByVidAndSkid { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseNocRootCertificatesByVidAndSkid } as NocRootCertificatesByVidAndSkid + message.certs = [] + 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 + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): NocRootCertificatesByVidAndSkid { + const message = { ...baseNocRootCertificatesByVidAndSkid } as NocRootCertificatesByVidAndSkid + message.certs = [] + if (object.vid !== undefined && object.vid !== null) { + message.vid = Number(object.vid) + } else { + message.vid = 0 + } + if (object.subjectKeyId !== undefined && object.subjectKeyId !== null) { + message.subjectKeyId = String(object.subjectKeyId) + } else { + message.subjectKeyId = '' + } + if (object.certs !== undefined && object.certs !== null) { + for (const e of object.certs) { + message.certs.push(Certificate.fromJSON(e)) + } + } + if (object.tq !== undefined && object.tq !== null) { + message.tq = Number(object.tq) + } else { + message.tq = 0 + } + return message + }, + + toJSON(message: NocRootCertificatesByVidAndSkid): unknown { + const obj: any = {} + message.vid !== undefined && (obj.vid = 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) + return obj + }, + + fromPartial(object: DeepPartial): NocRootCertificatesByVidAndSkid { + const message = { ...baseNocRootCertificatesByVidAndSkid } as NocRootCertificatesByVidAndSkid + message.certs = [] + if (object.vid !== undefined && object.vid !== null) { + message.vid = object.vid + } else { + message.vid = 0 + } + if (object.subjectKeyId !== undefined && object.subjectKeyId !== null) { + message.subjectKeyId = object.subjectKeyId + } else { + message.subjectKeyId = '' + } + if (object.certs !== undefined && object.certs !== null) { + for (const e of object.certs) { + message.certs.push(Certificate.fromPartial(e)) + } + } + if (object.tq !== undefined && object.tq !== null) { + message.tq = object.tq + } else { + message.tq = 0 + } + return message + } +} + +type Builtin = Date | Function | Uint8Array | string | number | undefined +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts index c8edbd78d..2d2c04ff1 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts @@ -15,6 +15,7 @@ import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from '../pki/pki_ import { NocRootCertificates } from '../pki/noc_root_certificates' import { NocIcaCertificates } from '../pki/noc_ica_certificates' import { RevokedNocRootCertificates } from '../pki/revoked_noc_root_certificates' +import { NocRootCertificatesByVidAndSkid } from '../pki/noc_root_certificates_by_vid_and_skid' export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki' @@ -218,6 +219,15 @@ export interface QueryAllRevokedNocRootCertificatesResponse { pagination: PageResponse | undefined } +export interface QueryGetNocRootCertificatesByVidAndSkidRequest { + vid: number + subjectKeyId: string +} + +export interface QueryGetNocRootCertificatesByVidAndSkidResponse { + nocRootCertificatesByVidAndSkid: NocRootCertificatesByVidAndSkid | undefined +} + const baseQueryGetApprovedCertificatesRequest: object = { subject: '', subjectKeyId: '' } export const QueryGetApprovedCertificatesRequest = { @@ -3159,6 +3169,136 @@ export const QueryAllRevokedNocRootCertificatesResponse = { } } +const baseQueryGetNocRootCertificatesByVidAndSkidRequest: object = { vid: 0, subjectKeyId: '' } + +export const QueryGetNocRootCertificatesByVidAndSkidRequest = { + encode(message: QueryGetNocRootCertificatesByVidAndSkidRequest, writer: Writer = Writer.create()): Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid) + } + if (message.subjectKeyId !== '') { + writer.uint32(18).string(message.subjectKeyId) + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesByVidAndSkidRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseQueryGetNocRootCertificatesByVidAndSkidRequest } as QueryGetNocRootCertificatesByVidAndSkidRequest + 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): QueryGetNocRootCertificatesByVidAndSkidRequest { + const message = { ...baseQueryGetNocRootCertificatesByVidAndSkidRequest } as QueryGetNocRootCertificatesByVidAndSkidRequest + if (object.vid !== undefined && object.vid !== null) { + message.vid = Number(object.vid) + } else { + message.vid = 0 + } + if (object.subjectKeyId !== undefined && object.subjectKeyId !== null) { + message.subjectKeyId = String(object.subjectKeyId) + } else { + message.subjectKeyId = '' + } + return message + }, + + toJSON(message: QueryGetNocRootCertificatesByVidAndSkidRequest): unknown { + const obj: any = {} + message.vid !== undefined && (obj.vid = message.vid) + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId) + return obj + }, + + fromPartial(object: DeepPartial): QueryGetNocRootCertificatesByVidAndSkidRequest { + const message = { ...baseQueryGetNocRootCertificatesByVidAndSkidRequest } as QueryGetNocRootCertificatesByVidAndSkidRequest + if (object.vid !== undefined && object.vid !== null) { + message.vid = object.vid + } else { + message.vid = 0 + } + if (object.subjectKeyId !== undefined && object.subjectKeyId !== null) { + message.subjectKeyId = object.subjectKeyId + } else { + message.subjectKeyId = '' + } + return message + } +} + +const baseQueryGetNocRootCertificatesByVidAndSkidResponse: object = {} + +export const QueryGetNocRootCertificatesByVidAndSkidResponse = { + encode(message: QueryGetNocRootCertificatesByVidAndSkidResponse, writer: Writer = Writer.create()): Writer { + if (message.nocRootCertificatesByVidAndSkid !== undefined) { + NocRootCertificatesByVidAndSkid.encode(message.nocRootCertificatesByVidAndSkid, writer.uint32(10).fork()).ldelim() + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): QueryGetNocRootCertificatesByVidAndSkidResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseQueryGetNocRootCertificatesByVidAndSkidResponse } as QueryGetNocRootCertificatesByVidAndSkidResponse + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.nocRootCertificatesByVidAndSkid = NocRootCertificatesByVidAndSkid.decode(reader, reader.uint32()) + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): QueryGetNocRootCertificatesByVidAndSkidResponse { + const message = { ...baseQueryGetNocRootCertificatesByVidAndSkidResponse } as QueryGetNocRootCertificatesByVidAndSkidResponse + if (object.nocRootCertificatesByVidAndSkid !== undefined && object.nocRootCertificatesByVidAndSkid !== null) { + message.nocRootCertificatesByVidAndSkid = NocRootCertificatesByVidAndSkid.fromJSON(object.nocRootCertificatesByVidAndSkid) + } else { + message.nocRootCertificatesByVidAndSkid = undefined + } + return message + }, + + toJSON(message: QueryGetNocRootCertificatesByVidAndSkidResponse): unknown { + const obj: any = {} + message.nocRootCertificatesByVidAndSkid !== undefined && + (obj.nocRootCertificatesByVidAndSkid = message.nocRootCertificatesByVidAndSkid + ? NocRootCertificatesByVidAndSkid.toJSON(message.nocRootCertificatesByVidAndSkid) + : undefined) + return obj + }, + + fromPartial(object: DeepPartial): QueryGetNocRootCertificatesByVidAndSkidResponse { + const message = { ...baseQueryGetNocRootCertificatesByVidAndSkidResponse } as QueryGetNocRootCertificatesByVidAndSkidResponse + if (object.nocRootCertificatesByVidAndSkid !== undefined && object.nocRootCertificatesByVidAndSkid !== null) { + message.nocRootCertificatesByVidAndSkid = NocRootCertificatesByVidAndSkid.fromPartial(object.nocRootCertificatesByVidAndSkid) + } else { + message.nocRootCertificatesByVidAndSkid = undefined + } + return message + } +} + /** Query defines the gRPC querier service. */ export interface Query { /** Queries a ApprovedCertificates by index. */ @@ -3199,6 +3339,8 @@ export interface Query { ): 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. */ @@ -3326,6 +3468,12 @@ export class QueryClientImpl implements Query { return promise.then((data) => QueryGetNocRootCertificatesResponse.decode(new Reader(data))) } + NocRootCertificatesByVidAndSkid(request: QueryGetNocRootCertificatesByVidAndSkidRequest): Promise { + const data = QueryGetNocRootCertificatesByVidAndSkidRequest.encode(request).finish() + const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Query', 'NocRootCertificatesByVidAndSkid', data) + return promise.then((data) => QueryGetNocRootCertificatesByVidAndSkidResponse.decode(new Reader(data))) + } + NocRootCertificatesAll(request: QueryAllNocRootCertificatesRequest): Promise { const data = QueryAllNocRootCertificatesRequest.encode(request).finish() const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Query', 'NocRootCertificatesAll', data) diff --git a/x/pki/client/cli/query_noc_certificates.go b/x/pki/client/cli/query_noc_certificates.go index ea933b8e8..05e2431af 100644 --- a/x/pki/client/cli/query_noc_certificates.go +++ b/x/pki/client/cli/query_noc_certificates.go @@ -47,6 +47,7 @@ func CmdListNocIcaCertificates() *cobra.Command { func CmdShowNocIcaCertificates() *cobra.Command { var vid int32 + var subject string cmd := &cobra.Command{ Use: "noc-x509-ica-certs", Short: "Gets NOC ICA certificates by VID", @@ -54,6 +55,18 @@ func CmdShowNocIcaCertificates() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) + if subject != "" { + var res types.NocRootCertificatesByVidAndSkid + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.ApprovedCertificatesKeyPrefix, + types.NocRootCertificatesByVidAndSkidKey(vid, subject), + &res, + ) + } + var res types.NocIcaCertificates return cli.QueryWithProof( @@ -67,6 +80,7 @@ func CmdShowNocIcaCertificates() *cobra.Command { } cmd.Flags().Int32Var(&vid, FlagVid, 0, "Vendor ID (positive non-zero)") + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject - optional") flags.AddQueryFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagVid) diff --git a/x/pki/genesis.go b/x/pki/genesis.go index 3762f5c26..d38cc4370 100644 --- a/x/pki/genesis.go +++ b/x/pki/genesis.go @@ -73,6 +73,10 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.RevokedNocRootCertificatesList { k.SetRevokedNocRootCertificates(ctx, elem) } + // Set all the nocRootCertificatesByVidAndSkid + for _, elem := range genState.NocRootCertificatesByVidAndSkidList { + k.SetNocRootCertificatesByVidAndSkid(ctx, elem) + } // this line is used by starport scaffolding # genesis/module/init } @@ -104,6 +108,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.NocRootCertificatesList = k.GetAllNocRootCertificates(ctx) genesis.NocIcaCertificatesList = k.GetAllNocIcaCertificates(ctx) genesis.RevokedNocRootCertificatesList = k.GetAllRevokedNocRootCertificates(ctx) + genesis.NocRootCertificatesByVidAndSkidList = k.GetAllNocRootCertificatesByVidAndSkid(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 752093289..bf93df5a2 100644 --- a/x/pki/genesis_test.go +++ b/x/pki/genesis_test.go @@ -160,6 +160,16 @@ func TestGenesis(t *testing.T) { SubjectKeyId: "1", }, }, + NocRootCertificatesByVidAndSkidList: []types.NocRootCertificatesByVidAndSkid{ + { + Vid: 0, + SubjectKeyId: "0", + }, + { + Vid: 1, + SubjectKeyId: "1", + }, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -184,5 +194,6 @@ func TestGenesis(t *testing.T) { require.ElementsMatch(t, genesisState.NocRootCertificatesList, got.NocRootCertificatesList) require.ElementsMatch(t, genesisState.NocIcaCertificatesList, got.NocIcaCertificatesList) require.ElementsMatch(t, genesisState.RevokedNocRootCertificatesList, got.RevokedNocRootCertificatesList) + require.ElementsMatch(t, genesisState.NocRootCertificatesByVidAndSkidList, got.NocRootCertificatesByVidAndSkidList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go new file mode 100644 index 000000000..98a0b6d17 --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go @@ -0,0 +1,28 @@ +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) NocRootCertificatesByVidAndSkid(c context.Context, req *types.QueryGetNocRootCertificatesByVidAndSkidRequest) (*types.QueryGetNocRootCertificatesByVidAndSkidResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetNocRootCertificatesByVidAndSkid( + ctx, + req.Vid, + req.SubjectKeyId, + ) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + + return &types.QueryGetNocRootCertificatesByVidAndSkidResponse{NocRootCertificatesByVidAndSkid: val}, nil +} diff --git a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go new file mode 100644 index 000000000..86dc9ec5f --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go @@ -0,0 +1,72 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "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 TestNocRootCertificatesByVidAndSkidQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNNocRootCertificatesByVidAndSkid(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetNocRootCertificatesByVidAndSkidRequest + response *types.QueryGetNocRootCertificatesByVidAndSkidResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetNocRootCertificatesByVidAndSkidRequest{ + Vid: msgs[0].Vid, + SubjectKeyId: msgs[0].SubjectKeyId, + }, + response: &types.QueryGetNocRootCertificatesByVidAndSkidResponse{NocRootCertificatesByVidAndSkid: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetNocRootCertificatesByVidAndSkidRequest{ + Vid: msgs[1].Vid, + SubjectKeyId: msgs[1].SubjectKeyId, + }, + response: &types.QueryGetNocRootCertificatesByVidAndSkidResponse{NocRootCertificatesByVidAndSkid: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetNocRootCertificatesByVidAndSkidRequest{ + Vid: 100000, + SubjectKeyId: strconv.Itoa(100000), + }, + err: status.Error(codes.InvalidArgument, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.NocRootCertificatesByVidAndSkid(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/keeper.go b/x/pki/keeper/keeper.go index 6300493cd..3b743177b 100644 --- a/x/pki/keeper/keeper.go +++ b/x/pki/keeper/keeper.go @@ -20,6 +20,7 @@ type ( dclauthKeeper types.DclauthKeeper } + CertificatePredicate func(*types.Certificate) bool ) func NewKeeper( @@ -102,3 +103,13 @@ func findCertificate(serialNumber string, certificates *[]*types.Certificate) (* return nil, false } + +func filterCertificates(certificates *[]*types.Certificate, predicate CertificatePredicate) []*types.Certificate { + var result []*types.Certificate + for _, s := range *certificates { + if predicate(s) { + result = append(result, s) + } + } + return result +} 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 45ce6efcb..02d43f86c 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 @@ -98,6 +98,9 @@ func (k msgServer) AddNocX509RootCert(goCtx context.Context, msg *types.MsgAddNo } k.SetUniqueCertificate(ctx, uniqueCertificate) + // add to vid, subject -> certificates map + k.AddNocRootCertificatesByVidAndSkid(ctx, certificate) + // add to subject -> subject key ID map k.AddApprovedCertificateBySubject(ctx, certificate.Subject, certificate.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 2d9cfe5e9..189f2ad97 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 @@ -81,6 +81,16 @@ func (k msgServer) _revokeNocRootCertificates(ctx sdk.Context, certificates type 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 + // remove from vid, subject key ID -> certificates map + k._removeCertificatesFromNocRootCertificatesByVidAndSkid( + ctx, + vid, + certificates.SubjectKeyId, + func(cert *types.Certificate) bool { + return cert.SubjectKeyId != certificates.Subject + }, + ) } func (k msgServer) _revokeNocRootCertificate( @@ -123,5 +133,32 @@ func (k msgServer) _revokeNocRootCertificate( k.RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber(ctx, cert.Subject, cert.SubjectKeyId, serialNumber) } + // remove from vid, subject key ID -> certificates map + k._removeCertificatesFromNocRootCertificatesByVidAndSkid( + ctx, + vid, + certificates.SubjectKeyId, + func(cert *types.Certificate) bool { + return cert.SubjectKeyId != certificates.Subject && cert.SerialNumber != serialNumber + }, + ) + return nil } + +func (k Keeper) _removeCertificatesFromNocRootCertificatesByVidAndSkid( + ctx sdk.Context, + vid int32, + subjectKeyID string, + predicate CertificatePredicate, +) { + nocCertificates, _ := k.GetNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) + filteredCertificates := filterCertificates(&nocCertificates.Certs, predicate) + + if len(filteredCertificates) > 0 { + nocCertificates.Certs = filteredCertificates + k.SetNocRootCertificatesByVidAndSkid(ctx, nocCertificates) + } else { + k.RemoveNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) + } +} diff --git a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go new file mode 100644 index 000000000..25ec45871 --- /dev/null +++ b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go @@ -0,0 +1,93 @@ +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" +) + +// SetNocRootCertificatesByVidAndSkid set a specific nocRootCertificatesByVidAndSkid in the store from its index +func (k Keeper) SetNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocRootCertificatesByVidAndSkid types.NocRootCertificatesByVidAndSkid) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) + b := k.cdc.MustMarshal(&nocRootCertificatesByVidAndSkid) + store.Set(types.NocRootCertificatesByVidAndSkidKey( + nocRootCertificatesByVidAndSkid.Vid, + nocRootCertificatesByVidAndSkid.SubjectKeyId, + ), b) +} + +// GetNocRootCertificatesByVidAndSkid returns a nocRootCertificatesByVidAndSkid from its index +func (k Keeper) GetNocRootCertificatesByVidAndSkid( + ctx sdk.Context, + vid int32, + subjectKeyID string, + +) (val types.NocRootCertificatesByVidAndSkid, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) + + b := store.Get(types.NocRootCertificatesByVidAndSkidKey( + vid, + subjectKeyID, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// Add a NOC root certificate to the list of NOC root certificates for the VID map. +func (k Keeper) AddNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocCertificate types.Certificate) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesKeyPrefix)) + + nocRootCertificatesByVidAndSkidKeyBytes := store.Get(types.NocRootCertificatesByVidAndSkidKey(nocCertificate.Vid, nocCertificate.SubjectKeyId)) + var nocRootCertificatesByVidAndSkid types.NocRootCertificatesByVidAndSkid + + if nocRootCertificatesByVidAndSkidKeyBytes == nil { + nocRootCertificatesByVidAndSkid = types.NocRootCertificatesByVidAndSkid{ + Vid: nocCertificate.Vid, + SubjectKeyId: nocCertificate.SubjectKeyId, + Certs: []*types.Certificate{}, + Tq: 1, + } + } else { + k.cdc.MustUnmarshal(nocRootCertificatesByVidAndSkidKeyBytes, &nocRootCertificatesByVidAndSkid) + } + + nocRootCertificatesByVidAndSkid.Certs = append(nocRootCertificatesByVidAndSkid.Certs, &nocCertificate) + + b := k.cdc.MustMarshal(&nocRootCertificatesByVidAndSkid) + store.Set(types.NocRootCertificatesKey(nocCertificate.Vid), b) +} + +// RemoveNocRootCertificatesByVidAndSkid removes a nocRootCertificatesByVidAndSkid from the store +func (k Keeper) RemoveNocRootCertificatesByVidAndSkid( + ctx sdk.Context, + vid int32, + subjectKeyID string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) + store.Delete(types.NocRootCertificatesByVidAndSkidKey( + vid, + subjectKeyID, + )) +} + +// GetAllNocRootCertificatesByVidAndSkid returns all nocRootCertificatesByVidAndSkid +func (k Keeper) GetAllNocRootCertificatesByVidAndSkid(ctx sdk.Context) (list []types.NocRootCertificatesByVidAndSkid) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.NocRootCertificatesByVidAndSkid + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go b/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go new file mode 100644 index 000000000..69af96a7f --- /dev/null +++ b/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go @@ -0,0 +1,67 @@ +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 createNNocRootCertificatesByVidAndSkid(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocRootCertificatesByVidAndSkid { + items := make([]types.NocRootCertificatesByVidAndSkid, n) + for i := range items { + items[i].Vid = int32(i) + items[i].SubjectKeyId = strconv.Itoa(i) + + keeper.SetNocRootCertificatesByVidAndSkid(ctx, items[i]) + } + return items +} + +func TestNocRootCertificatesByVidAndSkidGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocRootCertificatesByVidAndSkid(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetNocRootCertificatesByVidAndSkid(ctx, + item.Vid, + item.SubjectKeyId, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestNocRootCertificatesByVidAndSkidRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocRootCertificatesByVidAndSkid(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveNocRootCertificatesByVidAndSkid(ctx, + item.Vid, + item.SubjectKeyId, + ) + _, found := keeper.GetNocRootCertificatesByVidAndSkid(ctx, + item.Vid, + item.SubjectKeyId, + ) + require.False(t, found) + } +} + +func TestNocRootCertificatesByVidAndSkidGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocRootCertificatesByVidAndSkid(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllNocRootCertificatesByVidAndSkid(ctx)), + ) +} diff --git a/x/pki/types/genesis.go b/x/pki/types/genesis.go index be70e7c09..128036711 100644 --- a/x/pki/types/genesis.go +++ b/x/pki/types/genesis.go @@ -26,6 +26,7 @@ func DefaultGenesis() *GenesisState { NocRootCertificatesList: []NocRootCertificates{}, NocIcaCertificatesList: []NocIcaCertificates{}, RevokedNocRootCertificatesList: []RevokedNocRootCertificates{}, + NocRootCertificatesByVidAndSkidList: []NocRootCertificatesByVidAndSkid{}, // this line is used by starport scaffolding # genesis/types/default } } @@ -175,6 +176,16 @@ func (gs GenesisState) Validate() error { } revokedNocRootCertificatesIndexMap[index] = struct{}{} } + // Check for duplicated index in nocRootCertificatesByVidAndSkid + nocRootCertificatesByVidAndSkidIndexMap := make(map[string]struct{}) + + for _, elem := range gs.NocRootCertificatesByVidAndSkidList { + index := string(NocRootCertificatesByVidAndSkidKey(elem.Vid, elem.SubjectKeyId)) + if _, ok := nocRootCertificatesByVidAndSkidIndexMap[index]; ok { + return fmt.Errorf("duplicated index for nocRootCertificatesByVidAndSkid") + } + nocRootCertificatesByVidAndSkidIndexMap[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 382e133da..36ceea4fb 100644 --- a/x/pki/types/genesis.pb.go +++ b/x/pki/types/genesis.pb.go @@ -41,6 +41,7 @@ type GenesisState struct { NocRootCertificatesList []NocRootCertificates `protobuf:"bytes,14,rep,name=nocRootCertificatesList,proto3" json:"nocRootCertificatesList"` NocIcaCertificatesList []NocIcaCertificates `protobuf:"bytes,15,rep,name=nocIcaCertificatesList,proto3" json:"nocIcaCertificatesList"` RevokedNocRootCertificatesList []RevokedNocRootCertificates `protobuf:"bytes,16,rep,name=revokedNocRootCertificatesList,proto3" json:"revokedNocRootCertificatesList"` + NocRootCertificatesByVidAndSkidList []NocRootCertificatesByVidAndSkid `protobuf:"bytes,17,rep,name=nocRootCertificatesByVidAndSkidList,proto3" json:"nocRootCertificatesByVidAndSkidList"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -188,6 +189,13 @@ func (m *GenesisState) GetRevokedNocRootCertificatesList() []RevokedNocRootCerti return nil } +func (m *GenesisState) GetNocRootCertificatesByVidAndSkidList() []NocRootCertificatesByVidAndSkid { + if m != nil { + return m.NocRootCertificatesByVidAndSkidList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "zigbeealliance.distributedcomplianceledger.pki.GenesisState") } @@ -195,54 +203,57 @@ func init() { func init() { proto.RegisterFile("pki/genesis.proto", fileDescriptor_9478608499b59120) } var fileDescriptor_9478608499b59120 = []byte{ - // 750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0xc7, 0x6b, 0x36, 0x06, 0x78, 0xe3, 0xcd, 0xe2, 0x65, 0x9a, 0x50, 0x36, 0x06, 0x82, 0x01, - 0x5a, 0x2b, 0xc6, 0x81, 0xf3, 0xba, 0xa2, 0x31, 0x5e, 0xa6, 0xa9, 0x13, 0x17, 0x0e, 0x44, 0xa9, - 0x6b, 0x3a, 0xd3, 0x2e, 0x0e, 0x89, 0x3b, 0x51, 0x24, 0x24, 0x10, 0x88, 0x33, 0x47, 0xae, 0x48, - 0x7c, 0x00, 0x3e, 0xc6, 0x8e, 0x3b, 0x72, 0x9a, 0xd0, 0xfa, 0x45, 0x50, 0x9e, 0x38, 0x6b, 0x9a, - 0xd8, 0x5d, 0x1b, 0xf5, 0xd6, 0x26, 0xce, 0xff, 0xff, 0x7b, 0x9e, 0xe7, 0xef, 0x38, 0xf8, 0xb2, - 0xd7, 0xe4, 0xa5, 0x06, 0x73, 0x59, 0xc0, 0x83, 0xa2, 0xe7, 0x0b, 0x29, 0x48, 0xf1, 0x23, 0x6f, - 0xd4, 0x18, 0x73, 0x5a, 0x2d, 0xee, 0xb8, 0x94, 0x15, 0xeb, 0x3c, 0x90, 0x3e, 0xaf, 0xb5, 0x25, - 0xab, 0x53, 0xb1, 0xeb, 0x45, 0x57, 0x5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 0xfa, 0x77, 0x64, 0xa1, 0x1f, - 0x5d, 0xab, 0x70, 0xd0, 0xb5, 0x0a, 0x7f, 0xbb, 0x56, 0xe1, 0x75, 0xa5, 0xc1, 0xe5, 0x4e, 0xbb, - 0x56, 0xa4, 0x62, 0xb7, 0x14, 0x51, 0x2d, 0xc7, 0x58, 0xa5, 0x04, 0xd6, 0x72, 0x8f, 0x6b, 0x39, - 0x02, 0x2b, 0x7d, 0x08, 0xbf, 0x55, 0x4b, 0xb2, 0xe3, 0xb1, 0xa0, 0x36, 0x05, 0xdf, 0x71, 0x8f, - 0xfe, 0x07, 0x00, 0x00, 0xff, 0xff, 0x2a, 0xf7, 0x2d, 0x6f, 0x92, 0x0c, 0x00, 0x00, + // 796 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, 0x9f, 0x5a, 0x05, 0xaa, 0x0a, 0xb9, 0xa5, 0x45, 0x50, + 0x40, 0x4d, 0x44, 0x19, 0x98, 0x93, 0x06, 0x95, 0xf2, 0xa7, 0x54, 0xa9, 0x60, 0x60, 0xc0, 0x72, + 0xce, 0x47, 0x7a, 0x38, 0xf5, 0x19, 0xfb, 0x52, 0x11, 0x24, 0x24, 0x10, 0x08, 0x31, 0x32, 0xb2, + 0x22, 0x21, 0xb1, 0xf2, 0x31, 0x3a, 0x76, 0x64, 0x42, 0xa8, 0xf9, 0x22, 0xc8, 0xaf, 0xcf, 0x8d, + 0x63, 0xdf, 0xa5, 0x89, 0x95, 0x2d, 0xb1, 0xcf, 0xcf, 0xf3, 0xbb, 0xf7, 0x7d, 0x5e, 0x9f, 0xb5, + 0x69, 0xcf, 0xa1, 0xa5, 0x06, 0x71, 0x49, 0x40, 0x83, 0xa2, 0xe7, 0x33, 0xce, 0xf4, 0xe2, 0x3b, + 0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 0x60, 0x2b, 0x03, 0x71, 0x1e, 0x20, 0x2a, 0x39, 0x20, 0x52, 0x6a, 0x82, 0x41, 0xe1, 0xa3, 0x7f, + 0x47, 0x9a, 0x21, 0x5e, 0x47, 0x9b, 0x8a, 0x7a, 0x5c, 0x00, 0x94, 0x87, 0x39, 0xdf, 0x7e, 0xea, + 0xb2, 0x1c, 0xe3, 0xab, 0xff, 0x42, 0xda, 0x92, 0xa4, 0x72, 0x95, 0xf6, 0x73, 0x6a, 0x97, 0x5d, + 0x7b, 0xdb, 0xa1, 0x51, 0xa6, 0xa6, 0x81, 0xef, 0xe9, 0x28, 0xfa, 0x95, 0x90, 0x16, 0x90, 0x83, + 0x10, 0x54, 0x5e, 0xee, 0x1f, 0x1a, 0xe8, 0xe0, 0xd0, 0x40, 0xff, 0x0e, 0x0d, 0xf4, 0xad, 0x63, + 0x14, 0x0e, 0x3a, 0x46, 0xe1, 0x4f, 0xc7, 0x28, 0xbc, 0xa8, 0x36, 0x28, 0xdf, 0x69, 0xd5, 0x8b, + 0x98, 0xed, 0x96, 0x22, 0xbe, 0x95, 0x18, 0xb0, 0x94, 0x00, 0x5c, 0xe9, 0x12, 0xae, 0x44, 0x88, + 0xa5, 0xb7, 0xf0, 0x99, 0xca, 0xdb, 0x1e, 0x09, 0xea, 0x13, 0xf0, 0xc5, 0x79, 0xf7, 0x7f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xf9, 0x5e, 0xe6, 0x31, 0x6d, 0x0d, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -265,6 +276,22 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NocRootCertificatesByVidAndSkidList) > 0 { + for iNdEx := len(m.NocRootCertificatesByVidAndSkidList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocRootCertificatesByVidAndSkidList[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] = 0x8a + } + } if len(m.RevokedNocRootCertificatesList) > 0 { for iNdEx := len(m.RevokedNocRootCertificatesList) - 1; iNdEx >= 0; iNdEx-- { { @@ -599,6 +626,12 @@ func (m *GenesisState) Size() (n int) { n += 2 + l + sovGenesis(uint64(l)) } } + if len(m.NocRootCertificatesByVidAndSkidList) > 0 { + for _, e := range m.NocRootCertificatesByVidAndSkidList { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } return n } @@ -1185,6 +1218,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocRootCertificatesByVidAndSkidList", 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.NocRootCertificatesByVidAndSkidList = append(m.NocRootCertificatesByVidAndSkidList, NocRootCertificatesByVidAndSkid{}) + if err := m.NocRootCertificatesByVidAndSkidList[len(m.NocRootCertificatesByVidAndSkidList)-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 bf63cdb21..4f8d37c5c 100644 --- a/x/pki/types/genesis_test.go +++ b/x/pki/types/genesis_test.go @@ -152,6 +152,16 @@ SubjectKeyId: "0", SubjectKeyId: "1", }, }, +NocRootCertificatesByVidAndSkidList: []types.NocRootCertificatesByVidAndSkid{ + { + Vid: 0, +SubjectKeyId: "0", +}, + { + Vid: 1, +SubjectKeyId: "1", +}, +}, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, @@ -358,6 +368,22 @@ SubjectKeyId: "0", }, valid: false, }, +{ + desc: "duplicated nocRootCertificatesByVidAndSkid", + genState: &types.GenesisState{ + NocRootCertificatesByVidAndSkidList: []types.NocRootCertificatesByVidAndSkid{ + { + Vid: 0, +SubjectKeyId: "0", +}, + { + Vid: 0, +SubjectKeyId: "0", +}, + }, + }, + valid: false, +}, // this line is used by starport scaffolding # types/genesis/testcase } { t.Run(tc.desc, func(t *testing.T) { diff --git a/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go b/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go new file mode 100644 index 000000000..fa5c9b3d9 --- /dev/null +++ b/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go @@ -0,0 +1,29 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // NocRootCertificatesByVidAndSkidKeyPrefix is the prefix to retrieve all NocRootCertificatesByVidAndSkid + NocRootCertificatesByVidAndSkidKeyPrefix = "NocRootCertificatesByVidAndSkid/value/" +) + +// NocRootCertificatesByVidAndSkidKey returns the store key to retrieve a NocRootCertificatesByVidAndSkid from the index fields +func NocRootCertificatesByVidAndSkidKey( + vid int32, + subjectKeyId string, +) []byte { + var key []byte + + vidBytes := make([]byte, 8) + binary.BigEndian.PutUint32(vidBytes, uint32(vid)) + key = append(key, vidBytes...) + key = append(key, []byte("/")...) + + subjectKeyIdBytes := []byte(subjectKeyId) + key = append(key, subjectKeyIdBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/noc_root_certificates_by_vid_and_skid.pb.go b/x/pki/types/noc_root_certificates_by_vid_and_skid.pb.go new file mode 100644 index 000000000..2699d14e2 --- /dev/null +++ b/x/pki/types/noc_root_certificates_by_vid_and_skid.pb.go @@ -0,0 +1,455 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pki/noc_root_certificates_by_vid_and_skid.proto + +package types + +import ( + encoding_binary "encoding/binary" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 NocRootCertificatesByVidAndSkid struct { + Vid int32 `protobuf:"varint,1,opt,name=vid,proto3" json:"vid,omitempty" validate:"gte=1,lte=65535"` + 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"` +} + +func (m *NocRootCertificatesByVidAndSkid) Reset() { *m = NocRootCertificatesByVidAndSkid{} } +func (m *NocRootCertificatesByVidAndSkid) String() string { return proto.CompactTextString(m) } +func (*NocRootCertificatesByVidAndSkid) ProtoMessage() {} +func (*NocRootCertificatesByVidAndSkid) Descriptor() ([]byte, []int) { + return fileDescriptor_f0b75fe838c6f118, []int{0} +} +func (m *NocRootCertificatesByVidAndSkid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NocRootCertificatesByVidAndSkid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NocRootCertificatesByVidAndSkid.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 *NocRootCertificatesByVidAndSkid) XXX_Merge(src proto.Message) { + xxx_messageInfo_NocRootCertificatesByVidAndSkid.Merge(m, src) +} +func (m *NocRootCertificatesByVidAndSkid) XXX_Size() int { + return m.Size() +} +func (m *NocRootCertificatesByVidAndSkid) XXX_DiscardUnknown() { + xxx_messageInfo_NocRootCertificatesByVidAndSkid.DiscardUnknown(m) +} + +var xxx_messageInfo_NocRootCertificatesByVidAndSkid proto.InternalMessageInfo + +func (m *NocRootCertificatesByVidAndSkid) GetVid() int32 { + if m != nil { + return m.Vid + } + return 0 +} + +func (m *NocRootCertificatesByVidAndSkid) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +func (m *NocRootCertificatesByVidAndSkid) GetCerts() []*Certificate { + if m != nil { + return m.Certs + } + return nil +} + +func (m *NocRootCertificatesByVidAndSkid) GetTq() float32 { + if m != nil { + return m.Tq + } + return 0 +} + +func init() { + proto.RegisterType((*NocRootCertificatesByVidAndSkid)(nil), "zigbeealliance.distributedcomplianceledger.pki.NocRootCertificatesByVidAndSkid") +} + +func init() { + proto.RegisterFile("pki/noc_root_certificates_by_vid_and_skid.proto", fileDescriptor_f0b75fe838c6f118) +} + +var fileDescriptor_f0b75fe838c6f118 = []byte{ + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xc1, 0x4a, 0xeb, 0x50, + 0x10, 0x86, 0x7b, 0xd2, 0xdb, 0x0b, 0x37, 0xf7, 0x72, 0x17, 0x41, 0x21, 0x74, 0x91, 0x86, 0xac, + 0xb2, 0xb0, 0x89, 0x5a, 0xea, 0x42, 0xe9, 0xc2, 0xea, 0x46, 0x04, 0xc1, 0x08, 0x2e, 0x5c, 0x18, + 0x92, 0x73, 0xc6, 0x38, 0x26, 0xcd, 0x49, 0x93, 0x69, 0x31, 0x3e, 0x85, 0x8f, 0xe5, 0xb2, 0x4b, + 0x71, 0x21, 0xd2, 0xbe, 0x81, 0x4f, 0x20, 0x69, 0x10, 0xe3, 0xd2, 0xdd, 0xf0, 0x33, 0xf3, 0x7f, + 0xff, 0xcc, 0xa8, 0x6e, 0x16, 0xa3, 0x9b, 0x4a, 0xee, 0xe7, 0x52, 0x92, 0xcf, 0x21, 0x27, 0xbc, + 0x41, 0x1e, 0x10, 0x14, 0x7e, 0x58, 0xfa, 0x73, 0x14, 0x7e, 0x90, 0x0a, 0xbf, 0x88, 0x51, 0x38, + 0x59, 0x2e, 0x49, 0x6a, 0xce, 0x03, 0x46, 0x21, 0x40, 0x90, 0x24, 0x18, 0xa4, 0x1c, 0x1c, 0x81, + 0x05, 0xe5, 0x18, 0xce, 0x08, 0x04, 0x97, 0x93, 0xac, 0x56, 0x13, 0x10, 0x11, 0xe4, 0x4e, 0x16, + 0x63, 0x77, 0x23, 0x92, 0x91, 0x5c, 0x8f, 0xba, 0x55, 0x55, 0xbb, 0x74, 0x37, 0x2b, 0x6c, 0x83, + 0x56, 0xcb, 0xd6, 0x0b, 0x53, 0x7b, 0x67, 0x92, 0x7b, 0x52, 0xd2, 0x51, 0x23, 0xca, 0xb8, 0xbc, + 0x44, 0x71, 0x98, 0x8a, 0x8b, 0x18, 0x85, 0xb6, 0xad, 0xb6, 0xe7, 0x28, 0x74, 0x66, 0x32, 0xbb, + 0x33, 0x36, 0xde, 0x5f, 0x7b, 0xdd, 0x79, 0x90, 0xa0, 0x08, 0x08, 0xf6, 0xad, 0x88, 0x60, 0xb4, + 0xb3, 0x95, 0x10, 0x8c, 0xf6, 0x86, 0xc3, 0xc1, 0xd0, 0xf2, 0xaa, 0x56, 0xcd, 0x52, 0xff, 0x15, + 0xb3, 0xf0, 0x0e, 0x38, 0x9d, 0x42, 0x79, 0x22, 0x74, 0xc5, 0x64, 0xf6, 0x1f, 0xef, 0x9b, 0xa6, + 0x9d, 0xab, 0x9d, 0x2a, 0x4e, 0xa1, 0xb7, 0xcd, 0xb6, 0xfd, 0x77, 0xf7, 0xe0, 0x87, 0x6b, 0x3a, + 0x8d, 0xb8, 0x5e, 0xed, 0xa4, 0xfd, 0x57, 0x15, 0x9a, 0xea, 0xbf, 0x4c, 0x66, 0x2b, 0x9e, 0x42, + 0xd3, 0xf1, 0xf5, 0xd3, 0xd2, 0x60, 0x8b, 0xa5, 0xc1, 0xde, 0x96, 0x06, 0x7b, 0x5c, 0x19, 0xad, + 0xc5, 0xca, 0x68, 0x3d, 0xaf, 0x8c, 0xd6, 0xd5, 0x71, 0x84, 0x74, 0x3b, 0x0b, 0x1d, 0x2e, 0x27, + 0x6e, 0xcd, 0xed, 0x7f, 0x82, 0xdd, 0x06, 0xb8, 0xff, 0x45, 0xee, 0xd7, 0x68, 0xf7, 0x7e, 0xfd, + 0x3f, 0x2a, 0x33, 0x28, 0xc2, 0xdf, 0xeb, 0x1b, 0x0e, 0x3e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xbe, + 0x9e, 0x3c, 0xd4, 0xd3, 0x01, 0x00, 0x00, +} + +func (m *NocRootCertificatesByVidAndSkid) 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 *NocRootCertificatesByVidAndSkid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NocRootCertificatesByVidAndSkid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 = encodeVarintNocRootCertificatesByVidAndSkid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintNocRootCertificatesByVidAndSkid(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x12 + } + if m.Vid != 0 { + i = encodeVarintNocRootCertificatesByVidAndSkid(dAtA, i, uint64(m.Vid)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintNocRootCertificatesByVidAndSkid(dAtA []byte, offset int, v uint64) int { + offset -= sovNocRootCertificatesByVidAndSkid(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NocRootCertificatesByVidAndSkid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vid != 0 { + n += 1 + sovNocRootCertificatesByVidAndSkid(uint64(m.Vid)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovNocRootCertificatesByVidAndSkid(uint64(l)) + } + if len(m.Certs) > 0 { + for _, e := range m.Certs { + l = e.Size() + n += 1 + l + sovNocRootCertificatesByVidAndSkid(uint64(l)) + } + } + if m.Tq != 0 { + n += 5 + } + return n +} + +func sovNocRootCertificatesByVidAndSkid(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNocRootCertificatesByVidAndSkid(x uint64) (n int) { + return sovNocRootCertificatesByVidAndSkid(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NocRootCertificatesByVidAndSkid) 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 ErrIntOverflowNocRootCertificatesByVidAndSkid + } + 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: NocRootCertificatesByVidAndSkid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NocRootCertificatesByVidAndSkid: 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 ErrIntOverflowNocRootCertificatesByVidAndSkid + } + 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 SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocRootCertificatesByVidAndSkid + } + 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 ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + 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 ErrIntOverflowNocRootCertificatesByVidAndSkid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + 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)) + default: + iNdEx = preIndex + skippy, err := skipNocRootCertificatesByVidAndSkid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNocRootCertificatesByVidAndSkid(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, ErrIntOverflowNocRootCertificatesByVidAndSkid + } + 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, ErrIntOverflowNocRootCertificatesByVidAndSkid + } + 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, ErrIntOverflowNocRootCertificatesByVidAndSkid + } + 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, ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNocRootCertificatesByVidAndSkid + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNocRootCertificatesByVidAndSkid + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNocRootCertificatesByVidAndSkid = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNocRootCertificatesByVidAndSkid = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNocRootCertificatesByVidAndSkid = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/query.pb.go b/x/pki/types/query.pb.go index a1bfc03b0..9cd9942ac 100644 --- a/x/pki/types/query.pb.go +++ b/x/pki/types/query.pb.go @@ -2271,6 +2271,110 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) GetPagination() *query.Page return nil } +type QueryGetNocRootCertificatesByVidAndSkidRequest 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"` +} + +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) Reset() { + *m = QueryGetNocRootCertificatesByVidAndSkidRequest{} +} +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetNocRootCertificatesByVidAndSkidRequest) ProtoMessage() {} +func (*QueryGetNocRootCertificatesByVidAndSkidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_62972e0134af9ed2, []int{46} +} +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidRequest.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 *QueryGetNocRootCertificatesByVidAndSkidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidRequest.Merge(m, src) +} +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidRequest proto.InternalMessageInfo + +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) GetVid() int32 { + if m != nil { + return m.Vid + } + return 0 +} + +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +type QueryGetNocRootCertificatesByVidAndSkidResponse struct { + NocRootCertificatesByVidAndSkid NocRootCertificatesByVidAndSkid `protobuf:"bytes,1,opt,name=nocRootCertificatesByVidAndSkid,proto3" json:"nocRootCertificatesByVidAndSkid"` +} + +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) Reset() { + *m = QueryGetNocRootCertificatesByVidAndSkidResponse{} +} +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetNocRootCertificatesByVidAndSkidResponse) ProtoMessage() {} +func (*QueryGetNocRootCertificatesByVidAndSkidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_62972e0134af9ed2, []int{47} +} +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidResponse.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 *QueryGetNocRootCertificatesByVidAndSkidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidResponse.Merge(m, src) +} +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocRootCertificatesByVidAndSkidResponse proto.InternalMessageInfo + +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) GetNocRootCertificatesByVidAndSkid() NocRootCertificatesByVidAndSkid { + if m != nil { + return m.NocRootCertificatesByVidAndSkid + } + return NocRootCertificatesByVidAndSkid{} +} + func init() { proto.RegisterType((*QueryGetApprovedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesRequest") proto.RegisterType((*QueryGetApprovedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesResponse") @@ -2318,139 +2422,147 @@ func init() { 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((*QueryGetNocRootCertificatesByVidAndSkidRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesByVidAndSkidRequest") + proto.RegisterType((*QueryGetNocRootCertificatesByVidAndSkidResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesByVidAndSkidResponse") } func init() { proto.RegisterFile("pki/query.proto", fileDescriptor_62972e0134af9ed2) } var fileDescriptor_62972e0134af9ed2 = []byte{ - // 2025 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5b, 0x5f, 0x6c, 0xdc, 0x48, - 0x19, 0xcf, 0x78, 0x69, 0x11, 0x03, 0x02, 0x3a, 0x49, 0x9b, 0xb0, 0x6a, 0x36, 0xe9, 0x34, 0xcd, - 0xbf, 0x36, 0x6b, 0xd2, 0xaa, 0x2d, 0x3c, 0x94, 0x2a, 0x7f, 0x4a, 0xda, 0x22, 0xa2, 0x64, 0x83, - 0x28, 0xad, 0x4a, 0x57, 0x5e, 0xaf, 0xd9, 0x9a, 0x38, 0x6b, 0xd7, 0xf6, 0x86, 0x2e, 0x51, 0x90, - 0x40, 0xa2, 0x45, 0x3c, 0x95, 0x3f, 0x0f, 0x80, 0x2a, 0x1e, 0xa8, 0x54, 0xf1, 0xce, 0x03, 0x8f, - 0xbc, 0xa1, 0x4a, 0x3c, 0x50, 0x89, 0x07, 0x90, 0x90, 0x4e, 0xa7, 0xe6, 0x4e, 0x77, 0xa7, 0x56, - 0x3a, 0xdd, 0xcb, 0x9d, 0xee, 0xe5, 0xee, 0xe4, 0xf1, 0x38, 0xf6, 0xae, 0xc7, 0xb3, 0x5e, 0xef, - 0x6c, 0xfa, 0xb6, 0xf6, 0x8c, 0xbf, 0x6f, 0x7e, 0xbf, 0xef, 0xcf, 0x7c, 0x33, 0x5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0x2d, 0xab, 0x5d, 0x92, 0x5a, 0x6b, - 0xf9, 0x75, 0x81, 0x12, 0x29, 0xc4, 0x4b, 0x04, 0xe2, 0x45, 0x74, 0x3e, 0xf4, 0x63, 0x6f, 0x6e, - 0x9b, 0x91, 0xfd, 0x83, 0xd0, 0xae, 0xbc, 0xd3, 0xda, 0xab, 0xdb, 0x45, 0x7f, 0x95, 0xe0, 0x28, - 0xb7, 0x5f, 0x81, 0x6e, 0x0b, 0xf5, 0xce, 0xb6, 0xf6, 0x4f, 0xfe, 0x87, 0x7d, 0x92, 0x4e, 0xd9, - 0xb9, 0x4e, 0xd8, 0x59, 0x46, 0x8b, 0x71, 0x07, 0x08, 0xff, 0xb8, 0x25, 0x65, 0x40, 0xfc, 0x56, - 0x82, 0xe3, 0x5c, 0xad, 0x5e, 0x68, 0xdc, 0x16, 0xea, 0xc6, 0x62, 0xd8, 0x4a, 0xdb, 0x11, 0xc3, - 0xf3, 0x84, 0xad, 0xd3, 0x68, 0x26, 0x35, 0x5b, 0xe8, 0x13, 0x00, 0x07, 0x19, 0x6d, 0x87, 0xec, - 0x79, 0x32, 0xb9, 0x39, 0x93, 0x3d, 0x4f, 0x72, 0x3a, 0x30, 0xf8, 0x5b, 0x04, 0xf3, 0x37, 0xd0, - 0x85, 0x7d, 0xcc, 0xb4, 0x94, 0x48, 0xe9, 0x15, 0xef, 0x02, 0x78, 0x8c, 0x21, 0xbf, 0xa7, 0x34, - 0x29, 0x9c, 0x03, 0x7e, 0x17, 0x0a, 0x9f, 0x22, 0x1c, 0x8c, 0xa1, 0x51, 0x2e, 0x07, 0xe8, 0x03, - 0x00, 0x47, 0x92, 0xda, 0x27, 0xe8, 0x46, 0xaf, 0x45, 0x4a, 0x42, 0x21, 0x9b, 0xff, 0x81, 0x78, - 0xc1, 0x14, 0x36, 0x26, 0xb0, 0x8f, 0xa3, 0x7c, 0x08, 0xdb, 0x34, 0xdd, 0x56, 0xcc, 0x1f, 0x02, - 0x38, 0x9c, 0x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3c, - 0x7f, 0x51, 0x00, 0x6f, 0xbe, 0x28, 0x80, 0x47, 0x7b, 0x85, 0x81, 0xe7, 0x7b, 0x85, 0x81, 0xff, - 0xed, 0x15, 0x06, 0x6e, 0x2d, 0xd7, 0x74, 0xf7, 0x6e, 0xa3, 0x52, 0x54, 0xcd, 0x2d, 0xd9, 0x5f, - 0xef, 0x5c, 0xb0, 0x60, 0x39, 0xb2, 0xe0, 0xb9, 0x70, 0xc5, 0x73, 0xfe, 0x92, 0xe5, 0xfb, 0x44, - 0xaf, 0xdb, 0xb4, 0x34, 0xa7, 0x72, 0x98, 0xfc, 0x97, 0xcf, 0xb9, 0xcf, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x05, 0x4e, 0xa0, 0x73, 0xc2, 0x36, 0x00, 0x00, + // 2123 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5b, 0x5f, 0x8c, 0xdc, 0x46, + 0x19, 0xcf, 0x78, 0x49, 0x11, 0x03, 0x02, 0x3a, 0x49, 0x93, 0x63, 0x95, 0xdb, 0x4b, 0x26, 0xe9, + 0xe5, 0x5f, 0x6f, 0xdd, 0x34, 0x4a, 0x02, 0x42, 0x25, 0xba, 0xcb, 0x95, 0x6b, 0x8a, 0x38, 0xee, + 0xf6, 0x50, 0x4b, 0xab, 0x92, 0x95, 0xd7, 0xeb, 0x6e, 0xcc, 0xfa, 0xd6, 0xae, 0xed, 0x3d, 0xba, + 0x9c, 0x0e, 0x09, 0x24, 0x5a, 0xc4, 0x53, 0xf8, 0xf3, 0x00, 0xa8, 0xa2, 0x12, 0x95, 0x2a, 0xde, + 0x79, 0xe0, 0x91, 0xd7, 0x4a, 0x3c, 0x50, 0xa9, 0x0f, 0x20, 0x21, 0x21, 0x94, 0x03, 0x51, 0xd4, + 0x4a, 0x88, 0x17, 0x10, 0x2f, 0x50, 0x79, 0xfc, 0xf9, 0xec, 0x5d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 0x70, 0x4d, 0x3e, 0x15, 0x88, 0xb0, 0x3e, 0x71, 0x35, 0x25, 0x95, 0x0a, + 0x91, 0x19, 0xa3, 0x9b, 0x7e, 0x33, 0x53, 0x1c, 0x16, 0x82, 0x56, 0x15, 0x87, 0x7f, 0xaa, 0x01, + 0x94, 0x05, 0x34, 0x4f, 0x02, 0x65, 0xe5, 0x41, 0x41, 0xa9, 0x8e, 0xef, 0x21, 0x5e, 0x29, 0x46, + 0xb2, 0x60, 0x65, 0x70, 0x3b, 0x47, 0xd2, 0x24, 0x50, 0x7c, 0x6e, 0x23, 0x21, 0xb7, 0xdf, 0xd4, + 0xf0, 0xad, 0xa9, 0xd4, 0x42, 0x94, 0xfe, 0x84, 0xf0, 0x55, 0x6f, 0xf2, 0xef, 0x81, 0x4a, 0xa6, + 0xda, 0xd0, 0x71, 0x55, 0x41, 0x3c, 0xcb, 0x58, 0x49, 0xaf, 0xa7, 0xc7, 0x86, 0x75, 0xd7, 0x14, + 0x14, 0x3a, 0xf9, 0xfc, 0x33, 0x74, 0x14, 0xe0, 0x7e, 0x98, 0x66, 0xec, 0x5e, 0x7e, 0xb8, 0xec, + 0x36, 0xc6, 0xd1, 0x94, 0x64, 0x6c, 0x8e, 0x96, 0xec, 0x51, 0x40, 0xe2, 0xdc, 0x2c, 0x8e, 0x02, + 0xa5, 0x20, 0xa9, 0xcc, 0x1e, 0x12, 0x75, 0x8b, 0xfa, 0x5a, 0x7a, 0xf7, 0xb3, 0xee, 0x9a, 0xb7, + 0x4d, 0xa3, 0x18, 0x6f, 0x7e, 0x81, 0x86, 0x08, 0x97, 0xfb, 0x0e, 0x30, 0x7a, 0x05, 0x93, 0x5e, + 0x6e, 0x14, 0x62, 0xb3, 0x52, 0x02, 0xa2, 0x11, 0x49, 0x80, 0x10, 0x47, 0x07, 0xed, 0x82, 0x5f, + 0x71, 0x10, 0x05, 0x7e, 0xa9, 0xa2, 0xcc, 0xdf, 0xd1, 0x10, 0x43, 0x27, 0x45, 0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, 0xbf, 0xc8, 0xae, 0x7e, 0x18, 0x00, + 0x00, 0xff, 0xff, 0x6d, 0x73, 0x7b, 0xfa, 0x53, 0x39, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2501,6 +2613,8 @@ type QueryClient interface { 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 NocRootCertificatesByVidAndSkid by index. + NocRootCertificatesByVidAndSkid(ctx context.Context, in *QueryGetNocRootCertificatesByVidAndSkidRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesByVidAndSkidResponse, error) // Queries a list of NocRootCertificates items. NocRootCertificatesAll(ctx context.Context, in *QueryAllNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryAllNocRootCertificatesResponse, error) // Queries a NocIcaCertificates by index. @@ -2683,6 +2797,15 @@ func (c *queryClient) NocRootCertificates(ctx context.Context, in *QueryGetNocRo return out, nil } +func (c *queryClient) NocRootCertificatesByVidAndSkid(ctx context.Context, in *QueryGetNocRootCertificatesByVidAndSkidRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesByVidAndSkidResponse, error) { + out := new(QueryGetNocRootCertificatesByVidAndSkidResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificatesByVidAndSkid", 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...) @@ -2766,6 +2889,8 @@ type QueryServer interface { PkiRevocationDistributionPointsByIssuerSubjectKeyID(context.Context, *QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDRequest) (*QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse, error) // Queries a NocRootCertificates by index. NocRootCertificates(context.Context, *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) + // Queries a NocRootCertificatesByVidAndSkid by index. + NocRootCertificatesByVidAndSkid(context.Context, *QueryGetNocRootCertificatesByVidAndSkidRequest) (*QueryGetNocRootCertificatesByVidAndSkidResponse, error) // Queries a list of NocRootCertificates items. NocRootCertificatesAll(context.Context, *QueryAllNocRootCertificatesRequest) (*QueryAllNocRootCertificatesResponse, error) // Queries a NocIcaCertificates by index. @@ -2836,6 +2961,9 @@ func (*UnimplementedQueryServer) PkiRevocationDistributionPointsByIssuerSubjectK func (*UnimplementedQueryServer) NocRootCertificates(ctx context.Context, req *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificates not implemented") } +func (*UnimplementedQueryServer) NocRootCertificatesByVidAndSkid(ctx context.Context, req *QueryGetNocRootCertificatesByVidAndSkidRequest) (*QueryGetNocRootCertificatesByVidAndSkidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificatesByVidAndSkid not implemented") +} func (*UnimplementedQueryServer) NocRootCertificatesAll(ctx context.Context, req *QueryAllNocRootCertificatesRequest) (*QueryAllNocRootCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificatesAll not implemented") } @@ -3180,6 +3308,24 @@ func _Query_NocRootCertificates_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Query_NocRootCertificatesByVidAndSkid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNocRootCertificatesByVidAndSkidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NocRootCertificatesByVidAndSkid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocRootCertificatesByVidAndSkid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NocRootCertificatesByVidAndSkid(ctx, req.(*QueryGetNocRootCertificatesByVidAndSkidRequest)) + } + 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 { @@ -3346,6 +3492,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "NocRootCertificates", Handler: _Query_NocRootCertificates_Handler, }, + { + MethodName: "NocRootCertificatesByVidAndSkid", + Handler: _Query_NocRootCertificatesByVidAndSkid_Handler, + }, { MethodName: "NocRootCertificatesAll", Handler: _Query_NocRootCertificatesAll_Handler, @@ -5066,6 +5216,74 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) MarshalToSizedBuffer(dAtA [ return len(dAtA) - i, nil } +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) 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 *QueryGetNocRootCertificatesByVidAndSkidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) 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 m.Vid != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Vid)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) 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 *QueryGetNocRootCertificatesByVidAndSkidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocRootCertificatesByVidAndSkidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.NocRootCertificatesByVidAndSkid.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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -5734,6 +5952,33 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) Size() (n int) { return n } +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) 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 *QueryGetNocRootCertificatesByVidAndSkidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocRootCertificatesByVidAndSkid.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -10153,6 +10398,190 @@ func (m *QueryAllRevokedNocRootCertificatesResponse) Unmarshal(dAtA []byte) erro } return nil } +func (m *QueryGetNocRootCertificatesByVidAndSkidRequest) 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: QueryGetNocRootCertificatesByVidAndSkidRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNocRootCertificatesByVidAndSkidRequest: 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 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 *QueryGetNocRootCertificatesByVidAndSkidResponse) 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: QueryGetNocRootCertificatesByVidAndSkidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNocRootCertificatesByVidAndSkidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocRootCertificatesByVidAndSkid", 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.NocRootCertificatesByVidAndSkid.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 skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/pki/types/query.pb.gw.go b/x/pki/types/query.pb.gw.go index 1241037de..5625ec3fc 100644 --- a/x/pki/types/query.pb.gw.go +++ b/x/pki/types/query.pb.gw.go @@ -1019,6 +1019,82 @@ func local_request_Query_NocRootCertificates_0(ctx context.Context, marshaler ru } +func request_Query_NocRootCertificatesByVidAndSkid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocRootCertificatesByVidAndSkidRequest + 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) + } + + 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.NocRootCertificatesByVidAndSkid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NocRootCertificatesByVidAndSkid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocRootCertificatesByVidAndSkidRequest + 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) + } + + 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.NocRootCertificatesByVidAndSkid(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_NocRootCertificatesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -1677,6 +1753,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_NocRootCertificatesByVidAndSkid_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_NocRootCertificatesByVidAndSkid_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_NocRootCertificatesByVidAndSkid_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() @@ -2193,6 +2292,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_NocRootCertificatesByVidAndSkid_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_NocRootCertificatesByVidAndSkid_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_NocRootCertificatesByVidAndSkid_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() @@ -2333,6 +2452,8 @@ var ( 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_NocRootCertificatesByVidAndSkid_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_root_certificates", "vid", "subjectKeyId"}, "", 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))) @@ -2381,6 +2502,8 @@ var ( forward_Query_NocRootCertificates_0 = runtime.ForwardResponseMessage + forward_Query_NocRootCertificatesByVidAndSkid_0 = runtime.ForwardResponseMessage + forward_Query_NocRootCertificatesAll_0 = runtime.ForwardResponseMessage forward_Query_NocIcaCertificates_0 = runtime.ForwardResponseMessage From e1ef72b1ca0ddb15baf775eb1fdb85c4b91b897c Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Wed, 17 Apr 2024 12:43:18 +0500 Subject: [PATCH 2/7] Include querying the NOC certificate by VID and SKID in the unit tests --- x/pki/client/cli/query_noc_certificates.go | 14 ------ .../client/cli/query_noc_root_certificates.go | 16 +++++- x/pki/handler_add_noc_root_cert_test.go | 49 +++++++++++++++++++ x/pki/handler_revoke_noc_root_cert_test.go | 24 +++++++++ ...y_noc_root_certificates_by_vid_and_skid.go | 2 +- .../msg_server_revoke_noc_x_509_root_cert.go | 35 +------------ .../noc_root_certificates_by_vid_and_skid.go | 24 ++++++++- 7 files changed, 113 insertions(+), 51 deletions(-) diff --git a/x/pki/client/cli/query_noc_certificates.go b/x/pki/client/cli/query_noc_certificates.go index 05e2431af..ea933b8e8 100644 --- a/x/pki/client/cli/query_noc_certificates.go +++ b/x/pki/client/cli/query_noc_certificates.go @@ -47,7 +47,6 @@ func CmdListNocIcaCertificates() *cobra.Command { func CmdShowNocIcaCertificates() *cobra.Command { var vid int32 - var subject string cmd := &cobra.Command{ Use: "noc-x509-ica-certs", Short: "Gets NOC ICA certificates by VID", @@ -55,18 +54,6 @@ func CmdShowNocIcaCertificates() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) - if subject != "" { - var res types.NocRootCertificatesByVidAndSkid - - return cli.QueryWithProof( - clientCtx, - pkitypes.StoreKey, - types.ApprovedCertificatesKeyPrefix, - types.NocRootCertificatesByVidAndSkidKey(vid, subject), - &res, - ) - } - var res types.NocIcaCertificates return cli.QueryWithProof( @@ -80,7 +67,6 @@ func CmdShowNocIcaCertificates() *cobra.Command { } cmd.Flags().Int32Var(&vid, FlagVid, 0, "Vendor ID (positive non-zero)") - cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject - optional") flags.AddQueryFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagVid) diff --git a/x/pki/client/cli/query_noc_root_certificates.go b/x/pki/client/cli/query_noc_root_certificates.go index 5301bafd7..cdf0ca7e3 100644 --- a/x/pki/client/cli/query_noc_root_certificates.go +++ b/x/pki/client/cli/query_noc_root_certificates.go @@ -46,7 +46,8 @@ func CmdListNocRootCertificates() *cobra.Command { func CmdShowNocRootCertificates() *cobra.Command { var ( - vid int32 + vid int32 + subject string ) cmd := &cobra.Command{ @@ -56,6 +57,18 @@ func CmdShowNocRootCertificates() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) + if subject != "" { + var res types.NocRootCertificatesByVidAndSkid + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.ApprovedCertificatesKeyPrefix, + types.NocRootCertificatesByVidAndSkidKey(vid, subject), + &res, + ) + } + var res types.NocRootCertificates return cli.QueryWithProof( @@ -69,6 +82,7 @@ func CmdShowNocRootCertificates() *cobra.Command { } cmd.Flags().Int32Var(&vid, FlagVid, 0, "Vendor ID (positive non-zero)") + cmd.Flags().StringVarP(&subject, FlagSubject, FlagSubjectShortcut, "", "Certificate's subject - optional") flags.AddQueryFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagVid) diff --git a/x/pki/handler_add_noc_root_cert_test.go b/x/pki/handler_add_noc_root_cert_test.go index af409a811..a5d0ba232 100644 --- a/x/pki/handler_add_noc_root_cert_test.go +++ b/x/pki/handler_add_noc_root_cert_test.go @@ -197,6 +197,12 @@ func TestHandler_AddNocX509RootCert_AddNew(t *testing.T) { require.NoError(t, err) require.Equal(t, &newNocCertificate, nocRootCertificate) + // query noc root certificate by VID and SKID + nocRootCertificate, tq, err := querySingleNocRootCertificateByVidAndSkid(setup, newNocCertificate.Vid, newNocCertificate.SubjectKeyId) + require.NoError(t, err) + require.Equal(t, &newNocCertificate, nocRootCertificate) + require.Equal(t, float32(1), tq) + // check that unique certificate key registered require.True(t, setup.Keeper.IsUniqueCertificatePresent(setup.Ctx, testconstants.RootIssuer, testconstants.RootSerialNumber)) @@ -259,6 +265,12 @@ func TestHandler_AddNocX509RootCert_Renew(t *testing.T) { require.NoError(t, err) require.Equal(t, len(nocRootCertificates.Certs), 2) require.Equal(t, &newNocCertificate, nocRootCertificates.Certs[1]) + + // query noc root certificate by VID and SKID + renewedNocRootCertificate, tq, err := querySingleNocRootCertificateByVidAndSkid(setup, testconstants.Vid, newNocCertificate.SubjectKeyId) + require.NoError(t, err) + require.Equal(t, &newNocCertificate, renewedNocRootCertificate) + require.Equal(t, float32(1), tq) } func querySingleNocRootCertificate( @@ -295,3 +307,40 @@ func queryNocRootCertificates( return &resp.NocRootCertificates, nil } + +func querySingleNocRootCertificateByVidAndSkid( + setup *TestSetup, + vid int32, + subjectKeyID string, +) (*types.Certificate, float32, error) { + certificates, err := queryNocRootCertificatesByVidAndSkid(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 queryNocRootCertificatesByVidAndSkid( + setup *TestSetup, + vid int32, + subjectKeyID string, +) (*types.NocRootCertificatesByVidAndSkid, error) { + // query certificate + req := &types.QueryGetNocRootCertificatesByVidAndSkidRequest{Vid: vid, SubjectKeyId: subjectKeyID} + + resp, err := setup.Keeper.NocRootCertificatesByVidAndSkid(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocRootCertificatesByVidAndSkid, nil +} diff --git a/x/pki/handler_revoke_noc_root_cert_test.go b/x/pki/handler_revoke_noc_root_cert_test.go index 189f8ad6f..fe31834e6 100644 --- a/x/pki/handler_revoke_noc_root_cert_test.go +++ b/x/pki/handler_revoke_noc_root_cert_test.go @@ -244,6 +244,17 @@ func TestHandler_RevokeNocX509RootCert_RevokeDefault(t *testing.T) { require.Equal(t, 1, len(nocRootCerts.Certs)) require.Equal(t, testconstants.NocRootCert2SubjectKeyID, nocRootCerts.Certs[0].SubjectKeyId) + // query noc root certificate by VID and SKID + _, err = queryNocRootCertificatesByVidAndSkid(setup, testconstants.Vid, testconstants.NocRootCert1SubjectKeyID) + require.Error(t, err) + require.Equal(t, codes.NotFound, status.Code(err)) + + nocRootCertificatesByVidAndSkid, err := queryNocRootCertificatesByVidAndSkid(setup, testconstants.Vid, testconstants.NocRootCert2SubjectKeyID) + require.NoError(t, err) + require.Equal(t, testconstants.NocRootCert2SubjectKeyID, nocRootCertificatesByVidAndSkid.SubjectKeyId) + require.Equal(t, 1, len(nocRootCerts.Certs)) + require.Equal(t, float32(1), nocRootCertificatesByVidAndSkid.Tq) + // Child certificate should not be revoked _, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) @@ -336,6 +347,11 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithChild(t *testing.T) { require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) + // query noc root certificate by VID and SKID + _, err = queryNocRootCertificatesByVidAndSkid(setup, testconstants.Vid, testconstants.NocRootCert1SubjectKeyID) + 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) require.Equal(t, 0, len(aprCertsBySubjectKeyID)) @@ -441,6 +457,14 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumber(t *testing.T) { require.Equal(t, 1, len(revNocRoot.Certs)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, revNocRoot.Certs[0].SerialNumber) + // query noc root certificate by VID and SKID should return only one root cert + nocRootCertificatesByVidAndSkid, err := queryNocRootCertificatesByVidAndSkid(setup, testconstants.Vid, testconstants.NocRootCert1SubjectKeyID) + require.NoError(t, err) + require.Equal(t, testconstants.NocRootCert1SubjectKeyID, nocRootCertificatesByVidAndSkid.SubjectKeyId) + require.Equal(t, 1, len(revNocRoot.Certs)) + require.Equal(t, float32(1), nocRootCertificatesByVidAndSkid.Tq) + require.Equal(t, testconstants.NocRootCert1CopySerialNumber, nocRootCertificatesByVidAndSkid.Certs[0].SerialNumber) + // Child certificate should not be revoked _, err = queryRevokedCertificates(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) require.Equal(t, codes.NotFound, status.Code(err)) diff --git a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go index 98a0b6d17..3f936280d 100644 --- a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go +++ b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid.go @@ -21,7 +21,7 @@ func (k Keeper) NocRootCertificatesByVidAndSkid(c context.Context, req *types.Qu req.SubjectKeyId, ) if !found { - return nil, status.Error(codes.InvalidArgument, "not found") + return nil, status.Error(codes.NotFound, "not found") } return &types.QueryGetNocRootCertificatesByVidAndSkidResponse{NocRootCertificatesByVidAndSkid: val}, nil 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 189f2ad97..13bc1f962 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 @@ -83,14 +83,7 @@ func (k msgServer) _revokeNocRootCertificates(ctx sdk.Context, certificates type k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certificates.Subject, certificates.SubjectKeyId) // remove from vid, subject key ID -> certificates map // remove from vid, subject key ID -> certificates map - k._removeCertificatesFromNocRootCertificatesByVidAndSkid( - ctx, - vid, - certificates.SubjectKeyId, - func(cert *types.Certificate) bool { - return cert.SubjectKeyId != certificates.Subject - }, - ) + k.RemoveNocRootCertificatesByVidAndSkid(ctx, vid, certificates.SubjectKeyId) } func (k msgServer) _revokeNocRootCertificate( @@ -134,31 +127,7 @@ func (k msgServer) _revokeNocRootCertificate( } // remove from vid, subject key ID -> certificates map - k._removeCertificatesFromNocRootCertificatesByVidAndSkid( - ctx, - vid, - certificates.SubjectKeyId, - func(cert *types.Certificate) bool { - return cert.SubjectKeyId != certificates.Subject && cert.SerialNumber != serialNumber - }, - ) + k.RemoveNocRootCertificateByVidSkidAndSerialNumber(ctx, vid, certificates.SubjectKeyId, serialNumber) return nil } - -func (k Keeper) _removeCertificatesFromNocRootCertificatesByVidAndSkid( - ctx sdk.Context, - vid int32, - subjectKeyID string, - predicate CertificatePredicate, -) { - nocCertificates, _ := k.GetNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) - filteredCertificates := filterCertificates(&nocCertificates.Certs, predicate) - - if len(filteredCertificates) > 0 { - nocCertificates.Certs = filteredCertificates - k.SetNocRootCertificatesByVidAndSkid(ctx, nocCertificates) - } else { - k.RemoveNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) - } -} diff --git a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go index 25ec45871..328482a76 100644 --- a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go +++ b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go @@ -41,7 +41,7 @@ func (k Keeper) GetNocRootCertificatesByVidAndSkid( // Add a NOC root certificate to the list of NOC root certificates for the VID map. func (k Keeper) AddNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocCertificate types.Certificate) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesKeyPrefix)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) nocRootCertificatesByVidAndSkidKeyBytes := store.Get(types.NocRootCertificatesByVidAndSkidKey(nocCertificate.Vid, nocCertificate.SubjectKeyId)) var nocRootCertificatesByVidAndSkid types.NocRootCertificatesByVidAndSkid @@ -60,7 +60,7 @@ func (k Keeper) AddNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocCertifica nocRootCertificatesByVidAndSkid.Certs = append(nocRootCertificatesByVidAndSkid.Certs, &nocCertificate) b := k.cdc.MustMarshal(&nocRootCertificatesByVidAndSkid) - store.Set(types.NocRootCertificatesKey(nocCertificate.Vid), b) + store.Set(types.NocRootCertificatesByVidAndSkidKey(nocCertificate.Vid, nocCertificate.SubjectKeyId), b) } // RemoveNocRootCertificatesByVidAndSkid removes a nocRootCertificatesByVidAndSkid from the store @@ -76,6 +76,26 @@ func (k Keeper) RemoveNocRootCertificatesByVidAndSkid( )) } +// RemoveNocRootCertificatesByVidSkidAndSerialNumber removes root certificate with specified serial number from the list. +func (k Keeper) RemoveNocRootCertificateByVidSkidAndSerialNumber( + ctx sdk.Context, + vid int32, + subjectKeyID string, + serialNumber string, +) { + nocCertificates, _ := k.GetNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) + filteredCertificates := filterCertificates(&nocCertificates.Certs, func(cert *types.Certificate) bool { + return cert.SerialNumber != serialNumber + }) + + if len(filteredCertificates) > 0 { + nocCertificates.Certs = filteredCertificates + k.SetNocRootCertificatesByVidAndSkid(ctx, nocCertificates) + } else { + k.RemoveNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) + } +} + // GetAllNocRootCertificatesByVidAndSkid returns all nocRootCertificatesByVidAndSkid func (k Keeper) GetAllNocRootCertificatesByVidAndSkid(ctx sdk.Context) (list []types.NocRootCertificatesByVidAndSkid) { store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) From 40dda036bae7d40f935e477c3af65caaf49bace1 Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Wed, 17 Apr 2024 19:33:04 +0500 Subject: [PATCH 3/7] Include querying the NOC certificate by VID and SKID in the CLI tests --- integration_tests/cli/pki-noc-certs.sh | 61 ++++++++++++++++++- .../pki-noc-revocation-with-serial-number.sh | 16 +++++ .../client/cli/query_noc_root_certificates.go | 12 ++-- ...y_noc_root_certificates_by_vid_and_skid.go | 4 +- 4 files changed, 83 insertions(+), 10 deletions(-) diff --git a/integration_tests/cli/pki-noc-certs.sh b/integration_tests/cli/pki-noc-certs.sh index 51ec630ea..907c37c81 100755 --- a/integration_tests/cli/pki-noc-certs.sh +++ b/integration_tests/cli/pki-noc-certs.sh @@ -60,7 +60,7 @@ create_new_vendor_account $vendor_account_2 $vid_2_in_hex_format test_divider -echo "Request NOC certificate by VID must be empty" +echo "Request NOC root certificate by VID must be empty" result=$(dcld query pki noc-x509-root-certs --vid="$vid") check_response "$result" "Not Found" response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" @@ -71,6 +71,17 @@ echo $result | jq test_divider +echo "Request NOC root certificate by VID = $vid and SKID = $noc_root_cert_1_subject_key_id must be empty" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --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\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +response_does_not_contain "$result" "\"subjectAsText\": \"$noc_root_cert_1_subject_as_text\"" +echo $result | jq + +test_divider + echo "Request all NOC root certificates must be empty" result=$(dcld query pki all-noc-x509-root-certs) check_response "$result" "\[\]" @@ -136,7 +147,7 @@ check_response "$result" "\"code\": 0" test_divider -echo "Request NOC root certificate by VID" +echo "Request NOC root certificate by VID = $vid" result=$(dcld query pki noc-x509-root-certs --vid="$vid") echo $result | jq check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" @@ -153,6 +164,32 @@ check_response "$result" "\"vid\": $vid" test_divider +echo "Request NOC root certificate by VID = "$vid" and SKID = $noc_root_cert_1_subject_key_id" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --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" "\"schemaVersion\": $cert_schema_version_1" +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"tq\": 1" + +test_divider + +echo "Request NOC root certificate by VID = "$vid" and SKID = $noc_root_cert_2_subject_key_id" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --subject-key-id="$noc_root_cert_2_subject_key_id") +echo $result | jq +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\"" +check_response "$result" "\"subjectAsText\": \"$noc_root_cert_2_subject_as_text\"" +check_response "$result" "\"schemaVersion\": $cert_schema_version_0" +check_response "$result" "\"vid\": $vid" +check_response "$result" "\"tq\": 1" + +test_divider + echo "Request All NOC root certificate" result=$(dcld query pki all-noc-x509-root-certs) echo $result | jq @@ -349,6 +386,26 @@ response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" echo $result | jq +echo "Request NOC root certificate by VID = $vid and SKID = $noc_root_cert_1_subject must be empty" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --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\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +response_does_not_contain "$result" "\"subjectAsText\": \"$noc_root_cert_1_subject_as_text\"" +echo $result | jq + +echo "Request NOC root certificate by VID = "$vid" and SKID = $noc_root_cert_2_subject_key_id" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --subject-key-id="$noc_root_cert_2_subject_key_id") +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\"" +check_response "$result" "\"subjectAsText\": \"$noc_root_cert_2_subject_as_text\"" +check_response "$result" "\"schemaVersion\": $cert_schema_version_0" +check_response "$result" "\"vid\": $vid" +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") response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_1_subject\"" 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 e9a715b65..7cadcdabb 100755 --- a/integration_tests/cli/pki-noc-revocation-with-serial-number.sh +++ b/integration_tests/cli/pki-noc-revocation-with-serial-number.sh @@ -66,6 +66,14 @@ check_response "$result" "\"code\": 0" test_divider +echo "Request NOC root certificate by VID = $vid and SKID=$noc_root_cert_1_subject_key_id" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --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_serial_number\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_copy_serial_number\"" +echo $result | jq + echo "Request All NOC root certificate" result=$(dcld query pki all-noc-x509-root-certs) echo $result | jq @@ -129,6 +137,14 @@ check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" echo $result | jq +echo "Request NOC root certificate by VID = $vid and SKID=$noc_root_cert_1_subject_key_id should contain only one root certificate with serialNumber=$noc_root_cert_1_copy_serial_number" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --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\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +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") check_response "$result" "\"$noc_root_cert_1_subject\"" diff --git a/x/pki/client/cli/query_noc_root_certificates.go b/x/pki/client/cli/query_noc_root_certificates.go index cdf0ca7e3..60cb88b51 100644 --- a/x/pki/client/cli/query_noc_root_certificates.go +++ b/x/pki/client/cli/query_noc_root_certificates.go @@ -46,8 +46,8 @@ func CmdListNocRootCertificates() *cobra.Command { func CmdShowNocRootCertificates() *cobra.Command { var ( - vid int32 - subject string + vid int32 + subjectKeyID string ) cmd := &cobra.Command{ @@ -57,14 +57,14 @@ func CmdShowNocRootCertificates() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) - if subject != "" { + if subjectKeyID != "" { var res types.NocRootCertificatesByVidAndSkid return cli.QueryWithProof( clientCtx, pkitypes.StoreKey, - types.ApprovedCertificatesKeyPrefix, - types.NocRootCertificatesByVidAndSkidKey(vid, subject), + types.NocRootCertificatesByVidAndSkidKeyPrefix, + types.NocRootCertificatesByVidAndSkidKey(vid, subjectKeyID), &res, ) } @@ -82,7 +82,7 @@ func CmdShowNocRootCertificates() *cobra.Command { } 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)") flags.AddQueryFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagVid) diff --git a/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go b/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go index fa5c9b3d9..2eac6149f 100644 --- a/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go +++ b/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go @@ -12,7 +12,7 @@ const ( // NocRootCertificatesByVidAndSkidKey returns the store key to retrieve a NocRootCertificatesByVidAndSkid from the index fields func NocRootCertificatesByVidAndSkidKey( vid int32, - subjectKeyId string, + subjectKeyID string, ) []byte { var key []byte @@ -21,7 +21,7 @@ func NocRootCertificatesByVidAndSkidKey( key = append(key, vidBytes...) key = append(key, []byte("/")...) - subjectKeyIdBytes := []byte(subjectKeyId) + subjectKeyIdBytes := []byte(subjectKeyID) key = append(key, subjectKeyIdBytes...) key = append(key, []byte("/")...) From feaf9ea121a7cb66e435445ab24b13e9a496c1b0 Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Wed, 17 Apr 2024 20:58:28 +0500 Subject: [PATCH 4/7] Include querying the NOC certificate by VID and SKID in the gRPC/Rest tests --- integration_tests/cli/pki-noc-certs.sh | 22 ++++++ integration_tests/grpc_rest/pki/grpc_test.go | 2 +- .../grpc_rest/pki/noc_cert_helper.go | 70 ++++++++++++++++++- 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/integration_tests/cli/pki-noc-certs.sh b/integration_tests/cli/pki-noc-certs.sh index 907c37c81..5a71753dc 100755 --- a/integration_tests/cli/pki-noc-certs.sh +++ b/integration_tests/cli/pki-noc-certs.sh @@ -82,6 +82,28 @@ echo $result | jq test_divider +echo "Request NOC root certificate by VID = $vid and SKID = $noc_root_cert_2_subject_key_id must be empty" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --subject-key-id="$noc_root_cert_2_subject_key_id") +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_2_subject\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_2_subject_key_id\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_2_serial_number\"" +response_does_not_contain "$result" "\"subjectAsText\": \"$noc_root_cert_2_subject_as_text\"" +echo $result | jq + +test_divider + +echo "Request NOC root certificate by VID = $vid and SKID = $noc_root_cert_3_subject_key_id must be empty" +result=$(dcld query pki noc-x509-root-certs --vid="$vid" --subject-key-id="$noc_root_cert_3_subject_key_id") +check_response "$result" "Not Found" +response_does_not_contain "$result" "\"subject\": \"$noc_root_cert_3_subject\"" +response_does_not_contain "$result" "\"subjectKeyId\": \"$noc_root_cert_3_subject_key_id\"" +response_does_not_contain "$result" "\"serialNumber\": \"$noc_root_cert_3_serial_number\"" +response_does_not_contain "$result" "\"subjectAsText\": \"$noc_root_cert_3_subject_as_text\"" +echo $result | jq + +test_divider + echo "Request all NOC root certificates must be empty" result=$(dcld query pki all-noc-x509-root-certs) check_response "$result" "\[\]" diff --git a/integration_tests/grpc_rest/pki/grpc_test.go b/integration_tests/grpc_rest/pki/grpc_test.go index f75460122..2e2f5c45f 100644 --- a/integration_tests/grpc_rest/pki/grpc_test.go +++ b/integration_tests/grpc_rest/pki/grpc_test.go @@ -32,6 +32,6 @@ import ( func TestPkiDemoGRPC(t *testing.T) { suite := utils.SetupTest(t, testconstants.ChainID, false) - pki.Demo(&suite) + // pki.Demo(&suite) pki.NocCertDemo(&suite) } diff --git a/integration_tests/grpc_rest/pki/noc_cert_helper.go b/integration_tests/grpc_rest/pki/noc_cert_helper.go index daee8ffdf..c4c64ee9f 100644 --- a/integration_tests/grpc_rest/pki/noc_cert_helper.go +++ b/integration_tests/grpc_rest/pki/noc_cert_helper.go @@ -3,6 +3,7 @@ package pki import ( "context" "fmt" + "net/url" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -104,6 +105,34 @@ func GetNocX509RootCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocR return &res, nil } +func GetNocX509RootCertsByVidAndSkid(suite *utils.TestSuite, vendorID int32, subjectKeyID string) (*pkitypes.NocRootCertificatesByVidAndSkid, error) { + var res pkitypes.NocRootCertificatesByVidAndSkid + if suite.Rest { + var resp pkitypes.QueryGetNocRootCertificatesByVidAndSkidResponse + err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-root-certificates/%v/%s", vendorID, url.QueryEscape(subjectKeyID)), &resp) + if err != nil { + return nil, err + } + res = resp.GetNocRootCertificatesByVidAndSkid() + } 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.NocRootCertificatesByVidAndSkid( + context.Background(), + &pkitypes.QueryGetNocRootCertificatesByVidAndSkidRequest{Vid: vendorID, SubjectKeyId: subjectKeyID}, + ) + if err != nil { + return nil, err + } + res = resp.GetNocRootCertificatesByVidAndSkid() + } + + return &res, nil +} + func GetNocX509IcaCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocIcaCertificates, error) { var res pkitypes.NocIcaCertificates if suite.Rest { @@ -134,6 +163,10 @@ func GetNocX509IcaCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocIc //nolint:funlen func NocCertDemo(suite *utils.TestSuite) { + // Generate VIDs + vid1 := int32(tmrand.Uint16()) + vid2 := int32(tmrand.Uint16()) + // All requests return empty or 404 value allNocCertificates, _ := GetAllNocX509RootCerts(suite) require.Equal(suite.T, 0, len(allNocCertificates)) @@ -141,6 +174,13 @@ func NocCertDemo(suite *utils.TestSuite) { _, err := GetNocX509RootCerts(suite, testconstants.Vid) suite.AssertNotFound(err) + _, err = GetNocX509RootCertsByVidAndSkid(suite, vid1, testconstants.NocRootCert1SubjectKeyID) + suite.AssertNotFound(err) + _, err = GetNocX509RootCertsByVidAndSkid(suite, vid1, testconstants.NocRootCert2SubjectKeyID) + suite.AssertNotFound(err) + _, err = GetNocX509RootCertsByVidAndSkid(suite, vid2, testconstants.NocRootCert3SubjectKeyID) + suite.AssertNotFound(err) + // Alice and Jack are predefined Trustees aliceName := testconstants.AliceAccount aliceKeyInfo, err := suite.Kr.Key(aliceName) @@ -155,7 +195,6 @@ func NocCertDemo(suite *utils.TestSuite) { require.NoError(suite.T, err) // Register first Vendor account - vid1 := int32(tmrand.Uint16()) vendor1Name := utils.RandString() vendor1Account := test_dclauth.CreateVendorAccount( suite, @@ -172,7 +211,6 @@ func NocCertDemo(suite *utils.TestSuite) { require.NotNil(suite.T, vendor1Account) // Register second Vendor account - vid2 := int32(tmrand.Uint16()) vendor2Name := utils.RandString() vendor2Account := test_dclauth.CreateVendorAccount( suite, @@ -228,6 +266,27 @@ func NocCertDemo(suite *utils.TestSuite) { require.Equal(suite.T, testconstants.NocRootCert2Subject, nocCertificates.Certs[1].Subject) require.Equal(suite.T, testconstants.NocRootCert2SubjectKeyID, nocCertificates.Certs[1].SubjectKeyId) + // Request NOC root certificate by VID1 and SKID1 + nocCertificatesByVidAndSkid, _ := GetNocX509RootCertsByVidAndSkid(suite, vid1, testconstants.NocRootCert1SubjectKeyID) + require.Equal(suite.T, 1, len(nocCertificatesByVidAndSkid.Certs)) + require.Equal(suite.T, testconstants.NocRootCert1Subject, nocCertificatesByVidAndSkid.Certs[0].Subject) + require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, nocCertificatesByVidAndSkid.Certs[0].SubjectKeyId) + require.Equal(suite.T, float32(1), nocCertificatesByVidAndSkid.Tq) + + // Request NOC root certificate by VID1 and SKID2 + nocCertificatesByVidAndSkid, _ = GetNocX509RootCertsByVidAndSkid(suite, vid1, testconstants.NocRootCert2SubjectKeyID) + require.Equal(suite.T, 1, len(nocCertificatesByVidAndSkid.Certs)) + require.Equal(suite.T, testconstants.NocRootCert2Subject, nocCertificatesByVidAndSkid.Certs[0].Subject) + require.Equal(suite.T, testconstants.NocRootCert2SubjectKeyID, nocCertificatesByVidAndSkid.Certs[0].SubjectKeyId) + require.Equal(suite.T, float32(1), nocCertificatesByVidAndSkid.Tq) + + // Request NOC root certificate by VID2 and SKID3 + nocCertificatesByVidAndSkid, _ = GetNocX509RootCertsByVidAndSkid(suite, vid2, testconstants.NocRootCert3SubjectKeyID) + require.Equal(suite.T, 1, len(nocCertificatesByVidAndSkid.Certs)) + require.Equal(suite.T, testconstants.NocRootCert3Subject, nocCertificatesByVidAndSkid.Certs[0].Subject) + require.Equal(suite.T, testconstants.NocRootCert3SubjectKeyID, nocCertificatesByVidAndSkid.Certs[0].SubjectKeyId) + require.Equal(suite.T, float32(1), nocCertificatesByVidAndSkid.Tq) + // Request All NOC root certificate allNocCertificates, _ = GetAllNocX509RootCerts(suite) require.Equal(suite.T, 2, len(allNocCertificates)) @@ -350,6 +409,13 @@ func NocCertDemo(suite *utils.TestSuite) { nocCertificates, _ = GetNocX509RootCerts(suite, vid1) require.Equal(suite.T, 3, len(nocCertificates.Certs)) + // Request NOC root certificate by VID1 and SKID1 + nocCertificatesByVidAndSkid, _ = GetNocX509RootCertsByVidAndSkid(suite, vid1, testconstants.NocRootCert1SubjectKeyID) + require.Equal(suite.T, 2, len(nocCertificatesByVidAndSkid.Certs)) + require.Equal(suite.T, testconstants.NocRootCert1Subject, nocCertificatesByVidAndSkid.Certs[0].Subject) + require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, nocCertificatesByVidAndSkid.Certs[0].SubjectKeyId) + require.Equal(suite.T, float32(1), nocCertificatesByVidAndSkid.Tq) + // Add NOC leaf certificate msgAddNocCert := pkitypes.MsgAddNocX509IcaCert{ Signer: vendor1Account.Address, From c13da766f4f13ab75690e180993867bebf365f19 Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Thu, 18 Apr 2024 11:31:29 +0500 Subject: [PATCH 5/7] Add the GET_NOC_ROOT_BY_VID_AND_SKID transaction to the documentation --- docs/static/openapi.yml | 257 +++++++++++++++++++ docs/transactions.md | 19 ++ integration_tests/grpc_rest/pki/grpc_test.go | 2 +- 3 files changed, 277 insertions(+), 1 deletion(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 7da3e0926..eee6754b8 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -9877,6 +9877,120 @@ paths: format: int32 tags: - Query + /dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}: + get: + summary: Queries a NocRootCertificatesByVidAndSkid by index. + operationId: NocRootCertificatesByVidAndSkid + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocRootCertificatesByVidAndSkid: + 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 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: vid + in: path + required: true + type: integer + format: int32 + - name: subjectKeyId + in: path + required: true + type: string + tags: + - Query /dcl/pki/proposed-certificates: get: summary: Queries a list of ProposedCertificate items. @@ -21814,6 +21928,76 @@ definitions: schemaVersion: type: integer format: int64 + zigbeealliance.distributedcomplianceledger.pki.NocRootCertificatesByVidAndSkid: + 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 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float zigbeealliance.distributedcomplianceledger.pki.PkiRevocationDistributionPoint: type: object properties: @@ -22937,6 +23121,79 @@ definitions: schemaVersion: type: integer format: int64 + zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesByVidAndSkidResponse: + type: object + properties: + nocRootCertificatesByVidAndSkid: + 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 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean + schemaVersion: + type: integer + format: int64 + tq: + type: number + format: float zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesResponse: type: object properties: diff --git a/docs/transactions.md b/docs/transactions.md index 35931397a..88aaabd6b 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -1482,6 +1482,25 @@ Use [GET_ALL_REVOKED_NOC_ROOT](#get_revoked_noc_root) to get a list of all revok - REST API: - GET `/dcl/pki/noc-root-certificates/{vid}` +#### GET_NOC_ROOT_BY_VID_AND_SKID + +**Status: Implemented** + +Retrieve NOC root certificates associated with a specific VID and subject key ID. +This request also returns the Trust Quotient (TQ) value of the certificate + +Revoked NOC root certificates are not returned. +Use [GET_ALL_REVOKED_NOC_ROOT](#get_revoked_noc_root) to get a list of all revoked NOC root certificates. + +- Who can send: Any account +- Parameters: + - vid: `uint16` - Vendor ID (positive non-zero) + - 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-root-certs --vid= --subject-key-id=` +- REST API: + - GET `/dcl/pki/noc-root-certificates/{vid}/{subject_key_id}` + #### GET_NOC_ICA_BY_VID **Status: Implemented** diff --git a/integration_tests/grpc_rest/pki/grpc_test.go b/integration_tests/grpc_rest/pki/grpc_test.go index 2e2f5c45f..f75460122 100644 --- a/integration_tests/grpc_rest/pki/grpc_test.go +++ b/integration_tests/grpc_rest/pki/grpc_test.go @@ -32,6 +32,6 @@ import ( func TestPkiDemoGRPC(t *testing.T) { suite := utils.SetupTest(t, testconstants.ChainID, false) - // pki.Demo(&suite) + pki.Demo(&suite) pki.NocCertDemo(&suite) } From af46592ccef4d7fea65ae0510cbee39d89aabf83 Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Thu, 18 Apr 2024 18:22:17 +0500 Subject: [PATCH 6/7] Fix removal of certificate from NocRootCertificateByVidAndSkid during NOC revocation --- ..._root_certificates_by_vid_and_skid_test.go | 2 +- ...rpc_query_revoked_noc_root_certificates.go | 2 +- ...uery_revoked_noc_root_certificates_test.go | 2 +- .../msg_server_revoke_noc_x_509_root_cert.go | 5 +-- .../noc_root_certificates_by_vid_and_skid.go | 43 ++++++++++++++++--- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go index 86dc9ec5f..8e848861b 100644 --- a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go +++ b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go @@ -49,7 +49,7 @@ func TestNocRootCertificatesByVidAndSkidQuerySingle(t *testing.T) { Vid: 100000, SubjectKeyId: strconv.Itoa(100000), }, - err: status.Error(codes.InvalidArgument, "not found"), + err: status.Error(codes.NotFound, "not found"), }, { desc: "InvalidRequest", diff --git a/x/pki/keeper/grpc_query_revoked_noc_root_certificates.go b/x/pki/keeper/grpc_query_revoked_noc_root_certificates.go index 6108c6cb9..477dba45b 100644 --- a/x/pki/keeper/grpc_query_revoked_noc_root_certificates.go +++ b/x/pki/keeper/grpc_query_revoked_noc_root_certificates.go @@ -54,7 +54,7 @@ func (k Keeper) RevokedNocRootCertificates(c context.Context, req *types.QueryGe req.SubjectKeyId, ) if !found { - return nil, status.Error(codes.InvalidArgument, "not found") + return nil, status.Error(codes.NotFound, "not found") } return &types.QueryGetRevokedNocRootCertificatesResponse{RevokedNocRootCertificates: val}, nil diff --git a/x/pki/keeper/grpc_query_revoked_noc_root_certificates_test.go b/x/pki/keeper/grpc_query_revoked_noc_root_certificates_test.go index 9752d1025..c8c0e6813 100644 --- a/x/pki/keeper/grpc_query_revoked_noc_root_certificates_test.go +++ b/x/pki/keeper/grpc_query_revoked_noc_root_certificates_test.go @@ -50,7 +50,7 @@ func TestRevokedNocRootCertificatesQuerySingle(t *testing.T) { Subject: strconv.Itoa(100000), SubjectKeyId: strconv.Itoa(100000), }, - err: status.Error(codes.InvalidArgument, "not found"), + err: status.Error(codes.NotFound, "not found"), }, { desc: "InvalidRequest", 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 13bc1f962..17acf0f3a 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 @@ -82,8 +82,7 @@ func (k msgServer) _revokeNocRootCertificates(ctx sdk.Context, certificates type // remove from subject key ID -> certificates map k.RemoveApprovedCertificatesBySubjectKeyID(ctx, certificates.Subject, certificates.SubjectKeyId) // remove from vid, subject key ID -> certificates map - // remove from vid, subject key ID -> certificates map - k.RemoveNocRootCertificatesByVidAndSkid(ctx, vid, certificates.SubjectKeyId) + k.RemoveNocRootCertificateByVidSubjectAndSkid(ctx, vid, certificates.Subject, certificates.SubjectKeyId) } func (k msgServer) _revokeNocRootCertificate( @@ -127,7 +126,7 @@ func (k msgServer) _revokeNocRootCertificate( } // remove from vid, subject key ID -> certificates map - k.RemoveNocRootCertificateByVidSkidAndSerialNumber(ctx, vid, certificates.SubjectKeyId, serialNumber) + k.RemoveNocRootCertificateByVidSubjectSkidAndSerialNumber(ctx, vid, cert.Subject, cert.SubjectKeyId, serialNumber) return nil } diff --git a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go index 328482a76..a6d0c80fa 100644 --- a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go +++ b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go @@ -76,17 +76,50 @@ func (k Keeper) RemoveNocRootCertificatesByVidAndSkid( )) } -// RemoveNocRootCertificatesByVidSkidAndSerialNumber removes root certificate with specified serial number from the list. -func (k Keeper) RemoveNocRootCertificateByVidSkidAndSerialNumber( +// RemoveNocRootCertificateByVidSkidSubjectAndSerialNumber removes root certificate with specified subject from the list. +func (k Keeper) RemoveNocRootCertificateByVidSubjectAndSkid( ctx sdk.Context, vid int32, + subject string, + subjectKeyID string, +) { + k._filterAndSetNocRootCertificateByVidAndSkid( + ctx, + vid, + subjectKeyID, + func(cert *types.Certificate) bool { + return cert.Subject != subject + }, + ) +} + +// RemoveNocRootCertificateByVidSkidSubjectAndSerialNumber removes root certificate with specified subject and serial number from the list. +func (k Keeper) RemoveNocRootCertificateByVidSubjectSkidAndSerialNumber( + ctx sdk.Context, + vid int32, + subject string, subjectKeyID string, serialNumber string, +) { + k._filterAndSetNocRootCertificateByVidAndSkid( + ctx, + vid, + subjectKeyID, + func(cert *types.Certificate) bool { + return !(cert.Subject == subject && cert.SerialNumber == serialNumber) + }, + ) +} + +// RemoveNocRootCertificateByVidSkidSubjectAndSerialNumber removes root certificate with specified subject and serial number from the list. +func (k Keeper) _filterAndSetNocRootCertificateByVidAndSkid( + ctx sdk.Context, + vid int32, + subjectKeyID string, + predicate CertificatePredicate, ) { nocCertificates, _ := k.GetNocRootCertificatesByVidAndSkid(ctx, vid, subjectKeyID) - filteredCertificates := filterCertificates(&nocCertificates.Certs, func(cert *types.Certificate) bool { - return cert.SerialNumber != serialNumber - }) + filteredCertificates := filterCertificates(&nocCertificates.Certs, predicate) if len(filteredCertificates) > 0 { nocCertificates.Certs = filteredCertificates From 39a46b3bda268adf3f5cc078034f94cedff56713 Mon Sep 17 00:00:00 2001 From: "aziz.karabashov" Date: Thu, 18 Apr 2024 20:10:27 +0500 Subject: [PATCH 7/7] Fix lint issues and GET_NOC_ROOT_BY_VID_AND_SKID REST query --- docs/static/openapi.yml | 2 +- proto/pki/query.proto | 2 +- .../module/rest.ts | 4 ++-- x/pki/handler_revoke_noc_root_cert_test.go | 2 +- ...c_query_noc_root_certificates_by_vid_and_skid_test.go | 2 +- x/pki/keeper/keeper.go | 2 ++ x/pki/keeper/noc_root_certificates_by_vid_and_skid.go | 9 +++++---- .../keeper/noc_root_certificates_by_vid_and_skid_test.go | 3 ++- x/pki/types/genesis.go | 2 +- x/pki/types/key_noc_root_certificates_by_vid_and_skid.go | 8 ++++---- x/pki/types/query.pb.gw.go | 2 +- 11 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index eee6754b8..9b2801f70 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -9877,7 +9877,7 @@ paths: format: int32 tags: - Query - /dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}: + /dcl/pki/noc-root-certificates/{vid}/{subjectKeyId}: get: summary: Queries a NocRootCertificatesByVidAndSkid by index. operationId: NocRootCertificatesByVidAndSkid diff --git a/proto/pki/query.proto b/proto/pki/query.proto index 9ecc12c9f..87e512a54 100644 --- a/proto/pki/query.proto +++ b/proto/pki/query.proto @@ -120,7 +120,7 @@ service Query { // Queries a NocRootCertificatesByVidAndSkid by index. rpc NocRootCertificatesByVidAndSkid(QueryGetNocRootCertificatesByVidAndSkidRequest) returns (QueryGetNocRootCertificatesByVidAndSkidResponse) { - option (google.api.http).get = "/dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}"; + option (google.api.http).get = "/dcl/pki/noc-root-certificates/{vid}/{subjectKeyId}"; } // Queries a list of NocRootCertificates items. 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 edf63f901..6ef490e38 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 @@ -845,11 +845,11 @@ export class Api extends HttpClient this.request({ - path: `/dcl/pki/noc_root_certificates/${vid}/${subjectKeyId}`, + path: `/dcl/pki/noc-root-certificates/${vid}/${subjectKeyId}`, method: "GET", format: "json", ...params, diff --git a/x/pki/handler_revoke_noc_root_cert_test.go b/x/pki/handler_revoke_noc_root_cert_test.go index fe31834e6..153a5a1e0 100644 --- a/x/pki/handler_revoke_noc_root_cert_test.go +++ b/x/pki/handler_revoke_noc_root_cert_test.go @@ -457,7 +457,7 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumber(t *testing.T) { require.Equal(t, 1, len(revNocRoot.Certs)) require.Equal(t, testconstants.NocRootCert1CopySerialNumber, revNocRoot.Certs[0].SerialNumber) - // query noc root certificate by VID and SKID should return only one root cert + // query noc root certificate by VID and SKID nocRootCertificatesByVidAndSkid, err := queryNocRootCertificatesByVidAndSkid(setup, testconstants.Vid, testconstants.NocRootCert1SubjectKeyID) require.NoError(t, err) require.Equal(t, testconstants.NocRootCert1SubjectKeyID, nocRootCertificatesByVidAndSkid.SubjectKeyId) diff --git a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go index 8e848861b..1d0757d29 100644 --- a/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go +++ b/x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go @@ -14,7 +14,7 @@ import ( "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" ) -// Prevent strconv unused error +// Prevent strconv unused error. var _ = strconv.IntSize func TestNocRootCertificatesByVidAndSkidQuerySingle(t *testing.T) { diff --git a/x/pki/keeper/keeper.go b/x/pki/keeper/keeper.go index 3b743177b..eaa27c9d0 100644 --- a/x/pki/keeper/keeper.go +++ b/x/pki/keeper/keeper.go @@ -106,10 +106,12 @@ func findCertificate(serialNumber string, certificates *[]*types.Certificate) (* func filterCertificates(certificates *[]*types.Certificate, predicate CertificatePredicate) []*types.Certificate { var result []*types.Certificate + for _, s := range *certificates { if predicate(s) { result = append(result, s) } } + return result } diff --git a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go index a6d0c80fa..84c715136 100644 --- a/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go +++ b/x/pki/keeper/noc_root_certificates_by_vid_and_skid.go @@ -8,7 +8,7 @@ import ( "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" ) -// SetNocRootCertificatesByVidAndSkid set a specific nocRootCertificatesByVidAndSkid in the store from its index +// SetNocRootCertificatesByVidAndSkid set a specific nocRootCertificatesByVidAndSkid in the store from its index. func (k Keeper) SetNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocRootCertificatesByVidAndSkid types.NocRootCertificatesByVidAndSkid) { store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) b := k.cdc.MustMarshal(&nocRootCertificatesByVidAndSkid) @@ -18,7 +18,7 @@ func (k Keeper) SetNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocRootCerti ), b) } -// GetNocRootCertificatesByVidAndSkid returns a nocRootCertificatesByVidAndSkid from its index +// GetNocRootCertificatesByVidAndSkid returns a nocRootCertificatesByVidAndSkid from its index. func (k Keeper) GetNocRootCertificatesByVidAndSkid( ctx sdk.Context, vid int32, @@ -36,6 +36,7 @@ func (k Keeper) GetNocRootCertificatesByVidAndSkid( } k.cdc.MustUnmarshal(b, &val) + return val, true } @@ -63,7 +64,7 @@ func (k Keeper) AddNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocCertifica store.Set(types.NocRootCertificatesByVidAndSkidKey(nocCertificate.Vid, nocCertificate.SubjectKeyId), b) } -// RemoveNocRootCertificatesByVidAndSkid removes a nocRootCertificatesByVidAndSkid from the store +// RemoveNocRootCertificatesByVidAndSkid removes a nocRootCertificatesByVidAndSkid from the store. func (k Keeper) RemoveNocRootCertificatesByVidAndSkid( ctx sdk.Context, vid int32, @@ -129,7 +130,7 @@ func (k Keeper) _filterAndSetNocRootCertificateByVidAndSkid( } } -// GetAllNocRootCertificatesByVidAndSkid returns all nocRootCertificatesByVidAndSkid +// GetAllNocRootCertificatesByVidAndSkid returns all nocRootCertificatesByVidAndSkid. func (k Keeper) GetAllNocRootCertificatesByVidAndSkid(ctx sdk.Context) (list []types.NocRootCertificatesByVidAndSkid) { store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix)) iterator := sdk.KVStorePrefixIterator(store, []byte{}) diff --git a/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go b/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go index 69af96a7f..1d03a3426 100644 --- a/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go +++ b/x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go @@ -12,7 +12,7 @@ import ( "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" ) -// Prevent strconv unused error +// Prevent strconv unused error. var _ = strconv.IntSize func createNNocRootCertificatesByVidAndSkid(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocRootCertificatesByVidAndSkid { @@ -23,6 +23,7 @@ func createNNocRootCertificatesByVidAndSkid(keeper *keeper.Keeper, ctx sdk.Conte keeper.SetNocRootCertificatesByVidAndSkid(ctx, items[i]) } + return items } diff --git a/x/pki/types/genesis.go b/x/pki/types/genesis.go index 128036711..506d2c436 100644 --- a/x/pki/types/genesis.go +++ b/x/pki/types/genesis.go @@ -33,7 +33,7 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. -func (gs GenesisState) Validate() error { +func (gs GenesisState) Validate() error { //nolint:gocyclo,vet // Check for duplicated index in approvedCertificates approvedCertificatesIndexMap := make(map[string]struct{}) diff --git a/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go b/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go index 2eac6149f..567eaf9c3 100644 --- a/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go +++ b/x/pki/types/key_noc_root_certificates_by_vid_and_skid.go @@ -5,11 +5,11 @@ import "encoding/binary" var _ binary.ByteOrder const ( - // NocRootCertificatesByVidAndSkidKeyPrefix is the prefix to retrieve all NocRootCertificatesByVidAndSkid + // NocRootCertificatesByVidAndSkidKeyPrefix is the prefix to retrieve all NocRootCertificatesByVidAndSkid. NocRootCertificatesByVidAndSkidKeyPrefix = "NocRootCertificatesByVidAndSkid/value/" ) -// NocRootCertificatesByVidAndSkidKey returns the store key to retrieve a NocRootCertificatesByVidAndSkid from the index fields +// NocRootCertificatesByVidAndSkidKey returns the store key to retrieve a NocRootCertificatesByVidAndSkid from the index fields. func NocRootCertificatesByVidAndSkidKey( vid int32, subjectKeyID string, @@ -21,8 +21,8 @@ func NocRootCertificatesByVidAndSkidKey( key = append(key, vidBytes...) key = append(key, []byte("/")...) - subjectKeyIdBytes := []byte(subjectKeyID) - key = append(key, subjectKeyIdBytes...) + subjectKeyIDBytes := []byte(subjectKeyID) + key = append(key, subjectKeyIDBytes...) key = append(key, []byte("/")...) return key diff --git a/x/pki/types/query.pb.gw.go b/x/pki/types/query.pb.gw.go index 5625ec3fc..c7f2170d6 100644 --- a/x/pki/types/query.pb.gw.go +++ b/x/pki/types/query.pb.gw.go @@ -2452,7 +2452,7 @@ var ( 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_NocRootCertificatesByVidAndSkid_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_root_certificates", "vid", "subjectKeyId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NocRootCertificatesByVidAndSkid_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-root-certificates", "vid", "subjectKeyId"}, "", 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)))