go-ipld-prime icon indicating copy to clipboard operation
go-ipld-prime copied to clipboard

dag-json encoding should proactively reject maps that would be confusable with links during decode

Open warpfork opened this issue 3 years ago • 0 comments

The DAG-JSON encoding cannot differentiate between {a map with a single entry that has a key of "/" and a string value} and {an IPLD link}.

Therefore, in order to be reasonably bijective, and to error early rather than leave users to run into data corruption which might only be detected arbitrarily far in the future, the dagjson codec should proactively error during encode if a map would be confusable with links during decode.

This may require finalizing some details of the DAG-JSON specification more completely before being unambiguously implementable. Namely: https://github.com/ipld/specs/pull/356 .

warpfork avatar Mar 27 '21 12:03 warpfork