A library for handling DID identifiers used in Bluesky AT Protocol

allow overriding request options

+4 -3
+2 -2
lib/didkit/did.rb
··· 53 did.gsub(/^did\:web\:/, '') if type == :web 54 end 55 56 - def account_status 57 doc = self.document 58 return nil if doc.pds_endpoint.nil? 59 ··· 61 url = URI("#{pds_host}/xrpc/com.atproto.sync.getRepoStatus") 62 url.query = URI.encode_www_form(:did => @did) 63 64 - response = get_response(url) 65 status = response.code.to_i 66 is_json = (response['Content-Type'] =~ /^application\/json(;.*)?$/) 67
··· 53 did.gsub(/^did\:web\:/, '') if type == :web 54 end 55 56 + def account_status(request_options = {}) 57 doc = self.document 58 return nil if doc.pds_endpoint.nil? 59 ··· 61 url = URI("#{pds_host}/xrpc/com.atproto.sync.getRepoStatus") 62 url.query = URI.encode_www_form(:did => @did) 63 64 + response = get_response(url, request_options) 65 status = response.code.to_i 66 is_json = (response['Content-Type'] =~ /^application\/json(;.*)?$/) 67
+2 -1
lib/didkit/resolver.rb
··· 17 18 def initialize(options = {}) 19 @nameserver = options[:nameserver] 20 end 21 22 def resolve_handle(handle) ··· 49 50 def resolve_handle_by_well_known(domain) 51 url = "https://#{domain}/.well-known/atproto-did" 52 - response = get_response(url) 53 54 if response.is_a?(Net::HTTPSuccess) && (text = response.body) 55 return parse_did_from_well_known(text)
··· 17 18 def initialize(options = {}) 19 @nameserver = options[:nameserver] 20 + @request_options = options.slice(:timeout, :max_redirects) 21 end 22 23 def resolve_handle(handle) ··· 50 51 def resolve_handle_by_well_known(domain) 52 url = "https://#{domain}/.well-known/atproto-did" 53 + response = get_response(url, @request_options) 54 55 if response.is_a?(Net::HTTPSuccess) && (text = response.body) 56 return parse_did_from_well_known(text)