LoginSignup
7

More than 3 years have passed since last update.

MastodonのKeybase統合について

Last updated at Posted at 2019-03-24

update

2019.04.11に更新しました。keybaseのproofにmastodon.socialが登録されました。したがって、以下のコマンドを実行し、出てきたURLをクリックすると、連携が可能になります。

$ opne -a Keybase
$ keybase prove mastodon.social $USER

他のインスタンスは、現在、大手以外は、登録されていませんが、すべてのmastodonインスタンスは、登録可能であるとの情報があります。

2019.04.13 : 個人インスタンスや小規模のインスタンスでも認証が可能になりました。keybaseサーバーに多くのインスタンスのドメインが登録された模様です。

ただし、WEB_DOMAIN, LOCAL_DOMAINでハックしてメインドメインをmastodonのアドレス(@user@example.com)を設定しているようなインスタンスは、エラーが出るっぽいです。自分のところがそうでした。コマンドは発行できて、URLも出るのですが、承認のところでエラーが出ます。syui.cf <---> syui(keybase)では不可能で、mstdn.syui.cf <---> syui(keybase)なら可能でした。

取りうる対策はいくつかあり、最も可能性として高いやり方は、一旦、WEB_DOMAINなどの設定を削除して、mastodonアドレス(@user@example.com)をサブドメイン付き@user@sub.example.comにした上で、連携します。その後、もとに戻しても連携は取り消されません。ただ、keybase側がサブドメイン付きアドレスになってしまったため、少しだけ残念ですね。

このプルリクを取り込むと、エラー無しで認証できるようになります。ただ、keybase側の表示は、サブドメインのほうになりますが。

推測

1週間ほど前の2019.03.18くらいに、Mastodonに以下のPull Reqが取り込まれました。

Add Keybase integration

それで色々と調べていた結果、MastodonのKeybase統合は、こんな感じでできるんじゃないかなというのを書いていきたいと思います。

何か間違っていたら、コメントにて教えていただけると助かります。正直、MastodonのKeybase統合については、よくわかっていません。

インスタンスの/.well-known/keybase-proof-config.jsonにkeybase Proof Integration用のconfig.jsonという設定ファイルが作られるているので、それを検証し、OKなら、Keybaseスタッフのmlsteeleさんに当該、config.jsonをKeybase Message Chatなどで送る。

それが採用(登録)された場合に、keybase prove domain userコマンドが有効になり、連携が可能になる...のではないかなと思っています。

To send us the config, you can send us the public URL for your config file or attach it directly in a Keybase chat message to @mlsteele or email miles@keyba.se. In our example the file is hosted at https://keybase.io/.well-known/example-proof-config.json.

Mastodon Ver : 2.7.4 master

Example

config.jsonの検証
$ curl -sLO https://mstdn.syui.cf/.well-known/keybase-proof-config.json

$ brew install httpie

$ http POST "https://keybase.io/_/api/1.0/validate_proof_config.json" config="$(jq -c . < keybase-proof-config.json )"
{
    "status": {
        "code": 218,
        "desc": "Unable to parse JSON SyntaxError: Unexpected token . in JSON at position 118",
        "fields": {
            "config": "Unable to parse JSON SyntaxError: Unexpected token . in JSON at position 118"
        },
        "name": "GENERIC"
    }
}

$ http GET "https://keybase.io/_/api/1.0/validate_proof_config.json" config_url="https://mstdn.syui.cf/.well-known/keybase-proof-config.json"
{
    "status": {
        "code": 0,
        "name": "OK"
    }
}

ここで、OKが出たら、そのファイルをKeybaseスタッフのmlsteeleさんに送り、登録してもらえれば、以下のコマンドが有効になると思われます。

$ open -a Keybase

# 自分の場合、domainがsyui.cfでそれ以外をmstdn.syui.cfで設定しているため、少し特殊です
$ keybase prove syui.cf syui

# 例えば、オイゲンさんところのインスタンスがkeybase Proof Integrationに登録されれば、以下のコマンドが有効になると思われます
$ keybase prove mastodon.social syui

そこで、URLが示されるので、それを踏むと、連携が可能になる形だと思われます。

追記

情報によると4/8にKeybaseがやってくるというので、もしかしたら、この日に、mastodon.socialのドメインがkeybase proofに追加されて、使えるようになるのかもしれませんね。

あと、各インスタンスも上のようなURLにconfigが出力されますので、それを使えばkeybaseに出願できます。

ただ、4/8から出願したら自動で登録されるような仕組みになるのか、それともやはり従来のようにkeybaseの人の審査を経る必要があるのか、どうなるのかはわかりません。どうなるんでしょう。個人的には自動でkeybaseに登録して使えるようになると嬉しいですね。

MastodonのKeybase統合に関連するリンク

PR : https://github.com/tootsuite/mastodon/pull/10297

Docs : https://keybase.io/docs/proof_integration_guide

Ref : https://github.com/tootsuite/mastodon/pull/10013

config.json error : https://github.com/tootsuite/mastodon/issues/10323

Steps to Rollout : https://mastodon.zunda.ninja/@zundan/101807374869944766

1. Implement the proof-creation flow
2. Implement the proof-checking flow
3. Add a link on your users' profile screens if they've claimed a Keybase account, and if Keybase agrees that the signature is valid.
4. Verify your config with the validation endpoint
5. Send the config file or public URL as a chat message to @ mlsteele or email miles @ keyba.se and we'll flip the rest of the switches on our end.

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7