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
sessionIPersistenceSessionThe transaction the referencing document joins.
referenceDatabaseSecretReferenceThe stable reference the document carries.
userUserIdThe subject whose deletion removes the secret.
nameSecretNameThe safe declared name used for binding, rotation, and audit.
materialResolvedSecretThe caller-owned material, left usable and never retained.
cancellationTokenCancellationTokenCancels 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.