1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

public and private keys added to db and user domain. added account APIs got getting and putting keys.

This commit is contained in:
Kyle Spearrin
2017-02-11 23:00:55 -05:00
parent 7589f9c933
commit 024ee08907
6 changed files with 75 additions and 4 deletions

View File

@ -0,0 +1,23 @@
using Bit.Core.Domains;
using System.ComponentModel.DataAnnotations;
namespace Bit.Api.Models
{
public class KeysRequestModel
{
public string PublicKey { get; set; }
[Required]
public string PrivateKey { get; set; }
public User ToUser(User existingUser)
{
if(!string.IsNullOrWhiteSpace(PublicKey))
{
existingUser.PublicKey = PublicKey;
}
existingUser.PrivateKey = PrivateKey;
return existingUser;
}
}
}

View File

@ -0,0 +1,23 @@
using System;
using Bit.Core.Domains;
namespace Bit.Api.Models
{
public class KeysResponseModel : ResponseModel
{
public KeysResponseModel(User user)
: base("keys")
{
if(user == null)
{
throw new ArgumentNullException(nameof(user));
}
PublicKey = user.PublicKey;
PrivateKey = user.PrivateKey;
}
public string PublicKey { get; set; }
public string PrivateKey { get; set; }
}
}