Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the use of Resolver type from did-resolver is too restrictive #158

Closed
mirceanis opened this issue Mar 24, 2021 · 1 comment · Fixed by #159
Closed

the use of Resolver type from did-resolver is too restrictive #158

mirceanis opened this issue Mar 24, 2021 · 1 comment · Fixed by #159

Comments

@mirceanis
Copy link
Member

mirceanis commented Mar 24, 2021

The Resolver class from did-resolver is declared with the private fields included, which makes it hard to implement matching type signatures.

For example, the following object cannot be used directly in verifyJWT or similar methods that require Resolver.

const resolver = {
  resolve: (didURL: string, options: DIDResolutionOptions) => Promise.resolve(<DIDResolutionResult>{/*...*/})
}

The error is :

Type '{ resolve: (didUrl: string, options: DIDResolutionOptions) => Promise<DIDResolutionResult>; }' is missing the following properties from type 'Resolver': registry, cache

or

Type 'import("node_modules/did-resolver/lib/resolver").Resolver' is not assignable to type 'import("node_modules/did-jwt/node_modules/did-resolver/lib/resolver").Resolver'.
      Types have separate declarations of a private property 'registry'.

There is a workaround to use something like (resolver as unknown) as Resolver but this is not intuitive and annoying.

Only the required signature of the Resolver type should be required by this lib; without the private members.

@mirceanis mirceanis changed the title the use of Resolver type from did-resolver is to restrictive the use of Resolver type from did-resolver is too restrictive Mar 24, 2021
uport-automation-bot pushed a commit that referenced this issue Mar 25, 2021
## [5.1.1](5.1.0...5.1.1) (2021-03-25)

### Bug Fixes

* simplify expected Resolver type in verify methods ([#159](#159)) ([969de89](969de89)), closes [#158](#158)
@uport-automation-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 5.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants