diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-23 17:46:48 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-23 17:46:48 +0200 |
| commit | 998f9c69308ee88fac36cfb77dfb6d07c6fa926a (patch) | |
| tree | 445ba68e566e6672f8334103488d32ba2b52c5c5 /packages/meshbay-hub/tests/test_group_purge.py | |
| parent | 5bce0acad6d10f9b952874f1359406b4eae3a8f9 (diff) | |
| download | meshbay-998f9c69308ee88fac36cfb77dfb6d07c6fa926a.tar.gz | |
feat(hub): invitation-link tickets bound to a verified address
group_invite_links holds sha256(ticket) and the invitee's address blind
index; redeeming grants membership to that account only. Owner-only
create/list/cancel (a node token may create, never mail), 20 outstanding
per group, optional mail written by the hub itself and capped at 10 per
sender per day (mail.invite_link_daily_cap). MESHBAY_DESIGN.md §3.4 now
carries the whole link design.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_group_purge.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_group_purge.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/meshbay-hub/tests/test_group_purge.py b/packages/meshbay-hub/tests/test_group_purge.py index e729297..9c6a664 100644 --- a/packages/meshbay-hub/tests/test_group_purge.py +++ b/packages/meshbay-hub/tests/test_group_purge.py @@ -25,6 +25,7 @@ from meshbay_hub.db.models import ( ContentReport, EmailVerification, Group, + GroupInviteLink, GroupMember, IPLog, Notification, @@ -34,7 +35,8 @@ from meshbay_hub.db.purge import _referencing from sqlalchemy import delete, func, select, text from sqlalchemy.exc import IntegrityError -SEEDED = {"group_members", "notifications", "email_verifications", "content_reports"} +SEEDED = {"group_members", "notifications", "email_verifications", "content_reports", + "group_invite_links"} def _auth_key(password: str, username: str) -> str: @@ -80,6 +82,11 @@ async def _group_with_everything(client, db, owner_token: str, member: str, name expires_at=datetime.now(UTC) + timedelta(days=1))) db.add(ContentReport(reporter_id=member_id, content_hash="ab" * 32, group_id=gid, ip_address="192.0.2.1")) + owner_id = (await db.execute(select(Group.admin_id).where(Group.id == gid))).scalar_one() + db.add(GroupInviteLink(group_id=gid, created_by=owner_id, ticket_hash=gid[:8] * 8, + email_hash="1" * 64, email_masked="m***@e***.com", + expires_at=datetime.now(UTC) + timedelta(days=1), + redeemed_by=member_id, redeemed_at=datetime.now(UTC))) await db.commit() return gid |