Template of a custom feed generator service for the Bluesky network in Ruby

added helper for converting did<->handle

Changed files
+18
app
+18
app/utils.rb
··· 1 + require 'json' 2 + require 'open-uri' 3 + 4 + module Utils 5 + def handle_from_did(did) 6 + url = "https://plc.directory/#{did}" 7 + json = JSON.parse(URI.open(url).read) 8 + json['alsoKnownAs'][0].gsub('at://', '') 9 + end 10 + 11 + def did_from_handle(handle) 12 + url = "https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=#{handle}" 13 + json = JSON.parse(URI.open(url).read) 14 + json['did'] 15 + end 16 + 17 + extend self 18 + end