1
0
mirror of https://github.com/bitwarden/server synced 2025-12-22 11:13:27 +00:00

Add SingleUserRecipe for seeding a single known user

This commit is contained in:
Matt Gibson
2025-10-09 11:14:17 -07:00
parent 92f2555b5c
commit f4342e207b
3 changed files with 101 additions and 4 deletions

View File

@@ -0,0 +1,29 @@
using Bit.Core.Enums;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Seeder.Factories;
namespace Bit.Seeder.Recipes;
public class SingleUserRecipe(DatabaseContext db)
{
public Dictionary<string, string?> Seed(string email)
{
var userSeeder = new UserSeeder(Guid.NewGuid());
var user = userSeeder.CreateUser(email);
db.Add(user);
db.SaveChanges();
return userSeeder.GetMangleMap(user, new UserData
{
Email = email,
Id = Guid.Parse("00000000-0000-0000-0000-000000000001"),
Key = "seeded_key",
PublicKey = "seeded_public_key",
PrivateKey = "seeded_private_key",
ApiKey = "seeded_api_key",
Kdf = KdfType.PBKDF2_SHA256,
KdfIterations = 600_000,
});
}
}