authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 08:42:30-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 08:42:30-07:00
log6a8f4d3b8f1c73df33fb6ac3f1ff89e38b4cf633
treefee4d561becad5d0ff6e9af8b2d6b75d220b4020
parent761d4bac1c238ea7af4dd36b56719ad5e30771c3
signature Signed by PGP key B5690EEEBB952194

refactor(mobile): remove unused pairing redaction wrapper (#10147)


2 files changed, 1 insertions(+), 32 deletions(-)

apps/mobile/src/lib/connection.test.ts+1-22
...@@ -1,11 +1,7 @@...@@ -1,11 +1,7 @@
1import { afterEach, describe, expect, it, vi } from "vite-plus/test";1import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2import { EnvironmentId } from "@t3tools/contracts";2import { EnvironmentId } from "@t3tools/contracts";
33
4import {4import { isRelayManagedConnection, toStableSavedRemoteConnection } from "./connection";
5 isRelayManagedConnection,
6 redactPairingCredential,
7 toStableSavedRemoteConnection,
8} from "./connection";
9import { authClientMetadata } from "./authClientMetadata";5import { authClientMetadata } from "./authClientMetadata";
106
11const mobilePlatform = vi.hoisted(() => ({ OS: "ios" as "ios" | "android" }));7const mobilePlatform = vi.hoisted(() => ({ OS: "ios" as "ios" | "android" }));
...@@ -83,23 +79,6 @@ describe("mobile remote connection records", () => {...@@ -83,23 +79,6 @@ describe("mobile remote connection records", () => {
83 });79 });
84 });80 });
8581
86 it("removes one-time bootstrap credentials before persisting pairing URLs", () => {
87 expect(redactPairingCredential("https://desktop.example/#token=bootstrap-token")).toBe(
88 "https://desktop.example/",
89 );
90 expect(redactPairingCredential("https://desktop.example/?token=bootstrap-token")).toBe(
91 "https://desktop.example/",
92 );
93 });
94
95 it("removes hosted pairing credentials while keeping the advertised host", () => {
96 expect(
97 redactPairingCredential(
98 "https://app.t3.codes/pair?host=https%3A%2F%2Fdesktop.example&token=bootstrap-token&label=Desktop",
99 ),
100 ).toBe("https://app.t3.codes/pair?host=https%3A%2F%2Fdesktop.example&label=Desktop");
101 });
102
103 it("recognizes explicitly managed relay connections", () => {82 it("recognizes explicitly managed relay connections", () => {
104 expect(isRelayManagedConnection({ relayManaged: true })).toBe(true);83 expect(isRelayManagedConnection({ relayManaged: true })).toBe(true);
105 });84 });
apps/mobile/src/lib/connection.ts-10
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1import { EnvironmentId } from "@t3tools/contracts";1import { EnvironmentId } from "@t3tools/contracts";
2import { stripPairingTokenFromUrl } from "@t3tools/shared/remote";
3import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";2import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
43
5export interface SavedRemoteConnection {4export interface SavedRemoteConnection {
...@@ -17,15 +16,6 @@ export interface SavedRemoteConnection {...@@ -17,15 +16,6 @@ export interface SavedRemoteConnection {
1716
18export type RemoteClientConnectionState = EnvironmentConnectionPhase;17export type RemoteClientConnectionState = EnvironmentConnectionPhase;
1918
20export function redactPairingCredential(pairingUrl: string): string {
21 const trimmed = pairingUrl.trim();
22 try {
23 return stripPairingTokenFromUrl(new URL(trimmed)).toString();
24 } catch {
25 return trimmed;
26 }
27}
28
29export function isRelayManagedConnection(19export function isRelayManagedConnection(
30 connection: Pick<SavedRemoteConnection, "authenticationMethod" | "relayManaged">,20 connection: Pick<SavedRemoteConnection, "authenticationMethod" | "relayManaged">,
31): boolean {21): boolean {