Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds unit tests for generic DID syntax parsing and for the public
DID/DIDBufaccessors incrates/dids/core/src/did.rs. No production code changes.Why
DID::newwas only covered by 4 accept vectors and 3 reject vectors. A few ABNF cases that are easy to get wrong were untested, in particular consecutive colons inmethod-specific-idand malformed percent-encoding. The public accessors (method_name,method_specific_id,as_str, …) were also unexercised.What
Accept:
did:m1:1)-,_in the method-specific id%af)did:m::si:::1), allowed bymethod-specific-id = *( *idchar ":" ) 1*idcharReject:
%,%0,%0G)/,?,#) which are not DIDsAccessors:
as_str/as_bytes/method_name/method_specific_id(and*_bytes)DisplayandDerefonDIDDIDBuf::from_string,as_did,to_ownedround-tripmethod_specific_id(":si:::1")Notes
HEXDIGquoted strings are case-insensitive in RFC 5234, and RFC 3986 §2.1 treats%afand%AFas equivalent.did:jwk:…,did:web:example.com%3A443:…) already cover.and uppercaseALPHAin the method-specific id.