CVR Manager 1.0.0
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace CVRManager.Services;
|
||||
|
||||
public static class TokenVault
|
||||
{
|
||||
public static string Protect(string token) =>
|
||||
Convert.ToBase64String(ProtectedData.Protect(Encoding.UTF8.GetBytes(token), null, DataProtectionScope.CurrentUser));
|
||||
|
||||
public static string Unprotect(string stored)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stored)) return "";
|
||||
try { return Encoding.UTF8.GetString(ProtectedData.Unprotect(Convert.FromBase64String(stored), null, DataProtectionScope.CurrentUser)); }
|
||||
catch { return ""; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user