decentralized-identity / sidetree

Sidetree Specification and Reference Implementation
https://identity.foundation/sidetree/spec
Apache License 2.0
438 stars 112 forks source link

Spec vs Verify CAS file URI #927

Closed sandrask closed 3 years ago

sandrask commented 4 years ago

Reference application is verifying CAS file URI against protocol hashing algorithm here: https://github.com/decentralized-identity/sidetree/blob/ed1999209a45fd1cb8426a30c2b50724a1a2f937/lib/core/versions/latest/InputValidator.ts#L54

There are two issues here: 1) this code would not work against valid v1 IPFS CID: bafkreih6ot2yfqcerzp5l2qupc77it2vdmepfhszitmswnpdtk34m4ura4

https://cid.ipfs.io/#bafkreih6ot2yfqcerzp5l2qupc77it2vdmepfhszitmswnpdtk34m4ura4

2) reference application is assuming that IPFS CID is created using protocol's multihashing algorithm. Is this a requirement? I couldn't find any reference in the spec related to this. Is this functionality in the reference application necessary?

Also, issue 2) requires changes to write() method in CAS interface to pass multihash algorithm/code.

sandrask commented 4 years ago

@thehenrytsai @csuwildcat I added this issue to the agenda for today - hopefully you get a chance to look at it.

OR13 commented 4 years ago

https://docs.ipfs.io/concepts/content-addressing/#identifier-formats

OR13 commented 4 years ago

see also https://github.com/ipfs/specs/issues/247

OR13 commented 4 years ago

We are currently hard coding to v0 here:

https://github.com/transmute-industries/sidetree.js/blob/master/packages/cas/src/MockCas.ts#L70

sandrask commented 4 years ago

During Sidetree weekly it was agreed that reference application will: 1) support valid v1 IPFS CID (e.g. "bafkreih6ot2yfqcerzp5l2qupc77it2vdmepfhszitmswnpdtk34m4ura4") 2) make CAS URI validation protocol independent so there is no need to change CAS write() interface to include protocol multihash algorithm (18)

@thehenrytsai @csuwildcat @troyronda

isaacJChen commented 4 years ago

Fixed in implementation. Awaiting documentation to reflect it. https://github.com/decentralized-identity/sidetree/pull/953

csuwildcat commented 3 years ago

@sandrask @isaacJChen Sandra, if the spec does not correctly reflect what Isaac modified in code, can you highlight the language that needs to change and do a PR, or specifically cite it here and I will?

sandrask commented 3 years ago

@csuwildcat Spec and the implementation now match, thank you