A api key can always revoke itself, add a route to delete any api key

This commit is contained in:
nicolas.dorier
2020-03-27 14:46:51 +09:00
parent 39a8c3fe47
commit 6d7b57ea3b
5 changed files with 69 additions and 43 deletions

View File

@@ -27,5 +27,13 @@ namespace BTCPayServer.Client
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/api-keys/current", null, HttpMethod.Delete), token);
HandleResponse(response);
}
public virtual async Task RevokeAPIKey(string apikey, CancellationToken token = default)
{
if (apikey == null)
throw new ArgumentNullException(nameof(apikey));
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/api-keys/{apikey}", null, HttpMethod.Delete), token);
HandleResponse(response);
}
}
}