Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: add did document support for alsoKnownAs #3277

Merged

Conversation

brownoxford
Copy link
Contributor

Signed-off-by: Chris Abernethy brownoxford@gmail.com

Title:
Add alsoKnownAs support to DID document

Description:
Implement support for alsoKnownAs DID document element as described in DID Core v1

Summary:
Add AlsoKnownAs element to did.Doc and populate value in did.ParseDocument()
Add AlsoKnownAs element to did.rawDoc and populate value in did.Doc.JSONBytes()
Add did.populateRawAlsoKnownAs() helper function to convert alsoKnownAs from []string to []interface{}
Add alsoKnownAs to schemas used for DID Schema Validation

@@ -1395,6 +1400,16 @@ func populateRawServices(services []Service, didID, baseURI string) []map[string
return rawServices
}

func populateRawAlsoKnownAs(aka []string) []interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

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

please add unit tests to validate aka value as per schema

Copy link

Choose a reason for hiding this comment

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

suggest you cover a few different IRI formats, such as:

did:example:123, https://social.example/username, urn:uuid:1231

Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Baha-sk Unit tests added to doc_test.go

Copy link
Contributor

@baha-ai baha-ai left a comment

Choose a reason for hiding this comment

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

lgtm, added minor comment

"type": "array",
"items": {
"type": "string",
"format": "uri"
Copy link

Choose a reason for hiding this comment

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

careful with the uri format.... test cases need to exist to cover this... make sure you are covering all of:

https://www.w3.org/TR/did-core/#also-known-as

@codecov
Copy link

codecov bot commented Jul 14, 2022

Codecov Report

Merging #3277 (6f14536) into main (d5d31b7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #3277   +/-   ##
=======================================
  Coverage   88.28%   88.28%           
=======================================
  Files         315      315           
  Lines       42658    42668   +10     
=======================================
+ Hits        37659    37669   +10     
  Misses       3674     3674           
  Partials     1325     1325           
Impacted Files Coverage Δ
pkg/doc/did/doc.go 87.26% <100.00%> (+0.13%) ⬆️

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 d5d31b7...6f14536. Read the comment docs.

Signed-off-by: Chris Abernethy <brownoxford@gmail.com>
@troyronda troyronda merged commit d96b693 into hyperledger-archives:main Jul 14, 2022
@brownoxford brownoxford deleted the feature/did-document-aka branch July 15, 2022 15:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants