tesses.backup/Tesses.Backup.Server/Models/Login.cs

24 lines
565 B
C#

using System;
using System.Collections.Generic;
using System.Security.Cryptography;
namespace Tesses.Backup.Models
{
public class Login
{
public long Id {get;set;}
public string Key {get;set;}
public long UserId {get;set;}
public static Login Create(long userId)
{
byte[] key = new byte[16];
var rand=RandomNumberGenerator.Create();
rand.GetBytes(key);
return new Login(){UserId = userId,Key = BitConverter.ToString(key).Replace("-","")};
}
}
}