Skip to content

Conversation

@54m
Copy link

@54m 54m commented Jan 9, 2026

Summary

Implements client-side UI and logic for session sharing functionality, including shared session fetching, decryption, and management interface.

Features

Session Sharing Management UI

  • Manage sharing button in session info screen
  • Direct sharing dialog with friend selector
  • Access level selection (view/edit/admin)
  • Real-time share list with current access levels
  • Owner permission checks

Shared Session Support

  • Fetch sessions shared with current user
  • Decrypt encryptedDataKey using recipient's private key
  • Initialize shared sessions with proper encryption
  • Real-time updates for share events
  • Automatic session removal on revoke

Client-Side Decryption

  • Uses existing Box decryption (X25519-XSalsa20-Poly1305)
  • Decrypts encryptedDataKey with user's private key
  • Maintains E2E encryption throughout
  • Session data remains encrypted at rest

Real-time Events

  • session-shared: New share notification
  • session-share-updated: Access level changes
  • session-share-revoked: Share removal and cleanup

Security

  • Server-side encryption with recipient's public key
  • Client-side decryption with private key
  • No plaintext data keys transmitted
  • Owner-only permission enforcement

Implementation Details

New Components

  • SessionShareDialog: Share management interface
  • FriendSelector: Friend selection with search
  • PublicLinkDialog: Public link UI (marked as not implemented)

API Integration

  • Server-side encryption removes client encryption requirement
  • API interfaces updated to match backend
  • Proper error handling with HappyError

Translation Support

  • Added translations for all UI strings
  • Supported languages: en, ru, pl, es, ca, it, pt, ja, zh-Hans

Technical Changes

Files modified:

  • sources/sync/sync.ts: Shared session fetching and decryption
  • sources/sync/apiSharing.ts: API client updates
  • sources/sync/sharingTypes.ts: Type definitions
  • sources/sync/friendTypes.ts: Added publicKey field
  • sources/components/SessionSharing/: UI components
  • sources/app/(app)/session/[id]/: Sharing management screens
  • sources/text/: Translations

Related PRs

Backend PR: slopus/happy-server#25

Notes

Public link functionality is marked as not implemented pending encryption design for anonymous access.

54m added 30 commits January 9, 2026 16:18
Add comprehensive translations for session sharing feature including:
- Session sharing UI labels and actions
- Access level descriptions (view, edit, manage)
- Public link management
- Consent and access logging
- Error messages for sharing operations

Translations added for all 9 supported languages:
- English, Japanese, Russian, Polish, Spanish
- Portuguese, Chinese (Simplified), Italian, Catalan

- sources/text/_default.ts
- sources/text/translations/ja.ts
- sources/text/translations/ru.ts
- sources/text/translations/pl.ts
- sources/text/translations/es.ts
- sources/text/translations/pt.ts
- sources/text/translations/zh-Hans.ts
- sources/text/translations/it.ts
- sources/text/translations/ca.ts
Add comprehensive TypeScript types and API client for session sharing:

Types (`sharingTypes.ts`):
- ShareAccessLevel: view/edit/admin permissions
- SessionShare: Direct user-to-user sharing
- PublicSessionShare: Link-based public sharing
- Request/Response types for all API operations
- Custom error classes for error handling
- Detailed TSDoc for all types and interfaces

API Client (`apiSharing.ts`):
- Direct sharing: create, update, delete, list shares
- Public links: create, delete, access, manage
- Shared sessions: list and retrieve
- Access logs and blocked users management
- Detailed TSDoc with @param, @returns, @throws tags
- Automatic retry with backoff on failures
- Type-safe error handling

- sources/sync/sharingTypes.ts
- sources/sync/apiSharing.ts
Implements SessionShareDialog for managing session sharing with users.
Displays current shares, access levels, and provides UI for adding/removing shares.

- sources/components/SessionSharing/SessionShareDialog.tsx
Adds translations for session sharing UI elements across all 9 supported languages.
Includes strings for access levels, share management, and dialog text.

- sources/text/_default.ts
- sources/text/translations/ca.ts
- sources/text/translations/es.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/pl.ts
- sources/text/translations/pt.ts
- sources/text/translations/ru.ts
- sources/text/translations/zh-Hans.ts
Implements FriendSelector component for choosing friends to share sessions with.
Features searchable friend list and access level selection.

