Interface IApiKeyManagementService
User-facing management of a team's API keys. Every operation names the team it acts on as its first argument, and requires the Manage scope on that team — holding the scope for one team does not authorize acting on another.
public interface IApiKeyManagementService
Remarks
System keys, which belong to no team, live on ISystemApiKeyManagementService.
Methods
CreateKeyAsync(string, string, AccessLevel, string[], string[], DateTime?, IReadOnlyList<Tag>, bool)
Creates a new API key. When ownerScoped is true the key is private to the caller (owner = the caller's team-member key); a caller can only ever mint a key owned by themselves.
[RequireScope("apikey:manage")]
Task<IApiKey> CreateKeyAsync(string teamKey, string name, AccessLevel accessLevel, string[] roles = null, string[] scopeOverrides = null, DateTime? expiryDate = null, IReadOnlyList<Tag> tags = null, bool ownerScoped = false)
Parameters
teamKeystringnamestringaccessLevelAccessLevelrolesstring[]scopeOverridesstring[]expiryDateDateTime?tagsIReadOnlyList<Tag>ownerScopedbool
Returns
DeleteKeyAsync(string, string)
[RequireScope("apikey:manage")]
Task DeleteKeyAsync(string teamKey, string key)
Parameters
Returns
GetKeysAsync(string, PrivateKeyScope, bool)
Returns the team's API keys for the caller. Team-wide keys are always included; owner-scoped
("private") keys are included per privateKeys, intersected with the caller's
entitlement (owner sees own; Developer-role sees all; allowPrivileged additionally
lets Administrator/Owner see private keys). Defaults preserve the original team-wide-only behaviour.
[RequireScope("apikey:manage")]
IAsyncEnumerable<IApiKey> GetKeysAsync(string teamKey, PrivateKeyScope privateKeys = PrivateKeyScope.None, bool allowPrivileged = false)
Parameters
teamKeystringprivateKeysPrivateKeyScopeallowPrivilegedbool
Returns
LockKeyAsync(string, string)
[RequireScope("apikey:manage")]
Task LockKeyAsync(string teamKey, string key)
Parameters
Returns
RefreshKeyAsync(string, string)
[RequireScope("apikey:manage")]
Task<IApiKey> RefreshKeyAsync(string teamKey, string key)
Parameters
Returns
SetRolesAsync(string, string, string[])
[RequireScope("apikey:manage")]
Task SetRolesAsync(string teamKey, string key, string[] roles)
Parameters
Returns
SetScopeOverridesAsync(string, string, string[])
[RequireScope("apikey:manage")]
Task SetScopeOverridesAsync(string teamKey, string key, string[] scopes)