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

Identity Manager cannot create identity using did from DidDht #440

Closed
xiaoyunyang opened this issue Mar 10, 2024 · 2 comments · Fixed by #445
Closed

Identity Manager cannot create identity using did from DidDht #440

xiaoyunyang opened this issue Mar 10, 2024 · 2 comments · Fixed by #445
Milestone

Comments

@xiaoyunyang
Copy link

When I was implementing an identity manager the latest IdentityAgent from @web5/identity-agent, I ran into a problem trying to pass a did created using DidDht into identityManager.create() function. Specifically, the create function expects a different PortableDid type than the one that you can create using DidDht.

Here's the code I have

import { IdentityAgent } from "@web5/identity-agent";
import { DidDht } from "@web5/dids";

const didDht = await DidDht.create();
const portableDid = await didDht.export();

const agent = await IdentityAgent.create();

const identity = await agent.identityManager.create({
  name,
  kms: "local",
  did: portableDid, // <-- error occurs here
});

The error is

No overload matches this call.
  Overload 1 of 2, '(options: CreateWithDidMethod<keyof CreateDidMethodOptions>): Promise<ManagedIdentity>', gave the following error.
    Object literal may only specify known properties, and 'did' does not exist in type 'CreateWithDidMethod<keyof CreateDidMethodOptions>'.
  Overload 2 of 2, '(options: CreateWithDid): Promise<ManagedIdentity>', gave the following error.
    Type 'PortableDid' is missing the following properties from type 'PortableDid': did, keySet

I'm using these versions

{
  "@web5/dids": "^0.4.1",
  "@web5/identity-agent": "^0.2.6",
}
@xiaoyunyang
Copy link
Author

I think the problem is the agent package uses @web5/dids v0.2.4 which has a different PortableDid definition.

https://github.com/TBD54566975/web5-js/blob/9c27ee47777b2622003e50c89f29dd17c1153229/packages/agent/package.json#L75

Can this be upgraded to the latest version?

@frankhinek frankhinek added this to the @web5/api 0.9 milestone Mar 12, 2024
@frankhinek
Copy link
Contributor

@xiaoyunyang Thanks for opening the issue. This will be resolved in the 0.9 release of @web5/api and 0.3 of @web5/identity-agent.

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