Introduction
Terence Edente wrote a
postpost about using .well-known
addresseswka for
avatars and
asked for thoughts. They had me at .well-known addresses.
I love them. I think we should
build a new social network that uses
them to connect website via RSS feedsvision.
So, easy win there. The rest is details.
Here's where my head's at:
Current Draft
Just playing with the format for now. Write up will come after. Prior version of the prose is in the `Previous Drafts` section after the footnotes.
Notes
-
First image with a given ratio is the default
-
Tags can be used to identify images that should be used for specific cases (e.g. using a different
1:1for Mastodon). -
The UUID for
example@example.comisc91ba7fe-457c-5b62-b769-efa6643c3fde
Manifest Example
Footnotes
te ⇑
Terence Eden's Blog
- The site where this all kicked off.
post ⇑
Alpha launch - .well-known/avatar - feedback wanted
- the latest in a series of posts exploring the idea of .well-known/avatars.
wka ⇑
Well-known URIs
- boils down to specific URLs you can go to on a site to check if they have a content package. If it's there, it should conform to a specificion for the URL.
vision ⇑
A Vision for the Web
- Top level question, what if added specifications for connecting website via RSS feeds?
It's still a draft. There's a possibility I was having a little bit of a manic episode
when I wrote it, but I stand by it. It's something I'll be working on after I
finish bitty for making pages
interactive without frameworks (he says, doing a shameless plug).
Previous Drafts
Draft 1
TL;DR
-
Server files statically in order to open access to as many people as possilbe (e.g. folks that can't afford a server with dynamic processing should not be left out of the feature).
-
Provide
.well-known/avatarsfor both DOMAINS and ACCOUNTS. (e.g. so RSS readers can benefit from the feature as well) -
Default images must be square .jpg files and go to these locations for the DOMAIN and ACCOUNTS respectively.
/.well-known/avatars/default.jpg and /.well-known/avatars/UUID/default.jpg -
manifest.jsonfiles list other avatars that are available. They reside at:/.well-known/avatars/manifest.json and /.well-known/avatars/UUID/manifest.json -
MANIFEST FILES include two categories of avatars:
defaultandcustom.The
defaultavatars are intended to be used generically. Thecustomavatars are to provide the ability for folks to maintain multiple avatars in their own centralized location if they want to use more than one (e.g. so folks don't have to use the same avatar on LinkedIn that they use on Mastodon.) -
Tags are used to communicate intent for which images go where beyond the defaults.
-
Don't use image sizes, just use ratios.
-
Add a field for Alt Text
-
Provide for animated avatars as well
Preface/Assumptions
-
My site is twenty-five years old. I approach this kind of exercise by thinking about the next twenty-five. It's a fools errand. A prime opportunity for premature optimization. It's also an important part of my process. It boils down to the idea that "Temporary ain't^^tmp^^". The more folks involved in a thing, the more likely it is we'll only get one shot at it.
-
I'm using SHOULD/MUST/MAY style, but only loosely as a framework to help writing and to have something to react to. Coming up with a conforming spec/RFC is an exercise for a later time.
-
I'm specifying the default images should be ".jpg" files. The format is a placeholder to make the doc easier to read. I'm not concern with the actual format that's used, just that there's only one so the URL is the same 100% of the time.
I realize that points to a potential situation like
/favicon.icostill hanging around. My position is that we've had enough experience with image formats now that we can safely pick a default that will be useful for at least a few decades. -
I'm dropping a UUID in for a namespace identifier. It's as good as any, but should not be considered official in any way at this point.
Terminology
-
"ACCOUNT" - what/whoever's avatars are being served.
-
"CLIENT" - sites/networks/apps/RSS readers, etc... that display the avatars.
-
"DOMAIN" - the domain/subdomain hosting the AVATAR SET assets.
-
"AVATAR SET" - A DEFAULT IMAGE and a MANIFEST FILE. Notably, this DOES NOT include other image assets as those may be hosted in entirely different locations.
-
"DEFAULT IMAGE" - a JPEG encoded file that MUST BE named
default.jpg -
"MANIFEST FILE" - a JSON file that MUST BE named
manifest.jsonand MUST comply with the SCHEMA. -
"MANIFEST SCHEMA" - The JSON Schema for the MANIFEST FILE. (This will be versioned, but details on that are for a future iteration).
(I'm not sure where the schema would be hosted, but there will be an explicit URL for it)
DOMAIN Specific AVATAR SET
The purpose of this AVATAR SET is to represent the DOMAIN without the need for an ACCOUNT. One use case is RSS readers who can go to the .well-known address for any feed if no metadata points to other files. DOMAIN DEFAULT IMAGES
DOMAIN DEFAULT IMAGES
-
A DOMAIN SHOULD publish a DEFAULT IMAGE.
-
The DOMAIN DEFAULT IMAGE MUST BE at the URL:
/.well-known/avatars/default.jpg
-
The DOMAIN DEFAULT IMAGE MUST BE a square image (i.e. a 1:1 aspect ratio).
-
The DOMAIN DEFAULT IMAGE MUST BE named "default.jpg".
-
The DOMAIN DEFAULT IMAGE MUST BE a JPEG encoded image.
DOMAIN MANIFEST FILES
-
A DOMAIN SHOULD publish a MANIFEST FILE.
-
The MANIFEST FILE MUST BE at the URL:
/.well-known/avatars/manifest.json
- The MANIFEST FILE MUST BE conforming to the MANIFEST SCHEMA.
ACCOUNT Specific AVATAR SETS
Multiple ACCOUNT specific AVATAR SETS can be hosted on a single DOMAIN. These ACCOUNT AVATAR SETS MUST BE fully independent and addressed individually.
ACCOUNT UUIDs
-
Each ACCOUNT MUST BE represented by a UUID.
-
The UUID MUST BE version 5.
-
Version 5 UUIDs are made from a "namespace identifier" and "name". The "namespace identifier" MUST BE the UUID ba69072a-456d-4a26-9ec3-8631f29eca3b
-
The "name" portion of the ACCOUNT UUID MAY BE an email address.
-
The "name" portion of the ACCOUNT UUID CAN BE an valid string that generates a UUID.
(obviously, one of the key points here is to be able to use email addresses to tie things together, but explicitly being an email address isn't required. This opens the door for other tokens to be used as well.)
ACCOUNT DEFAULT IMAGES
-
ACCOUNTS SHOULD publish a DEFAULT IMAGE.
-
The URL for an ACCOUNT'S DEFAULT IMAGE MUST BE:
/.well-known/avatars/UUID/default.jpg
-
The ACCOUNT'S DEFAULT IMAGE MUST BE a square image (i.e. a 1:1 aspect ratio).
-
The ACCOUNT'S DEFAULT IMAGE MUST BE named "default.jpg".
-
The ACCOUNT'S DEFAULT IMAGE MUST BE a JPEG encoded image.
ACCOUNT MANIFEST FILES
-
A ACCOUNT SHOULD publish a MANIFEST FILE.
-
The ACCOUNT MANIFEST FILE MUST BE at the URL:
/.well-known/avatars/UUID/manifest.json
-
The ACCOUNT MANIFEST FILE MUST BE conforming to the MANIFEST SCHEMA.
Image Formats
-
CLIENTS MUST accept static raster avatars from
.jpg,.png,.webp,.avif(TODO: determine list of all formats and the specific encoding that each one can represent) -
CLIENTS MAY accept static raster avatars from encodings for other extensions.
-
CLIENTS MUST accept static vector avatars as
.svg. -
CLIENTS MAY accept static vector avatars from other encodings/extensions.
-
CLIENTS MUST accept animated avatars from
.gif,.avif,.mp4,.webm -
CLIENTS MAY accept animated avatars from other encodings/extensions.
Image Cropping
MANIFEST FILE Proposal
Don't use multiple image sizes
Make one big copy of each avatar image. Leave it to the CLIENTS to convert images to sizes that suite their needs.
If an ACCOUNT or DOMAIN publishes an avatar that's all pixelated because it's too small they can make it bigger (something they'd have to do anyway if the largest image they provided wasn't big enough).
Use aspect ratios instead of explicit dimensions
Provide x and y
values for images that represent its ratio instead of explicit
width
and height dimensions
CLIENTS can scan the MANIFEST FILE and pick whichever radio is closest to the one they need.
CLIENTS can also publish lists of aspect ratios they'd prefer allowing ACCOUNTS and DOMAINS to create matching images if they wish
Include Alt-Text with each image
Add a key for each image that hold alt text. There's an argument to be made for not letting the field be `null`, but that's maybe a touch agressive.
Don't publish MIME types
Make the requirement that the image's "url" key end with a `.EXTENSION` that must match the encoding of the image.
Provide containers for both static and animated avatars
Discords (and probably other CLIENTS) are already using animated avatars. It feels like it make the most sense to include them, but keep them under their own category so its easy for clients to determine which are which. (e.g. animated image formats often come with non-animated capabilities. So, CLIENTS can't rely solely on image extensions to make the determination)
Provide both default and alternate image sets
The alternate images take priority if a matching criteria is found. If not, the default images are used
Use tags for selection criteria
Expect multiples of the same ratio to exist
There can be more than on image per category with the same x/y aspect ratio. Trying to mandate they be unique would only cause overhead for everyone trying to come up with different ways to deal with it when it inevitably happens. Instead, leave it as an option so CLIENTS make decisions about how to handle it explicitly (e.g. just pick the first one).
Allow relative URLs
Having to use full URL that include the domain with OG images is a pain for dev and testing. Make it explicit that URLs that are relative from the docroot are allowed.
Allow alternate domain URLs
Any valid URL should be accepted, regardless of the domain.
Image Ratio Significant Digits
CLIENTS MUST respect image ratios up to two significant digits.
CLIENTS MAY respect more than two significant digits.
MANIFEST FILE Proposal Example
NOTE: I've only filled in a few avatars in the `default/static` section. The same format would be used for the other sections if folks have them. They would, of coruse, be opt-in. So, this could be a full example as well
Various Rationales
-
Using
/.well-known/avatarsinstead of/.well-known/avatarmakes it clear that multiple accounts may be available (and possibly the DOMAIN) are potentially included. -
Using a directory based appraoch like:
/.well-known/avatars/UUID/default.jpg and /.well-known/avatars/UUID/manifest.jsoninstead of a query string appraoch like:
/.well-known/avatar?resource=acct:username@example.comallow for the entire feature to be served statically. My position is that this lowers the barrier of entry to gaining access to the avatars significantly. If server side processing is required an entire category of free services is taken off the board.
-
Email address should never be sent in cleartext. Even if the requests themselves go over an encrypted channel, it's entirely to easy for a service leak URLs (e.g. a naive developer might call the URL with email address directly from public pages). The system should be set up so that leaking either through intention or mistake is eliminated wherever possible.
I'm pitching UUID v5 here, but that's very much open for discussion. Those decisions are securty based and I'd look for help from experts in the field on that front.
The thing I'd want to keep in mind is that whatever approach is used that it be desgined to be portable. Specifcially, you should be able to move your UUID to different DOMAINs without losing the UUID.
-
I like having the DOMAIN version included for two reasons. First, it would let folks who have domains use them without having to submit any other token or PII. Second, it feels like a nice way to expand the tools that RSS readers have available as well.
-
The idea of using an
Acceptheader to determine which content to reply with is very cool. My push back against it is that it requires server side processing. That introduces the same issue of limiting the availabity to folks who have accesss to server site processing.That's what leads me to the independent, explict paths for the
.jsonand.jpgfiles. -
Thiking about the user interface on CLIENT sides, there would have to be two fields to enter: 1. the email address (or other account token), and 2. the DOMAIN responsible for provding the AVATAR SET.
Otherwise, there's no way for folks with accounts on domains they don't own to participage.
-
A metadata tag should be defined as well. something like:
<link rel="avatars" href="/.well-known/avatars/UUID/manifest.json" />I don't know enough about the process to know if that would be handled in a sepearate proposal or not. That could do things like signal RSS readers to use ACCOUNT specific AVATAR SETS instead of DOMAIN ones.
-
It's clear a big impetus for using a
.well-knownaddress is so a single set of images can be used across multiple services.That's awesome, but I don't want to have to use the same image everywhere. The easiest example is that I don't want to use the same image on Mastodon as LinkedIn.
The desirability of the feature goes up an order of magnitude if I can manage my avatars in a central location but not be limited to one. That's what led to the idea of the default and alternate image collections.
-
Square images are the way of the world these days. I don't like the idea of locking into that over a decades long timeline. Different CLIENTS are gonna have designs that call for different image sizes. Frankly, I wouldn't have it any other way. That's what lead to the idea of the different apect ratios.
Indiivdual CLIENTS can choose whatever best fits their system. They can also publish guidlies for what the most optimail ratios would be. Thouse guidelines would likely include minimal size recommendations. It feels like that's where those recommendations make the most sense intead of trying to define it at the spec level.
The approch should give some nice flexibilty without getting into the XKCD Standards problem ^^xkcd^^
-
CLIENTS can publish a list of TAGS they look for.
I need to think about this more, but I can see a path to setting up guildelines like:
CLIENTS CAN utilize any image from the
defaultarray.CLIENTS SHOULD NOT utilize any images in the
alternatearray unless they contain a tag matching one the CLIENT makes known they are useing etc...Basic idea is that individual who manage an ACCOUNT/DOMAIN AVATAR SET can make DEFAULT images avilable without any extra overhead. But, anyone who's intersted in distributing differeng images to different CLIENTS will have the capability of doing so if they want to put in the effort.
(And for anyone thinking about yet, you're right, there's not a security envelope around this. Every image listed in a manifest.json could be used by anyone at any point. That's a feature of the system not an oversight. The only way to prevent an image from being used is by not publishing it at all.)
-
Tagging also offers some other possabilities. For example CLIENTS could publish that one of the image tags they look for is
bannerwith a ration of 16:9.I wouldn't try to standardize those tags but if big services adopt some they'd likely become de facto standards on their own.
-
None of this discusses cache handling/proxying etc... That's all worthy of discussion but beyond the scope of this document.
Conclusion
This is, obviously, way more complex than the original idea. My position is that the flexibility is worth the trade-off and that flexibility will have an outsized increase in bring usage into a default move.
I see it as a binary complexity switch. It's either dead simple, or you get a fiddle with a bunch of things.
If you're making your own avatar and don't want to have to deal with the complexity just throw a square image in the default path and be done with it:
-- path/
/.well-known/avatars/SOME_OBFUSCATED_ID/default.jpg
-- /path
-- aside -- title: aside
We'd want to make a tool that generates the IDs for folks so it's easy to do. Ideally, that would get backed into site building apps, but we should make sure there are tools/sites that make it easy to do independently.
-- p
If you're a service/app/RSS reader using the images you can also just pull the default if you want to show an image but don't want to devote the resources to go all-out.
For those people and projects that do want to go father, all the tools are there. From simply using a horizontal image all the way to having multiple animated images for every day of the week for your favorite RSS reader, you can take things as far as the collaboration between the makers and the displayers wants to go.
-- list/
-
For users, if you don't want to mess with shit, just throw a square image in:
-
If you want to play with all the options start chucking more images into the
manifest.jpgat whatever level you want. -
Same goes for services that use the images. Need to get up and running quickly? Grab
default.jpg. -
If you're a service that wants more you can grab the horizontal or vertical images.
-
Even more? publish a tag you'll back up with recommended sizes. Slurp them up if you find them.
-- /list
Footnotes
-- footnote -- id: tmp
I don't remember who I heard the phrase "Temporary ain't" from. It was years ago, but it's a front-of-mind idea for me.
The best example I have is the "Temporary" process I wrote for grabbing weather data from an API and showing in the PGA TOUR leaderboard during my career there.
It wasn't supposed to be my job, but the team that was theoretically responsible for it couldn't meed a sales deadline. I threw together a script that did the thing until they could get to it. It got used for for ten years.
-- footnote -- id: xkcd -- title: XKCD: Standards -- url: https://xkcd.com/927/
Start with N, end up with N+1.
-- ref -- title: Mastodon Thread -- url: https://hachyderm.io/@Edent@mastodon.social/115424378257516254
-- ref -- title: example -- url: https://shkspr.mobi/.well-known/avatar/?resource=acct:whatever@shkspr.mobi
-- ref -- title: Key Discovery -- url: https://datatracker.ietf.org/doc/html/draft-koch-openpgp-webkey-service-20#name-key-discovery
Something interesting that was referenced in the thread.