@@ -102,21 +102,6 @@ def resolve_handle_by_well_known(domain)
102102 nil
103103 end
104104
105- def resolv_options
106- options = Resolv ::DNS ::Config . default_config_hash . dup
107- options [ :nameserver ] = nameserver if nameserver
108- options
109- end
110-
111- def parse_did_from_dns ( txt )
112- txt =~ /\A did\= (did\: \w +\: .*)\z / ? $1 : nil
113- end
114-
115- def parse_did_from_well_known ( text )
116- text = text . strip
117- text . lines . length == 1 && text =~ DID ::GENERIC_REGEXP ? text : nil
118- end
119-
120105 # Resolve a DID to a DID document.
121106 #
122107 # Looks up the DID document with the DID's identity details from an appropriate source, i.e. either
@@ -132,16 +117,6 @@ def resolve_did(did)
132117 did . type == :plc ? resolve_did_plc ( did ) : resolve_did_web ( did )
133118 end
134119
135- def resolve_did_plc ( did )
136- json = get_json ( "https://plc.directory/#{ did } " , content_type : /^application\/ did\+ ld\+ json(;.+)?$/ )
137- Document . new ( did , json )
138- end
139-
140- def resolve_did_web ( did )
141- json = get_json ( "https://#{ did . web_domain } /.well-known/did.json" )
142- Document . new ( did , json )
143- end
144-
145120 # Returns the first verified handle assigned to the given DID.
146121 #
147122 # Looks up the domain handles assigned to the DID in the DID document, checks if they are
@@ -166,5 +141,33 @@ def get_verified_handle(subject)
166141 def first_verified_handle ( did , handles )
167142 handles . detect { |h | resolve_handle ( h ) == did . to_s }
168143 end
144+
145+
146+ private
147+
148+ def resolv_options
149+ options = Resolv ::DNS ::Config . default_config_hash . dup
150+ options [ :nameserver ] = nameserver if nameserver
151+ options
152+ end
153+
154+ def parse_did_from_dns ( txt )
155+ txt =~ /\A did\= (did\: \w +\: .*)\z / ? $1 : nil
156+ end
157+
158+ def parse_did_from_well_known ( text )
159+ text = text . strip
160+ text . lines . length == 1 && text =~ DID ::GENERIC_REGEXP ? text : nil
161+ end
162+
163+ def resolve_did_plc ( did )
164+ json = get_json ( "https://plc.directory/#{ did } " , content_type : /^application\/ did\+ ld\+ json(;.+)?$/ )
165+ Document . new ( did , json )
166+ end
167+
168+ def resolve_did_web ( did )
169+ json = get_json ( "https://#{ did . web_domain } /.well-known/did.json" )
170+ Document . new ( did , json )
171+ end
169172 end
170173end
0 commit comments