Falsehoods Programmers Believe About ATProto
Comments
Falsehoods Programmers Believe About ATProto - assumptions about handles, DIDs, records, and servers that will break your code.
In the year 2010, Patrick McKenzie wrote and published the article “Falsehoods Programmers Believe About Names” - a list of reasonable-sounding assumptions about people's names that not only were not true, but also (if assumed) would create bugs and even break software.
That article started a whole genre of Falsehoods Programmers Believe articles. This article ("Falsehoods Programmers Believe About ATProto") is one of my contributions to that genre.
Every numbered statement below is false. Each one is followed by what is actually true - and where to read more. These are not made up for effect. Each one is backed by the specification, or by a live request to real ATProto servers (made in November 2026).
Handles
A user's handle never changes.
Handles can change. The account's DID is what is permanent - the accounts specification calls it (DIDs) “unique and immutable”.
My handle changed! My handle was first
reiver.bsky.social, then becamereiver.myatproto.social, and then later becamereiver.blacksky.team. You can see that if you dig through the data atplc.directory/did:plc:scewmn2pl3oz36mxme2b6czz/log/audit. (did:plc:scewmn2pl3oz36mxme2b6czzis my DID-PLC DID.)So, a handle is a good database key for a user.
Use the DID. Store the handle only for display (cosmetic) purposes - and re-check what each DID's handle is from time to time.
But, you need to normalize the DID before using it. DIDs are URIs, and URI schemes are case-insensitive (RFC 3986) - so
DID:plc:scewmn2pl3oz36mxme2b6czzanddid:plc:scewmn2pl3oz36mxme2b6czzare the same DID. ATProto requires the normalized (lowercase) form: normalize DIDs when they come from user input, store and compare only the normalized form, and reject non-normalized DIDs that arrive in protocol data.When a user changes their handle, the first part stays the same - such as
reiver.bsky.social→reiver.myatproto.social→reiver.blacksky.team.A new handle does not have to have anything in common with the old one.
joeblow.bsky.social→me.example.com→bbqlover.net→ilikeicecream.comwould be fine. Changing a handle just means pointing the account at a different domain -com.atproto.identity.updateHandletakes any valid handle, and only “Verifies handle validity”.For example, Bluesky's own account (
did:plc:z72i7hdynmk6r22z27h6tvur) started out asbluesky-team.bsky.social, and then becamebsky.app. You can see that in its audit log atplc.directory/did:plc:z72i7hdynmk6r22z27h6tvur/log/audit. (Another reason to key users by DID, and not by any part of their handle.)You can trust a handle you saw five minutes ago.
A handle can change at any moment. The user can switch to a new handle. The domain's owner can point it at a different DID - or the domain can expire, and be registered by someone else. Or, its DNS record or
/.well-known/atproto-didfile can just disappear, and the handle stops resolving. The handle specification says “If the handle for a known DID is confirmed to no longer resolve, it should be marked as invalid.”So, a handle → DID mapping is only as good as when you last checked it. The specification recommends caching handle resolution “up to some lifetime”, and re-resolving “periodically”. Watch the firehose for
#identityevents, which announce handle changes. And, never use a cached handle to decide who someone is (for example, for permissions) - use the DID.Every user has a handle.
An account might have no handle in its DID document (no
at://entry inalsoKnownAs), or a handle that no longer resolves back to it. The DID specification says “an account whose DID document does not contain a valid and confirmed handle can still participate in the atproto ecosystem. Software should be careful to either not display any handle for such account, or obviously indicate that any handle associated with it is invalid.”In API responses, such an account's handle may show up as the special value
handle.invalid- which “can not be used in most situations (search queries, API requests, etc).” And, thehandlefield on the firehose's#identityevent is optional. So, your code needs a “no handle” case.Every handle ends in
.bsky.social.Any Internet domain can be a handle. And, other PDSes hand out their own - the
blacksky.appPDS, for example, offers.blacksky.app,.myatproto.social,.cryptoanarchy.network, and others.Even if a user's handle is not a
.bsky.socialhandle now, their first handle was.A user's first handle is whatever they got when their account was created - on whichever PDS they signed up with.
com.atproto.server.createAccountjust takes a “Requested handle for the account”, and each PDS offers its own domains. So, someone who signed up onblacksky.appmight start out asalice.myatproto.social- and never have had a.bsky.socialhandle at all.You can see this in a DID's audit log on
plc.directory(https://plc.directory/ /log/audit) - the very first operation (the one that created the DID) shows the first handle, and the first PDS. For example, the audit log fordid:plc:ub2k2k5zahuegnkkvxjk5y2w(plc.directory/did:plc:ub2k2k5zahuegnkkvxjk5y2w/log/audit) has just 1 operation - the one that created it, on November 13th, 2026. Its first handle wasshadowoftruth.myatproto.social, and its first PDS wasblacksky.app. It has never had a.bsky.socialhandle.A handle is a third-level domain - like
alice.bsky.social,alice.blacksky.app, oralice.myatproto.social.A handle can have any number of segments, as long as there are at least 2.
example.comis a valid handle - and so isapple.banana.cherry.example.com. The handle specification only says “there must be at least two segments” (so a bare top-level domain likecomis not allowed), each segment can be 1 to 63 characters, and the whole handle can be at most 253 characters. Its own examples includea.co,8.cn, andXX.LCS.MIT.EDU; and the official test vectors includejohn.test.bsky.app, and a valid handle with 10 segments.Handles are resolved with DNS.
With DNS (a TXT record at
_atproto.) or HTTPS (/.well-known/atproto-did). You need to support both.If a DID document lists a handle, the account owns that handle.
Anyone can put any handle in their own DID document. The handle has to resolve back to the same DID - both directions must agree. Otherwise, show
handle.invalid.com.atproto.identity.resolveHandlechecks both directions for you.Its own lexicon says it “Does not necessarily bi-directionally verify against the the DID document.” (See: How-To Resolve a Handle to a DID.)
Handles are case-sensitive - so keep the capitalization the user typed.
Handles are not case-sensitive. The handle specification says “Only normalized (lowercase) handles should be stored in records or used in outbound API calls. Applications should not preserve user-provided case information and attempt to display handles in anything other than lower-case.” Its example: “the handle input string
BlueskyWeb.xyzshould be normalized, stored, and displayed asblueskyweb.xyz.”The @ is part of the handle.
It is just decoration, for display. The handle specification says “Handles may be prefixed with the "at" symbol (like
@user.example.com) in user interfaces, but this is not a valid syntax for a handle in records, APIs, and other back-end contexts.” So, strip it from user input before resolving.On
example.com's own site, it is fine to show@alice.example.comas just@alice.The handle specification says “Handles should generally not be truncated to local context. For example, the handle
@alice.example.comshould not be displayed as@alice, even in the local context of anexample.comservice.” (It also warns that very long handles “can result in similar issues when truncated at the start or end” - for example, a handle that starts withpaypal.combeing shown aspaypal.com….)
DIDs
Every DID is a
did:plc.did:webis supported too. Your code needs to handle both.A
did:webcan be anydid:web.In ATProto, “did:web is restricted in atproto to only full domains, not paths or port specification” (from the record key specification).
Whatever
plc.directoryreturns for a DID is that DID's document.Check that the document's
idmatches the DID you asked for. (See: How-To Resolve a DID to a PDS.)A
did:plcis case-insensitive - soDID:PLC:…ordid:plc:Z72I7HDYNMK6R22Z27H6TVURis fine.The
did:and the method name (plc) must be lowercase - “The URI starts with lowercasedid:”, and “The method segment is one or more lowercase letters”. And, adid:plcidentifier is lowercase too: “the entire identifier is lower-case (and should be normalized to lower-case)” (from thedid:plcspecification). The ATProto specification says “protocol implementations should reject DIDs with invalid casing.” (plc.directoryanswereddid:plc:Z72I7HDYNMK6R22Z27H6TVUR,did:PLC:…, andDID:PLC:…with400 “Resolution of non-PLC DIDs not supported”.)(This is about DIDs in protocol data - records, tokens, API responses. As a URI, the
did:scheme is case-insensitive, soDID:means the same thing - but ATProto requires the normalized, lowercase form there. DIDs typed in by a user may be normalized; see item 2. And, even under the general DID syntax, the method name must be lowercase, sodid:PLC:…is invalid on its own.)DIDs are case-sensitive - so
did:plc:abc…anddid:plc:ABC…are 2 different accounts.For
did:plc, the uppercase one is not a different DID - it is not a validdid:plcat all, since its identifier is lowercase-only base32. The ATProto specification says “the currently-supported methods are not case sensitive, and could be safely lowercased”, and that “It is permissible to attempt case normalization when receiving user-controlled input, such as when parsing public URL path components, or text input fields.” So: reject bad casing in protocol data; lowercasing what a user typed is fine.If a DID parser accepts it, it is a valid DID.
A generic DID parser only checks the generic syntax - which allows uppercase in the identifier (the test vectors list
did:method:VALas valid). The indigo library'ssyntax.ParseDIDacceptsdid:plc:Z72I7HDYNMK6R22Z27H6TVUR- butplc.directoryrejects it. Generic syntax is not the same as a validdid:plc.A
did:plc's DID document never changes.The DID never changes - but its DID document can. Each change is a signed operation, and the handle (
alsoKnownAs), the PDS (the#atproto_pdsservice), the signing key (#atproto), and the rotation keys can all be changed.For example, my DID's audit log (
plc.directory/did:plc:scewmn2pl3oz36mxme2b6czz/log/audit) has 4 operations:| Date | Handle | PDS | What Changed |
|---|---|---|---|
| 2023-04-18 |reiver.bsky.social|bsky.social| (created) |
| 2023-11-13 |reiver.bsky.social|lionsmane.us-east.host.bsky.network| PDS, signing key |
| 2026-10-23 |reiver.myatproto.social|blacksky.app| handle, PDS, signing key |
| 2026-11-06 |reiver.blacksky.team|blacksky.app| handle |And, the
did:plcspecification has 2 more surprises. A “tombstone” operation “clears all of the data fields and permanently deactivates the DID”. And, there is a 72-hour window during which a higher-authority rotation key can “"rewrite" history”. So, do not cache a DID document forever - re-resolve it from time to time, and watch the firehose for#identityevents.
Personal Data Servers
“Personal” Data Server means one server per person.
“Many PDSes will host multiple users” (the glossary). Most host many.
Bluesky users' data is on
bsky.social.Bluesky's accounts are spread across many PDS hosts - for example,
@bsky.appis onpuffball.us-east.host.bsky.network.bsky.socialis where they log in.The server a user logs in at is the server that has their data.
It might be an entryway - a separate OAuth server for many PDSes.
puffball.us-east.host.bsky.network's/.well-known/oauth-protected-resourcelistshttps://bsky.socialas its authorization server. (blacksky.app, on the other hand, lists itself.)A user's PDS never changes.
Accounts can migrate to another PDS - that is a core design goal. Always look up the current PDS from the DID document (and do not cache it forever).
A user's PDS can show them everyone's posts.
A PDS only has its own accounts' data. For timelines, threads, and counts, it forwards the request to an AppView. (See: ATProto PDS.)
A user's PDS builds (or renders) their timeline.
The timeline (
app.bsky.feed.getTimeline) is built by an AppView. The PDS just forwards the app's request to it. And, no server renders it - the AppView returns JSON, and the app (on the user's phone or computer) renders that.(This one used to be closer to true. Bluesky's feed generator starter kit still says “In the future, the PDS will hydrate the feed with the help of an App View, but for now, the PDS handles hydration itself.” Today, the AppView does it. See: ATProto Feed Generator.)
Bluesky's PDS software is the only PDS software.
Any server that implements the right end-points is a PDS. (For example, the Blacksky team's
rskyproject, written in Rust, includesrsky-pds.)Self-hosting a PDS means you have to index the entire network.
A PDS only stores its own accounts' data. Indexing the network is the job of relays and AppViews - a self-hosted PDS uses someone else's. (In Bluesky's PDS software,
PDS_CRAWLERSdefaults tohttps://bsky.network, andPDS_BSKY_APP_VIEW_URLdefaults tohttps://api.bsky.app.)That is why the hardware is small. The official PDS instructions recommend 1 GB of memory, 1 CPU core, and a 20 GB SSD - for 1 to 20 users. (See: ATProto PDS.)
Records and Repositories
Every record on the network is a Bluesky post.
A repository can hold records of any type - any lexicon, from any app - all mixed together in the same user's repository. Calendar events, bookmarks, blog posts, game state, workout logs, or a custom app's own schema: each is just another collection. (And, by default, a PDS accepts records whose lexicon it does not know - “optimistic validation”.)
For exampl
Comments
No comments yet. Start the discussion.