Skip to content

Commit 05f4dfe

Browse files
committed
cache downloaded document in DID#document
1 parent 3f2885d commit 05f4dfe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/didkit/did.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def initialize(did, resolved_by = nil)
2929

3030
alias to_s did
3131

32+
def document
33+
@document ||= get_document
34+
end
35+
3236
def get_document
3337
Resolver.new.resolve_did(self)
3438
end
@@ -70,7 +74,7 @@ def is_known_by_relay?(relay, options = {})
7074
end
7175

7276
def account_status
73-
doc = get_document
77+
doc = self.document
7478
return nil if doc.pds_endpoint.nil?
7579

7680
pds_host = URI(doc.pds_endpoint).origin
@@ -99,7 +103,7 @@ def account_status
99103
end
100104

101105
def account_exists?
102-
doc = get_document
106+
doc = self.document
103107
return false if doc.pds_endpoint.nil?
104108

105109
pds_host = URI(doc.pds_endpoint).origin

0 commit comments

Comments
 (0)