percentDecode

fun percentDecode(segment: String): String

Percent-decodes a single did:web method-specific-id segment (RFC 3986 §2.1).

Per the W3C did:web specification, each colon-separated segment of the method-specific identifier MUST be percent-decoded before constructing the HTTPS URL. This is what allows ports to be expressed: did:web:example.com%3A8080 → host example.com:8080.

Return

The decoded segment (UTF-8)

Parameters

segment

The raw (possibly percent-encoded) segment

Throws

if the segment contains a malformed percent-encoding