Skip to content

feat(nearby): implement Nearby Share / Quick Share support (#1272) - #3933

Open
Saik2789 wants to merge 1 commit into
microg:masterfrom
Saik2789:feat/bounty-1272
Open

Saik2789 wants to merge 1 commit into
microg:masterfrom
Saik2789:feat/bounty-1272

Conversation

@Saik2789

Copy link
Copy Markdown

Resolves #1272

/claim #1272

Root Cause / Motivation

microG lacked support for Google's Nearby Share (Quick Share) protocol and Nearby Connections API. This prevented users from discovering, sending, and receiving files to/from standard Google Play Services devices, Chromebooks, and PCs over local network transports.

Key Changes

  • Nearby Connections API (play-services-nearby): Added Nearby.getConnectionsClient() with complete ConnectionsClient interface, option builders (AdvertisingOptions, DiscoveryOptions), Strategy, Payload, and status codes.
  • Service & Discovery Protocol (play-services-nearby-core): Implemented mDNS service advertisement and discovery for Nearby Share (_FC9F5ED42C8A._tcp.) conforming to standard Nearby Endpoint Info encoding.
  • UKEY2 Handshake & Cryptography (NearbyCrypto): Implemented P-256 ECDH key exchange with SHA-512 commitment verification, HKDF-SHA256 key derivation (D2D client/server keys), AES-256-CBC framing, and 4-digit PIN verification generation matching standard Nearby protocol.
  • File Transfer Engine (NearbySharingClient & NearbySharingServer): Implemented encrypted introduction frame negotiation, connection response handling, and chunked payload transfer for bidirectional file sharing.
  • UI & Integration: Implemented NearbySharingActivity for sending files/text via Android Sharesheet (SEND/SEND_MULTIPLE/SHARE_NEARBY), ReceiveActivity for accepting incoming transfers with PIN verification, and NearbySharingSettingsActivity for device name and visibility controls.
  • Testing: Added unit test suites covering NearbyEndpointInfo, NearbyCrypto (handshake, tamper detection, sequence replay prevention), and ConnectionsClient.

Verification & Test Proof

Executed full Gradle assemble, test, and Android lint checks:

./gradlew :play-services-nearby:assemble :play-services-nearby-core:assemble \
          :play-services-nearby:test :play-services-nearby-core:test \
          :play-services-nearby:lintDebug :play-services-nearby-core:lintDebug \
          :play-services-nearby:lintRelease :play-services-nearby-core:lintRelease

Result:

BUILD SUCCESSFUL in 42s
558 actionable tasks: 41 executed, 517 up-to-date
  • All 15 unit tests passed cleanly across :play-services-nearby and :play-services-nearby-core.
  • Both lintDebug and lintRelease passed with 0 errors.

Payout Address

Wallet (USDC on Base network): 0x20A0525b47f087f1Cc498cda257A0feB78D2320B

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.

Implementation of Nearby Share

1 participant