mirror of
https://github.com/bitwarden/server.git
synced 2026-06-01 01:55:55 -05:00
28 lines
868 B
C#
28 lines
868 B
C#
using Bit.Core.Vault.Entities;
|
|
using Bit.Core.Vault.Enums;
|
|
using Bit.Seeder.Models;
|
|
|
|
namespace Bit.Seeder.Factories;
|
|
|
|
internal static class SecureNoteCipherSeeder
|
|
{
|
|
internal static Cipher Create(CipherSeed options)
|
|
{
|
|
|
|
var cipherView = new CipherViewDto
|
|
{
|
|
OrganizationId = options.OrganizationId,
|
|
Name = options.Name,
|
|
Notes = options.Notes,
|
|
Type = CipherTypes.SecureNote,
|
|
SecureNote = options.SecureNote ?? new SecureNoteViewDto { Type = 0 },
|
|
Fields = options.Fields,
|
|
Reprompt = (int)options.Reprompt
|
|
};
|
|
|
|
var encrypted = CipherEncryption.Encrypt(cipherView, options.EncryptionKey!);
|
|
return CipherEncryption.CreateEntity(encrypted, encrypted.ToSecureNoteData(), CipherType.SecureNote, options.OrganizationId, options.UserId);
|
|
}
|
|
|
|
}
|