Resolve DID documents from Quarkus: did:plc, did:web and did:key built in,
more through a DidMethod SPI. Resolution only: what a document means (AT Protocol handles, PDS endpoints, keys for a
given purpose) is the caller's business. Every fetch goes through
quarkus-safe-fetch.
Minimum supported Quarkus: 3.40 (LTS). Status: experimental, version 0.1.
<dependency>
<groupId>org.sitenetsoft.quarkus</groupId>
<artifactId>quarkus-did</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>@Inject DidResolver resolver; // blocking; never on the event loop
@Inject ReactiveDidResolver reactive; // Mutiny
DidDocument doc = resolver.resolve("did:plc:ewvi7nxzyoun6zhxrhs64oiz");
String key = doc.verificationMethod("#atproto").orElseThrow().publicKeyMultibase();
URI pds = doc.service("#atproto_pds").flatMap(Service::endpointUri).orElseThrow();verificationMethod(..) and service(..) accept #x, x or <did>#x and match entries stored with relative or
absolute ids. Properties the record does not type (@context, assertionMethod, …) are kept in extra() and
written back when the document is serialised.
The returned document's id always equals the requested DID. Failures are DidException subclasses:
| Exception | When |
|---|---|
DidNotFound |
did:plc 404; did:web 404 or 410 |
DidDeactivated |
did:plc 410 (tombstone) |
InvalidDidDocument |
unparseable, larger than max-document-size, or id is another DID |
DidResolutionFailed |
malformed DID, method not enabled, network failure, other statuses |
did:plc:GET {quarkus.did.plc.url}/{did}.did:web:did:web:example.com→https://example.com/.well-known/did.json;did:web:example.com:user:alice→https://example.com/user/alice/did.json; a port is percent-encoded (did:web:example.com%3A8443). Test-only behaviour: whenquarkus.safe-fetch.https-only=falsethe scheme ishttp, so tests can point a did:web DID at a loopback server (did:web:127.0.0.1%3A<port>). Leave https-only on in production.did:key: built locally from the multikey (oneMultikeyverification method<did>#<multibase>), no network.
Add a method by declaring a CDI bean that implements DidMethod (method() returns the name, resolve(did) a
Uni<DidDocument>). Application methods are always enabled and win over a built-in of the same name. The resolver
checks DID syntax, the document id and caching for you.
| Property | Default | Purpose |
|---|---|---|
quarkus.did.plc.url |
https://plc.directory |
PLC directory base URL |
quarkus.did.cache-ttl |
5m |
How long resolved documents are cached; 0 disables (keep under 10 minutes for AT Protocol OAuth) |
quarkus.did.methods |
plc,web,key |
Built-in methods to enable |
quarkus.did.max-document-size |
256K |
Larger documents are rejected |
Fetches also obey quarkus.safe-fetch.* (timeout, https-only, private addresses). In tests against loopback servers
set quarkus.safe-fetch.https-only=false and quarkus.safe-fetch.allow-private-addresses=true.
The card has a resolver box: enter a DID and see its document or the resolution error, plus the enabled methods.
Depends on multikey-java and quarkus-safe-fetch (install them first). Then JAVA_HOME=/path/to/jdk21 mvn -T 8 install.