Skip to content

Commit

Permalink
Merge pull request #12 from dodobrands/demo-register-interrupt-fix
Browse files Browse the repository at this point in the history
[Demo] Use username hash as userhandle
  • Loading branch information
vanbukin authored Mar 23, 2024
2 parents a144f86 + 9cd0abf commit cb6a939
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 cb6a939

Please sign in to comment.