openwallet-foundation/credo-ts

DID Exchange fails when requester uses numAlgo 0

conanoc opened this issue · 3 comments

I added the following test case to didexchange-numalgo.test.ts:

  test('Connect using numalgo 0 for requester and default setting for responder', async () => {
    await didExchangeNumAlgoBaseTest({ requesterNumAlgoSetting: PeerDidNumAlgo.InceptionKeyWithoutDoc })
  })

Then the test fails with error:

CredoError: Did document creation failed: {"state":"failed","reason":"Missing key type"}

NumAlgo 0 can't be used for did exchange as it can't include a didcomm service, only a key.

So this is expected, but we should make the error handling more clear

I expected did:peer:0 to be treated as a DID for an agent that does not have endpoints. This was supported in the connection protocol by using an endpoint "didcomm:transport/queue". This feature is beneficial for mobile agents that do not utilize mediators.

The agent could create a numAlgo 2 DID by assigning a dummy service with an endpoint "didcomm:transport/queue". However, for this use case, using did:peer:0 would be more convenient and concise.

Hmm but in that case we'd have to assume that the wallet wants use didcomm:transport/queue when using did:peer:0 which is very implicit behavior and would also require 'hacks' to make it work as the did resolver doesn't return a service for a did:peer:0. It's basically the same as did:key.

I think in this case you should use any of the other did:peer numalgos