zigbee-alliance / distributed-compliance-ledger

DCL is a public permissioned ledger framework for certification of device models. The ledger is based on Cosmos SDK and CometBFT (Tendermint).
Apache License 2.0
89 stars 44 forks source link

pagination is not working with /dcl/pki/certificates api #275

Open j2fong opened 2 years ago

j2fong commented 2 years ago

Calling /dcl/pki/certificates?limit=2will return 3 items and not 2.

{ "approvedCertificates": [ { "subject": "CN=Matter Development PAA", "subject_key_id": "FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8", "certs": [ { "pem_cert": "-----BEGIN CERTIFICATE-----\nMIIBoDCCAUagAwIBAgIIV9Oi0B4xgZAwCgYIKoZIzj0EAwIwITEfMB0GA1UEAwwW\nTWF0dGVyIERldmVsb3BtZW50IFBBQTAgFw0yMTA2MjgxNDIzNDNaGA85OTk5MTIz\nMTIzNTk1OVowITEfMB0GA1UEAwwWTWF0dGVyIERldmVsb3BtZW50IFBBQTBZMBMG\nByqGSM49AgEGCCqGSM49AwEHA0IABBsPJZQuPZKr1nBMGieBoDjsUyEsTatYsL48\nQL37SSMjQhx53MetcBgQBxINyG8KiSU9iZPrN6tlLvjbE3XlsUWjZjBkMBIGA1Ud\nEwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBT6ks8JXvpC\n4RQwZRYy/v4bLHenyDAfBgNVHSMEGDAWgBT6ks8JXvpC4RQwZRYy/v4bLHenyDAK\nBggqhkjOPQQDAgNIADBFAiBQp5AzZLZT/w6kY9xoSobdJccxo57+s8IM0t7RtmB+\nLwIhAK/U7UtqmeX4xVIdcB68+f1TuTlP2A/FmZL/Plu7tgo1\n-----END CERTIFICATE-----\n", "serial_number": "6328580916129137040", "issuer": "", "authority_key_id": "", "root_subject": "", "root_subject_key_id": "", "is_root": true, "owner": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "subject": "CN=Matter Development PAA", "subject_key_id": "FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8", "approvals": [ { "address": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "time": "1646289765", "info": "Matter Dev certificate VID=0x6006 (Google)" }, { "address": "cosmos1sad2wh7amdu7j99n9qh0t2e2n6q5vsjkhs986q", "time": "1646328031", "info": "" } ] } ] }, { "subject": "CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036", "subject_key_id": "B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21", "certs": [ { "pem_cert": "-----BEGIN CERTIFICATE-----\nMIIB7TCCAZOgAwIBAgIBATAKBggqhkjOPQQDAjBLMQswCQYDVQQGEwJVUzEPMA0G\nA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFBIDExFDASBgorBgEEAYKi\nfAIBDAQ2MDA2MCAXDTIxMTIwODIwMjYwM1oYDzIxMjExMjA4MjAyNjAzWjBLMQsw\nCQYDVQQGEwJVUzEPMA0GA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFB\nIDExFDASBgorBgEEAYKifAIBDAQ2MDA2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\nQgAE8iZX+exx8NDV7jYKorx3EcsD1gessexUTSimIfvFI2PySlReMjJDVCGIzXor\nhTYFOzwMAx4b6ogNMIUmcW7uT6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNV\nHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLAAVoG4iGKJYoDhIRihqL4J3pMhMB8GA1Ud\nIwQYMBaAFLAAVoG4iGKJYoDhIRihqL4J3pMhMAoGCCqGSM49BAMCA0gAMEUCIQCV\nc26cVlyqjhQfcgN3udpne6zZQdyVMNLRWZn3EENBkAIgasUeFU8zaUt8bKNWd0k+\n4RQp5Cp5wYzrE8AxJ9BiA/E=\n-----END CERTIFICATE-----\n", "serial_number": "1", "issuer": "", "authority_key_id": "", "root_subject": "", "root_subject_key_id": "", "is_root": true, "owner": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "subject": "CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036", "subject_key_id": "B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21", "approvals": [ { "address": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "time": "1646289886", "info": "Matter Prod certificate VID=0x6006 (Google)" }, { "address": "cosmos1sad2wh7amdu7j99n9qh0t2e2n6q5vsjkhs986q", "time": "1646328058", "info": "" } ] } ] }, { "subject": "CN=Non Production ONLY - XFN PAA Class 3", "subject_key_id": "F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9", "certs": [ { "pem_cert": "-----BEGIN CERTIFICATE-----\nMIIByjCCAXCgAwIBAgIUFkdW6XaPDQDsJ3530eRkiOtYbWQwCgYIKoZIzj0EAwIw\nMDEuMCwGA1UEAwwlTm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3Mg\nMzAgFw0yMTEyMTQwMzI3MzZaGA8yMDUxMTIwNzAzMjczNlowMDEuMCwGA1UEAwwl\nTm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3MgMzBZMBMGByqGSM49\nAgEGCCqGSM49AwEHA0IABB+Unq8KdMuQ6xWFKtAVGreDGzDlyLrpuSIZ86eMswgu\n4xvjijYN6iljia1HjxVTTRdieROa7mpoLD7qEUC5yjmjZjBkMBIGA1UdEwEB/wQI\nMAYBAf8CAQEwHwYDVR0jBBgwFoAU+Jmp1a1xceTDgX8UEH948Nn3YukwHQYDVR0O\nBBYEFPiZqdWtcXHkw4F/FBB/ePDZ92LpMA4GA1UdDwEB/wQEAwIBhjAKBggqhkjO\nPQQDAgNIADBFAiBYIsjeauI2nDknU1ThEDzyGfg4F9tLSkiuTrTJGr5EqQIhAMFX\nbxTzgOfx0RPgpEU8syFEYyXCBcv4hV14rWddc08G\n-----END CERTIFICATE-----\n", "serial_number": "127188720967193433433853406409065077573408025956", "issuer": "", "authority_key_id": "", "root_subject": "", "root_subject_key_id": "", "is_root": true, "owner": "cosmos1nnjlvrr0t5va9l00dz3hz8sqh3w00ca0wsqejh", "subject": "CN=Non Production ONLY - XFN PAA Class 3", "subject_key_id": "F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9", "approvals": [ { "address": "cosmos1nnjlvrr0t5va9l00dz3hz8sqh3w00ca0wsqejh", "time": "1645725246", "info": "" }, { "address": "cosmos1gq58u3wh6h635ey6x2kppr85ey420xyfm2ulsz", "time": "1645726929", "info": "" } ] } ] } ], "pagination": { "next_key": null, "total": "3" } }

