Skip to content

Commit 0b92d9f

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
docs: add gRPC remote access section with diagrams + security disclaimer
1 parent 92cc723 commit 0b92d9f

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,59 @@ flowchart TD
278278

279279
4. **gRPC Layer** (`grpc/`) — Remote proxy for Android APIs over gRPC. A companion app runs the gRPC server on-device; clients call Android APIs from any machine. Generated by `grpcgen`.
280280

281+
### gRPC Remote Access
282+
283+
The gRPC layer turns any Android phone into a remotely accessible API server. A companion service (`jniservice`) runs on the device — either as an APK (non-rooted) or a Magisk module (rooted, auto-starts on boot). Clients on any machine connect over the network using `jnicli`.
284+
285+
```mermaid
286+
sequenceDiagram
287+
participant Client as jnicli (host)
288+
participant Server as jniservice (phone)
289+
participant Android as Android APIs
290+
291+
Client->>Server: auth register (CSR)
292+
Server-->>Client: signed client cert + CA cert
293+
294+
Client->>Server: auth request-permission
295+
Server->>Android: launch approval dialog
296+
Note over Android: User taps "Approve"
297+
Server-->>Client: status: approved
298+
299+
Client->>Server: location get (mTLS)
300+
Server->>Android: LocationManager.getLastKnownLocation()
301+
Android-->>Server: Location object
302+
Server-->>Client: {lat, lon, alt, accuracy}
303+
```
304+
305+
Each client registers with a unique certificate (mTLS). Method access is controlled by per-service ACLs — the device owner approves which services each client can use through an on-screen dialog:
306+
307+
```mermaid
308+
flowchart LR
309+
subgraph Client
310+
CLI["jnicli"]
311+
end
312+
313+
subgraph "jniservice (on device)"
314+
TLS["mTLS gateway"]
315+
ACL["Per-service ACL"]
316+
SVC["31 Android API\nservices"]
317+
RAW["Raw JNI surface"]
318+
PROXY["Callback proxy\n(Camera2, etc.)"]
319+
end
320+
321+
CLI -->|client cert| TLS
322+
TLS --> ACL
323+
ACL -->|"camera.*"| SVC
324+
ACL -->|"admin only"| RAW
325+
SVC --> Android["Android\nFramework"]
326+
RAW --> Android
327+
PROXY --> Android
328+
```
329+
330+
**Available services** include camera, location, bluetooth, WiFi, telephony, battery, power, alarm, vibrator, audio, NFC, notifications, and more (31 services total, ~2000 RPCs). Callback-based APIs (like Camera2) work through a bidirectional streaming proxy with build-time generated adapter classes.
331+
332+
> **Security disclaimer:** This is a hobby/research project. The mTLS + ACL system provides basic access control, but it has not been audited and should not be relied upon for security-critical deployments. The self-signed CA, handle-based object references, and raw JNI surface all have inherent attack surface. Use it on trusted networks for development, testing, and experimentation.
333+
281334
## Project Layout
282335

283336
```

0 commit comments

Comments
 (0)