Skip to content

Commit

Permalink
Use username hash as userhandle
Browse files Browse the repository at this point in the history
  • Loading branch information
Keroosha committed Mar 22, 2024
1 parent a144f86 commit 9cd0abf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Text.Json;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.WebUtilities;
Expand Down Expand Up @@ -106,7 +108,7 @@ private void Write(HttpContext httpContext, TypedInternalApplicationUser[] items

private static TypedInternalApplicationUser Create(string userName)
{
var userHandle = Guid.NewGuid().ToByteArray();
var userHandle = SHA256.HashData(Encoding.UTF8.GetBytes(userName));
var createdAt = DateTimeOffset.FromUnixTimeSeconds(DateTimeOffset.UtcNow.ToUnixTimeSeconds());
return new(userHandle, userName, createdAt);
}
Expand Down

0 comments on commit 9cd0abf

Please sign in to comment.