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 @@
11import { afterEach, describe, expect, it, vi } from "vite-plus/test";
22import { EnvironmentId } from "@t3tools/contracts";
33
4import {
5 isRelayManagedConnection,
6 redactPairingCredential,
7 toStableSavedRemoteConnection,
8} from "./connection";
4import { isRelayManagedConnection, toStableSavedRemoteConnection } from "./connection";
95import { authClientMetadata } from "./authClientMetadata";
106
117const mobilePlatform = vi.hoisted(() => ({ OS: "ios" as "ios" | "android" }));
......@@ -83,23 +79,6 @@ describe("mobile remote connection records", () => {
8379 });
8480 });
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
10382 it("recognizes explicitly managed relay connections", () => {
10483 expect(isRelayManagedConnection({ relayManaged: true })).toBe(true);
10584 });
apps/mobile/src/lib/connection.ts-10
......@@ -1,5 +1,4 @@
11import { EnvironmentId } from "@t3tools/contracts";
2import { stripPairingTokenFromUrl } from "@t3tools/shared/remote";
32import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
43
54export interface SavedRemoteConnection {
......@@ -17,15 +16,6 @@ export interface SavedRemoteConnection {
1716
1817export 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
2919export function isRelayManagedConnection(
3020 connection: Pick<SavedRemoteConnection, "authenticationMethod" | "relayManaged">,
3121): boolean {