Skip to content

Commit 5da8ea8

Browse files
committed
chore(*): Rename isProductionFromApiKey to isProductionFromSecretKey
1 parent 1fcf88d commit 5da8ea8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/backend/src/tokens/interstitialRule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { checkCrossOrigin } from '../util/request';
2-
import { isDevelopmentFromSecretKey, isProductionFromApiKey } from '../util/shared';
2+
import { isDevelopmentFromSecretKey, isProductionFromSecretKey } from '../util/shared';
33
import type { AuthStatusOptionsType, RequestState } from './authStatus';
44
import { AuthErrorReason, interstitial, signedIn, signedOut } from './authStatus';
55
import { verifyToken } from './verify';
@@ -105,7 +105,7 @@ export const potentialRequestAfterSignInOrOutFromClerkHostedUiInDev: Interstitia
105105
export const potentialFirstRequestOnProductionEnvironment: InterstitialRule = options => {
106106
const { secretKey = '', clientUat, cookieToken } = options;
107107

108-
if (isProductionFromApiKey(secretKey) && !clientUat && !cookieToken) {
108+
if (isProductionFromSecretKey(secretKey) && !clientUat && !cookieToken) {
109109
return signedOut(options, AuthErrorReason.CookieAndUATMissing);
110110
}
111111
return undefined;

packages/backend/src/util/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export { addClerkPrefix, getScriptUrl, getClerkJsMajorVersionOrTag } from '@clerk/shared/url';
22
export { callWithRetry } from '@clerk/shared/callWithRetry';
3-
export { isDevelopmentFromSecretKey, isProductionFromApiKey, parsePublishableKey } from '@clerk/shared/keys';
3+
export { isDevelopmentFromSecretKey, isProductionFromSecretKey, parsePublishableKey } from '@clerk/shared/keys';
44
export { deprecated, deprecatedProperty } from '@clerk/shared/deprecated';
55

66
import { buildErrorThrower } from '@clerk/shared/error';

packages/shared/src/__tests__/keys.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
buildPublishableKey,
33
createDevOrStagingUrlCache,
44
isDevelopmentFromSecretKey,
5-
isProductionFromApiKey,
5+
isProductionFromSecretKey,
66
isPublishableKey,
77
parsePublishableKey,
88
} from '../keys';
@@ -97,7 +97,7 @@ describe('isDevelopmentFromSecretKey(key)', () => {
9797
});
9898
});
9999

100-
describe('isProductionFromApiKey(key)', () => {
100+
describe('isProductionFromSecretKey(key)', () => {
101101
const cases: Array<[string, boolean]> = [
102102
['sk_live_Y2xlcmsuY2xlcmsuZGV2JA==', true],
103103
['sk_test_Y2xlcmsuY2xlcmsuZGV2JA==', false],
@@ -106,7 +106,7 @@ describe('isProductionFromApiKey(key)', () => {
106106
];
107107

108108
test.each(cases)('given %p as a publishable key string, returns %p', (publishableKeyStr, expected) => {
109-
const result = isProductionFromApiKey(publishableKeyStr);
109+
const result = isProductionFromSecretKey(publishableKeyStr);
110110
expect(result).toEqual(expected);
111111
});
112112
});

packages/shared/src/keys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ export function isDevelopmentFromSecretKey(apiKey: string): boolean {
7474
return apiKey.startsWith('test_') || apiKey.startsWith('sk_test_');
7575
}
7676

77-
export function isProductionFromApiKey(apiKey: string): boolean {
77+
export function isProductionFromSecretKey(apiKey: string): boolean {
7878
return apiKey.startsWith('live_') || apiKey.startsWith('sk_live_');
7979
}

0 commit comments

Comments
 (0)