refactor!: rename the project from Monitor to MoShiro [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful
ci/woodpecker/push/main-amd64-build Pipeline was successful
Namespaces, assemblies, solution, binaries, images, systemd units, config paths, environment variables, protocol methods and the Linux user are all renamed. Breaking: existing databases, node identities and installed units must be recreated.
This commit is contained in:
1 parent
27ac7fb787
commit
2e146d4da7
309 files changed
+1565
-1572
No files matched your search
@@ -0,0 +1,41 @@
|
||||
namespace MoShiro.Backend.Application;
|
||||
|
||||
public sealed record UserRecord(string Id, string Username, byte[] PasswordHash, byte[] PasswordSalt, int Iterations, long CreatedAtMs);
|
||||
|
||||
public sealed record SessionRecord(byte[] IdSha256, string UserId, byte[] CsrfToken, long CreatedAtMs, long ExpiresAtMs);
|
||||
|
||||
public sealed record ApiTokenRecord(string Id, string Name, string Scope, byte[] TokenSha256, long CreatedAtMs, long? LastUsedAtMs, long? RevokedAtMs);
|
||||
|
||||
public interface IAuthStore
|
||||
{
|
||||
ValueTask<int> CountUsersAsync(CancellationToken ct);
|
||||
|
||||
ValueTask<UserRecord?> GetUserByNameAsync(string username, CancellationToken ct);
|
||||
|
||||
ValueTask<UserRecord?> GetUserAsync(string id, CancellationToken ct);
|
||||
|
||||
ValueTask<IReadOnlyList<UserRecord>> ListUsersAsync(CancellationToken ct);
|
||||
|
||||
/// <summary>用户名已存在时返回 false。</summary>
|
||||
ValueTask<bool> CreateUserAsync(UserRecord user, CancellationToken ct);
|
||||
|
||||
ValueTask UpdatePasswordAsync(string userId, byte[] hash, byte[] salt, int iterations, CancellationToken ct);
|
||||
|
||||
ValueTask CreateSessionAsync(SessionRecord session, CancellationToken ct);
|
||||
|
||||
ValueTask<SessionRecord?> GetSessionAsync(byte[] idSha256, CancellationToken ct);
|
||||
|
||||
ValueTask DeleteSessionAsync(byte[] idSha256, CancellationToken ct);
|
||||
|
||||
ValueTask DeleteExpiredSessionsAsync(long nowMs, CancellationToken ct);
|
||||
|
||||
ValueTask CreateApiTokenAsync(ApiTokenRecord token, CancellationToken ct);
|
||||
|
||||
ValueTask<ApiTokenRecord?> FindApiTokenAsync(byte[] tokenSha256, CancellationToken ct);
|
||||
|
||||
ValueTask<IReadOnlyList<ApiTokenRecord>> ListApiTokensAsync(CancellationToken ct);
|
||||
|
||||
ValueTask<bool> RevokeApiTokenAsync(string id, long nowMs, CancellationToken ct);
|
||||
|
||||
ValueTask TouchApiTokenAsync(string id, long nowMs, CancellationToken ct);
|
||||
}
|
||||
Reference in new issue
Block a user