Accessing your PDS
PLC is a persistent global identifier system, stands for “Public Ledger of Credentials”, it’s a persistent global identifier system, which allows accounts to retain relationships while changing names or migrating between service providers
DID resolution can be as simple as:
import gleam/http/request
import possum
let assert Ok(did) = did.parse("did:plc:z72i7hdynmk6r22z27h6tvur")
// Send a request to plc.directory
let request = possum.get_plc_data(did)
// You can use a decoder like this for your PDS endpoint
let decoder =
decode.at(["services", "atproto_pds", "endpoint"], decode.string)
Response
{
"did": "string",
"verificationMethods": {
"atproto": "string"
},
"rotationKeys": [
"string",
"string"
],
"alsoKnownAs": [
"string"
],
"services": {
"atproto_pds": {
"type": "string",
"endpoint": "string"
}
}