Skip to content

Commit

Permalink
added #pick_valid_handle helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mackuba committed Mar 11, 2024
1 parent 92b0f03 commit 0cd4c01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/didkit/document.rb
Expand Up @@ -39,7 +39,7 @@ def initialize(did, json)
end

def get_validated_handle
Resolver.new.get_validated_handle(self)
Resolver.new.pick_valid_handle(did, handles)
end
end
end
6 changes: 5 additions & 1 deletion lib/didkit/resolver.rb
Expand Up @@ -85,7 +85,11 @@ def resolve_did_web(did)
def get_validated_handle(did_or_doc)
document = did_or_doc.is_a?(Document) ? did_or_doc : resolve_did(did_or_doc)

document.handles.detect { |h| resolve_handle(h) == document.did }
pick_valid_handle(document.handles, document.did)
end

def pick_valid_handle(did, handles)
handles.detect { |h| resolve_handle(h) == did }
end
end
end

0 comments on commit 0cd4c01

Please sign in to comment.