WIP: Add NIP-26 delegation tag support #4

Closed
optout21 wants to merge 1 commit from delegation into master
optout21 commented 2023-03-01 02:56:36 +13:00 (Migrated from github.com)

Description

Add support for complete NIP-26 delegation tags: create a delegation tag, validate a delegation tag.

Checklists

  • Add create delegation tag
  • Add validate delegation tag
  • Add parsing and evaluating condition strings

Notes

  • Error struct (delegation::DelegationError) could be consolidated into main Error struct.
<!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description <!-- Describe the purpose of this PR, what's being adding and/or fixed --> Add support for complete NIP-26 delegation tags: create a delegation tag, validate a delegation tag. ### Checklists * [x] Add create delegation tag * [x] Add validate delegation tag * [x] Add parsing and evaluating condition strings ### Notes - Error struct (`delegation::DelegationError`) could be consolidated into main `Error` struct.
mikedilger commented 2023-03-01 12:45:20 +13:00 (Migrated from github.com)

First off, thanks for doing this. That's quite a lot of code.

I'd like to integrate this more closely with the rest of how nostr-types works. A delegation tag should be an enum variant within Tag in src/types/tag.rs. It needs to serialize/deserialize as a Tag. Otherwise we will not recognize these tags when they come in, they will be Tag::Other.

First off, thanks for doing this. That's quite a lot of code. I'd like to integrate this more closely with the rest of how nostr-types works. A delegation tag should be an enum variant within `Tag` in `src/types/tag.rs`. It needs to serialize/deserialize as a `Tag`. Otherwise we will not recognize these tags when they come in, they will be `Tag::Other`.
optout21 commented 2023-03-01 20:34:34 +13:00 (Migrated from github.com)

Thanks for checking.
The Tag::Delegation tag already exists; I will rework starting from that.
I will also leave out some of the code, and leave only what's needed for #4 (condition parsing is only needed when validating a delegation of a message).
I mostly took code from https://github.com/rust-nostr/nostr/pull/46 and hacked into nostr-types, but not all is needed.

Thanks for checking. The `Tag::Delegation` tag already exists; I will rework starting from that. I will also leave out some of the code, and leave only what's needed for #4 (condition parsing is only needed when validating a delegation of a message). I mostly took code from https://github.com/rust-nostr/nostr/pull/46 and hacked into nostr-types, but not all is needed.
optout21 commented 2023-03-01 23:29:33 +13:00 (Migrated from github.com)

It turned out #4 only needs delegation tag parsing&serialization, which is already present in nostr-types.
Closing this PR.
Signature validation, and condition parsing and validation could be added here later.

It turned out #4 only needs delegation tag parsing&serialization, which is already present in `nostr-types`. Closing this PR. Signature validation, and condition parsing and validation could be added here later.

Pull request closed

Sign in to join this conversation.
No description provided.