fix: correctly expire pre-auth-keys in 0.28.0+

This commit is contained in:
Aarnav Tale
2026-04-06 21:36:49 -04:00
parent bdcd4c5bad
commit 10278d0cc9
4 changed files with 19 additions and 8 deletions
@@ -34,7 +34,7 @@ export interface PreAuthKeyEndpoints {
* @param user The user associated with the pre-authentication key.
* @param key The pre-authentication key to expire.
*/
expirePreAuthKey(user: string, key: string): Promise<void>;
expirePreAuthKey(user: string, key: PreAuthKey): Promise<void>;
}
export default defineApiEndpoints<PreAuthKeyEndpoints>((client, apiKey) => ({
@@ -77,9 +77,17 @@ export default defineApiEndpoints<PreAuthKeyEndpoints>((client, apiKey) => ({
},
expirePreAuthKey: async (user, key) => {
if (client.isAtleast("0.28.0")) {
await client.apiFetch<void>("POST", "v1/preauthkey/expire", apiKey, {
id: key.id,
});
return;
}
await client.apiFetch<void>("POST", "v1/preauthkey/expire", apiKey, {
user,
key,
key: key.key,
});
},
}));