-
Notifications
You must be signed in to change notification settings - Fork 91
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
[Task] Implement new Resolver API #493
Comments
As per internal discussions and #422, using the initial resolver API might look something like the following: // A Resolver should either contain a ClientMap or it could replace it entirely.
let client_map = ClientMap::new().await;
client_map.insert(Client::from_network(Network::Devnet).await?);
// Build a resolver that caches calls to the tangle for this specific did
let resolver = Resolver::new(client_map);
// Resolve the latest version of a DID document (basically the same as Client::resolve right now),
// where IotaTangleDocument is a new wrapper struct from the metadata refactor.
let iota_did: IotaDID = "did:iota:...".parse().unwrap();
let document: IotaTangleDocument = resolver.resolve(&iota_did).await?;
// Try resolve a DID document from a specific version.
let old_document: IotaTangleDocument = resolver.resolve_with_options(
&iota_did,
ResolveOptions::new().version_id("1.5")
).await?;
// Try resolve a DID document from a specific timestamp.
let old_document: IotaTangleDocument = resolver.resolve_with_options(
&iota_did,
ResolveOptions::new().version_time("2021-10-01T00:00:00Z")
).await?;
// Separate API, but can share the network cache of the created resolver instance.
let history: DocumentHistory = resolver.resolve_history(&iota_did).await?;
// Verify a presentation or credential, fetching issuer and subject DID documents automatically.
let validation: PresentationValidation = resolver.verify_presentation(&presentation).await?;
let validation: CredentialValidation = resolver.verify_credential(&credential).await?; The exact details of each method are still unclear at this stage. Since E.g. // Resolve the latest version of a DID document with default options.
let document: IotaTangleDocument = resolver.resolve(&iota_did).fetch().await?;
// Resolve a specific version of a DID document.
let old_document: IotaTangleDocument = resolver.resolve(&iota_did)
.version_id("1.5")
.fetch()
.await?; |
The I feel like this issue can be closed and new ones opened to extend the |
Closed by #594. See above comment #493 (comment). |
Description
Old Description: As has been discussed at length in discussion #422, the Resolver logic will be completely refactored with a new API design. It will be able to internally cache the DID message data from the Tangle and return metadata. An additional DID spec compliant API will be introduced in a later issue.
New Description: We have discussed a new Resolver API, that crates a consistent object that can be used for Verification throughout an application. It works for multiple resolutions, may work with multiple networks (main, dev, shimmer) and can resolve different methods (iota, stardust?, disposable?). The same Verifier API can also take care of VC and VP verification. DID resolution and VC & VP verification may be done with resolution/verification options such as
resolve_at
orverifiy_at
. Caching is out of scope for this PR.For details about the API design, I'd refer to #422 and the comments on this Issue.
Motivation
Improve developer experience with a clean, easy yet powerful API.
To-do list
Create a task-specific to-do list . Please link PRs that match the To-do list item behind the item after it has been submitted.
ClientMap
with newResolver
#594CredentialValidator
, addPresentationValidator
#599The text was updated successfully, but these errors were encountered: