Skip to content

Commit

Permalink
reject handles from disallowed domains
Browse files Browse the repository at this point in the history
  • Loading branch information
mackuba committed Mar 9, 2024
1 parent 25fd0bb commit 66110d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/didkit/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@

module DIDKit
class Resolver
RESERVED_DOMAINS = %w(alt arpa example internal invalid local localhost onion test)

def resolve_handle(handle)
domain = handle.gsub(/^@/, '')

return nil if RESERVED_DOMAINS.include?(domain.split('.').last)

if dns_did = resolve_handle_by_dns(domain)
DID.new(dns_did, :dns)
elsif http_did = resolve_handle_by_well_known(domain)
Expand Down

0 comments on commit 66110d1

Please sign in to comment.