openwallet-foundation / acapy

Hyperledger Aries Cloud Agent Python (ACA-Py) is a foundation for building decentralized identity applications and services running in non-mobile environments.
https://wiki.hyperledger.org/display/aries
Apache License 2.0
408 stars 512 forks source link

Impossible to emit verbose Credential Exchange 2.0 webhooks #3191

Closed mkempa closed 1 month ago

mkempa commented 1 month ago

Hi. Looking at the breaking change mentioned in the 1.0.0 changelog, especially PR #3081, it seems that Issue credential 2.0 protocol now emits terse webhooks only.

In this code the line with debug.webhooks config property is completely removed while in the pres_exchange it is preserved.

I believe it is a bug but please correct me if this was intentional. Thank you.

swcurran commented 1 month ago

@jamshale or @ianco — can one of you take a look at this? Thanks!

ianco commented 1 month ago

@jamshale or @ianco — can one of you take a look at this? Thanks!

I'll take a look

ianco commented 1 month ago

Not sure about the logic offhand, but when I run a test using the alice/faber demo it looks like both cred issue and pres req are both issuing verbose webhooks:

ACAPY_DEBUG_WEBHOOKS=1 ./run_demo run faber --wallet-type askar-anoncreds --events

and

ACAPY_DEBUG_WEBHOOKS=1 ./run_demo run alice --wallet-type askar-anoncreds --events

@mkempa are you finding there is data missing from your webhooks?

PS the change you referenced added some additional content to the "terse" webhook, so the "terse" vs "verbose" content is actually pretty similar now

mkempa commented 1 month ago

I ran the demo with commands you provided and this is what I got.

