You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is of concern for systems that use hashes of documents for content-based addressing and also digital signatures. Hashing the result of jsonld.normalize is common practice for these purposes.
Hashing algorithms readily accept '' (an empty string) as a valid input. Since a valid hash is produced, this sort of issue may go unnoticed.
Would it be possible to throw an error instead of returning an empty string? I suggest that an empty string should not be valid output for normalize.
This is of concern for systems that use hashes of documents for content-based addressing and also digital signatures. Hashing the result of
jsonld.normalize
is common practice for these purposes.Hashing algorithms readily accept
''
(an empty string) as a valid input. Since a valid hash is produced, this sort of issue may go unnoticed.Would it be possible to throw an error instead of returning an empty string? I suggest that an empty string should not be valid output for
normalize
.In this case, the empty output is due to this conditional: https://github.com/digitalbazaar/jsonld.js/blob/master/lib/toRdf.js#L108
Sample code:
Output:
Related: digitalbazaar/bedrock-ledger-node#12
The text was updated successfully, but these errors were encountered: