Consulting your DID

Users in AT Protocol have permanent decentralized identifiers (DIDs) for their accounts. They also have a configurable domain name, which acts as a human-readable handle. An example DID is did:plc:ewvi7nxzyoun6zhxrhs64oiz.

// Use `did.parse` to turn strings into valid DID format
let assert Ok(did) = did.parse("did:plc:ewvi7nxzyoun6zhxrhs64oiz")

Handle Resolution

Handles have a limited role in atproto, and need to be resolved to a DID in almost all situations. Clients can rely on network services (eg, their PDS) to resolve handles for them, using the com.atproto.identity.resolveHandle endpoint, and don’t usually need to implement resolution directly themselves.

// You can consult your identifier by sending a request directly to your PDS,
// or you can use projects like [Slingshot](https://slingshot.microcosm.blue)
// for easy access to cached data when resolving a handle.
let assert Ok(handle) = handle.parse("gleam.run")
let request = possum.resolve_handle(handle, pds: "slingshot.microcosm.blue")

HTTPS well-known Method

A web server at the handle domain implements a special well-known endpoint at the path /.well-known/atproto-did. A valid HTTP response will have an HTTP success status (2xx) and include the DID as the HTTP body with no prefix or wrapper formatting.

import possum

// You also verify your DID without DNS by sending a request to `/.well-know/atproto-did`
// Your server can then respond with the DID value as plain text.
//
// The response Content-Type header does not need to be strictly verified.
let request = possum.resolve_well_known_did(host: "gleam.run")
Search Document