Last active
February 14, 2024 09:26
-
-
Save chromabox/14178330e446544feeb9ff00d974d8d4 to your computer and use it in GitHub Desktop.
blueskyのハンドルネームからdidを問い合わせて取り出すbashスクリプト(認証必要なし&要curl jq)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bluesky did to handle resolver | |
# written by chromabox | |
# | |
# requirements curl jq | |
# apt install curl jq | |
# | |
user_handle=${1} | |
api_endpoint="https://bsky.social/xrpc/com.atproto.identity.resolveHandle" | |
echo "bluesky resolve handle name to did ${user_handle} .... " | |
jsonout="$(curl -s -G -d handle=$user_handle $api_endpoint)" | |
raw_did=$(echo "$jsonout" | jq -r '.did') | |
#echo $raw_did | |
if [ "$raw_did" == "null" ]; then | |
echo "error: request missing!!!! did entry isnot found." | |
echo "responce:" | |
echo $jsonout | |
exit 1 | |
fi | |
echo "${user_handle} did is ${raw_did}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
didはdid:plc:も含めないとだめらしい
したがつて…
$ ./bluesky_query_did.sh chromarock.bsky.social
bluesky resolve handle name to did chromarock.bsky.social ....
chromarock.bsky.social did is did:plc:ezccyc3owli52xsxysmifvps
となります。