Consent: optional at registration, a consent page, CSRF-guarded accept/withdraw, notice v2 (#58)

This commit is contained in:
Heimdall 2026-11-11 12:11:02 +00:00
commit 1571bf3e32
17 changed files with 1141 additions and 266 deletions

View file

@ -325,7 +325,8 @@ public sealed class BifrostDbContext(DbContextOptions<BifrostDbContext> options)
modelBuilder.Entity<ConsentReceipt>(entity =>
{
entity.HasIndex(x => new { x.UserAccountId, x.NoticeVersion }).IsUnique();
// One live receipt per account and version; a withdrawn row stays as history and a later agreement is a new row.
entity.HasIndex(x => new { x.UserAccountId, x.NoticeVersion }).IsUnique().HasFilter("\"WithdrawnAtUtc\" IS NULL");
entity.HasOne(x => x.UserAccount)
.WithMany()
.HasForeignKey(x => x.UserAccountId)

View file

@ -0,0 +1,36 @@
using Bifrost.Web.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bifrost.Web.Data.Migrations
{
// Hand-written like AddConsentReceipts: no dotnet-ef on the authoring host; the snapshot was edited to match.
// A person may withdraw and agree again to the same version, so uniqueness narrows to the live receipt.
[DbContext(typeof(BifrostDbContext))]
[Migration("20261111100000_ConsentReceiptsOneLivePerVersion")]
public partial class ConsentReceiptsOneLivePerVersion : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(name: "IX_ConsentReceipts_UserAccountId_NoticeVersion", table: "ConsentReceipts");
migrationBuilder.CreateIndex(
name: "IX_ConsentReceipts_UserAccountId_NoticeVersion",
table: "ConsentReceipts",
columns: new[] { "UserAccountId", "NoticeVersion" },
unique: true,
filter: "\"WithdrawnAtUtc\" IS NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(name: "IX_ConsentReceipts_UserAccountId_NoticeVersion", table: "ConsentReceipts");
migrationBuilder.CreateIndex(
name: "IX_ConsentReceipts_UserAccountId_NoticeVersion",
table: "ConsentReceipts",
columns: new[] { "UserAccountId", "NoticeVersion" },
unique: true);
}
}
}

View file

@ -1461,7 +1461,8 @@ namespace Bifrost.Web.Data.Migrations
b.HasKey("Id");
b.HasIndex("UserAccountId", "NoticeVersion")
.IsUnique();
.IsUnique()
.HasFilter("\"WithdrawnAtUtc\" IS NULL");
b.ToTable("ConsentReceipts");
});

View file

