ssbc / ssb-buttwoo

A new binary feed format for SSB
3 stars 0 forks source link

Does `tag` have to be required when creating a message? #5

Open Powersource opened 2 years ago

Powersource commented 2 years ago

I was getting an error about tag missing as an opt, when I added that it seems to have fixed things. So now I have

ssb.db.create(
        {
          content,
          recps: recipientKeys,
          encryptionFormat: 'box2',
          feedFormat: 'buttwoo-v1',
          tag: 0,
        },

a bit verbose (and also confusing, what's a tag)?

Powersource commented 2 years ago

And yeah I get that the tag is what's described in https://github.com/ssbc/ssb-buttwoo-spec#metadata

arj03 commented 2 years ago

Yeah tag is required. It would be good if this repo had at least an example of how to use it in ssb-db2 ;-)

It's not really super clear that it should be an int: https://github.com/ssbc/ssb-buttwoo/blob/master/format.js#L91

arj03 commented 2 years ago

Also the enum is exported, so you can use tag: butt2.tags.SSB_FEED for improved readability.

Powersource commented 2 years ago

Could it default to SSB_FEED? And could it be called something like messageType instead?

arj03 commented 2 years ago

I guess it would be good with a default. Can you make a PR for that?

Maybe we can call it just type? It is just also quite generic. Hmm

Powersource commented 2 years ago

Tried to use SSB_FEED but got

TypeError: Cannot read properties of undefined (reading 'SSB_FEED')

Does this comment have something to do with that?

https://github.com/ssbc/ssb-buttwoo/blob/b1f0a0585a07a3e64f0b3793cb200a646d57120b/format.js#L323-L326