20 lines
581 B
C#
20 lines
581 B
C#
namespace RelayClient.Crypto;
|
|
|
|
public static class KeyStorage
|
|
{
|
|
public static void SavePrivateKey(string username, string privateKey)
|
|
{
|
|
Directory.CreateDirectory("keys");
|
|
File.WriteAllText(Path.Combine("keys", $"{username}.private.key"), privateKey);
|
|
}
|
|
|
|
public static string LoadPrivateKey(string username)
|
|
{
|
|
return File.ReadAllText(Path.Combine("keys", $"{username}.private.key"));
|
|
}
|
|
|
|
public static bool PrivateKeyExists(string username)
|
|
{
|
|
return File.Exists(Path.Combine("keys", $"{username}.private.key"));
|
|
}
|
|
} |