From c4478e8594c3e21bd4afcaff61f7d7baccb617d6 Mon Sep 17 00:00:00 2001 From: Bohdan Kuchma Date: Wed, 11 Dec 2024 16:07:39 +0200 Subject: [PATCH] Change router endpoint --- README.md | 98 +++++++++++++++++++------------------- internal/service/router.go | 2 +- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index e44d5ac..f203538 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,66 @@ -# identity-provider-service +# incognito-light-registrator ## Description -This service is responsible for verifying a user-provided ZKP, real-world identity certificate and issuing voting permission claim. +This service is responsible for verifying a user-provided ZKP and real-world identity certificate ## Endpoints ### create_identity -`create_identity` verifies a user-provided ZKP that proves the real-world identity ownership, validates this real-world identity certificate and issues a PollsCredential claim.

-Path: `POST /integrations/identity-provider-service/v1/create-identity`
+`register` verifies a user-provided ZKP that proves the real-world identity ownership, validates this real-world +identity certificate and return poseidon hash of truncated signed attributes by 252 bits along with ECDSA signature of +dg1 and poseidon hash. +Path: `POST /integrations/incognito-light-registrator/v1/register`
Payload example (proof is provided as an example and actually does not prove anything): ```json { "data": { - "id": "did:iden3:readonly:tJWarsbwqiUxHm8BPi4aYSnnj54AbuR4D2RrhkykQ", - "document_sod": { - "signed_attributes": "hex_string", - "algorithm": "SHA256withRSA", - "signature": "hex_string", - "pem_file": "-----BEGIN CERTIFICATE-----\n{...}\n-----END CERTIFICATE-----", - "encapsulated_content": "hex_string" - }, - "zkproof": { - "proof": { - "pi_a": [ - "4486400337619062702179111506341517111494111681111222111137338836157671763417", - "4486400337619062702179111506341517111494111681111222111137338836157671763417", - "1" + "attributes": { + "document_sod": { + "hash_algorithm": "SHA256", + "signature_algorithm": "ECDSA", + "signed_attributes": "0x3030 30 30 30 30 30 30 30 ", + "encapsulated_content": "3081d6020100300b06096086480165030402013081c330250201010420b50b1f69b0002816c41219170a1cee830c6ba6406780597899e1b0c439b300bf3025020102042093e182e8583ae18c6501560abb0a9d2e23e54f51499c17b45f27b524703be4cd30250201030420d6a6670509ee6247ea3f95afb60995adaf82a2b2228464ddaef06b43d016fe8e302502010b0420c75f429b736c644295af7b40b254aebacddf5be4600d3d5d6a1463db3402b579302502010e042099b67cd9864166e4c3f06f92479c84499e29365ee2f9cd7010824c78aa6c6565", + "signature": "043e303c021c4c4d8999f5936d9123b194444ba02f538fd0064120faa824002101db021c06c5214f7ea4b12df4fdfdea375822aaab85c653b663f2eea4c2d6e5", + "aa_signature": "043e303c021c4c4d8999f5936d9123b194444ba02f538fd0064120faa824002101db021c06c5214f7ea4b12df4fdfdea375822aaab85c653b663f2eea4c2d6e5", + "pem_file": "-----BEGIN CERTIFICATE-----\nMIIC5jCCAougAwIBAgICJ50wCwYHKoZIzj0EAQUAMEMxCzAJBgNVBAYTAkxUMRcw\nFQYDVQQKDA5BRElDIHVuZGVyIE1PSTENMAsGA1UEAwwEQ1NDQTEMMAoGA1UEBRMD\nMDA2MB4XDTI0MDIxMjEyMDM0N1oXDTM0MDYxMjEyMDM0N1owZDELMAkGA1UEBhMC\nTFQxFzAVBgNVBAoMDkFESUMgdW5kZXIgTU9JMS4wLAYDVQQDDCVEb2N1bWVudCBT\naWduZXIgQ2VydGlmaWNhdGUgTGl0aHVhbmlhMQwwCgYDVQQFEwMwODcwggEqMIHr\nBgcqhkjOPQIBMIHfAgEBMCgGByqGSM49AQECHQD/////////////////////AAAA\nAAAAAAAAAAABMFMEHP////////////////////7///////////////4EHLQFCoUM\nBLOr9UEyVlBEsLfXv9i6Jws5QyNV/7QDFQC9cTRHmdXH/NxFtZ+juauPapSLxQQ5\nBLcODL1rtL9/MhOQuUoDwdNWwhEiNDKA1hFcHSG9N2OItfcj+0wi3+bNQ3WgWgdH\nZETVgZmFAH40Ah0A//////////////////8WouC48D4T3SlFXFwqPQIBAQM6AARw\n6K/lTn4c8lZsqFzFix+nZv62SSUwut+0BNPbY05wSh36YXMQrRdna0NMfw2gKpYi\nzIxNmqOR5qN6MHgwKwYDVR0QBCQwIoAPMjAyNDAyMTEyMjAwMDBagQ8yMDI0MDUx\nMTIwNTk1OVowGAYDVR0gBBEwDzANBgsrBgEEAYKGVQEBATAfBgNVHSMEGDAWgBSd\nLFzpO+GBh/uyjgeogb8+smM6uDAOBgNVHQ8BAf8EBAMCB4AwCwYHKoZIzj0EAQUA\nA0gAMEUCIGGDJKBObbfQdqYa23H7Ch+Fcei28no4dRrngBZBFaXeAiEAjF08Czap\ndy5M468rxmt11gMOgTH2GEaPnzkgNOIkBTM=\n-----END CERTIFICATE-----", + "dg15": "No dg15 sorry :D" + }, + "zk_proof": { + "pub_signals": [ + "269026869708513946446687457343201764886487626366912263327519242377662974364", + "9703171290812407050309456313448874004026885475822544145072049896756804971676", + "8363204307440260454371899968449677801961271755493031845914373830692124556998" ], - "pi_b": [ - [ - "4486400337619062702179111506341517111494111681111222111137338836157671763417", - "4486400337619062702179111506341517111494111681111222111137338836157671763417" + "proof": { + "pi_a": [ + "21589962259727307365900411907219442681669776401882179485681795376006899316989", + "7377561516389953415384751801715657350657958299641961691410220357838042690674", + "1" ], - [ - "4486400337619062702179111506341517111494111681111222111137338836157671763417", - "4486400337619062702179111506341517111494111681111222111137338836157671763417" + "protocol": "groth16", + "pi_c": [ + "1337371437317667959599140538475488497194727231607049369731348753999808567844", + "10009859513192051580087069990100788191890785009804966508063222754666103028282", + "1" ], - [ - "1", - "0" + "pi_b": [ + [ + "2627107369102081752799656750018525812345397265178758306071312169468153172532", + "15868602158674313289727067742845259729719815385142670691512463053966346120014" + ], + [ + "9466571619665024797398906391835545912875008602410323769132305631091731235382", + "5799019424856843313632398271917852551556989350345438961080241423958328780035" + ], + [ + "1", + "0" + ] ] - ], - "pi_c": [ - "44864003376190627021791115063415171114941116811112221111373388361576717634171", - "4486400337619062702179111506341517111494111681111222111137338836157671763417", - "1" - ], - "protocol": "groth16", - "curve": "bn128" - }, - "pub_signals": [ - "311829949927574718572524671081106490489", - "311829949927574718572524671081106490489", - "4903111", - "24", - "1", - "25", - "25", - "1", - "25", - "18" - ] + } + } } } } @@ -93,7 +91,7 @@ The only Issuer Node that is used is CreateCredential that issues claim. This cl ``` git clone github.com/rarimo/passport-identity-provider - cd identity-provider-service + cd incognito-light-registrator go build main.go export KV_VIPER_FILE=./config.yaml ./main migrate up diff --git a/internal/service/router.go b/internal/service/router.go index 3187445..5ead7c2 100644 --- a/internal/service/router.go +++ b/internal/service/router.go @@ -23,7 +23,7 @@ func (s *service) router() chi.Router { ) r.Route("/integrations/incognito-light-registrator", func(r chi.Router) { r.Route("/v1", func(r chi.Router) { - r.Post("/verify-sod", handlers.Register) + r.Post("/register", handlers.Register) }) })