You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove the parseJson() overrides that repeat the base TransactionType.parseJson() #2216
Once #2186 merges, TransactionType.parseJson() reads transaction_data_hashes_alg itself, using the payload from parseOpenId4VpRequest() and then parseJoseHashAlgorithms(). Three overrides do the same thing and can go:
PaymentTransaction.parseJson() in multipaz-doctypes
PingTransaction.parseJson() in multipaz-utopia
the test transaction type in DigitalCredentialsPresentmentTest in multipaz
Each already implements parseOpenId4VpRequest(), so the base function should give the same result.
Notes
Removing the override in DigitalCredentialsPresentmentTest also runs the base parseJson() through the existing presentment tests, which already ask for sha-384 and check the response. The tests added in Keep the verifier's hash algorithms for every transaction type. #2186 stop at TransactionData.hashAlgorithms.
The JsonData classes probably have to keep their transactionDataHashesAlg field, because their jsonFormat may not ignore unknown keys. Check this when removing the overrides.
Raised in review of #2186. Not part of that PR, to keep it to one change.
A suggestion for this follow-up, from the DX review of #2186.
With #2186, a new type writes nothing to have transaction_data_hashes_alg honoured. On the way out, though, every type still writes the whole OpenID4VP envelope by hand in serializeOpenId4VpRequest(): type, credential_ids and transaction_data_hashes_alg. Nothing in the KDoc says so, and the library's half isn't documented either: addTransactionType() leads to parseJson() being called for each item, and the developer never sees it.
A type that leaves out transaction_data_hashes_alg silently drops the verifier's choice. The wallet answers with SHA-256, and verifyMdocResponse() accepts whichever algorithm the response names. The envelope is also parsed three times per item: in parseJsonTransactions(), in the base parseJson() and in parseOpenId4VpRequest().
While removing the overrides, could the base class own the envelope both ways, so a type only maps its payload?
That takes the NoteTransaction in TransactionTypeParseJsonTest from about 19 lines to about 8, and it can be added next to the existing functions without breaking them. It could also add the check that the response's algorithm is one the verifier requested. This is a trace; I didn't run it.
Activity
dzuluaga commentedon Nov 19, 2026
A suggestion for this follow-up, from the DX review of #2186.
With #2186, a new type writes nothing to have
transaction_data_hashes_alghonoured. On the way out, though, every type still writes the whole OpenID4VP envelope by hand inserializeOpenId4VpRequest():type,credential_idsandtransaction_data_hashes_alg. Nothing in the KDoc says so, and the library's half isn't documented either:addTransactionType()leads toparseJson()being called for each item, and the developer never sees it.A type that leaves out
transaction_data_hashes_algsilently drops the verifier's choice. The wallet answers with SHA-256, andverifyMdocResponse()accepts whichever algorithm the response names. The envelope is also parsed three times per item: inparseJsonTransactions(), in the baseparseJson()and inparseOpenId4VpRequest().While removing the overrides, could the base class own the envelope both ways, so a type only maps its payload?
That takes the
NoteTransactioninTransactionTypeParseJsonTestfrom about 19 lines to about 8, and it can be added next to the existing functions without breaking them. It could also add the check that the response's algorithm is one the verifier requested. This is a trace; I didn't run it.