NIP-39
#NIP
External Identities in Profiles
https://github.com/nostr-protocol/nips/blob/master/39.md
プロファイルのメタデータに外部のソーシャルネットワークアカウントを紐付けることができる。
本人を保証するものではなく、検証するかはクライアントの実装に依存する (keybaseやnostr.directoryとは違う)。
現在は GitHub, Twitter, Mastodon, Telegram に対応しているが、後述するように拡張される可能性が高い。
code:event.json
{
"id": <id>,
"pubkey": <pubkey>,
...
"tags": [
"i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab",
"i", "twitter:semisol_public", "1619358434134196225",
"i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"
"i", "telegram:1087295469", "nostrdirectory/770"
]
}
iタグにplatform:identityとproofの2つのパラメータを持たせる。
platform:identity: プラットフォーム名(githubなど)と、そのプラットフォームでのID (h3y6eなど)を:で繋いだもの。
proof: このIDを所有していることを証明する文字列
クライアントは、将来の拡張性のために2つ以上の値を持つiタグを処理するべきである(SHOULD)。
platformは、a-z, 0-9, および文字._-/のみを含むべきであり、 :を含んではならない(MUST NOT)。
identityは、可能であれば大文字を小文字に置き換えて正規化すべきであり、あるエンティティに複数の別名がある場合は、プライマリのものを使用すべきである(SHOULD)。
github
identity: GitHub ユーザ名
proof: GitHub Gist ID。このGistファイルは<identity>によって作成され、Verifying that I control the following Nostr public key: <npub encoded public key>というテキストを持つ必要がある。このファイルはhttps://gist.github.com/<identity>/<proof>に置かれる。
PublicでもSecretでもどちらでも良い (Secret GistはURLを知っていれば誰でも見える為)
説明やファイル名は空で良い
例: https://gist.github.com/h3y6e/5cc2e41285f2b3e4f2516f0864d554c8 -> ["i", "github:h3y6e", "5cc2e41285f2b3e4f2516f0864d554c8"]
twitter
identity: Twitter ユーザ名
proof: ツイートID。このツイートは<identity>によって投稿され、Verifying my account on nostr My Public Key: "<npub encoded public key>"というテキストを持つ必要がある。このツイートはhttps://twitter.com/<identity>/status/<proof>に置かれる。
https://nostr.directory の形式と同じ
例: https://twitter.com/h3y6e/status/1622322028073320448 -> ["i", "twitter:h3y6e", "1622322028073320448"]
mastodon
identity: <Mastodonインスタンス名>/@<ユーザ名>
proof: Mastodonの投稿ID。この投稿は@<ユーザ名>@<インスタンス名>によって投稿され、Verifying that I control the following Nostr public key: "<npub encoded public key>"というテキストを持つ必要がある。この投稿はhttps://<identity>/<proof>に置かれる。
例: https://fedibird.com/@h3y6e/109994237967250817 -> ["i", "mastodon:fedibird.com/@h3y6e", "109994237967250817"]
telegram
identity: Telegram ユーザID
proof: 名前<ref>とメッセージID<id>を持つ公開チャンネルまたはグループで公開されたメッセージを指す、<ref>/<id>の形式の文字列。このメッセージは<identity>によって送信され、Verifying that I control the following Nostr public key: "<npub encoded public key>".というテキストを持つ必要がある。このメッセージはhttps://t.me/<proof> に置かれる。
記述されている形式と違うが、例を見る限りでは https://nostr.directory で紐付ける際に送信したものをそのまま利用できる?
例: https://t.me/nostrdirectory/1545 -> ["i", "telegram:5186679993", "nostrdirectory/1545"]
https://github.com/nostr-protocol/nips/pull/201#discussion_r1091220147 や https://github.com/nostr-protocol/nips/pull/201#discussion_r1091474149 を見る限り https://nostr.directory の存在は強く意識しており、クライアント開発者はこれを再利用できるように実装する必要がありそう。
つまり、npubから始まる文字列がテキストに含まれていればそれでよく、Verifying my account on nostr My Public Key や Verifying that I control the following Nostr public key の文字列は実際は何でもよさそう (文脈の無い公開鍵を外部SNSにいる人が見て驚かないようにする程度の意味)。
Amethystで確認した様子 (2022/3/11 現在はTwitter, GitHub, Mastodonに対応)
https://scrapbox.io/files/640c63b646c19e001bf87557.png
※ Mastodonは現在うまくパース出来ていないので修正PRを投げています。マージされたら治るはずh3y6e.icon
マージされました