'ap' URLs are not valid URIs according to RFC-3986. FEP-ef61 describes a possible solution: percent-encode a DID (the authority component of an 'ap' URL)

Today I found another solution. RFC-3986 allows future, as-yet-undefined IP literal address formats if they are enclosed in square brackets and prefixed with a version flag.

For example, this is a valid URI:

ap://[vd.did:key:z6MkvUie7gDQugJmyDQQPhMCCBfKJo7aGvzQYF2BqvFvdwx6]/objects/123

#fep_ef61