refactor(shared): remove unused Clerk hostname predicate (#10008)
This commit is contained in:
1 parent
6270a6f88b
commit
cb58dfd645
2 files changed
-22
No files matched your search
@@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user