- sources/components/SessionSharing/FriendSelector.tsx
Adds translation keys for friend search and selection in session sharing.
Includes searchFriends, noFriendsFound, and addShare across all languages.

- sources/text/_default.ts
- sources/text/translations/ca.ts
- sources/text/translations/es.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/pl.ts
- sources/text/translations/pt.ts
- sources/text/translations/ru.ts
- sources/text/translations/zh-Hans.ts
Implements PublicLinkDialog for creating and managing public share links.
Features QR code generation, expiration settings, usage limits, and consent options.

- sources/components/SessionSharing/PublicLinkDialog.tsx
Adds translation keys for public link creation and management UI.
Includes expiration, usage limits, and consent options across all languages.

- sources/text/_default.ts
- sources/text/translations/ca.ts
- sources/text/translations/es.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/pl.ts
- sources/text/translations/pt.ts
- sources/text/translations/ru.ts
- sources/text/translations/zh-Hans.ts
Align frontend with server-side encryption implementation. The server
now handles data key encryption automatically using recipient's public
keys. Clients no longer provide encryptedDataKey when creating shares.

Files:
- sources/sync/sharingTypes.ts
- sources/sync/apiSharing.ts
- sources/app/(app)/session/[id]/sharing.tsx
Add publicKey field to UserProfile for encryption support. Add getUserID
and getUserPublicKey helper methods to sync class for accessing user info.

Files:
- sources/sync/friendTypes.ts
- sources/sync/sync.ts
Add translations for session sharing UI including direct sharing,
public links, access levels, and error messages across all languages.

Files:
- sources/text/_default.ts
- sources/text/translations/ca.ts
- sources/text/translations/es.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/pl.ts
- sources/text/translations/pt.ts
- sources/text/translations/ru.ts
- sources/text/translations/zh-Hans.ts
Add navigation button to session sharing management screen in the
quick actions section of session info page.

Files:
- sources/app/(app)/session/[id]/info.tsx
Implement client-side logic to fetch and decrypt sessions shared with
the current user. Uses existing Box decryption to decrypt encryptedDataKey
with recipient's private key, enabling E2E encrypted session sharing.

Files:
- sources/sync/sync.ts
Add token-based encryption for public shares with client-side key
generation. Clients generate random tokens, encrypt data keys with
derived keys, and send both to server for E2E security.

Files:
- sources/sync/publicShareEncryption.ts
- sources/sync/sync.ts
- sources/sync/apiSharing.ts
- sources/app/(app)/session/[id]/sharing.tsx
Store owner profile information and access level for shared sessions.
This enables UI to display who shared the session and enforce permissions.

- sources/sync/storageTypes.ts
- sources/sync/sync.ts
Add translations for view-only mode and permission error messages.
Covers all supported languages for access control feedback.

- sources/text/_default.ts
- sources/text/translations/ca.ts
- sources/text/translations/es.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/pl.ts
- sources/text/translations/pt.ts
- sources/text/translations/ru.ts
- sources/text/translations/zh-Hans.ts
Show owner badge with icon and name for shared sessions.
Helps users quickly identify which sessions are shared with them.

- sources/components/ActiveSessionsGroup.tsx
Support disabling input field and send button for read-only sessions.
Implements UI enforcement of view-only access level.

- sources/components/AgentInput.tsx
Disable input and block message sending for view-only sessions.
Show appropriate placeholder and error messages based on access level.

- sources/-session/SessionView.tsx
Hide sharing management button for non-admin access levels.
Only session owners and admin-level users can modify sharing settings.

- sources/app/(app)/session/[id]/info.tsx
Add method to store decrypted data keys from public shares.
Expose server URL getter for public share API access.

- sources/sync/sync.ts
- sources/sync/publicShareEncryption.ts
Add translations for share access errors and consent flow.
Covers not found, expired, decryption failure, and consent UI.

- sources/text/_default.ts
- sources/text/translations/ca.ts
- sources/text/translations/es.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/pl.ts
- sources/text/translations/pt.ts
- sources/text/translations/ru.ts
- sources/text/translations/zh-Hans.ts
Add screen for accessing sessions via public share links.
Handles token-based decryption and consent flow with owner display.

- sources/app/(app)/share/[token].tsx
Use username as primary display name with firstName as fallback.
Maintains consistency across user profile displays.

