A library for handling DID identifiers used in Bluesky AT Protocol

allow overriding request options

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