For the upcoming launch of the swiyu Public Beta Trust Infrastructure we created a new organisation swiyu-admin-ch.
This repository will be archived in the near term. New releases are published under https://github.com/swiyu-admin-ch/didresolver.
Latest version of the DID methods might not be supported yet
An official Swiss Government project made by the Federal Office of Information Technology, Systems and Telecommunication FOITT as part of the electronic identity (e-ID) project.
This project contains a DID resolver which allows to resolve the following methods:
This repository is part of the ecosystem developed for the future official Swiss e-ID. The goal of this repository is to engage with the community and collaborate on developing the Swiss ecosystem for e-ID and other credentials. We warmly encourage you to engage with us by creating an issue in the repository.
For more information about the project please visit the introduction into open source of the public beta.
The library can be used either directly in rust as is or through the different built bindings which are published in different submodules
The library can be used directly in rust by adding the following dependency to your Cargo.toml
:
[dependencies]
didresolver = {git="https://github.com/e-id-admin/didresolver.git", branch="main"}
# Optional: For manipulating the json content in the example
serde_json = "1.0.215"
General information how the bindings are generated can be found in the UniFFI user guide
The library is also available in other languages. Please consult the documentation of the subsequent repositories for more information:
In the example the following steps are shown:
- Convert supplied DID string into the standard did representation, if possible
- Fetch a raw DID log, using the url embedded in the did object created previously, if available
- Try resolving the raw DOD log into a DID doc
- Get different parts from the DID doc w.r.t. data model
use didresolver::did::Did;
use ureq::get as fetch_url;
fn main() {
let did = Did::new(String::from("did:tdw:QmZ3ZcSA52uEaPahx9SQL4xfjcfJ2e7Y8HqNv2sohG1iK7:gist.githubusercontent.com:vst-bit:8d8247633dbc5836324a81725c1216d8:raw:fde1612e271991f23e814943d7636a4dbac6752b"));
let url = match did.get_url() {
Ok(url) => url,
Err(e) => panic!("invalid (unsupported or malformed) DID supplied")
};
let did_log_raw = fetch_url(&url).call().into_string().unwrap();
let did_doc = match did.resolve(did_log_raw) {
Ok(did_doc) => did_doc,
Err(e) => panic!("Error occurred during resolution")
};
did_doc.get_verification_method().iter().for_each(|method| {
println!("id: {}, publicKey: {:?}, publicKeyJwk: {:?}", method.id, method.public_key_multibase, method.public_key_jwk)
})
}
---
title: Available types
---
classDiagram
PublicKey <|-- Diddoc
class Did {
+constructor(String did)
+resolve()
}
class PublicKey {
+String id
+String keyType
+String controller
+String publicKeyMultibase
+String publicKeyJwk
}
class Diddoc {
+String[] context
+String id
+PublicKey[] verificationMethod
+PublicKey[] authenticationMethod
+PublicKey[] capabilityInvocation
+PublicKey[] capabilityDelegation
+PublicKey[] assertionMethod
+String[] controller
+bool deactivated
}
We welcome any feedback on the code regarding both the implementation and security aspects. Please follow the guidelines for contributing found in CONTRIBUTING.md.
This project is licensed under the terms of the MIT license. See the LICENSE file for details.