refactor(mobile): remove unused pairing redaction wrapper (#10147)
This commit is contained in:
1 parent
761d4bac1c
commit
6a8f4d3b8f
2 files changed
+1
-32
No files matched your search
@@ -1,11 +1,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { EnvironmentId } from "@t3tools/contracts";
|
||||
|
||||
import {
|
||||
isRelayManagedConnection,
|
||||
redactPairingCredential,
|
||||
toStableSavedRemoteConnection,
|
||||
} from "./connection";
|
||||
import { isRelayManagedConnection, toStableSavedRemoteConnection } from "./connection";
|
||||
import { authClientMetadata } from "./authClientMetadata";
|
||||
|
||||
const mobilePlatform = vi.hoisted(() => ({ OS: "ios" as "ios" | "android" }));
|
||||
@@ -83,23 +79,6 @@ describe("mobile remote connection records", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("removes one-time bootstrap credentials before persisting pairing URLs", () => {
|
||||
expect(redactPairingCredential("https://desktop.example/#token=bootstrap-token")).toBe(
|
||||
"https://desktop.example/",
|
||||
);
|
||||
expect(redactPairingCredential("https://desktop.example/?token=bootstrap-token")).toBe(
|
||||
"https://desktop.example/",
|
||||
);
|
||||
});
|
||||
|
||||
it("removes hosted pairing credentials while keeping the advertised host", () => {
|
||||
expect(
|
||||
redactPairingCredential(
|
||||
"https://app.t3.codes/pair?host=https%3A%2F%2Fdesktop.example&token=bootstrap-token&label=Desktop",
|
||||
),
|
||||
).toBe("https://app.t3.codes/pair?host=https%3A%2F%2Fdesktop.example&label=Desktop");
|
||||
});
|
||||
|
||||
it("recognizes explicitly managed relay connections", () => {
|
||||
expect(isRelayManagedConnection({ relayManaged: true })).toBe(true);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { EnvironmentId } from "@t3tools/contracts";
|
||||
import { stripPairingTokenFromUrl } from "@t3tools/shared/remote";
|
||||
import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
|
||||
|
||||
export interface SavedRemoteConnection {
|
||||
@@ -17,15 +16,6 @@ export interface SavedRemoteConnection {
|
||||
|
||||
export type RemoteClientConnectionState = EnvironmentConnectionPhase;
|
||||
|
||||
export function redactPairingCredential(pairingUrl: string): string {
|
||||
const trimmed = pairingUrl.trim();
|
||||
try {
|
||||
return stripPairingTokenFromUrl(new URL(trimmed)).toString();
|
||||
} catch {
|
||||
return trimmed;
|
||||
}
|
||||
}
|
||||
|
||||
export function isRelayManagedConnection(
|
||||
connection: Pick<SavedRemoteConnection, "authenticationMethod" | "relayManaged">,
|
||||
): boolean {
|
||||
|
||||
Reference in new issue
Block a user