feat: link fediverse account to existing user

This commit is contained in:
sam 2024-12-04 01:48:52 +01:00
parent 03209e4028
commit 57e1ec09c0
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
17 changed files with 335 additions and 95 deletions

View file

@ -63,13 +63,14 @@ public static class KeyCacheExtensions
this KeyCacheService keyCacheService,
AuthType authType,
Snowflake userId,
string? instance = null,
CancellationToken ct = default
)
{
var state = AuthUtils.RandomToken();
await keyCacheService.SetKeyAsync(
$"add_account:{state}",
new AddExtraAccountState(authType, userId),
new AddExtraAccountState(authType, userId, instance),
Duration.FromDays(1),
ct
);
@ -93,4 +94,4 @@ public record RegisterEmailState(
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)] Snowflake? ExistingUserId
);
public record AddExtraAccountState(AuthType AuthType, Snowflake UserId);
public record AddExtraAccountState(AuthType AuthType, Snowflake UserId, string? Instance = null);