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

fix(connections): allow ; to convert legacy did #882

Merged

Conversation

TimoGlastra
Copy link
Contributor

Older dids use ; as an identifier separator instead of the now used #. So an id of did:sov:123;indy would be normalized to #did:sov:123;indy. We now check when converting a legacy did doc to a new did doc whether an ; character is in place and the # isn't and we will handle it correclty so it parses to #indy

Signed-off-by: Timo Glastra <timo@animo.id>
@TimoGlastra TimoGlastra requested a review from a team as a code owner June 19, 2022 15:27
@codecov-commenter
Copy link

codecov-commenter commented Jun 19, 2022

Codecov Report

Merging #882 (4ac318b) into main (ad35b08) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #882   +/-   ##
=======================================
  Coverage   87.58%   87.58%           
=======================================
  Files         468      468           
  Lines       11092    11095    +3     
  Branches     1745     1746    +1     
=======================================
+ Hits         9715     9718    +3     
  Misses       1377     1377           
Impacted Files Coverage Δ
...s/core/src/modules/connections/services/helpers.ts 98.00% <100.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad35b08...4ac318b. Read the comment docs.

Signed-off-by: Timo Glastra <timo@animo.id>
const [, id] = fullId.split('#')
// Some old dids use `;` as the delimiter for the id. If we can't find a `#`
// and a `;` exists, we will parse everything after `;` as the id.
if (!fullId.includes('#') && fullId.includes(';')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parser only works if there is a single ; in the id. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only usage I've seen is with one ;. I think it was used before the # and you can only include one. What we could do is leave the other ones in place (like url parsers do):

image

So we would get #indy;anotherword instead of #indy if the id was something;indy;anotherword. Do you think that is better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think leaving them behind, which follows the url parser you showed, is good. I am very unaware of the security implications (likely none) here though.

@TimoGlastra TimoGlastra enabled auto-merge (squash) June 20, 2022 09:15
@TimoGlastra TimoGlastra merged commit 448a29d into openwallet-foundation:main Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants