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
André Kunz 434869cefd
Create SUPPORT.md for user assistance
Added support documentation for users seeking help with the swiyu Trust Infrastructure, including system status, release announcements, testing applications, and reporting issues.
2026-12-03 14:04:15 +01:00
.github chore(deps): bump github/codeql-action/upload-sarif 2026-11-23 10:44:53 +00:00
criterion docs (EIDOMNI-1209): updated benchmarks 2026-09-15 14:49:54 +02:00
did feat (EIDOMNI-999): refactored DidDocNormalized to support both references and verification method objects 2026-10-23 10:00:10 +02:00
did_sidekicks feat(EIDOMNI-1602): improve jwk support, keeping more fields and allowing alg to be EdDSA and Ed25519 2026-11-25 11:41:42 +01:00
did_tdw feat(EIDOMNI-1602): Ed25519 JWKs must have alg 'Ed25519' 2026-11-27 10:02:20 +01:00
did_webvh feat(EIDOMNI-1602): Ed25519 JWKs must have alg 'Ed25519' 2026-11-27 10:02:20 +01: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 chore: update CHANGELOG.md and version to 2.12.0-SNAPSHOT 2026-11-27 11:15:28 +01:00
CHANGELOG.md chore: update CHANGELOG.md and version to 2.12.0-SNAPSHOT 2026-11-27 11:15:28 +01: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 Revise README with updated DID methods and project info 2026-12-02 10:40:22 +01:00
SECURITY.md docs (EIDOMNI-1455): update SECURITY.md and mark tdw as deprecated 2026-10-26 10:40:25 +01:00
SUPPORT.md Create SUPPORT.md for user assistance 2026-12-03 14:04:15 +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 swiyu 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 refer to the technical documentation. There you find an overview of all components, specifications, and standards of the swiyu Trust Infrastructure. You can find further community-related content in 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" }
# For retrieving the did log from the registry
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 as_string: 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
    ├── struct FRAGMENT_REGEX: pub(self)
    │   └── fn initialize: pub(self)
    └── fn get_did_from_absolute_kid: 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 Sandbox Trust Infrastructure was deliberately released at an early stage to enable future ecosystem participants. The feature roadmap shows the current discrepancies between Sandbox 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.