webfinger
#仕様
https://webfinger.net/
https://www.rfc-editor.org/rfc/rfc7033.html
https://datatracker.ietf.org/doc/rfc7033/
https://datatracker.ietf.org/doc/html/rfc7565
https://datatracker.ietf.org/doc/rfc7565/
webfingerで使用される acct に関する仕様
https://github.com/mastodon/goldfinger
Mastodonが一時期まで保守していたwebfinger client library (archived)
https://docs.joinmastodon.org/spec/webfinger/
URIで示されるリソースのメタデータを取得するプロトコル
ActivityPubにおいては、acct @example@example.com から Actor のURL https://example.com/users/example を取得するのに使われている
ActivityPubにおけるユーザID上のホスト部とそれをホストしているサーバとが異なる場合にも対応できる
例: Vivaldi SocialではユーザIDは@example@vivaldi.netであるが、サーバはsocial.vivaldi.netである
その他の活用例
OStatus でもacctから各種エンドポイントなどを取得するのに使っていた
OpenID Connect でメールアドレスやURLといったリソースからエンドポイントを探すのに使うことがある
etc.
実装
HTTPエンドポイントを用意するだけでよい
example@example.com について照会する場合、https://example.com/.well-known/webfinger?resource=acct:example@example.comに対してGETリクエストが飛ぶ
ActivityPub 向けに最低限必要なレスポンスは以下の通り:
code:resp.json
{
"subject": "acct:example@example.com",
"links": [
{
"rel": "self",
"type": "application/activity+json",
"href": "https://example.com/actor" // @example@example.com に対応するアクターエンドポイント
}
]
}
Content-TypeはJSON Resource Descriptor、つまりapplication/jrd+json; charset=utf-8である必要がある
実装によっては https://example.com/.well-known/webfinger?resource=https://example.com/actor のようにGETリクエストすることで URL https://example.com/actor について照会できる
これを利用して、逆にアクターエンドポイントの URL をもとに acct @example@example.com を引くこともできる
mogaminsk.icon 2023/7/28 時点の Mastodon main ブランチ, Misskey v13.13.2, Pleroma BE 2.5.2 でできた
hr.icon
mogaminsk.icon Pleroma は webfinger への GET リクエストの accept: ヘッダで application/xml を優先するように指定すると、content-type: application/xrd+xml; charset=utf-8 で xml 形式のデータを返すこともできるみたい