Watch
1
0
Fork
You've already forked didresolver
0
mirror of https://github.com/swiyu-admin-ch/didresolver.git synced 2026-08-17 12:43:36 +00:00
Read-only mirror of https://github.com/swiyu-admin-ch/didresolver — Bundesamt für Justiz. Issues & pull requests at the source. Catalog: https://www.opensource.admin.ch/en/softwares/qwqekt https://www.opensource.admin.ch/en/softwares/qwqekt
  • Rust 96.9%
  • Kotlin 2.6%
  • Go Template 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Bruno Zimmermann b3ce22218b
Merge pull request #67 from swiyu-admin-ch/fix/EIDOMNI-1114_fix_witness_serialization
Fix/eidomni 1114 fix witness serialization
2026-08-03 13:54:32 +02:00
.github Merge pull request #65 from swiyu-admin-ch/dependabot/github_actions/github/codeql-action/upload-sarif-4.37.3 2026-07-31 08:18:32 +02:00
criterion EIDOMNI-212: Workspace-based refactoring (code motion) 2025-11-06 09:43:58 +01:00
did feat(EIDOMNI-1141): improve did document validation 2026-07-13 09:31:07 +02:00
did_sidekicks fix (EIDOMNI-1135): disallow id of verification method to belong to different did document 2026-07-30 10:00:26 +02:00
did_tdw fix (EIDOMNI-1135): disallow id of verification method to belong to different did document 2026-07-30 10:00:26 +02:00
did_webvh Merge pull request #67 from swiyu-admin-ch/fix/EIDOMNI-1114_fix_witness_serialization 2026-08-03 13:54:32 +02:00
images EIDOMNI-212: Workspace-based refactoring (code motion) 2025-11-06 09:43:58 +01:00
.gitattributes Create .gitattributes 2025-11-13 19:10:11 +01:00
.gitignore Update .gitignore 2025-03-12 11:29:15 +01:00
.snyk fix: EIDOMNI-861 update dependencies 2026-05-08 12:22:53 +02:00
Cargo.toml feat(EIDOMNI-1141): improve did document validation 2026-07-13 09:31:07 +02:00
CHANGELOG.md fix (EIDOMNI-1135): disallow id of verification method to belong to different did document 2026-07-30 10:00:26 +02:00
CONTRIBUTING.md Update contributing guidelines with DCO and signing info 2026-06-19 11:53:29 +02:00
developer-certificate-of-origin Add Developer Certificate of Origin v1.1 2026-06-19 11:51:31 +02:00
didresolver.spdx.json Bump version 2.7.0 2026-03-25 10:38:11 +01:00
LICENSE.md Update LICENSE.md 2025-04-28 14:32:01 +02:00
publiccode.yml Update publiccode.yml 2025-11-21 10:30:58 +01:00
README.md EIDOMNI-212: Workspace-based refactoring (code motion) 2025-11-06 09:43:58 +01:00
SECURITY.md Create SECURITY.md 2025-01-29 08:10:08 +01:00
THIRD-PARTY-LICENSES.md Create THIRD-PARTY-LICENSES.md 2025-04-28 14:46:39 +02:00

Public Beta banner

DID resolver

Build and Test CodeQL Analysis OSV-Scanner Clippy Analysis

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 DID methods:

Table of contents

Overview

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 for the Public Beta or the Open Source Community repository.

Using the library

The library can be used either directly in rust as is or through the different built bindings which are published in different submodules

Rust

The library can be used directly in rust by adding the following dependency to your Cargo.toml:

[dependencies]
# Alternatively, feel free to so use tag=<ANY_EXISTING_VERSION> instead of branch="main"
didresolver = { git="https://github.com/swiyu-admin-ch/didresolver.git", branch="main" }
ureq = "3.0.12"

# Optional: For manipulating the json content in the example
serde_json = "1.0.215"

Additional language bindings

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:

Example

In the example the following steps are shown:

  1. Convert supplied DID string into the standard did representation, if possible
  2. Fetch a raw DID log, using the url embedded in the did object created previously, if available
  3. Try resolving the raw DOD log into a DID doc
  4. Explore different parts of the received DID doc
use didresolver::did::Did;

fn main() {
    let did = Did::new(String::from("did:webvh:QmXi8p2LNXA6kbc2brwdpXwGETHCrPoFk15yPbLaAu27Pj:gist.githubusercontent.com:vst-bit:20c3f59d8179e324a6e29aef45240db4:raw:7870280f80dfcfb7459ee1488df4ab33f2bcf709"))
        .expect("invalid DID supplied");

    let url = did.get_https_url();

    let did_log = ureq::get(&url)
        .call()
        .expect("Failed to call did url")
        .into_body()
        .read_to_string()
        .expect("Failed to read DID to string");

    let did_doc_extended = match did.resolve_all(did_log) {
        Ok(v) => v,
        Err(reason) => panic!("Error occurred during resolution: {}", reason),
    };

    did_doc_extended.get_did_doc().get_verification_method().iter().for_each(|method| {
        println!(
            "id: {}, publicKey: {:?}, publicKeyJwk: {:?}",
            method.id, method.public_key_multibase, method.public_key_jwk
        )
    });
}

Crate's hierarchical structure

Such structure may be easily obtained by simply running cargo-modules structure --lib --package did:

crate didresolver
└── mod did: pub
    ├── struct Did: pub
    │   ├── fn get_https_url: pub
    │   ├── fn get_method: pub
    │   ├── fn get_parts: pub
    │   ├── fn get_scid: pub
    │   ├── fn get_url: pub
    │   ├── fn new: pub
    │   ├── fn resolve: pub
    │   └── fn resolve_all: pub
    ├── enum DidMethod: pub
    │   ├── fn get_https_url: pub
    │   ├── fn get_scid: pub
    │   └── fn new_did_resolver_impl: pub(self)
    ├── enum DidResolveError: pub
    │   └── const fn kind: pub
    └── enum DidResolveErrorKind: pub

Internal dependencies

Dependencies

The graph is also available in other layouts: circo, dot, fdp, neato, sfdp, twopi

Benchmarks

All the relevant reports are available here.

Missing Features and Known Issues

The swiyu Public Beta Trust Infrastructure was deliberately released at an early stage to enable future ecosystem participants. The feature roadmap shows the current discrepancies between Public Beta and the targeted productive Trust Infrastructure. There may still be minor bugs or security vulnerabilities in the test system. These are marked as KnownIssues in each repository.

Contributions and feedback

We welcome any feedback on the code regarding both the implementation and security aspects. Please follow the guidelines for contributing found in CONTRIBUTING.md.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.