@ -35,7 +35,7 @@ public sealed partial class BifrostIdentityService(
public async Task<UserAccount> RegisterNativeAsync(
string identity,
string? displayName,
int noticeVersion,
int? noticeVersion,
CancellationToken cancellationToken)
{
var normalizedIdentity = await CheckAvailableAsync(identity, cancellationToken);
@ -66,14 +66,17 @@ public sealed partial class BifrostIdentityService(
}
};
// One SaveChanges: no account exists without the receipt of the notice it accepted.
// One SaveChanges: an account that agreed never exists without its receipt. No version, no receipt.
dbContext.UserAccounts.Add(userAccount);
dbContext.ConsentReceipts.Add(new ConsentReceipt
if (noticeVersion is { } agreed)
{
UserAccount = userAccount,
NoticeVersion = noticeVersion,
AcceptedAtUtc = now
});
dbContext.ConsentReceipts.Add(new ConsentReceipt
{
UserAccount = userAccount,
NoticeVersion = agreed,
AcceptedAtUtc = now
});
}
try
{
await dbContext.SaveChangesAsync(cancellationToken);

View file

@ -0,0 +1,191 @@
using Bifrost.Web.Configuration;
using Bifrost.Web.Data;
using Bifrost.Web.Domain;
using Bifrost.Web.Features.Membership;
using Bifrost.Web.Features.Shared;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
namespace Bifrost.Web.Features.Registration;
/// <summary>
/// The consent page and its two form posts, for any signed-in account. The receipt rows are the only state: a receipt is
/// live while <see cref="ConsentReceipt.WithdrawnAtUtc"/> is null, and an account's messages count only while a live
/// receipt for the version in force exists. Both posts are refused by <see cref="RequestOriginGuard.Allows"/> before
/// anything is read or written, since a signed-in session is a cookie and these carry no antiforgery token.
/// </summary>
public static class ConsentEndpoints
{
public const string Path = "/auth/bifrost/consent";
public static void MapConsent(this IEndpointRouteBuilder app)
{
app.MapGet(Path, async (ICurrentBifrostActorAccessor actors, BifrostDbContext db, CancellationToken ct) =>
{
var actor = await actors.GetAsync(ct);
if (!actor.IsAuthenticated || actor.UserAccount is null)
{
return Results.Redirect($"/auth/sign-in?returnUrl={Uri.EscapeDataString(LocalReturnPath.Parse(Path).Value)}");
}
return await PageAsync(db, actor.UserAccount.Id, null, StatusCodes.Status200OK, ct);
}).AllowAnonymous();
app.MapPost(Path + "/accept", async (
HttpContext http,
ICurrentBifrostActorAccessor actors,
BifrostDbContext db,
TimeProvider clock,
IOptions<BifrostHostOptions> host,
CancellationToken ct) =>
{
if (!RequestOriginGuard.Allows(http.Request, host.Value))
{
return Refused();
}
var actor = await actors.GetAsync(ct);
if (!actor.IsAuthenticated || actor.UserAccount is null)
{
return Results.Unauthorized();
}
var form = await ReadFormAsync(http.Request, ct);
if (form is null || form["version"].ToString() != TrainingNotice.Version.ToString(System.Globalization.CultureInfo.InvariantCulture))
{
return await PageAsync(db, actor.UserAccount.Id, $"Send the version in force, {TrainingNotice.Version}, to agree.", StatusCodes.Status400BadRequest, ct);
}
var accountId = actor.UserAccount.Id;
if (!await HasLiveReceiptAsync(db, accountId, ct))
{
db.ConsentReceipts.Add(new ConsentReceipt
{
UserAccountId = accountId,
NoticeVersion = TrainingNotice.Version,
AcceptedAtUtc = clock.GetUtcNow()
});
try
{
await db.SaveChangesAsync(ct);
}
catch (DbUpdateException error) when (IsUniqueViolation(error))
{
// The filtered unique index refused a second live receipt: another request holds it, so this accept has nothing to add.
// Only that violation is swallowed; any other store fault propagates. Not re-checked: a withdraw may already have stamped the winner, and the outcome for this request is the same.
db.ChangeTracker.Clear();
}
}
return Back();
}).AllowAnonymous();
app.MapPost(Path + "/withdraw", async (
HttpContext http,
ICurrentBifrostActorAccessor actors,
BifrostDbContext db,
TimeProvider clock,
IOptions<BifrostHostOptions> host,
CancellationToken ct) =>
{
if (!RequestOriginGuard.Allows(http.Request, host.Value))
{
return Refused();
}
var actor = await actors.GetAsync(ct);
if (!actor.IsAuthenticated || actor.UserAccount is null)
{
return Results.Unauthorized();
}
var live = await db.ConsentReceipts
.Where(x => x.UserAccountId == actor.UserAccount.Id && x.WithdrawnAtUtc == null)
.ToListAsync(ct);
if (live.Count > 0)
{
var now = clock.GetUtcNow();
foreach (var receipt in live)
{
receipt.WithdrawnAtUtc = now;
}
await db.SaveChangesAsync(ct);
}
return Back();
}).AllowAnonymous();
}
// Postgres SqlState 23505, on the exception or anywhere down its inner chain.
private static bool IsUniqueViolation(Exception error)
{
for (var e = (Exception?)error; e is not null; e = e.InnerException)
{
if (e is Npgsql.PostgresException { SqlState: Npgsql.PostgresErrorCodes.UniqueViolation })
{
return true;
}
}
return false;
}
private static IResult Refused() => Results.Text("Cross-site consent changes are refused.", statusCode: StatusCodes.Status403Forbidden);
private static IResult Back() => new SeeOther(Path);
private static Task<bool> HasLiveReceiptAsync(BifrostDbContext db, Guid accountId, CancellationToken ct) =>
db.ConsentReceipts.AnyAsync(x => x.UserAccountId == accountId && x.NoticeVersion == TrainingNotice.Version && x.WithdrawnAtUtc == null, ct);
private static async Task<IFormCollection?> ReadFormAsync(HttpRequest request, CancellationToken ct)
{
const int MaxFormBytes = 1024;
if (!request.HasFormContentType || request.ContentLength > MaxFormBytes)
{
return null;
}
if (request.HttpContext.Features.Get<Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature>() is { IsReadOnly: false } limit)
{
limit.MaxRequestBodySize = MaxFormBytes;
}
try
{
return await request.ReadFormAsync(ct);
}
catch (Exception error) when (error is InvalidDataException or BadHttpRequestException)
{
return null;
}
}
private sealed class SeeOther(string location) : IResult
{
public Task ExecuteAsync(HttpContext httpContext)
{
httpContext.Response.StatusCode = StatusCodes.Status303SeeOther;
httpContext.Response.Headers.Location = location;
httpContext.Response.Headers.CacheControl = "no-store";
return Task.CompletedTask;
}
}
private static async Task<IResult> PageAsync(BifrostDbContext db, Guid accountId, string? error, int status, CancellationToken ct)
{
var receipts = await db.ConsentReceipts.AsNoTracking().Where(x => x.UserAccountId == accountId).ToListAsync(ct);
return new HtmlPage(ConsentPage.Render(ConsentPage.StateOf(receipts), error), status);
}
private sealed class HtmlPage(string html, int status) : IResult
{
public async Task ExecuteAsync(HttpContext httpContext)
{
httpContext.Response.StatusCode = status;
httpContext.Response.ContentType = "text/html; charset=utf-8";
httpContext.Response.Headers.CacheControl = "no-store";
await httpContext.Response.WriteAsync(html);
}
}
}

View file

@ -0,0 +1,104 @@
using System.Net;
using Bifrost.Web.Domain;
namespace Bifrost.Web.Features.Registration;
/// <summary>Where an account stands against the notice in force. Exactly one holds.</summary>
public abstract record ConsentState
{
public sealed record None : ConsentState;
public sealed record Current(DateTimeOffset AgreedAtUtc) : ConsentState;
public sealed record Older(int Version, DateTimeOffset AgreedAtUtc) : ConsentState;
public sealed record Withdrawn(DateTimeOffset WithdrawnAtUtc) : ConsentState;
}
/// <summary>
/// The server-rendered consent page: the notice in force, the account's state and the buttons that apply. No script,
/// no external asset, no cookie of its own.
/// </summary>
public static class ConsentPage
{
/// <summary>A live receipt for the version in force wins, then a live older one, then the latest withdrawal, else none.</summary>
public static ConsentState StateOf(IReadOnlyCollection<ConsentReceipt> receipts)
{
var live = receipts.Where(x => x.WithdrawnAtUtc is null).ToList();
if (live.FirstOrDefault(x => x.NoticeVersion == TrainingNotice.Version) is { } current)
{
return new ConsentState.Current(current.AcceptedAtUtc);
}
if (live.OrderByDescending(x => x.NoticeVersion).FirstOrDefault() is { } older)
{
return new ConsentState.Older(older.NoticeVersion, older.AcceptedAtUtc);
}
return receipts.Count > 0
? new ConsentState.Withdrawn(receipts.Max(x => x.WithdrawnAtUtc!.Value))
: new ConsentState.None();
}
private static string Iso(DateTimeOffset time) => time.UtcDateTime.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'", System.Globalization.CultureInfo.InvariantCulture);
public static string Render(ConsentState state, string? error)
{
static string E(string? text) => WebUtility.HtmlEncode(text ?? "");
var version = TrainingNotice.Version.ToString(System.Globalization.CultureInfo.InvariantCulture);
var (message, anyLive) = state switch
{
ConsentState.Current current => ($"You agreed to version {version} on {Iso(current.AgreedAtUtc)}. Your messages may be used as the notice says.", true),
ConsentState.Older older => ($"You agreed to version {older.Version} on {Iso(older.AgreedAtUtc)}; version {version} is in force and your messages are not used until you agree to it.", true),
ConsentState.Withdrawn withdrawn => ($"You withdrew on {Iso(withdrawn.WithdrawnAtUtc)}. Your messages are not used.", false),
_ => ("You have not agreed. Your messages are not used.", false)
};
var summary = error is null ? "" : $"""<div id="errors" role="alert" tabindex="-1"><strong>That did not go through.</strong><p>{E(error)}</p></div>""";
// Withdraw whenever any live receipt exists (an older one included); Agree whenever none is live for the version in force.
var withdrawButton = anyLive
? """<form method="post" action="/auth/bifrost/consent/withdraw"><button type="submit">Withdraw</button></form>"""
: "";
var agreeButton = state is ConsentState.Current
? ""
: $"""<form method="post" action="/auth/bifrost/consent/accept"><input type="hidden" name="version" value="{version}" /><button type="submit">Agree to version {version}</button></form>""";
var button = agreeButton + withdrawButton;
return $$"""
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Training consent - Bifrost</title>
<style>
body { margin: 0; min-height: 100svh; display: grid; place-items: center; background: #090908; color: #fff8ef; font-family: system-ui, sans-serif; line-height: 1.5; }
main { width: min(92vw, 600px); margin: 24px 0; padding: 28px; border: 1px solid rgba(255,248,239,.16); border-radius: 8px; background: #141110; }
h1 { margin: 0 0 10px; font-size: 2rem; line-height: 1.1; }
p { color: #c7b8ad; }
fieldset { margin: 20px 0 0; padding: 14px 16px; border: 1px solid #8a7d73; border-radius: 6px; }
legend { padding: 0 6px; color: #d9ad66; font-weight: 750; }
#state { color: #fff8ef; font-weight: 650; }
button { margin-top: 20px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 6px; background: #c43e4f; color: #fff; font: inherit; font-weight: 750; cursor: pointer; }
:focus-visible { outline: 3px solid #ffd27a; outline-offset: 2px; }
#errors { margin-top: 18px; padding: 10px 14px; border: 2px solid #ff9aa6; border-radius: 6px; color: #ffc2c9; }
#errors p { margin: 4px 0 0; color: #ffc2c9; }
small { color: #d9ad66; }
</style>
</head>
<body>
<main>
<small>Your account</small>
<h1>Training consent</h1>
{{summary}}
<p id="state" aria-live="polite">{{E(message)}}</p>
{{button}}
<fieldset>
<legend>Training notice, version {{version}}</legend>
{{TrainingNotice.Html("notice")}}
</fieldset>
</main>
</body>
</html>
""";
}
}

View file

@ -35,8 +35,8 @@ public sealed record RegistrationOutcome(
/// <summary>
/// The one registration gate, run by the JSON endpoint and the form alike after each has spent the general address budget.
/// Order: consent, one proof only, the identity rules (which spend nothing), the challenge (proof of work, or the
/// time-lock plus its tighter budget), then the account and receipt in one save, then the cookie. A refusal at any step
/// Order: consent version (when sent), one proof only, the identity rules (which spend nothing), the challenge (proof of work, or the
/// time-lock plus its tighter budget), then the account (and its receipt when consent was sent) in one save, then the cookie. A refusal at any step
/// creates nothing, and a refusal before the challenge step spends neither the challenge nor a fallback permit.
/// </summary>
public sealed class NativeRegistration(
@ -46,12 +46,12 @@ public sealed class NativeRegistration(
{
public async Task<RegistrationOutcome> RunAsync(HttpContext http, RegistrationAttempt attempt, CancellationToken cancellationToken)
{
// Consent first, then the proof; a refusal here creates nothing.
if (attempt.AcceptedNoticeVersion != TrainingNotice.Version)
// Consent is optional: none sends no receipt. A version that is sent must be the one in force; a refusal here creates nothing.
if (attempt.AcceptedNoticeVersion is { } sent && sent != TrainingNotice.Version)
{
return RegistrationOutcome.Reject(
StatusCodes.Status400BadRequest,
$"Registration requires accepting the training notice, current version {TrainingNotice.Version}.",
$"The training notice in force is version {TrainingNotice.Version}; send that version to agree, or send none to register without agreeing.",
RegistrationField.Consent);
}
@ -111,7 +111,7 @@ public sealed class NativeRegistration(
try
{
var account = await identities.RegisterNativeAsync(attempt.Identity ?? "", attempt.DisplayName, TrainingNotice.Version, cancellationToken);
var account = await identities.RegisterNativeAsync(attempt.Identity ?? "", attempt.DisplayName, attempt.AcceptedNoticeVersion, cancellationToken);
await http.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, identities.BuildPrincipal(account));
return new(account, null, StatusCodes.Status200OK, null, RegistrationField.None, false);
}

View file

@ -99,7 +99,7 @@ public static class RegistrationPage
var link = model.ErrorField switch
{
RegistrationField.Identity => """<ul><li><a href="#identity">Identity name</a></li></ul>""",
RegistrationField.Consent => """<ul><li><a href="#consent">I have read this notice and consent</a></li></ul>""",
RegistrationField.Consent => """<ul><li><a href="#consent">I agree to this notice (optional)</a></li></ul>""",
_ => ""
};
summary.Append($"""<div id="errors" role="alert" tabindex="-1"><strong>Registration did not go through.</strong><p>{E(model.Error)}</p>{link}</div>""");
@ -153,8 +153,9 @@ public static class RegistrationPage
</fieldset>
<fieldset>
<legend>Training notice, version {{notice}}</legend>
<p id="notice">{{E(TrainingNotice.Text)}}</p>
<label class="check" for="consent"><input type="checkbox" id="consent" name="consent" value="yes" required aria-describedby="notice"{{Invalid(RegistrationField.Consent)}} />I have read this notice and consent</label>
{{TrainingNotice.Html("notice")}}
<label class="check" for="consent"><input type="checkbox" id="consent" name="consent" value="yes" aria-describedby="notice"{{Invalid(RegistrationField.Consent)}} />I agree to this notice (optional)</label>
<p class="hint">Optional. You can create an account without agreeing; then none of your messages are used. You can agree later on your consent page.</p>
<input type="hidden" name="acceptedNoticeVersion" value="{{notice}}" />
</fieldset>
<input type="hidden" name="challenge" value="{{E(model.Challenge)}}" />
@ -165,7 +166,7 @@ public static class RegistrationPage
<button type="submit" id="create">Create account</button>
<button type="submit" id="skip" class="secondary">Skip the automatic check and wait {{wait}} seconds instead</button>
</form>
<p class="hint" id="wait-note">Without a script, or if the automatic check is slow, wait {{wait}} seconds after the page opened and press the button to skip it (or Create account when there is no script). Pressed sooner, the page comes back saying how many seconds remain and keeps your names; the consent box comes back unchecked, so tick the box again before you submit. Without the automatic check only a few registrations per hour are accepted from one address.</p>
<p class="hint" id="wait-note">Without a script, or if the automatic check is slow, wait {{wait}} seconds after the page opened and press the button to skip it (or Create account when there is no script). Pressed sooner, the page comes back saying how many seconds remain and keeps your names; the consent box comes back unchecked, so tick it again if you want to agree. Without the automatic check only a few registrations per hour are accepted from one address.</p>
<p><small>After registering, Bifrost returns you to {{E(model.ReturnPath)}}.</small></p>
</main>
<script>{{Script}}</script>

View file

@ -1,17 +1,35 @@
using System.Net;
using System.Text;
namespace Bifrost.Web.Features.Registration;
/// <summary>
/// The training notice a registrant accepts. DRAFT wording: Eureka replaces <see cref="Text"/>. Changing the wording
/// in substance means a new <see cref="Version"/> (a positive integer, no leading zeros), because a receipt records the
/// version the person accepted.
/// The training notice a person may agree to. Changing the wording in substance means a new <see cref="Version"/> (a
/// positive integer, no leading zeros), because a receipt records the version the person agreed to; a receipt for an
/// older version no longer counts and the person is asked again on the consent page.
/// </summary>
public static class TrainingNotice
{
public const int Version = 1;
public const int Version = 2;
public const string Text =
"Chat messages and activity on GameCult chat may be used to train and evaluate AI models. " +
"No Discord material is used. " +
"Your consent is voluntary. It is recorded with this notice version and the time you give it, " +
"and you can withdraw it at any time. Withdrawing stops future use; it cannot recall use that already happened.";
"GameCult chat training notice, version 2\n\n" +
"GameCult may use messages you post in GameCult chat to train and evaluate AI models that GameCult builds and runs.\n\n" +
"What counts. The text of your messages, with their time and room, tied to your account name. Not your email address, your sign-in details or anything you did not post. Nothing that came from Discord is used, in any form.\n\n" +
"It is your choice. You can use GameCult chat without agreeing. If you do not agree, none of your messages are used.\n\n" +
"If you agree, we record your account, this notice's version number and the time. Nothing else is stored with it.\n\n" +
"If you withdraw, we leave all your messages out of every training set made after that moment. Withdrawing deletes nothing: your messages stay in chat and on our servers, anything already used to train a model stays used, and a dataset already built is not recalled. We keep the record that you agreed and when you withdrew.\n\n" +
"You can agree or withdraw at any time on your consent page while signed in. If the notice changes, its version changes and we ask again; until you agree to the new version, your messages are not used.";
/// <summary>The text as HTML-encoded paragraphs inside a div with the given id.</summary>
public static string Html(string id)
{
var html = new StringBuilder($"<div id=\"{id}\">");
foreach (var paragraph in Text.Split("\n\n"))
{
html.Append("<p>").Append(WebUtility.HtmlEncode(paragraph)).Append("</p>");
}
return html.Append("</div>").ToString();
}
}

View file

@ -497,10 +497,11 @@ app.MapPost("/auth/bifrost/register/form", async (
string Field(string name) => form[name].FirstOrDefault() ?? "";
var returnPath = LocalReturnPath.Parse(Field("returnUrl"));
// The checkbox is the consent act: without it the posted notice version is not taken as accepted.
int? accepted = Field("consent") == "yes" && int.TryParse(Field("acceptedNoticeVersion"), System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, out var version)
? version
: null;
// The checkbox is the consent act and is optional: unticked, the posted notice version is ignored and no receipt is made.
// Anything but the canonical decimal of the version in force ("02" included) with the box ticked is sent as -1 and refused, never read as "did not agree".
int? accepted = Field("consent") != "yes"
? null
: Field("acceptedNoticeVersion") == TrainingNotice.Version.ToString(System.Globalization.CultureInfo.InvariantCulture) ? TrainingNotice.Version : -1;
var identity = Field("identity");
var displayName = Field("displayName");
var challenge = Field("challenge");
@ -554,38 +555,7 @@ app.MapGet("/auth/bifrost/challenge", (HttpContext httpContext, RegistrationChal
app.MapGet("/auth/bifrost/notice", () =>
JsonResult(new { version = TrainingNotice.Version, text = TrainingNotice.Text }, appJsonSerializerOptions)).AllowAnonymous();
// Withdrawal stops future use; the receipt row stays. Idempotent: an already-withdrawn receipt keeps its first timestamp.
app.MapPost("/auth/bifrost/consent/withdraw", async (
ICurrentBifrostActorAccessor actors,
BifrostDbContext dbContext,
TimeProvider clock,
CancellationToken cancellationToken) =>
{
var actor = await actors.GetAsync(cancellationToken);
if (!actor.IsAuthenticated || actor.UserAccount is null)
{
return Results.Unauthorized();
}
var receipts = await dbContext.ConsentReceipts
.Where(x => x.UserAccountId == actor.UserAccount.Id)
.ToListAsync(cancellationToken);
if (receipts.Count == 0)
{
return Results.Text("No consent receipt is recorded for this account.", statusCode: StatusCodes.Status404NotFound);
}
var now = clock.GetUtcNow();
foreach (var receipt in receipts.Where(x => x.WithdrawnAtUtc is null))
{
receipt.WithdrawnAtUtc = now;
}
await dbContext.SaveChangesAsync(cancellationToken);
return JsonResult(
new { withdrawnAtUtc = receipts.Min(x => x.WithdrawnAtUtc) },
appJsonSerializerOptions);
});
app.MapConsent();
app.MapGet("/auth/heimdall/{provider}", async (
string provider,