-
Notifications
You must be signed in to change notification settings - Fork 57
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
Web5 agent/register did service endpoints #741
Web5 agent/register did service endpoints #741
Conversation
|
Looks good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, but I'd like to avoid the circular dependency between the packages.
To test this locally, I'm doing: |
I updated the PR to include a
Here is my test code: Step 1: connect.ts const password = 'some-password'
const { web5, did, recoveryPhrase } = await Web5.connect({
password,
sync: '1s'
})
console.log("did ", did);
console.log("recoveryPhrase ", recoveryPhrase);
const agent = web5.agent as Web5PlatformAgent
const dids = await agent.identity.list()
console.log("dids ", dids);
console.log("agentDidPortable ", JSON.stringify(await web5.agent.agentDid.export())); Step 2: Delete local const password = 'some-password'
const agentVault = await Web5.recover({ password, recoveryPhrase });
console.log('recover agentVault', agentVault);
const { web5, did } = await Web5.connect({
agentVault,
password,
recoveryPhrase,
sync: '1s',
});
console.log("web5 ", web5);
console.log("did ", did);
const agent = web5.agent as Web5PlatformAgent
const dids = await agent.identity.list()
console.log("dids ", dids);
const identity = await agent.identity.get({ didUri: 'did:dht:oeegnbss6ykiu4rhi7xeqhcb5tre9z3wsjk5ffsqn86sijiy6hwy' })
console.log("identity ", identity); I can confirm that this DID has service endpoints {
"service": [
{
"id": "did:dht:hpihge9ouh697bj8dcmubb54yxuzzojkm4sbc7jd1csbdpmpa41o#dwn",
"type": "DecentralizedWebNode",
"serviceEndpoint": [
"https://dwn.tbddev.org/dwn6",
"https://dwn.tbddev.org/dwn0"
],
"enc": "#enc",
"sig": "#sig"
}
]
} I was using |
Hey @bnonni This is looking like it's going in the right direction! I think the only part that's missing is on the |
@LiranCohen I see. I didn't realize the agent did is no longer registered when recovering the agent and the local data store, but that makes a lot of sense. Thank you. Will try that now. |
Ok, after some deep investigation, I made some updates; however, I am still unable to recover any connected dids but I discovered something that may be part of the problem: When sync is not set in
Latest Changes Based on this thinking, the following reqs make sense for recovery:
My flow goes:
I've also tried just running a |
@frankhinek it's hard for me to diagnose what's going on that's blocking this from working, do you see anything that stands out? |
I want to make a note here that I reorganized this comment to be a bit more clear and reflective of my latest changes and process. |
Yeah it's designed on an interval and only kicks off after the first timeout currently until a live sync is put into place.
I'm not sure that this is your problem, because of the way the DWN is designed sync in either direction is intended to create the same state between both (or all) parties. So only if an explicit delete is created will a record be deleted. So a blank local couldn't overwrite a remote. It's hard to say what's happening without debugging a bit further, ie: when sync is doing a MessagesQuery is it recieving anything? Also I did a quick glance at the code and saw you added an async to |
I see. That makes a lot of sense. I was also wondering if everything was being sent properly during sync but wasn't sure where exactly to look to debug that. I'll take a look at the sync code closer and see if I can do some logging.
Yeah, good point. I think my brain saw a returning |
A very basic overview of how sync works is as follows: Pulling from remote: Pushing to remote: |
Thanks for the rundown. That's helpful. I'll take a look at this and the sync code. Questions
|
I don't see any immediate issues and expect this will take some in depth examination of exactly what is attempting to be done in order to assess the best approach. It would likely be helpful to write out in words the desired sequence of events that should be happening for the recover operation. Probably also a good idea to break this up into multiple PRs. Have 1 that just adds the service endpoints... and then work on follow-ups that introduce new features. |
When the
As far as I understand it the |
I agree. Outlining the requirements would be helpful. I've sort of been winging it and coding to requirements in my head that change as I test my thinking, which can get messy.
I also agree here. Tbh, I really only needed the registering of the agent did for the DCX project to move forward. Right now, I'm somewhat blocked. I'll slim down this PR to only the original code that registered the agent did with service endpoints. Then I'll create another PR that builds on that with the remainder of the code I wrote. |
I may have asked the question poorly. I'm wondering what is stored in the DWN during the sync process? Registering a did adds it to the const registeredIdentities = await this._db.sublevel('registeredIdentities').keys().all(); I'm trying to parse through the rest of the
Thanks for clarifying. The real questions behind the questions are:
|
dbeb97d
to
348ee12
Compare
348ee12
to
dcac4ad
Compare
This PR has been updated to only register the agent did with service endpoints. I haven't submitted a subsequent PR yet for |
Closing as this PR is now unnecessary |
Reopening on direction from @LiranCohen and @csuwildcat. I mis-interpreted the implementation of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ant to get this merged in! Good work, just a couple of comments and a question for @frankhinek.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #741 +/- ##
==========================================
- Coverage 93.42% 93.40% -0.03%
==========================================
Files 118 118
Lines 33134 33157 +23
Branches 2649 2650 +1
==========================================
+ Hits 30956 30969 +13
- Misses 2138 2149 +11
+ Partials 40 39 -1
|
HdIdentityValue.initialize()
to passdwnEndpoints
to allow the registration of the dwn did service duingDidDht.create()