Heimdall-backed members enrol WebAuthn passkeys on the Linked accounts page (ticket from a fresh ordinary Heimdall sign-in, 48 h cooling-off, cap 5, FixedWindowBudget on ceremonies) and unlink with a strong passkey: the assertion is verified at Bifrost, then inside the completion that holds the bearer Bifrost calls Heimdall's POST /v1/apps/bifrost/step-up and the unlink with the returned token. The Google step-up closes once a strong passkey exists. Migration AddPasskeyCredentials is additive. Tests use a software authenticator and a fake Heimdall step-up route modeled on the contract. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
65 lines
2.3 KiB
C#
65 lines
2.3 KiB
C#
using Bifrost.Web.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace Bifrost.Web.Tests;
|
|
|
|
public sealed class MigrationDiscoveryTests
|
|
{
|
|
private static readonly string[] ExpectedMigrations =
|
|
[
|
|
"20260422084653_InitialAlphaFoundation",
|
|
"20260608210000_AddHeimdallUserIdentity",
|
|
"20260609143000_AddPatronSupportDerivation",
|
|
"20260609160000_AddExternalPatronProviderIntake",
|
|
"20260617010537_AddBridgeActionLedger",
|
|
"20260617022305_AddAgentDispatchRuns",
|
|
"20260617033635_AddAgentTransportReceipts",
|
|
"20260617041417_AddGovernanceActivityReceipts",
|
|
"20260622142000_AddBridgeActionIdentityProvenance",
|
|
"20260622165000_AddBifrostNativeIdentity",
|
|
"20260622202000_AddBridgeActionTargetSurfaceName",
|
|
"20260705190000_AddPatronSupportProjectAttribution",
|
|
"20261010043937_AddConceptVotes",
|
|
"20261022163159_AddOpenIddict",
|
|
"20261109200000_AddSealedBallotMotions",
|
|
"20261109210000_AddMindKeys",
|
|
"20261111090000_AddConsentReceipts",
|
|
"20261111100000_ConsentReceiptsOneLivePerVersion",
|
|
"20261111110000_AddMembershipSuspensionReason",
|
|
"20261111120000_ClearLegacyConsentReceipts",
|
|
"20261113120000_AddPasskeyCredentials",
|
|
];
|
|
|
|
// Database.GetMigrations() reads assembly metadata only; no connection is opened.
|
|
private static List<string> Discovered()
|
|
{
|
|
var options = new DbContextOptionsBuilder<BifrostDbContext>()
|
|
.UseNpgsql("Host=unused")
|
|
.Options;
|
|
using var db = new BifrostDbContext(options);
|
|
return db.Database.GetMigrations().ToList();
|
|
}
|
|
|
|
[Fact]
|
|
public void Every_migration_type_is_discovered()
|
|
{
|
|
var discovered = Discovered();
|
|
var declared = typeof(BifrostDbContext).Assembly.GetTypes()
|
|
.Where(t => !t.IsAbstract && typeof(Migration).IsAssignableFrom(t))
|
|
.ToList();
|
|
|
|
Assert.NotEmpty(declared);
|
|
Assert.Equal(declared.Count, discovered.Count);
|
|
foreach (var type in declared)
|
|
{
|
|
Assert.Contains(discovered, id => id.EndsWith("_" + type.Name, StringComparison.Ordinal));
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void All_migrations_are_listed_in_order()
|
|
{
|
|
Assert.Equal(ExpectedMigrations, Discovered());
|
|
}
|
|
}
|