Skip to content
TypeScript

refactor(shared): remove unused Clerk hostname predicate (#10008)

Julius Marmingecb58dfd64531
diff --git a/packages/shared/src/relayAuth.test.ts b/packages/shared/src/relayAuth.test.ts
index 3abff9b5210..4e1f28eefda 100644
--- a/packages/shared/src/relayAuth.test.ts
+++ b/packages/shared/src/relayAuth.test.ts
@@ -5,7 +5,6 @@ import {
ClerkPublishableKeyFrontendApiError,
clerkFrontendApiHostnameFromPublishableKey,
clerkFrontendApiUrlFromPublishableKey,
- isAllowedClerkFrontendApiHostname,
} from "./relayAuth.ts";
const clerkPublishableKey = (hostname: string): string => `pk_test_${btoa(`${hostname}$`)}`;
@@ -75,14 +74,4 @@ describe("Clerk relay auth", () => {
});
expect((error as ClerkPublishableKeyFrontendApiError).cause).toBeInstanceOf(Error);
});
-
- it("allows standard Clerk hosts and an exact configured custom hostname", () => {
- expect(isAllowedClerkFrontendApiHostname("example.clerk.accounts.dev", null)).toBe(true);
- expect(isAllowedClerkFrontendApiHostname("example.clerk.accounts.com", null)).toBe(true);
- expect(isAllowedClerkFrontendApiHostname("clerk.t3.codes", "clerk.t3.codes")).toBe(true);
- expect(isAllowedClerkFrontendApiHostname("attacker.example", "clerk.t3.codes")).toBe(false);
- expect(isAllowedClerkFrontendApiHostname("nested.clerk.t3.codes", "clerk.t3.codes")).toBe(
- false,
- );
- });
});
diff --git a/packages/shared/src/relayAuth.ts b/packages/shared/src/relayAuth.ts
index a384db77d8a..4c5d766c148 100644
--- a/packages/shared/src/relayAuth.ts
+++ b/packages/shared/src/relayAuth.ts
@@ -81,17 +81,6 @@ export function clerkFrontendApiHostnameFromPublishableKey(publishableKey: strin
return parseClerkFrontendApi(publishableKey).hostname;
}
-export function isAllowedClerkFrontendApiHostname(
- hostname: string,
- configuredHostname: string | null,
-): boolean {
- return (
- hostname.endsWith(".clerk.accounts.dev") ||
- hostname.endsWith(".clerk.accounts.com") ||
- hostname === configuredHostname
- );
-}
-
export function relayClerkTokenOptions(template: string) {
return {
template,