Skip to content

Commit

Permalink
cache downloaded document in DID#document
Browse files Browse the repository at this point in the history
  • Loading branch information
mackuba committed Dec 13, 2024
1 parent 3f2885d commit 05f4dfe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/didkit/did.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def initialize(did, resolved_by = nil)

alias to_s did

def document
@document ||= get_document
end

def get_document
Resolver.new.resolve_did(self)
end
Expand Down Expand Up @@ -70,7 +74,7 @@ def is_known_by_relay?(relay, options = {})
end

def account_status
doc = get_document
doc = self.document
return nil if doc.pds_endpoint.nil?

pds_host = URI(doc.pds_endpoint).origin
Expand Down Expand Up @@ -99,7 +103,7 @@ def account_status
end

def account_exists?
doc = get_document
doc = self.document
return false if doc.pds_endpoint.nil?

pds_host = URI(doc.pds_endpoint).origin
Expand Down

0 comments on commit 05f4dfe

Please sign in to comment.