mirror of
https://github.com/bitwarden/server.git
synced 2026-02-07 17:33:11 +08:00
30 lines
822 B
C#
30 lines
822 B
C#
using Bit.Core.Vault.Entities;
|
|
using Bit.Core.Vault.Enums;
|
|
using Bit.Seeder.Models;
|
|
|
|
namespace Bit.Seeder.Factories;
|
|
|
|
internal static class SshKeyCipherSeeder
|
|
{
|
|
internal static Cipher Create(
|
|
string encryptionKey,
|
|
string name,
|
|
SshKeyViewDto sshKey,
|
|
Guid? organizationId = null,
|
|
Guid? userId = null,
|
|
string? notes = null)
|
|
{
|
|
var cipherView = new CipherViewDto
|
|
{
|
|
OrganizationId = organizationId,
|
|
Name = name,
|
|
Notes = notes,
|
|
Type = CipherTypes.SshKey,
|
|
SshKey = sshKey
|
|
};
|
|
|
|
var encrypted = CipherEncryption.Encrypt(cipherView, encryptionKey);
|
|
return CipherEncryption.CreateEntity(encrypted, encrypted.ToSshKeyData(), CipherType.SSHKey, organizationId, userId);
|
|
}
|
|
}
|