Skip to content

Commit 2d3c081

Browse files
committed
fix(core,sdk): use _sk_ additional API key infix
1 parent e37b155 commit 2d3c081

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

packages/core/src/v3/apiKeys.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { isAdditionalApiKey } from "./apiKeys.js";
33

44
describe("isAdditionalApiKey", () => {
55
it.each(["dev", "stg", "prod", "preview"])("recognizes %s additional keys", (environment) => {
6-
expect(isAdditionalApiKey(`tr_${environment}_ak_0123456789abcdefghijklmn`)).toBe(true);
6+
expect(isAdditionalApiKey(`tr_${environment}_sk_0123456789abcdefghijklmn`)).toBe(true);
77
});
88

99
it.each([
1010
"tr_prod_0123456789abcdefghijklmn",
11-
"tr_prod_ak_too-short",
12-
"tr_prod_ak_0123456789abcdefghijklmn_extra",
13-
"tr_test_ak_0123456789abcdefghijklmn",
14-
"tr_prod_ak_0123456789abcdefghijkl_",
11+
"tr_prod_sk_too-short",
12+
"tr_prod_sk_0123456789abcdefghijklmn_extra",
13+
"tr_test_sk_0123456789abcdefghijklmn",
14+
"tr_prod_sk_0123456789abcdefghijkl_",
1515
])("rejects %s", (key) => {
1616
expect(isAdditionalApiKey(key)).toBe(false);
1717
});

packages/core/src/v3/apiKeys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const ADDITIONAL_API_KEY_PATTERN = /^tr_(dev|stg|prod|preview)_ak_[0-9a-zA-Z]{24}$/;
1+
const ADDITIONAL_API_KEY_PATTERN = /^tr_(dev|stg|prod|preview)_sk_[0-9a-zA-Z]{24}$/;
22

33
/**
44
* Returns whether a key has the additional environment API key format.

packages/trigger-sdk/src/v3/auth.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("public token API key routing", () => {
3838
});
3939

4040
it("uses server minting for additional keys", async () => {
41-
const key = "tr_prod_ak_0123456789abcdefghijklmn";
41+
const key = "tr_prod_sk_0123456789abcdefghijklmn";
4242
const token = await apiClientManager.runWithConfig({ baseURL: baseUrl, accessToken: key }, () =>
4343
auth.createPublicToken({
4444
scopes: { read: { runs: ["run_123"] } },
@@ -63,7 +63,7 @@ describe("public token API key routing", () => {
6363
});
6464

6565
it("server-mints trigger tokens with one-time-use semantics", async () => {
66-
const key = "tr_dev_ak_0123456789abcdefghijklmn";
66+
const key = "tr_dev_sk_0123456789abcdefghijklmn";
6767
await apiClientManager.runWithConfig({ baseURL: baseUrl, accessToken: key }, () =>
6868
auth.createTriggerPublicToken(["task-one", "task-two"], { multipleUse: true })
6969
);
@@ -75,7 +75,7 @@ describe("public token API key routing", () => {
7575
});
7676

7777
it("server-mints batch trigger tokens for additional keys", async () => {
78-
const key = "tr_stg_ak_0123456789abcdefghijklmn";
78+
const key = "tr_stg_sk_0123456789abcdefghijklmn";
7979
await apiClientManager.runWithConfig({ baseURL: baseUrl, accessToken: key }, () =>
8080
auth.createBatchTriggerPublicToken("batch-task", {
8181
expirationTime: "2h",
@@ -136,7 +136,7 @@ describe("public token API key routing", () => {
136136
["an empty scopes object", {}],
137137
["a scope group with nothing selected", { read: {} }],
138138
])("rejects %s clearly for additional keys", async (_label, scopes) => {
139-
const key = "tr_prod_ak_0123456789abcdefghijklmn";
139+
const key = "tr_prod_sk_0123456789abcdefghijklmn";
140140
const promise = apiClientManager.runWithConfig({ baseURL: baseUrl, accessToken: key }, () =>
141141
auth.createPublicToken(scopes === undefined ? undefined : { scopes })
142142
);
@@ -152,7 +152,7 @@ describe("public token API key routing", () => {
152152
const promise = apiClientManager.runWithConfig(
153153
{
154154
baseURL: baseUrl,
155-
accessToken: "tr_prod_ak_0123456789abcdefghijklmn",
155+
accessToken: "tr_prod_sk_0123456789abcdefghijklmn",
156156
},
157157
() => auth.createPublicToken({ scopes: { read: { runs: true } } })
158158
);

packages/trigger-sdk/src/v3/createStartSessionAction.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe("chat.createStartSessionAction — runtime", () => {
137137
const start = chat.createStartSessionAction("fake-chat", {
138138
apiClient: {
139139
baseURL: "https://example.invalid",
140-
accessToken: "tr_prod_ak_0123456789abcdefghijklmn",
140+
accessToken: "tr_prod_sk_0123456789abcdefghijklmn",
141141
},
142142
tokenTTL: "30m",
143143
fetch: async (url, init, context) => {

0 commit comments

Comments
 (0)