From 05f4dfe9dab20cffc78e433bf91759bf362a0cb7 Mon Sep 17 00:00:00 2001 From: Kuba Suder Date: Fri, 13 Dec 2024 03:07:19 +0200 Subject: [PATCH] cache downloaded document in DID#document --- lib/didkit/did.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/didkit/did.rb b/lib/didkit/did.rb index 67af56b..6deac40 100644 --- a/lib/didkit/did.rb +++ b/lib/didkit/did.rb @@ -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 @@ -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 @@ -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