Table of Contents

Method ProvisionPublicKeyAsync

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

ProvisionPublicKeyAsync(UserId, string?, IReadOnlyList<MailFathomPermission>?, UserCredentialReach, CancellationToken)

Registers a public key whose signed assertions authenticate one user.

public Task<UserCredentialProvisioning> ProvisionPublicKeyAsync(UserId user, string? writtenPublicKey, IReadOnlyList<MailFathomPermission>? permissions, UserCredentialReach reach, CancellationToken cancellationToken)

Parameters

user UserId

The user the credential authenticates.

writtenPublicKey string

The client's public key as the operator supplied it.

permissions IReadOnlyList<MailFathomPermission>

The names the credential narrows its user's grant to, or null to name none and hold what the user holds.

reach UserCredentialReach

On which endpoints, and from which networks, the credential may be presented.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<UserCredentialProvisioning>

What the act did, and the fingerprint the client's assertions must name.

Exceptions

ArgumentException

Thrown when user names nobody, the written key is not one this deployment accepts, or the grant names something a user-facing credential cannot hold.

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.