A self-only space is the smallest shape permissioned data can take, with one authority, one member, and one repo all under the same DID. This post works through the whole thing for bookmarks, from the space type declaration to the sync flow.
Last month I published Reading Proposal 0016, a close read of Daniel Holmgren's permissioned data draft. This series is the follow-up. Instead of reading the spec, I want to apply it: a tour of the shapes I expect permissioned data spaces to take in practice, with real URIs, reco…
2
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The first shape is the smallest one: a space with exactly one member, me.
Bookmarks are an old interest of mine. I worked on del.icio.us back in the day, and the question of where bookmarks live and who gets to see them has followed me around ever since. The atmosphere already has a good public answer (disclaimer: I helped author it). community.lexicon…
5
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The problem is that the public repository is the only place to put them. Some bookmarks are meant for sharing. A lot of them are not: research for a job hunt, gift ideas, an article you want to save but not broadcast, etc.. Today those either go into an app's silo or they don't g…
6
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The proposal makes that possible, and the personal case is small enough that most of the protocol's machinery drops away. That's what makes it a good first shape.
7
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
The Shape
8
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
386
byteStart
382
plaintext
A space is identified by three values: an authority DID, a space type NSID, and a space key. For personal data, the proposal says the authority can simply be your own DID. Dedicated space DIDs exist so that shared spaces can transfer between people, and nothing about my bookmarks…
Permissioned URIs reuse the at:// scheme. The literal space segment sits where a collection NSID would appear in a public URI, and since a collection NSID always contains at least two dots and space contains none, the two are never ambiguous. My DID appears twice in that record U…
16
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
Declaring the Type
17
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
79
byteStart
64
1
features
0
$type
pub.leaflet.richtext.facet#link
uri
https://lexicon.community/
index
byteEnd
190
byteStart
173
plaintext
Space types are NSIDs that resolve to a Lexicon definition with "type": "space". There isn't one for bookmarks yet, so treat this as a strawman for chartering one under the Lexicon Community namespace:
Two fields do real work here. The key field recommends a space key type the same way record key types work, and any keeps this type open: self is the convention for the one personal collection, and a TID or a slug can key additional collections of the same type. That matters late…
20
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
One thing worth knowing: the protocol doesn't constrain which collections can be written into a space. The declaration sets expectations and scope defaults, but if I want to drop private draft notes into this same space later, nothing stops me. I'd probably charter a sibling type…
21
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
Standing It Up
22
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
184
byteStart
170
1
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
239
byteStart
220
2
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
321
byteStart
313
3
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
354
byteStart
342
plaintext
My PDS is both the repo host and the space host here, because that's the fallback the spec defines. A space authority resolves through two optional DID document entries, #atproto_space for the credential signing key and #atproto_space_host for the host endpoint. When they're abse…
23
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
51
byteStart
28
1
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
147
byteStart
134
plaintext
Space creation goes through com.atproto.simplespace, the management implementation every PDS is required to support. An app holding a manage=create grant calls:
24
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.code
language
plaintext
plaintext
POST /xrpc/com.atproto.simplespace.createSpace
{
"spaceType": "community.lexicon.bookmarks.collection",
"skey": "self"
}
and gets back the space URI. One note on the examples in this post: the method names come straight from the proposal, but the request and response bodies are my reading of the draft lexicons, which are still moving. Querying com.atproto.space.getSpace afterward surfaces the simpl…
policy: member-list means the authority authorizes readers from an explicit list, and mine never grows past me. Whether the creator sits on that list as entry number one or is implicitly authorized as the authority is a simplespace detail the drafts will settle. Either way, addMe…
28
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
Writing a Bookmark
29
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
This is the part I care about most. Writing a permissioned record is the same motion as writing a public one. Here's a public bookmark today:
The record is byte-for-byte identical. Same lexicon, same validation, same CID computation. The repo parameter became a space parameter, and that's the entire difference between a bookmark the whole network can see and one only I can. The storage underneath differs, since permiss…
34
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
Reading It Back
35
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
I've been using "app view" loosely, so let me be specific about the three consumers I actually want here, because they get to use three different amounts of the protocol.
36
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
149
byteStart
140
plaintext
A browser extension that captures bookmarks writes records and reads back what it wrote. The OAuth scope grammar has a grant made for this: read_self covers the read and sync methods for my own repo in the space and nothing else. In a self-only space, my repo is the whole space, …
It never mints a delegation token, and it can't reach anyone else's data even in principle, because the grant doesn't include the method that would start that flow.
39
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
115
byteStart
71
1
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
162
byteStart
153
2
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
179
byteStart
175
3
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
185
byteStart
181
4
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
501
byteStart
472
5
features
0
$type
pub.leaflet.richtext.facet#code
index
byteEnd
515
byteStart
506
plaintext
A web client front end gets the same result with a wider grant. A bare space:community.lexicon.bookmarks.collection scope is the whole personal package: authority defaults to self, skey defaults to any, the collections default to what the type declaration lists, and the actions d…
40
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
An indexing app view is the one that runs a real service: search across everything, tag aggregation, an XRPC surface that a thin client or the extension can call. It syncs, so it walks the full credential flow, and in the self shape the flow becomes a very short loop. It asks my …
Single use, sixty seconds, signed with my account key. Note that iss and the authority in aud are the same DID: my PDS mints a token addressed to itself. The indexer exchanges it via com.atproto.space.getSpaceCredential on that same PDS and receives a space credential:
Two hours, multi-use, and no aud, because it's meant to be presented to every repo host in the space. My space has one repo host. The indexer can call com.atproto.space.listRepos for the writer set, get back a list of one, and sync me incrementally:
45
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.code
language
plaintext
plaintext
GET /xrpc/com.atproto.space.listRepoOps
?space=at://did:plc:cbkjy5n7bk3ax2wplmtjofq2/space/community.lexicon.bookmarks.collection/self
&since=3lzvhw3xakc2p
Each operation is {rev, collection, rkey, cid, prev} with record values inlined, and when a response reaches the end of the oplog it carries the current signed commit so the syncer can compare its running set hash against mine. The commit signature is intentionally deniable, so a…
48
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
The Permission Surface
49
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Since the point of the shape is that access is legible, here is the full set of grants the whole system runs on:
50
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.code
language
plaintext
plaintext
# a full bookmarks client: read and write my space
space:community.lexicon.bookmarks.collection
# capture extension: write, and read only my own repo
space:community.lexicon.bookmarks.collection?action=create&action=read_self
# export or backup tool: read my repo, touch nothing…
51
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
For apps that would rather present something friendlier than a scope string, the same grant bundles into a permission set:
52
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.code
language
json
plaintext
{
"type": "permission-set",
"title": "Bookmarks",
"detail": "Read and save your bookmarks",
"permissions": [
{
"type": "permission",
"resource": "space",
"spaceType": "community.lexicon.bookmarks.collection",
…
53
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Revoking an app is revoking its OAuth session. When an indexer loses its last session for my account, it can no longer renew its space credential, and access decays on its own within the credential's lifetime. That's the entire offboarding story, and none of it is code I have to …
54
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
Trade-offs
55
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
features
0
$type
pub.leaflet.richtext.facet#link
uri
https://dholms.leaflet.pub/3meluqcwky22a
index
byteEnd
275
byteStart
240
1
features
0
$type
pub.leaflet.richtext.facet#link
uri
https://ngerakines.leaflet.pub/3mf5wu6fs6225
index
byteEnd
506
byteStart
489
plaintext
The proposal is a draft, and the authors expect terminology and behavior to change. The bookmarks space type doesn't exist yet and would need to go through Lexicon Community chartering, which I'd like to help with. And permissioned data is access control, not confidentiality. My …
56
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
plaintext
What's Next
57
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
What I get from this shape is my whole archive under one identity, in one record shape, with the private half addressed instead of siloed. It migrates when my account migrates, it goes away when I delete the space, and every app that already understands a bookmark record understa…
58
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Two things I'm deliberately leaving for later: moving a bookmark between the public repository and the space, which today is a delete and a re-create under a new URI, and what account migration looks like when you hold one permissioned repo per space, which the proposal describes…
id
019f70d5-b210-7ee9-a4fb-54f0c9ec1507
description
A self-only space is the smallest shape permissioned data can take: one authority, one member, one repo, and private bookmarks that share a record shape and a write path with public ones.