Table of Contents

Method StoreAsync

Namespace
MailFathom.Infrastructure.Secrets.Database
Assembly
MailFathom.Infrastructure.dll

StoreAsync(IPersistenceSession, DatabaseSecretReference, UserId, SecretName, ResolvedSecret, CancellationToken)

Seals and stages one stored secret, creating its user-and-name identity or replacing its material.

Task<DatabaseSecretReference> StoreAsync(IPersistenceSession session, DatabaseSecretReference reference, UserId user, SecretName name, ResolvedSecret material, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The transaction the referencing document joins.

reference DatabaseSecretReference

The stable reference the document carries.

user UserId

The subject whose deletion removes the secret.

name SecretName

The safe declared name used for binding, rotation, and audit.

material ResolvedSecret

The caller-owned material, left usable and never retained.

cancellationToken CancellationToken

Cancels sealing or joining the transaction.

Returns

Task<DatabaseSecretReference>

The stable reference for the user-and-name identity once the write is staged.

Remarks

The supplied reference is used only when no row exists for user and name. A retry after a concurrent insert returns the winner's reference and replaces its material, so submitting the same user and name twice rotates one secret rather than creating two.