A library for handling DID identifiers used in Bluesky AT Protocol

allow passing an existing DID object to DID.new

+5 -1
+4
lib/didkit/did.rb
··· 18 18 attr_reader :type, :did, :resolved_by 19 19 20 20 def initialize(did, resolved_by = nil) 21 + if did.is_a?(DID) 22 + did = did.to_s 23 + end 24 + 21 25 if did =~ GENERIC_REGEXP 22 26 @did = did 23 27 @type = did.split(':')[1].to_sym
+1 -1
lib/didkit/resolver.rb
··· 19 19 end 20 20 21 21 def resolve_handle(handle) 22 - if handle =~ DID::GENERIC_REGEXP 22 + if handle.is_a?(DID) || handle =~ DID::GENERIC_REGEXP 23 23 return DID.new(handle) 24 24 end 25 25