EVENT: Agent called controller webhook: handle_issue_credential_v2_0
POST http://host.docker.internal:8822/webhooks/topic/issue_credential_v2_0/ with payload: 
{
    "connection_id": "bda7d2f9-75f7-4589-b19e-112e2c1e0119",
    "cred_ex_id": "49b6e37b-d5fb-4a14-a41b-7635285fecf4",
    "role": "issuer",
    "initiator": "self",
    "auto_offer": false,
    "auto_remove": false,
    "thread_id": "5a7191b4-d21b-4567-99dd-c1e80a352bee",
    "state": "offer-sent",
    "by_format": {
        "cred_proposal": {
            "indy": {
                "cred_def_id": "NwJukpsx7Ry7o5SmP1pTAD:3:CL:66:faber.agent.degree_schema"
            }
        },
        "cred_offer": {
            "indy": {
                "schema_id": "NwJukpsx7Ry7o5SmP1pTAD:2:degree schema:101.6.22",
                "cred_def_id": "NwJukpsx7Ry7o5SmP1pTAD:3:CL:66:faber.agent.degree_schema",
                "key_correctness_proof": {
                    "c": "73207316327473064441861642757273074753430566032431775760927875723582323055791",
                    "xz_cap": "780169783006881845635415662871605391353473119251538095333289658617988591619956599939904100187000417885118355486260560281279733346420695537938351169979626105966455577277791973997620708927248229336483026303046572455676930084687340893071356262254133310929823045243893760997184013520843456900705900576640055655125678381479148742658258020306491947761571412526990598490635959698067841057217597240303979787023146635505508759064887847179038270032686682349954186306883829175579445269205027295397143428520760663011625303812659335950282331520344900243874717997472208015429013371424868812882993957531538557704619723715475533423198501538431889977180296356368499809471985329599347369754818214859067241456203",
                    "xr_cap": [
                        [
                            "name",
                            "1129079435623873188416542347624904031065426426652275050428521049862989317415724702925797690116755595773409485537782615106676022969608617874645514044076044581993927871128466221674415604591347621593605525869975195706487622795337028473691517231304033101208884397769584244290629117679084512691060743541001834019983561703190300499058030121504317553463793909217712308091331123377778656720910976678267905857271814644701073121658530587989991788170868018840438153130081602515087057472976122322815748194529317441425871287871605098084899568072494365402809182847658665161834590861553952598211775685584324810005388765841436815529677778628238040080173977115513096282942036955194112136411747927429035143972704"
                        ],
                        [
                            "date",
                            "482487150697049974675186700629318352171850593042282202945995757326785238430737074945139541093066149454485269261979347768079506569059370346953701167169149363543568585680103881483673917343793797585255355890428296867334829673523392226984455323556144206859093764200374720969660186263996649562883886855311749699558692534913860568096050353930469446292338465536690139515679344897109077717751064989010938422051879177234320567584729059230904020939937779971760641630887304244482671778965522403806948515340584316288591240100623295600002973721458091844703289331502285741719100706381871181536559821738603782566310361195397354676122531811508558540612275857069590258575241517441650147114273366880525906199645"
                        ],
                        [
                            "birthdate_dateint",
                            "1213830523766651581710627693709237302303801371282003751967583517407961163102859146906406823185489592806877563530768207052464930253866994339548299616588419222934904876227409737351805029737165539255707619751576133318177106273699125959495361439521669720710838560207227211596233042931926720550187528581589634104543747949988628751855491039406207117685284327688297703509417551187671990906054580375131990357107031289698422725030742447620778790679520638387408619251039488128045943748453689401696312927791151589323283264940657897506678524896834533120195089768099520010551712297128901216467246525964991310623218450548894511572516926136735404393936983014749697841987930097519397123335444507333380298289487"
                        ],
                        [
                            "timestamp",
                            "571944916998353266410938906466218320172367676242007909417331388596594006771890039872372863770334633273585835477269801219501414758524225558973251695735578161511668330193982986872079904908331485053791873159054459853493698870241401994209106338736335259174914638762279340119095758112313417458107628841019393503537837552505092123344723225931743722102958914010262094595006708433757854586155223185222067710108510829054219868220238406916707779630189413707624158665120488499723983813714314859915621583970015059522283120306343035919013877775188939537928528720802148875766295187413333971678880392026017214514855098627467655268603287244947369658953246657892518025897140357802940315706913339466426167296612"
                        ],
                        [
                            "degree",
                            "1435858003755723802381590893184707438329284742888106939716932612050880345826971801223960214492825088477460242409685234644367441992206073565510845111727826700265468811446860134887565320537153799726608836283097157014257810295680472295484361471671291172310296049205309240057442254895896677776451788146543839719679098907612360912949845358634564789730629131865466114236598996905260760245256996028986560007936328040447984187361615823711609920778760062664975448166041986444993396098987587021623742288181342707519784799278322492798281290423925052333951090153532527274414436520826353086348262974928568874807990492452193847116718159977692330752041317909022295380154590568067004683841481023279271007134826"
                        ],
                        [
                            "master_secret",
                            "1236898138725748635083548812873272672506951713362673837996948408203592816563133041164370235413745454151238449172692523536734056602415040878942667385023920930019275030825303271194347171691201319037949669430941863226095808157011267472810403518718733696138383324718791693968928350057499315858923452715258563444737003446495634112316970358804196817176103468926772475557933713965201111516860930168246585389694281819008234845714634817530566812746918021028231914502966133801756705148175761834192288532734122735409786092957418632283160240375427892907632288020126060723706666345040913357602139803632135729095659404467102333953337555121079821833597593397060591421002252541429088578295973273745927723810913"
                        ]
                    ]
                },
                "nonce": "1185050084224714546914967"
            }
        }
    },
    "trace": false,
    "created_at": "2024-08-22T09:24:43.863033Z",
    "updated_at": "2024-08-22T09:24:43.863033Z"
}

Compared to the verbose webhook it misses cred_offer at root level, besides others, which a webhook listener on our backend is complaining about.

ianco commented 1 month ago

OK I'll take a look, thanks!

ianco commented 1 month ago

@mkempa a fix has been merged can you test?

mkempa commented 1 month ago

Tested with and without ACAPY_DEBUG_WEBHOOKS=1 and both webhook formats look alright. Thank you very much.