Is there a problem with P-256 for js-did?

/home/ubuntu/Downloads/node_modules/dids/lib/did.js:175
throw new Error(Failed to resolve ${didUrl}: ${error}${maybeMessage});
^

Error: Failed to resolve did:key:zDnaezUFn4zmNoNeZvBEdVyCv6MVL69X8NRD8YavTCJWGuXM7#zDnaezUFn4zmNoNeZvBEdVyCv6MVL69X8NRD8YavTCJWGuXM7: invalidDid, TypeError: Cannot read properties of undefined (reading ‘keyToDidDoc’)
at DID. (/home/ubuntu/Downloads/node_modules/dids/lib/did.js:175:23)
at Generator.next ()
at fulfilled (/home/ubuntu/Downloads/node_modules/dids/lib/did.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

More details are here:

FYI @jthor @zfer @ukstv

That’s weird. Going to see what’s wrong here first thing in the morning.

I have a stub called: GitHub - bshambaugh/key-did-provider-p256 . This I recall was an earlier attempt to develop a did-provider that generated a key pair within the library like
key-did-provider-ed25519 or key-did-provider-secp256k1 .

It may be prudent to go back and finish this up and see if I get the same problem. The heavy lifting as I recall is done by did-jwt, and this was just updated to support ES256. Add ES256 to JWT.ts by bshambaugh · Pull Request #254 · decentralized-identity/did-jwt · GitHub .

Once this is done, the layer of complexity can be added back that pulls in the signature over a stream (i.e [1]) instead of doing it local to the js code like all of your did providers have before.

[1]P256Provider_class.ts

This has nothing to do with providers.

I get the code to reproduce the issue. It seems to me that you use some old version of key-did-resolver, which does not support yet secp256r1 did key. Try recent version maybe @bshambaugh ? On the recent version, your did:key:zDnaezUFn4zmNoNeZvBEdVyCv6MVL69X8NRD8YavTCJWGuXM7 resolves all right.

hmm…I think it was the case that I have a key-did-resolver version that was outdated. I’m getting a funny error with the latest version of the key-did-resolver.

const did = new DID({ provider, resolver: KeyResolver.getResolver() })

Type ‘ResolverRegistry’ is not assignable to type ‘Resolver | ResolverRegistry’.
Type ‘ResolverRegistry’ is missing the following properties from type ‘Resolver’: registry, cache, resolvets(2322)
did.d.ts(72, 5): The expected type comes from property ‘resolver’ which is declared here on type ‘DIDOptions’

I will continue to work on this

const did = new DID({ provider, resolver: KeyResolver.getResolver() as DIDResolver })

maybe this is close, but this is not exactly correct

okay, I updated package.json with all of the latest versions of the npm module (apparently that wasn’t the case) and it just works now.

1 Like

I’ve been running into same error. How to fix this one?