-
Notifications
You must be signed in to change notification settings - Fork 90
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
[Request] Allow Account
to resolve remote DIDs
#387
Comments
With the lock/thread-safety discussion (in #377) a related issue came up. If we didn't use an incrementing integer to identify identities locally in the account (i.e. the I would suggest removing I would not add a new function that also resolves identities (option 2) to avoid increasing the complexity. Similarly, I also wouldn't expose a part of the low-level API in the high-level API (option 4) for the same reason. |
I'm not aware of the design decisions behind I agree with the suggestion to remove Would the |
We can actually keep the String interning would probably not help in that case, since the array holding the strings would have to be shared among the account and storage implementation, which seems hard to do, unless I'm missing your point? If we want to keep the naming feature too, then we basically also need to keep the My main point is just to reduce complexity for the users of our library by removing tag and id from the public interface. If we keep naming, then we also need to keep the |
Keeping It was just a suggestion as a potential optimisation to prevent copies, I don't know what technical roadblocks we may encounter and I don't intend to start off with that. I was just under the assumption we were replacing Naming the identities seems out-of-scope from the |
Without names, the approach would be to let all methods that currently take an Inside these methods, we can get low-cost access to the Without the index and thus without the |
Not really, because an Replacing with a bare
Yes but I'm not convinced that's terrible performance-wise, |
Sure, but then the current implementation would also be broken/ambiguous. let did: IotaDID = "did:iota:test:BjCGvYHiv3JDVRqdQyzavjC1QTFB46LVSVBeoUfrZt6h?query=xyz#fragment".parse().unwrap();
account.update_identity(did, ...).await?; This operates only on the There is a lot of that ambiguity in the interface, like in If we continue to have a shared interface, then this wouldn't become clearer, since you can still call
Sorry for that, I was just exploring different options. It's not that the |
Yes, using a full I agree we should have a consistent interface but this is may be overlapping with other To summarise, I want to:
Not all of these objectives may be possible, but it seems to be what we're converging on, yes? |
Regarding the first point, I would perhaps discuss adding The other points I fully agree with. |
Looks like this might be made redundant by PR #436 since |
I think so. Although even in #436 the resolve function is still part of the account, to let tests pass. Once the new resolver API lands, that method can be removed and this issue will no longer be one. |
Issue has become a non-issue as this feature is going to be removed entirely from the Account in a near-future update. |
Description
Update the
Account
to allow it to resolve DIDs from the Tangle that do not correspond to a locally-storedIdentityKey
.Motivation
Currently,
Account::resolve_identity()
throwsError::IdentityNotFound
if called with a DID that does not correspond to anIdentityKey
stored locally in theAccount
(e.g. one created withAccount::create_identity()
).This is confusing because the low-level API's
Client::resolve()
function returns any valid DID from the network, andIdentityNotFound
implies that the DID does not exist at all, not just locally.Options
E.g.
"Identity not found in account"
instead of just"Identity not found"
.resolve_identity()
to try avoid confusion.E.g.
resolve_account_identity()
orresolve_identity_key()
resolve_identity()
to take anIotaDID / IdentityTag
so any DID may be resolved, instead of anIdentityKey
(which may be anIdentityId
, a local identifier that does not contain a full DID tag).resolve_identity()
as-is (or rename it) and add a new function, e.g.resolve_remote_identity()
, which can resolve any DID.get_client_map()
, to expose a reference to theClientMap
inState::clients
from theAccount
. This would allow users to call the low-level API'sresolve()
manually.Overall a combination of the above options may be preferable. Personally I prefer (1) improve error message (in general) and (3) update
resolve_identity()
signature, since it doesn't seem to be used internally with anyIdentityId
s. If theAccount
is only intended to resolve identities managed locally, then the function should be renamed (2).I am in favour of exposing the
ClientMap
to avoid the anti-pattern of just calling the low-level API indirectly through theAccount
using wrapper functions that do nothing else (not that we do this currently). Other thanresolve()
, there are one or two convenient functions, such asresolve_history()
, that are currently inaccessible through theAccount
.However, we may want to discourage misuse of the low-level API on DID documents managed by the
Account
which could result in an inconsistent/corrupt state.Are you planning to do it yourself in a pull request?
Yes, pending discussions.
The text was updated successfully, but these errors were encountered: