Skip to content

Consider alternative to asCID signaling mechanism #213

@Gozala

Description

@Gozala

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:

  1. Signal is retained when transferring value across the JS threads / realms because structural cloning respects self referentiality.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions