fix(didcomm): tolerate base64url in signed attachment payloads#2761
fix(didcomm): tolerate base64url in signed attachment payloads#2761genaris merged 2 commits intoopenwallet-foundation:mainfrom
Conversation
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
|
|
Wait isn't it supposed to be base64url for data.base64 (i know confusing...)
I want to change it to base64url, but @TimoGlastra preferred not to, to keep better interoperability. |
The problem is that with the current code as it is right now on main, I have problems when trying to make it interact with a mediator using credo 0.5.17, so it already has an interop issue. But you have a good point. Maybe we should first check for base64url and use base64 as a fallback? I'll explore this problem a bit more in detail to see what is actually going on here. |
|
@berendsliedrecht initially I thought to take the same approach as we did in feat/didcomm-v2 branch, by modifying the TypedArrayEncoder to accept both, which seems to be actually the same behaviour as we had prior to upgrading to So maybe it would be better to treat it as a regression of TypedArrayEncoder (and fix it to match the previous behaviour) rather than a specific case for DIDComm attachments. What do you think? |
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
|
I'd prefer to keep |
Yeah, I agree. Better to keep it focused in DIDComm attachments and eventually remove the fallback once most agents are properly encoding them. |
data.base64in signed attachments is spec'd as standard base64, but peers routinely emit base64url (padded or not). Earlier Credo versions, AFJ 0.5.x, ACA-Py. Credo 0.7'sTypedArrayEncoder.fromBase64uses@scure/basewhich is strict, so DID Exchange responses (and any other signed-attachment flow) fail with:So here we are creating some new helpers and updates in
DidCommAttachmentthat do strict base64 first, fall back to base64url (stripping=to cover both padded and unpadded). DidExchangeProtocol makes use of this logic.