Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync code #63

Merged
merged 10 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions Controllers/Models/Register.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using SimpleWebChatApplication.Services;

namespace SimpleWebChatApplication.Controllers.Models;
Expand All @@ -18,19 +19,36 @@ public readonly struct RegisterUserPostResponse {
/// RegisterController 用户 Post 方法用户数据序列化模板。
/// </summary>
public readonly struct RegisterUserPostJsonSerializeTemplate {
public RegisterUserPostJsonSerializeTemplate() => HMACKey = IGeneralTools.GenerateRandomData(16).ToArray();
public RegisterUserPostJsonSerializeTemplate() => _hmacKey = IGeneralTools.GenerateRandomData(16).ToArray();

[JsonPropertyName("a")]
public string? Account { get; init; }

private readonly byte[]? _passwordHash;

[JsonPropertyName("h")]
public byte[]? PasswordHash { get; init; }
public byte[]? PasswordHash {
get => (byte[]?)_passwordHash?.Clone();
init => _passwordHash = value;
}

private readonly byte[]? _passwordSalt;

[JsonPropertyName("s")]
public byte[]? PasswordSalt { get; init; }
public byte[]? PasswordSalt {
get => (byte[]?)_passwordSalt?.Clone();
init => _passwordSalt = value;
}

private readonly byte[] _hmacKey;

private byte[] GetHMACKey() => (byte[])_hmacKey.Clone();

[JsonPropertyName("k")]
public byte[] HMACKey { get; init; }
public byte[] HMACKey {
get => GetHMACKey();
init => _hmacKey = value;
}
}


Expand Down
12 changes: 6 additions & 6 deletions SimpleWebChatApplication.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>x64;ARM64</Platforms>
Expand All @@ -16,11 +16,11 @@
<ItemGroup>
<PackageReference Include="LC6464.ASPNET.Http304" Version="1.1.0" />
<PackageReference Include="LC6464.ASPNET.AddResponseHeaders" Version="1.3.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.9" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.9" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.5" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.1.5">
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.0" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.7" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
38 changes: 29 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.