-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Labels
Description
As per #212 making asCID
enumerable creates a problem, it also seems to be motivating factor for some of the work in #211.
For the background me and @mikeal have chosen cid.asCID === cid
as a signaling mechanism that value is CID
with following properties:
- Signal is retained when transferring value across the JS threads / realms because structural cloning respects self referentiality.
- It has very low collision chance - It is very unlikely that codec will be passed a data where
cid.asCID === cid
is true, while user was meant to pass something unrelated.
At the time we also considered following alternative cid['/'] === cid.bytes
(which was inspired by DAG-JSON spec, but ultimately chose cid.asCID === cid
because it seemed like it had even less collision opportunity.
Maybe given recent problems it is worth considering switch to cid['/'] === cid.bytes
which would address those problems