-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathICredentialStore.cs
More file actions
22 lines (20 loc) · 1.34 KB
/
Copy pathICredentialStore.cs
File metadata and controls
22 lines (20 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace RustPlusBot.Abstractions.Credentials;
/// <summary>Persists and counts per-server player credentials. Tokens are protected at rest.</summary>
public interface ICredentialStore
{
/// <summary>
/// Inserts or refreshes the credential for (GuildId, RustServerId, OwnerUserId). The first credential
/// stored for a server becomes <c>Active</c>; subsequent owners are <c>Standby</c>. Re-pairing refreshes
/// the SteamId and token and resets an <c>Invalid</c> credential to <c>Standby</c>. Returns the credential's id.
/// </summary>
/// <param name="request">The plaintext credential inputs.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>The credential's id.</returns>
Task<Guid> UpsertFromPairingAsync(StoreCredentialRequest request, CancellationToken cancellationToken = default);
/// <summary>Counts stored credentials for a server within a guild.</summary>
/// <param name="guildId">Owning Discord guild snowflake.</param>
/// <param name="rustServerId">The server to count credentials for.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>The number of stored credentials for that (guild, server).</returns>
Task<int> CountForServerAsync(ulong guildId, Guid rustServerId, CancellationToken cancellationToken = default);
}