Skip to content

fix(concord-cli): --invites finds v2 Direct Invites (kind 3313) - #95

Open
TheSeydiCharyyev wants to merge 1 commit into
VectorPrivacy:widescreenfrom
TheSeydiCharyyev:fix/concord-cli-v2-invites
Open

TheSeydiCharyyev wants to merge 1 commit into
VectorPrivacy:widescreenfrom
TheSeydiCharyyev:fix/concord-cli-v2-invites

Conversation

@TheSeydiCharyyev

Copy link
Copy Markdown

concord --invites now finds v2 Direct Invites (kind 3313). Before, it counted them in the kind tally and then printed NONE. Closes #76.

Change (only crates/concord-cli/src/main.rs)

  • New invite_of(kind, content): it parses an unwrapped rumor with the bundle parser the app uses for that kind. parse_invite_rumor for 3304 (v1), CommunityInvite::from_bundle_json for 3313 (v2), the same as event_handler.rs does for incoming invites.
  • A bundle that fails to parse or validate is listed with the reason ("invites the app would refuse") instead of being dropped.
  • The tally labels both kinds. The NONE line names both kinds, and it only says the invite did not reach the relays when no invite was unwrapped at all.
  • The doc comments now name both kinds.

Tests

concord-cli had no tests. Four new ones in main.rs:

  • A v2 Direct Invite built with build_direct_invite and unwrapped with UnwrappedGift::from_gift_wrap (the probe's own unwrap) is found.
  • A v2 bundle whose owner does not match its community_id is refused, and the reason names the owner.
  • A v1 invite from build_invite_rumor is still found.
  • A kind-14 DM is not an invite.

Without the 3313 branch, the two v2 tests fail.

Verified at 781cadd0afb0 + this commit, on Windows:

  • cd crates && cargo test -p concord-cli: 4 passed, 0 failed.

Not covered

  • CI does not build concord-cli, so the run above is the only check.
  • I did not run concord --invites against a real inbox. To check it: run it on an account that got a v2 invite. The invite should now show under "community invites on network" with v2.
  • Expiry is not checked: an expired invite is still listed, as before.

Base branch

widescreen, where current work lands.

The probe only treated a v1 bundle (3304) as an invite. A v2 Direct
Invite was counted in the kind tally and then dropped, so the verdict
said NONE and blamed the relays.

Each unwrapped rumor now goes through the bundle parser the app uses
for its kind: parse_invite_rumor for 3304, from_bundle_json for 3313.
A bundle that fails is listed with the reason instead of dropped.

Closes VectorPrivacy#76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant