-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
…linkedData folder
…d sig types complete
ts/linkedData/index.ts
Outdated
{ ['@context']: _, ...data }: JsonLdObject, | ||
context: JsonLdContext, | ||
) => canonize(data, { | ||
expandContext: context, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
key files are
ts/linkedData/index.ts
andts/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.