energywebfoundation/ew-credentials

fetchCredential ENS Error

Closed this issue · 3 comments

Description

Hello, I have been trying to fetch credentials through the iam-client-lib with claimsService.fetchCredentials or claimsService.resolveCredentialsAndVerify. However, when given certain (maybe old?) DID, this function throws an ENS Undefined Error. I have also created brand new wallet accounts with only a couple of roles (all made on latest version of iam-client-lib) and the function worked fine, however, today the function is now throwing the same error for my new addresses. I believe the only thing that I did to my DID document was create a self-signed claim.

Code

async getEIP191JWT(
did: string,
namespace: string
): Promise<RoleEIP191JWT | undefined> {
const eip191Jwts = await this.eip191JwtsOf(did);
return eip191Jwts.find(
(jwt) =>
jwt?.payload?.claimData.claimType === namespace ||
utils.namehash(jwt?.payload?.claimData.claimType) === namespace
);
}

I believe in some cases when the jwt?.payload?.claimData.claimType is undefined, utils.namehash still tries to parse it, causing the error. I removed the utils.namehash check in my node-module and the function worked fine.

Error

invalid ENS name; not a string (argument="name", value=undefined, code=INVALID_ARGUMENT, version=hash/5.7.0).

Thanks, good find @jreedy-riis . We will investigate and fix.

@jreedy-riis This should be fixed in latest iam-lib. Could you check that?

Hello! It looks like it is fixed, thank you!