deleteAccountKeys method

Future<RevokedKey?> deleteAccountKeys({
  1. String? type,
})

Revokes the caller's own API key of the requested class.

Revokes the caller's own API key of the requested class. The class is the same field mint takes — ?type=publishable, defaulting to secret — so revoking the key that ships in a browser bundle does not sign its holder out of their own API: the other key keeps working. Revoking is how a key is replaced when it does not need replacing; minting the same class again rotates it in one step. IAM drops the credential immediately, but the gateway caches keys for a few minutes, so a request that beat the cache expiry may still be served. For callers written against the older shape, the class is also accepted in a JSON request body, read only when ?type= is absent.

Parameters:

  • String type: Type is the key class to act on: "secret" (sk-, session-equivalent, belongs on a server) or "publishable" (pk-, org-identifying, safe in a browser bundle). Omitted means secret, which is what every existing caller means.

Implementation

Future<RevokedKey?> deleteAccountKeys({ String? type, }) async {
  final response = await deleteAccountKeysWithHttpInfo( type: type, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'RevokedKey',) as RevokedKey;

  }
  return null;
}