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

Feat/329/jsonld validation #376

Merged
merged 18 commits into from
Dec 2, 2019
Merged

Feat/329/jsonld validation #376

merged 18 commits into from
Dec 2, 2019

Conversation

chunningham
Copy link
Contributor

key files are ts/linkedData/index.ts and ts/linkedData/types.ts. Other changes are including jsonLD types in DID doc sections and credential types, and using the digestion/validation functions in DID doc and signed credential classes.

Comment on lines 26 to 29
{ ['@context']: _, ...data }: JsonLdObject,
context: JsonLdContext,
) => canonize(data, {
expandContext: context,
Copy link
Contributor

Choose a reason for hiding this comment

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

replacing the context can always result in breaking the signature validation. This is why I'm afraid of this context expansion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

context is provided as a second param so that contexts can be used for objects which may not have their own, e.g. normalizing a json-ld proof. An overload with just one arg which doesn't do this replacement may be good though

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, replacing the context might be a nice feature for now (because may contexts are just garbage), but for long term we should avoid this... I would vote for a second optional parameter to override the context and use the existing one otherwise.

ts/linkedData/types.ts Show resolved Hide resolved
ts/utils/contexts.ts Outdated Show resolved Hide resolved
If we rely on TS to infer the type of the defaultContext, we can avoid exporting, the
JsonLdContextEntry type, at which point the alias is not needed anymore
Copy link
Collaborator

@Exulansis Exulansis left a comment

Choose a reason for hiding this comment

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

Outside of the comments left above, and ideally a few more unit tests for normalization / digest functions, this should be good to go.

Copy link
Collaborator

@Exulansis Exulansis left a comment

Choose a reason for hiding this comment

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

👍

@Exulansis Exulansis merged commit 246fe90 into develop Dec 2, 2019
@Exulansis Exulansis deleted the feat/329/jsonld_validation branch December 2, 2019 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants