The core infrastructure backend (API, database, Docker, etc).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
650 B

using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Utilities;
using Bit.Seeder.Pipeline;
namespace Bit.Seeder.Steps;
internal sealed class CreateOrganizationApiKeyStep : IStep
{
public void Execute(SeederContext context)
{
var org = context.RequireOrganization();
var apiKey = new OrganizationApiKey
{
Id = CoreHelpers.GenerateComb(),
OrganizationId = org.Id,
Type = OrganizationApiKeyType.Default,
ApiKey = CoreHelpers.SecureRandomString(30),
RevisionDate = DateTime.UtcNow,
};
context.OrganizationApiKey = apiKey;
}
}