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

Fix W3cCredentialsApi verifyCredential types #2043

Open
jrhender opened this issue Sep 23, 2024 · 0 comments
Open

Fix W3cCredentialsApi verifyCredential types #2043

jrhender opened this issue Sep 23, 2024 · 0 comments

Comments

@jrhender
Copy link

I believe the type signature of the W3cCredentialsApi verifyCredential method is incorrect.

Code as follows has a TS compilation error:

const w3cVerifyCredentialOptions: W3cVerifyCredentialOptions<ClaimFormat.LdpVc> = {
      credential: W3cJsonLdVerifiableCredential.fromJson(vc)
};
const verifyCredential: W3cVerifyCredentialResult =
      await this.credoService.agent.w3cCredentials.verifyCredential(w3cVerifyCredentialOptions);
Argument of type 'W3cJsonLdVerifyCredentialOptions' is not assignable to parameter of type 'W3cJwtVerifyCredentialOptions'.
  Types of property 'credential' are incompatible.
    Type 'W3cJsonLdVerifiableCredential' is not assignable to type 'string | W3cJwtVerifiableCredential'.
      Type 'W3cJsonLdVerifiableCredential' is missing the following properties from type 'W3cJwtVerifiableCredential': jwt, _credential, credential, serializedJwtts(2345)

I suggest that the type signature of verifyCredential be changed from

public async verifyCredential(options: W3cVerifyCredentialOptions)

to

public async verifyCredential<Format extends ClaimFormat.JwtVc | ClaimFormat.LdpVc>(options: W3cVerifyCredentialOptions<Format>
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

No branches or pull requests

1 participant