Open auer-martin opened 1 year ago
Hi @2mau, I'm new to AFJ and I'd like to start contributing by working on this issue. From what I found, https://github.com/hyperledger/aries-framework-javascript/blob/bd4932d34f7314a6d49097b6460c7570e1ebc7a8/packages/indy-vdr/src/anoncreds/IndyVdrAnonCredsRegistry.ts#L307-L310
the function signature does seem to have the correct types. Could you please elaborate as to what changes this issue is supposed to encompass, since I'm new to the code base?
Hi, @hs2361. I'll try to explain the problem to you in more detail, but I'm not 100% sure if this is the right way. Maybe @TimoGlastra can also take a look at this problem, and give his opinion.
For anoncreds, there is an API called AnoncredsApi which is the public-facing part. In this file, you can find the registerCredentialDefinition
and registerSchema
functions. Currently, registerCredentialDefinition
allows Providing a generic Type T to type its input values. The issue is that by typing the Input values as IndyVdrRegisterCredentialDefinitionOptions
the return value should become IndyVdrRegisterCredentialDefinitionReturn
, but instead the more Generic RegisterCredentialDefinitionReturn
type is used, that is why the cast is required. In the IndyVdrAnonCredsRegistry (the snippet you posted), the typing is still correct, but it is not correctly propagated towards the public-facing part of the API.
I think we need to find solutions here in multiple places.
IndyVdrAnonCredsRegistry
and CheqdAnonCredsRegistry
are supported. So when calling RegisterCredentialDefinition
, there is a function findRegistryForIdentifiers
which is used to find the correct registry. But that function already returns the more Generic AnoncredsRegistry
instead of indy-vdr/cheqd AnoncredsRegistry.registerCredentialDefinition/Schema
methods adds proper typing to the findRegistryForIdentifiers
.RegisterSchema/CredentialDefinition
method as the result of calling the registry-specific RegisterSchema/CredentialDefinition
.
The return types are not correctly typed, and therefore need to be casted. See the snippet below.