Skip to content

Commit 8328348

Browse files
authored
chore(repo): Backport backend API keys methods update (#7400) (#7427)
1 parent 4b9871c commit 8328348

File tree

5 files changed

+450
-8
lines changed

5 files changed

+450
-8
lines changed

.changeset/kind-humans-retire.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

integration/testUtils/usersService.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export type FakeOrganization = {
7575
export type FakeAPIKey = {
7676
apiKey: APIKey;
7777
secret: string;
78-
revoke: () => Promise<APIKey>;
78+
revoke: (reason?: string | null) => Promise<APIKey>;
7979
};
8080

8181
export type UserService = {
@@ -232,10 +232,8 @@ export const createUserService = (clerkClient: ClerkClient) => {
232232
return {
233233
apiKey,
234234
secret: apiKey.secret ?? '',
235-
revoke: () =>
236-
withErrorLogging('revokeAPIKey', () =>
237-
clerkClient.apiKeys.revoke({ apiKeyId: apiKey.id, revocationReason: 'For testing purposes' }),
238-
),
235+
revoke: (reason?: string | null) =>
236+
clerkClient.apiKeys.revoke({ apiKeyId: apiKey.id, revocationReason: reason }),
239237
} satisfies FakeAPIKey;
240238
},
241239
passwordCompromised: async (userId: string) => {

integration/tests/machine-auth/api-keys.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test.describe('Next.js API key auth within clerkMiddleware() @machine', () => {
6565
});
6666

6767
test.afterAll(async () => {
68-
await fakeAPIKey.revoke();
68+
await fakeAPIKey.revoke('Testing purposes within clerkMiddleware()');
6969
await fakeUser.deleteIfExists();
7070
await app.teardown();
7171
});

0 commit comments

Comments
 (0)