Table of Contents

Method RotateApiKeyAsync

Namespace
MailFathom.Application.Access.Credentials
Assembly
MailFathom.Application.dll

RotateApiKeyAsync(UserId, Guid, CancellationToken)

Draws a new key for one credential, which stops the previous one working at that instant.

public Task<UserCredentialRotation> RotateApiKeyAsync(UserId user, Guid credentialId, CancellationToken cancellationToken)

Parameters

user UserId

The user the credential belongs to.

credentialId Guid

The credential being rotated.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<UserCredentialRotation>

What the act did, and the key to report where it was performed.

Remarks

The lookup moves with the key, because it is the key's own digest — which is what makes rotating one a single write rather than a second credential the operator then has to remember to delete.

Exceptions

ArgumentException

Thrown when user names nobody or credentialId is the empty identifier.

PrincipalNotAuthorizedException

Thrown when the caller holds AdminCredentialsWrite at no scope, does not hold a name the user holds widely enough, or is not the root while the user holds a role listing a pattern.