Sphereon-Opensource / SIOP-OID4VP

Self Issued OpenID Provider v2 (SIOP) with optional OpenID for Verifiable Presentations (OpenID4VP)
77 stars 25 forks source link

multiple did methods aren't supported #31

Open siacomuzzi opened 2 years ago

siacomuzzi commented 2 years ago

Hi,

I think I found an issue in /functions/DIDResolution.ts:

https://github.com/Sphereon-Opensource/did-auth-siop/blob/cdbbcfe3c9e5d7a7b099abbf8371230485acc7e9/src/main/functions/DIDResolution.ts#L17-L24

Please note that uniResolvers is an array, so ...uniResolvers will send N args to the Resolver constructor (where N is the number of elements of the array). Causing that only the first element of the array is configured as resolver.

Proposed fix, use a json object instead of array:

let uniResolvers = {};
for (const didMethod of opts.didMethods) {
  const uniResolver = getUniResolver(getMethodFromDid(didMethod), { resolveUrl: opts.resolveUrl });
  uniResolvers = { ...uniResolvers, ...uniResolver };
}
return new Resolver(uniResolvers);
nklomp commented 2 years ago

Hmzz, we will have to revisit this, as a PR is about to be merged that completely changes the way we build the different resolver options @sksadjad

sksadjad commented 2 years ago

Yes we have some issues with this, but it'll be fixed in the branch v2.0.0 which eventualy make the v3.0.0 version of did-auth-siop

nklomp commented 2 years ago

0.3.0 you mean

nklomp commented 2 years ago

(We are still in alpha state at this point)