Calling /dcl/pki/certificates?reverse-true does not return the reverse order { "approvedCertificates": [ { "subject": "CN=Matter Development PAA", "subject_key_id": "FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8", "certs": [ { "pem_cert": "-----BEGIN CERTIFICATE-----\nMIIBoDCCAUagAwIBAgIIV9Oi0B4xgZAwCgYIKoZIzj0EAwIwITEfMB0GA1UEAwwW\nTWF0dGVyIERldmVsb3BtZW50IFBBQTAgFw0yMTA2MjgxNDIzNDNaGA85OTk5MTIz\nMTIzNTk1OVowITEfMB0GA1UEAwwWTWF0dGVyIERldmVsb3BtZW50IFBBQTBZMBMG\nByqGSM49AgEGCCqGSM49AwEHA0IABBsPJZQuPZKr1nBMGieBoDjsUyEsTatYsL48\nQL37SSMjQhx53MetcBgQBxINyG8KiSU9iZPrN6tlLvjbE3XlsUWjZjBkMBIGA1Ud\nEwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBT6ks8JXvpC\n4RQwZRYy/v4bLHenyDAfBgNVHSMEGDAWgBT6ks8JXvpC4RQwZRYy/v4bLHenyDAK\nBggqhkjOPQQDAgNIADBFAiBQp5AzZLZT/w6kY9xoSobdJccxo57+s8IM0t7RtmB+\nLwIhAK/U7UtqmeX4xVIdcB68+f1TuTlP2A/FmZL/Plu7tgo1\n-----END CERTIFICATE-----\n", "serial_number": "6328580916129137040", "issuer": "", "authority_key_id": "", "root_subject": "", "root_subject_key_id": "", "is_root": true, "owner": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "subject": "CN=Matter Development PAA", "subject_key_id": "FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8", "approvals": [ { "address": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "time": "1646289765", "info": "Matter Dev certificate VID=0x6006 (Google)" }, { "address": "cosmos1sad2wh7amdu7j99n9qh0t2e2n6q5vsjkhs986q", "time": "1646328031", "info": "" } ] } ] }, { "subject": "CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036", "subject_key_id": "B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21", "certs": [ { "pem_cert": "-----BEGIN CERTIFICATE-----\nMIIB7TCCAZOgAwIBAgIBATAKBggqhkjOPQQDAjBLMQswCQYDVQQGEwJVUzEPMA0G\nA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFBIDExFDASBgorBgEEAYKi\nfAIBDAQ2MDA2MCAXDTIxMTIwODIwMjYwM1oYDzIxMjExMjA4MjAyNjAzWjBLMQsw\nCQYDVQQGEwJVUzEPMA0GA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFB\nIDExFDASBgorBgEEAYKifAIBDAQ2MDA2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\nQgAE8iZX+exx8NDV7jYKorx3EcsD1gessexUTSimIfvFI2PySlReMjJDVCGIzXor\nhTYFOzwMAx4b6ogNMIUmcW7uT6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNV\nHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLAAVoG4iGKJYoDhIRihqL4J3pMhMB8GA1Ud\nIwQYMBaAFLAAVoG4iGKJYoDhIRihqL4J3pMhMAoGCCqGSM49BAMCA0gAMEUCIQCV\nc26cVlyqjhQfcgN3udpne6zZQdyVMNLRWZn3EENBkAIgasUeFU8zaUt8bKNWd0k+\n4RQp5Cp5wYzrE8AxJ9BiA/E=\n-----END CERTIFICATE-----\n", "serial_number": "1", "issuer": "", "authority_key_id": "", "root_subject": "", "root_subject_key_id": "", "is_root": true, "owner": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "subject": "CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036", "subject_key_id": "B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21", "approvals": [ { "address": "cosmos1y3w6cpkmasawy8txsn9wrauggfqrxdx9qaq9aj", "time": "1646289886", "info": "Matter Prod certificate VID=0x6006 (Google)" }, { "address": "cosmos1sad2wh7amdu7j99n9qh0t2e2n6q5vsjkhs986q", "time": "1646328058", "info": "" } ] } ] }, { "subject": "CN=Non Production ONLY - XFN PAA Class 3", "subject_key_id": "F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9", "certs": [ { "pem_cert": "-----BEGIN CERTIFICATE-----\nMIIByjCCAXCgAwIBAgIUFkdW6XaPDQDsJ3530eRkiOtYbWQwCgYIKoZIzj0EAwIw\nMDEuMCwGA1UEAwwlTm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3Mg\nMzAgFw0yMTEyMTQwMzI3MzZaGA8yMDUxMTIwNzAzMjczNlowMDEuMCwGA1UEAwwl\nTm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3MgMzBZMBMGByqGSM49\nAgEGCCqGSM49AwEHA0IABB+Unq8KdMuQ6xWFKtAVGreDGzDlyLrpuSIZ86eMswgu\n4xvjijYN6iljia1HjxVTTRdieROa7mpoLD7qEUC5yjmjZjBkMBIGA1UdEwEB/wQI\nMAYBAf8CAQEwHwYDVR0jBBgwFoAU+Jmp1a1xceTDgX8UEH948Nn3YukwHQYDVR0O\nBBYEFPiZqdWtcXHkw4F/FBB/ePDZ92LpMA4GA1UdDwEB/wQEAwIBhjAKBggqhkjO\nPQQDAgNIADBFAiBYIsjeauI2nDknU1ThEDzyGfg4F9tLSkiuTrTJGr5EqQIhAMFX\nbxTzgOfx0RPgpEU8syFEYyXCBcv4hV14rWddc08G\n-----END CERTIFICATE-----\n", "serial_number": "127188720967193433433853406409065077573408025956", "issuer": "", "authority_key_id": "", "root_subject": "", "root_subject_key_id": "", "is_root": true, "owner": "cosmos1nnjlvrr0t5va9l00dz3hz8sqh3w00ca0wsqejh", "subject": "CN=Non Production ONLY - XFN PAA Class 3", "subject_key_id": "F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9", "approvals": [ { "address": "cosmos1nnjlvrr0t5va9l00dz3hz8sqh3w00ca0wsqejh", "time": "1645725246", "info": "" }, { "address": "cosmos1gq58u3wh6h635ey6x2kppr85ey420xyfm2ulsz", "time": "1645726929", "info": "" } ] } ] } ], "pagination": { "next_key": null, "total": "3" } }

hawk248 commented 2 years ago

Requires further investigation ... if it is more pervasive, in lower level SDK, it will be pulled in before Mainnet launch.

hawk248 commented 2 years ago

Post Mainnet 1.0.