- sources/components/ActiveSessionsGroup.tsx
Remove non-existent CustomModal dependency from FriendSelector and PublicLinkDialog.
Convert to standard View components without modal wrapper logic.

- sources/components/SessionSharing/FriendSelector.tsx
- sources/components/SessionSharing/PublicLinkDialog.tsx
Updated theme property references to match existing codebase patterns.
Changed background->surface, typography->text, primary->textLink, margins to fixed pixel values.
Applied consistent radio button styling using theme.colors.radio.

- sources/components/SessionSharing/SessionShareDialog.tsx
- sources/components/SessionSharing/FriendSelector.tsx
- sources/components/SessionSharing/PublicLinkDialog.tsx
Added translation keys for share error messages, public link options, and consent flow.
Includes shareNotFound, shareExpired, failedToDecrypt, and various UI labels.

- sources/text/_default.ts
Fixed component props to match actual interfaces (Avatar, Item).
Updated translation key format from sessionSharing to session.sharing.
Prioritized username display over firstName+lastName concatenation.

- sources/app/(app)/session/[id]/sharing.tsx
- sources/app/(app)/share/[token].tsx
Added missing translation keys for session sharing feature.
Includes error messages, public link options, and consent flow strings.

- sources/text/translations/ru.ts
- sources/text/translations/pl.ts
- sources/text/translations/es.ts
- sources/text/translations/pt.ts
- sources/text/translations/ca.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/zh-Hans.ts
Added remaining translation keys for public link options, error messages, and consent flow.
Includes expiration options, usage limits, and dynamic count functions.

- sources/text/translations/ru.ts
- sources/text/translations/pl.ts
- sources/text/translations/es.ts
- sources/text/translations/pt.ts
- sources/text/translations/ca.ts
- sources/text/translations/it.ts
- sources/text/translations/ja.ts
- sources/text/translations/zh-Hans.ts
54m added 5 commits January 10, 2026 12:12
Fixed parameter names in translation function calls.
Changed count->used for usage count display functions.
Changed common.close->common.cancel for consistency.
Removed non-existent ownerUsername property reference.

- sources/app/(app)/share/[token].tsx
- sources/components/SessionSharing/PublicLinkDialog.tsx
- sources/components/SessionSharing/SessionShareDialog.tsx
Replaced `sync.getServerUrl` with direct `getServerUrl` call.
Removed redundant `getServerUrl` method from `sync`.

- sources/app/(app)/share/[token].tsx
- sources/sync/sync.ts
Remove unused Modal import from sharing screen

- sources/app/(app)/share/[token].tsx
Replaced `ItemGroup` with `ItemList` for better structure. Adjusted styles and removed unused `isCreating` state logic. Consolidated common sections and updated QR code dimensions for consistency.

- sources/components/SessionSharing/PublicLinkDialog.tsx
Updated icons in SessionShareDialog to use Ionicons for consistency and styling improvements. Adjusted size and color to align with design guidelines.

- sources/components/SessionSharing/SessionShareDialog.tsx
@54m 54m marked this pull request as draft January 10, 2026 04:39
54m added 2 commits January 10, 2026 20:33
Add three event schemas for real-time session sharing notifications. These schemas enable clients to receive updates when sessions are shared, share permissions are modified, or shares are revoked.

- sources/sync/apiTypes.ts
Replace plain Item component with RoundButton for the create button. Makes the primary action more visible and easier to recognize in the dialog.

- sources/components/SessionSharing/PublicLinkDialog.tsx
@54m 54m marked this pull request as ready for review January 10, 2026 13:51
@54m
Copy link
Author

54m commented Jan 10, 2026

@ex3ndr (Are you the correct person to mention?)
Since there is no EAS project, I cannot build it and therefore cannot check its operation.
The web version also has a problem with machine selection, so I cannot check the exact operation of the implementation.
Although I have not committed it, I have created a preview file and have only performed a simple operation check.
You may adjust the UI as needed. Thank you.

@54m 54m force-pushed the feature/session-sharing branch from 16af0c1 to 7213402 Compare January 10, 2026 14:20
54m added 2 commits January 10, 2026 23:21
delete: unnecessary file

delete: unnecessary file

delete: unnecessary file
@54m 54m force-pushed the feature/session-sharing branch from 7213402 to a7a2a6f Compare January 10, 2026 14:22
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