30 lines · 973 B · TypeScript
RawDownload
export function clerkFrontendApiUrlFromPublishableKey(publishableKey: string): string {  const encodedFrontendApi = publishableKey.split("_").slice(2).join("_");  const frontendApi = globalThis.atob(encodedFrontendApi).replace(/\$$/u, "");  if (frontendApi.length === 0 || frontendApi.includes("/")) {    throw new Error("Invalid Clerk publishable key.");  }  return `https://${frontendApi}`;} export function clerkFrontendApiHostnameFromPublishableKey(publishableKey: string): string {  return new URL(clerkFrontendApiUrlFromPublishableKey(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,    skipCache: true,  } as const;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t