Skip to content

Malformed documents and the hasher #12

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

Open
mattcollier opened this issue Mar 23, 2018 · 0 comments
Open

Malformed documents and the hasher #12

mattcollier opened this issue Mar 23, 2018 · 0 comments
Assignees

Comments

@mattcollier
Copy link
Contributor

https://github.com/digitalbazaar/bedrock-ledger-node/blob/master/lib/index.js#L580

A malformed document can result in jsonld.canonize producing an empty string. niUri.digest has no problem hashing an empty string.

What would be desirable behavior for the hasher API when this occurs? Seems to me that there is no valid use case for hashing an empty string, so that should return an error.

This document is invalid because id is not a URL

{
  "@context": [
    "https://w3id.org/webledger/v1",
    "https://w3id.org/security/v1"
  ],
  "id": "07179fd9-4856-4e55-baf8-b2589a037566",
  "type": "WebLedgerEventBlock",
  "blockHeight": 1,
  "previousBlock": "deaffbb3-8e79-4faa-b837-ab833567150b",
  "previousBlockHash": "cc961a7b-513c-4bcc-876c-2fe488162684"
}
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

No branches or pull requests

1 participant