[Atp] Potential 'at' URI Solution

I have a new ‘at’ URI scheme syntax/structure proposal that could be a way forward:

at:public///
at:public/did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g

As a reminder, the current ‘at:///…’ syntax with double slashes is not a valid IETF URI, nor a valid WHATWG URL. In this proposal we lose the nice idiomatic prefix (‘at://’), but keep the account identifiers vebatim, and don’t need any escaping or encoding. The general shape is unchanged: a three-tuple of {account, type, key}.

This prefix structure would generalize well to other URIs in the broader atproto ecosystem. For example, design work is wrapping up on “atproto spaces”, a protocol extension for non-public data[0]. This is outside the scope of this group’s current charter, but assuming all goes well with the current charter we expect to propose it in a future re-charter. Spaces have a dual namespace structure, with two separate three-tuples, and need distinguishable URIs. With feedback from the developer ecosystem we have iterated on a couple different syntaxes (including a new ‘ats:’ URI scheme), and currently settled on a ‘/space/’ as the first path prefix:

at:///space/////
at://did:plc:735r43lcgemuv2woqpvx3lso/space/my.bulletin.board/self/did:plc:735r43lcgemuv2woqpvx3lso/my.bulletin.post/3mtiiz6ci6c2j

This reuses the ‘at:’ scheme (which we like), but has all the same syntax problems as the current public protocol references (aka, the double-slash), and also has the ‘/space/’ in the middle. Under the new proposed syntax, these could be:

at:space//////
at:space/did:plc:735r43lcgemuv2woqpvx3lso/space/my.bulletin.board/self/did:plc:735r43lcgemuv2woqpvx3lso/my.bulletin.post/3mtiiz6ci6c2j

The use of ‘public’ for the prefix for regular atproto records could be debated; maybe ‘at:repo’ would make sense. We would still expect the ‘at://’ syntax to be supported as a mandatory “legacy” format for all the billions of existing records containing strings in that format, but we would be careful not to call them “URIs”.

We have a short time window in which we could adopt the ‘at:space’ syntax for the atproto spaces beta deployment, which we expect to go live soon after IETF 127 (“by the end of November”). That would sort of hinge on expecting the general pattern to work out as the public data URI syntax as well. It is impossible to come to a formal consensus on this timeframe, but there is time to get feedback on this list and have a discussion at IETF 127. If there is broad support this format, we will likely use it in the spaces beta deployment. If not, we will likely go ahead with the syntactically-invalid ‘at://’ format, and resolve that problem at the same time as the public data references.

Some questions for the list:

  • are there any concerns about this new proposed syntax being a valid and well-formed IETF URI?
  • how likely is this new syntax likely to be pass scrutiny at the IESG and/or uri-review@ietf.org phase?
  • are folks willing to let go of the nice ‘at://’ prefix?
  • is it worth the disruption and friction of supporting two syntaxes (“valid URI” and “legacy non-URI”) indefinitely?
  • are there any firm counter-proposals waiting in the wings?
  • any strong aesthetic or conceptual objections to this new syntax?

–bryan

1 Like

The ‘at:space’ example had a typo (the ‘/space/’ was accidentally included in the example). It should read:

at:space/did:plc:735r43lcgemuv2woqpvx3lso/my.bulletin.board/self/did:plc:735r43lcgemuv2woqpvx3lso/my.bulletin.post/3mtiiz6ci6c2j

Thanks to Nick Gerakines for the sharp eyes.

–bryan

Hi all,

Is there actually really a need for two different URI schemes here? It’s all AT Protocol data, all that’s changing is where it’s hosted / how it’s access?

what’s wrong with at:/// where collection may either be a reserved word or a valid NSID

If collection is a valid NSID, then the spec defines the further URL segments as:

at:///

And then we could define the space reserved word via an extension, which could then define it’s own path segments:

at://space/////

I’m not sure why we’d explicitly need two different URI schemes?

(The at:// syntax is a valid URI, it’s just at:// that fails due to custom schemes / syntax)

— Emelia

One thing I like about this proposal is that it isn’t two different URI schemes. It’s all at:.

The first path segment (public or space) is just a semantic of at-uris not a part of the scheme. To a URI parser it is a scheme (at:) followed by a rootless path.

– Daniel

Also, there’s a reason not to use at:space// — WHATWG’s URL parser cannot parse / construct it properly:

URL.parse(‘my.bulletin.post/3mtiiz6ci6c2j’, ‘at:space/did:plc:735r43lcgemuv2woqpvx3lso/’)

Results in null, instead of a valid URI. By comparison, the form I proposed:

URL.parse(‘my.bulletin.post/3mtiiz6ci6c2j’, ‘at:/did:plc:735r43lcgemuv2woqpvx3lso/’)
=> parses correctly to: at:/did:plc:735r43lcgemuv2woqpvx3lso/my.bulletin.post/3mtiiz6ci6c2j

So I think that’d be a strong argument against at:space/

— Emelia

To be clear, I think you are talking about relative URL handling. That is not something that I know is needed or beneficial in the context of atproto. But it is good to flag as additional context.

Just to make sure there is no confusion for others folks about parsing the proposed format as absolute web URLs, in my browser, if I call:

URL.parse(“at:public/did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g”).pathname

I get back:

‘public/did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g’

Which is what I would expect. And the same for ‘at:space’.

–bryan

I mean, if we’re keeping the DID out of the first segment, is there a reason we need to get rid of the at:// now? Since public and space are single keywords that aren’t valid domains but to my knowledge are still valid to put in a host segment, it’s pretty easy to swap on both new and legacy URI syntax when parsing.

I really like being able to immediately tell the difference between the public and private URIs at a glance when reading left-to-right and during string parsing.
I think the “at://” prefix inspired ideas about an AT Protocol browser (like https://) but that idea seems to have died so personally I’m fine with letting go of that prefix.

Keeping the legacy not-a-URI format around indefinitely is only mildly irksome because it breaks the “one obvious way to do things” principle. I think there was a legacy blob format at one point that was eventually phased out. My main concern is updating the rsky-syntax (https://github.com/blacksky-algorithms/rsky/tree/main/rsky-syntax) codebase to support the v1 format, then reworking the existing code for v0, and eventually removing the v0 code.

So, being firm about this would be ideal.

Hi,

I understand there’s little will for improving the current (and aging) URI specification and parsers to adopt a DID in the authority. Nonetheless, I still hold hope that the AT-URI can achieve the same and greater success for innovation that the URI specification has with its flexible path/query/fragment design.

As it stands, the AT-URI specification defines a complementary URI structure with “at://authority [path] [?query] [#fragment]” but the query and fragment are documented as yet to be supported. The allure of the AT-URI has been this intention to conform with the URI specification while delivering its single greatest innovation – a portable identity (DID) as the “authority”.

My concern is that the “at:public” or “at:space” segmentation implies that AT-URI’s can only be one or the other.

(1) What about content that is local or private or hosted by some current or yet-to-be-invented custom service? Can it have an AT-URI? If no, why not?

(2) Would additional prefixes be under some form of protocol governance committee? How would such a process expedite/hinder innovation?

(3) Can the content be referenced such that it starts off in one domain (eg. space) but through its lifecyle ends up in another domain (eg. public)?

Why further restrict, as opposed to expand, the AT-URI specification with the affordances of the URI specification? What is the hesitation for using the “query” to identify the “service” responsible for “hosting” a resource?

Public content => at:///did/nsid/rkey?service=atproto
Space content => at:///did/…?service=atproto_space

Other service content => at:///did/…?service=acme

Either one (“/”) or three (“///”) slashes after “at:” I believe would conform to the URI specification. Here, the query "service” would refer to a service supported by a user’s DID document (either did:plc or did:web)–thereby eliminating the need to hard-code “at:public ==> service=atproto” and “at:space ==> service=atproto_space”. It’s also is extensible for future services.

Just a few thoughts to ponder. I’ve enjoyed following these conversations in the AT Protocol community…they’ve been inspirational.

Best regards,

Scott Handley
NorthStar Software LLC
scott@nstarsoftware.com | www.nstarsoftware.com

Queries are already used by XRPC queries over HTTP, so I don’t think they can be feasibly included in URIs as they are right now.

Hi Meredith,

As AT-URIs aren’t hyperlinks but are programmatically parsed for DID, NSID, and RKEY in order to form an appropriate XRPC service URL over HTTP, I don’t think this is an issue?

Have the service as part of the AT-URI would help this programmatic process by identifying the target service in the user’s DID document that is responsible for the resource. Today, the public service lookup is hardcoded to “atproto_pds”. Presumably, the spaces context would also be hardcoded for lookup. Is there an alternative that could be more open and flexible?

-Scott

I have a new 'at' URI scheme syntax/structure proposal that could be a way forward:

  at:public/<account>/<collection>/<rkey>
  at:public/did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g

Thoughts on at:public:<handle or did>/collection/rkey? No option here is entirely pretty, but it does feel a little nicer to me.

Some questions for the list:

- are there any concerns about this new proposed syntax being a valid and well-formed IETF URI?

I don’t see any issues; it’s not any stranger than many existing protocols (e.g. SIP) end up being when you think of them in RFC3968 terms

- how likely is this new syntax likely to be pass scrutiny at the IESG and/or uri-review@ietf.org phase?
- are folks willing to let go of the nice 'at://' prefix?

I know there are emotions here, but it is very annoying that having to write special cases everywhere when handling at URIs so at://did:plc:…/ addresses don’t break things or get dropped, so I can only really see it as a positive.

We can lament that the URI generic syntax is the way it is, but URIs have been more or less this defined this way for 30 years and we are otherwise going to keep bumping into lots of legacy.

- is it worth the disruption and friction of supporting two syntaxes ("valid URI" and "legacy non-URI") indefinitely?

That friction will be paid by people reading old records, but its probably less than the friction dealt with by people trying to deal with URIs generically and finding their parsers tripping up on existing ATProto URIs not being a well formed URI. The nice thing is that you can push it down into your parser with simple logic that replaces “at://“ prefixes with “at:public/“ or “at:public:” without atproto gubbins spilling out all over the rest of your system.

- Erin

I’m mostly worried that [https://pds.example/xrpc/com.atproto.repo.getRecord?uri=at:///did:web:example.com/app.bsky.feed.post/whatever?service=atproto](https://pds.example/xrpc/com.atproto.repo.getRecord?uri=at:///did:web:example.com/app.bsky.feed.post/whatever?service=atproto) or the like would cause issues for URL parsing, since AT URIs are passed through XRPC queries fairly often.

Good point. Forgot about those XRPC endpoints which take a uri param instead. Sigh.

Revisiting the scheme…what about the URI authority (as opposed to AT URI authority) being the context/service. This would bring the AT-URI into URI compliance.

at://atproto_pds//…
at://atproto_space//…
at://acme//…
at://local/…

My interest here is ensuring AT-URIs have everything needed to resolve them effectively in the wild.

With the spaces functionality imminent, this is the best time to ensure we aren’t hardcoding “at:space” as meaning look for the DID document service with name “atproto_space”. This would perpetuate the current hardcoding of “at://“ with “atproto_pds”.

We already know others have needed to stand up internal custom PDSes for their implementations. Hopefully, innovators will be given the latitude to use the value of AT-URIs to reference their resources so as not to create work arounds by mapping NSIDs to repos which could (and probably should) be independent.

-Scott

Dear ATP experts,

I have been following this discussion as an outsider (which I definitely am both for ATP as well as for DIDs). [I'm at least moderately familiar with URI syntax as one of the authors of the IRI spec (RFC 3987).]

Some comments inline.

Hi,

I understand there's little will for improving the current (and aging) URI specification and parsers to adopt a DID in the authority. Nonetheless, I still hold hope that the AT-URI can achieve the same and greater success for innovation that the URI specification has with its flexible path/query/fragment design.

I think it's not so much about the "will". There are so many places URIs are implemented, and it's impossible to change them. Over the years, every once in a while some protocol has come up with the wish for an extension to the syntax, and it was always the protocol that had to give way and adapt. And URI syntax is quite adaptable if you look carefully.

As it stands, the AT-URI specification defines a complementary URI structure with "at://authority [path] [?query] [#fragment]" but the query and fragment are documented as yet to be supported. The allure of the AT-URI has been this intention to conform with the URI specification while delivering its single greatest innovation -- a portable identity (DID) as the “authority”.

I have looked at the syntax of DIDs in https://www.w3.org/TR/did/#did-syntax. If this is outdated, please tell me. It seems to me that the DID 'inventors' were thinking about DIDs as freestanding URIs (registered provisionally at Uniform Resource Identifier (URI) Schemes), see also https://www.iana.org/assignments/uri-schemes/prov/did. But they didn't think about DIDs as authority components in other URI schemes.

Now looking at the syntax at https://www.w3.org/TR/did/#did-syntax, there may be a rather easy way to integrate DIDs as authority components in general URIs (please excuse if such a solution has been proposed already elsewhere).

The 'method-name' component is limited to lower-case letters and digits. The 'method-specific-id' is limited to letters, digits, period, hyphen, underscore, and colon, with all other letters (if there are any) percent-encoded. On the other hand, the host component in the authority of an URI, in case it is not an IP address but a reg-name, included sub-delims (see RFC 3986: Uniform Resource Identifier (URI): Generic Syntax | RFC Editor and RFC 3986: Uniform Resource Identifier (URI): Generic Syntax | RFC Editor).

Now sub-delims includes quite a number of characters:
       sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
                   / "*" / "+" / "," / ";" / "="

This does not include ":", but we can replace ":" with one of these. Not all of them work equally well visually, and some of them have other problems, but instead of e.g.
at://did:plc:735r43lcgemuv2woqpvx3lso, what about
at://did$plc$735r43lcgemuv2woqpvx3lso or
at://did!plc!735r43lcgemuv2woqpvx3lso or so?

That means that if you put a DID into an authority slot, replace the colons with "$" or "!" (or whatever other character we choose as most suitable). When you take that DID back out, replace the other way round.

And ideally, this wouldn't be decided by ATP for the at: scheme, but in coordination with the W3C Decentralized Identifier Working Group and potentially other interested parties. It could even go as far as the colon in DIDs themselves being changed to another character. DIDs are way younger than URIs, and should have an easier job of absorbing such a change.

My concern is that the “at:public” or “at:space” segmentation implies that AT-URI’s can only be one or the other.

I must admit that I don't understand the difference between these two, but the long history of networking and data exchange shows that it's a bad idea to distinguish between public and (in some way or other) private resources so openly in the resource syntax. This is similar to other aspects that shouldn't be integrated into identifier syntax. We just recently had a proposal for a httpq scheme on the
uri-review@ietf.org list (see uri-review). This proposed using a different scheme for post-quantum encryption protected HTTP resources.

Discussing URI syntax on the uri-review@ietf.org list or the uri@ietf.org list may bring up some more ideas.

Regards, Martin.

Hey Bryan,

the primary downside I see with this proposal is that it no longer formally has the identity as the authority, despite that being conceptually the case. But there are, like, five people who even know what an authority is and so in pragmatic terms this is essentially an aesthetic bikeshedding concern.

As far as I'm concerned, the requirements for this are:

• It parses.
• It contains the requisite information.

And this meets both. I like clearly separating public from spaced; this seems like it could open the door to also flagging different kinds of spaces and perhaps at:local.

I don't think that relative resolution is a requirement here. We don't have things like resolving blobs relative to other blobs from an AT location, for instance — that's what MASL is for.

So I think this works!

This is not a counterproposal but since you seem to have some longing for keeping at://, note that these options also work:

#1 Space v public authority

   • at://did:plc:735r43lcgemuv2woqpvx3lso@public/
   • at://did:plc:735r43lcgemuv2woqpvx3lso@space/
   • at://robin.berjon.com@public/
   • at://robin.berjon.com@space/

It's a little clunky to reassemble the identifier but *shrug*.

#2 Special-case DIDs with their own authority

   • at://735r43lcgemuv2woqpvx3lso@plc/
   • at://robin.berjon.com/

This drops the early public/space flag but it has the advantage that it keeps existing AT URLs that have a handle authority untouched. The semantics remain largely correct. If the authority is a DID method, then consult the username. (I never understood what the `did:` prefix was for anyway given that any interop only happens at the method level — it seems largely spurious?)

Inline

at://did:plc:735r43lcgemuv2woqpvx3lso, what about
at://did$plc$735r43lcgemuv2woqpvx3lso or
at://did!plc!735r43lcgemuv2woqpvx3lso or so?

Not just me, but many people in the community[^1], and Ted here on the list[^2], have lobbied for "DID-as-authority", whether via W3C DID URLs or not. It might look like disparate suggestions treated separately, but keeping [some reference to or transformation of] the account identifier as the authority segment is a shared goal across many proposals that don't seem to be getting considered seriously, in aggregate or individually. I'm less wed to the means chosen to achieve the goal than I am to the high-level goal of long-lived account identifiers (DIDs or not) being authorities in pURLs. Either of Robin's suggestions in the other branch of this thread, or Martin's, or Ted's, all seem strictly preferable to the current PBC proposal, IMHO, if a global protocol of which independent implementations are possible is the goal and for which smooth browser support would be maximally realistic to strive for. I would, however, take issue that "five people" care what the authority segment of a URL is, as URLs things that normal human copy-paste into browser bars and popups, and normal humans _are_ often acutely aware of what a domain apex is, and get suspicious the further you take them from URLs in recognizable shapes. Greetings from W3C TPAC, btw.

That means that if you put a DID into an authority slot, replace the
colons with "$" or "!" (or whatever other character we choose as most
suitable). When you take that DID back out, replace the other way round.

And ideally, this wouldn't be decided by ATP for the at: scheme, but in
coordination with the W3C Decentralized Identifier Working Group and
potentially other interested parties.

Fun fact, as of midnight last night Baile Átha Cliath time, a second DID WG was created at W3C, which treats individual DID methods; this might help with the questions previously raised by Orie of content-types and resolution failure cases. Also, the unstable portions of the DID Resolution spec mentioned months ago are starting to clear up. Whether DID URLs get used or not, NOT consulting with the people working on DID URLs seems like a wasted opportunity to compare notes with other design problems being worked on in parallel, particularly since some of problems this decomposes to (such as how else to express DIDs as authorities, if a host-url is sought) are well-studied there.

> My concern is that the “at:public” or “at:space” segmentation implies that AT-URI’s can only be one or the other.

I must admit that I don't understand the difference between these two,
but the long history of networking and data exchange shows that it's a
bad idea to distinguish between public and (in some way or other)
private resources so openly in the resource syntax. This is similar to
other aspects that shouldn't be integrated into identifier syntax.

+1. Might deserve a separate thread, as it's orthogonal to which category of URI is used.

[^1]: The AT-URI Syntax Mess - #11 by mfzx.net
[^2]: [Atp] Re: Draft "at" URI Scheme Document (legacy not-actually-URI version)

“That means that if you put a DID into an authority slot, replace the colons with “$” or “!” (or whatever other character we choose as most suitable). When you take that DID back out, replace the other way round.”

This seems like a reasonable compromise that preserves the integrity of the AT-URI definition for a DID authority without holistically changing the specification in potentially limiting less standard ways.

If I really wanted to throw a brick into this I could propose a DID display along the lines of at://fxgreqfae3vqhyjsntsikfux@did.plc/<collection>/<rkey> or at://example.com@did.web/<collection>/<rkey> but that feels like it might be going a little too far given the current direction of this discussion both here in the thread and on the atmo community forum.