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

Extend the Agent and Identities with a metadata field (local storage) #696

Open
sondreb opened this issue Jun 24, 2024 · 4 comments
Open

Comments

@sondreb
Copy link

sondreb commented Jun 24, 2024

It would be nice if we could store a small piece of metadata (JSON) connected to either agent or identities. This way it could be used for friendly names or tags, etc. Would allow me to have some extra information persisted connected to the agents and identities and rely on the storage implementation that the Web5 API gets injected.

@sondreb
Copy link
Author

sondreb commented Jun 24, 2024

There is already a metadata field on the BearerIdentity that holds name, tenant and uri.

@shamilovtim
Copy link
Contributor

This is what we discussed the other day @csuwildcat

@sondreb
Copy link
Author

sondreb commented Oct 18, 2024

I have made UI that allow users to rename their accounts, but I don't know how to update and save these changes. Is that even possible?

This is from the identity-api.ts which saves the identities and the initial name in create operation and also in the import and manage.

Image

If I manage the creation of the AgentIdentityApi and the DwnIdentityStore, I can access the store.set function from where I edit name of accounts.

Image

Here I attempt to set the updated metadata:

Image

Unfortunately it will trigger an error when attempting to set, I don't think I should allow duplicates? set is kind of misleading here right, it sounds more like an add/insert if it doesn't really care about the id/did?

DwnIdentityStore: Import failed due to duplicate entry for: did:dht:f5755egabp5tdfipgucd94ccjfauzrhsss9sbhxggsurxcoq1gwy

Attempted to first delete before set, the delete operation happens, but it triggers same duplicate error... and after reload, the identity is gone.

@LiranCohen
Copy link
Member

@sondreb I recently enabled the ability to update existing records in the IdentityStore using the updateExisting flag:

public async set({ id, data, tenant, agent, preventDuplicates = true, updateExisting = false, useCache = false }:

I'm hesitant in allowing a flat out update() of the metadata object since it is pretty central to the entire agent and could be a bad foot-gun. We use it to store connectedDid when a did is a delegate of another DID.

I was leaning towards doing something similar to what I did for DWN Endpoints in my last PR, adding getMetadtaName() and setMetadataName() methods to set that particular piece of data.

Additionally, these things are quite literally DWN records written to the agent's own DWN, if any additional data is needed by a specific wallet they could in practice install that to the agent as their own protocol and write to it.

However if we think there are specific additional fields that we would like to tie to ProtableIdentity that we think all web5 wallets would find useful I am very supportive.

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

3 participants