In the future I'll be looking at replacing go-nostr, and this seems a good library for it.

Just a few comments:

1) ID, Pubkey, Sig imo should be specific types of [32]byte or [64]byte, all represented as string with the method Hex(). This would allow inspections of individual bytes which I think might be useful.

2) Filter.Limit, when unspecified I think it should be MaxInt, because an unspecified limit means "give me everything". Similar to Since and Until, this would allow to avoid pointer checks and simply using comparison operators.

if filter.Limit > 1000 {

filter.Limit = 1000

}

Reply to this note

Please Login to reply.

Discussion

Thanks for the review. I like your first suggestion. It would make my code a bit simpler.

As for the limit being a pointer, a nil value indicates its absence. Then it has a direct translation to/from JSON null. I wouldn't change it.