ipfs / js-ipns

Utilities for creating, parsing, and validating IPNS records
Other
80 stars 24 forks source link

feature request: support extensible data fields #302

Open tabcat opened 5 months ago

tabcat commented 5 months ago

I would like to add support for extensible data to this implementation of the IPNS record.

This could be done by:

  1. adding an optional extensibleData field to CreateOptions.
  2. adding an optional parameter extensibleData to createCborData.
  3. inside of createCborData, merge extensibleData the data object.
  4. add tests and documentation

It's not necessary to change types or add generics to the record type. Users of this feature would simply have to decode IPNSRecord.data to read any extensible fields.

welcome[bot] commented 5 months ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

dentropy commented 5 months ago

Thank you for posting this issue, I had the exact same question, and you saved me the time reading through the docs

dentropy commented 5 months ago

Oh look what I found, https://github.com/ipfs/js-ipns/blob/f622fc8978d2b62c20baa26ec2e0adcc42aa10d1/src/index.ts#L65

It's just waiting for a pull request

dentropy commented 5 months ago

@tabcat I got a working POC of extendable for js-ipns in this pull requres

https://github.com/ipfs/js-ipns/pull/309

dentropy commented 5 months ago

@tabcat if you want to use it check my tests, https://github.com/dentropy/js-ipns/blob/main/test/extensible_data.spec.ts

You have to recast js-ipns type IPNSRecordData as any to get the data out