did_to_url

Function did_to_url 

Source
pub fn did_to_url(did: &str) -> Result<String>
Expand description

Convert a did:web DID to the HTTPS URL where the DID Document is hosted.

Rules (per spec):

  • did:web:example.comhttps://example.com/.well-known/did.json
  • did:web:example.com:path:tohttps://example.com/path/to/did.json
  • did:web:example.com%3A3000https://example.com:3000/.well-known/did.json

Colons in the method-specific identifier are path separators. Percent-encoded characters (like %3A for :) are decoded.

Rejects domains that resolve to private/reserved IP ranges (SSRF protection) and path segments containing .. (path traversal protection).