//native
type Ably = {
accessToken: string;
};
/**
* Revokes a key
* Revokes the API key with the specified ID, with the Application ID. This deletes the key.
*/
export async function main(auth: Ably, app_id: string, key_id: string) {
const url = new URL(
`https://control.ably.net/v1/apps/${app_id}/keys/${key_id}/revoke`,
);
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer " + auth.accessToken,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 138 days ago