Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Incorrect did matcher regex #104

Closed
stephhuynh18 opened this issue Oct 25, 2021 · 1 comment
Closed

[BUG] Incorrect did matcher regex #104

stephhuynh18 opened this issue Oct 25, 2021 · 1 comment
Labels
bug Something isn't working released

Comments

@stephhuynh18
Copy link
Contributor

Current Behavior

Did matcher regex used in the parse function (https://github.com/decentralized-identity/did-resolver/blob/master/src/resolver.ts#L166) uses an incorrect regex according to the specification (https://www.w3.org/TR/did-core/#did-syntax). Specifically:

  • method should not include capitals which it currently does
  • method_id should allow for sequential colons (ex. did:method::id)
  • % can only be followed by two hex digits (ex. did:method:%1p is invalid while did:method:%1f is valid)

Expected Behavior

The matcher regex should conform to the did specification.

Failure Information

parse('did:CAPITALS:id')

{
  did: 'did:CAPITALS:id',
  method: 'CAPITALS',
  id: 'id',
  didUrl: 'did:CAPITALS:id'
}

Steps to Reproduce

  1. Invoke parse with a did that follows the specification and parse will return null OR with an invalid did and parse will return a ParsedDid

Environment Details

  • node/browser version: v16.11.1
  • OS Version: Big Sur v11.6
  • Device details:

Failure Logs/Screenshots

None

Alternatives you considered

None

@stephhuynh18 stephhuynh18 added the bug Something isn't working label Oct 25, 2021
uport-automation-bot pushed a commit that referenced this issue Oct 26, 2021
## [3.1.3](3.1.2...3.1.3) (2021-10-26)

### Bug Fixes

* update regex to match DID specification ([#105](#105)) ([4f71bc5](4f71bc5)), closes [#104](#104)
@uport-automation-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 3.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants