From 6482472e4fa5d5ca24c9019ee17da1e89d051e46 Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Thu, 11 Jan 2024 20:59:15 -0500 Subject: [PATCH] Updated ABNF Signed-off-by: Charles Lanahan --- spec/core.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/spec/core.md b/spec/core.md index 2141cec..1dcb400 100644 --- a/spec/core.md +++ b/spec/core.md @@ -23,9 +23,28 @@ component of the path. The [[ref: ABNF]] definition of a `did:webs` DID is as follows: -``` -webs-did = "did:webs:" host ":" aid -webs-did = "did:webs:" host * (":" path) ":" aid +```abnf +webs-did = "did:webs:" host [pct-encoded-colon port] *(":" path) ":" aid + +; 'host' as defined in RFC 1035 and RFC 1123 +host = *( ALPHA / DIGIT / "-" / "." ) ; Simplified representation, actual RFCs + ; have more complex rules for domains and IP addresses. + ; IN ACTUAL IMPLEMENTATIONS REPLACE WITH A MATURE + ; HOST PARSING LIBRARY. + +; 'pct-encoded-colon' represents a percent-encoded colon +pct-encoded-colon = "%3A" / "%3a" ; Percent encoding for ':' + +; 'port' number (simplified version) +port = 1*5(DIGIT) + +; 'path' definition +path = 1*(ALPHA / DIGIT / "-" / "_" / "~" / "." / "/") + +; 'aid' as base64 encoded value +aid = 1*(ALPHA / DIGIT / "+" / "/" / "=") ; Base64 characters + +; ALPHA, DIGIT are standard ABNF primitives for alphabetic and numeric characters ``` The formal rules describing valid [[ref: host]] syntax are described in