v6: Replace account.proto with net model

This commit is contained in:
Liza 2023-12-08 03:52:50 +01:00
parent 64e576a004
commit 4ded313998
Signed by: liza
GPG Key ID: 7199F8D727D55F67
11 changed files with 111 additions and 145 deletions

View File

@ -39,22 +39,17 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.12"/> <PackageReference Include="DalamudPackager" Version="2.1.12"/>
<PackageReference Include="Dalamud.Extensions.MicrosoftLogging" Version="2.0.0"/> <PackageReference Include="Dalamud.Extensions.MicrosoftLogging" Version="2.0.0"/>
<PackageReference Include="Google.Protobuf" Version="3.25.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.59.0"/>
<PackageReference Include="GitInfo" Version="2.3.0"> <PackageReference Include="GitInfo" Version="2.3.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Grpc.Tools" Version="2.59.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.13" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0"/> <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="7.0.1"/> <PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -63,12 +58,6 @@
<ProjectReference Include="..\vendor\LLib\LLib.csproj" /> <ProjectReference Include="..\vendor\LLib\LLib.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Protobuf Include="..\Pal.Common\Protos\account.proto" Link="Protos\account.proto" GrpcServices="Client" Access="Internal"/>
<Protobuf Include="..\Pal.Common\Protos\palace.proto" Link="Protos\palace.proto" GrpcServices="Client" Access="Internal"/>
<Protobuf Include="..\Pal.Common\Protos\export.proto" Link="Protos\export.proto" GrpcServices="Client" Access="Internal"/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<!--You may need to adjust these paths yourself. These point to a Dalamud assembly in AppData.--> <!--You may need to adjust these paths yourself. These point to a Dalamud assembly in AppData.-->
<Reference Include="Dalamud"> <Reference Include="Dalamud">

View File

@ -23,28 +23,6 @@
"resolved": "2.3.0", "resolved": "2.3.0",
"contentHash": "LdnsKNdwQvdDvpPYQuoGjXML75dY7NybKRe+qlkPPQaTY4dE5Fy8VCrD8YBhXO0fH/5xnmvKeSq4yztzg5KY0Q==" "contentHash": "LdnsKNdwQvdDvpPYQuoGjXML75dY7NybKRe+qlkPPQaTY4dE5Fy8VCrD8YBhXO0fH/5xnmvKeSq4yztzg5KY0Q=="
}, },
"Google.Protobuf": {
"type": "Direct",
"requested": "[3.25.0, )",
"resolved": "3.25.0",
"contentHash": "pIEkH1IqZV1iK8J5MYdG1kOyY0EoQLB6yEKvBq12RYNtvGXwCvnQg5zQsFmcqAEPtIZvSqPozIbUZaEd5a2gCg=="
},
"Grpc.Net.Client": {
"type": "Direct",
"requested": "[2.59.0, )",
"resolved": "2.59.0",
"contentHash": "I2CP5aLTek9mz7OwmM8T94pzvuV2Jib91KqzHh+vohazx/rL0ks1GCsUrwf+7866UsSsOznaWRKqFxWPEYstpg==",
"dependencies": {
"Grpc.Net.Common": "2.59.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.0"
}
},
"Grpc.Tools": {
"type": "Direct",
"requested": "[2.59.0, )",
"resolved": "2.59.0",
"contentHash": "LzL71SCmx62zh6YMBOAEYxzK7LlhHYsBADnawyn8u3n/HL6qntZtGN2ep69T734zBQKWPBQVbVdiIaqaqOfhXg=="
},
"Microsoft.EntityFrameworkCore.Sqlite": { "Microsoft.EntityFrameworkCore.Sqlite": {
"type": "Direct", "type": "Direct",
"requested": "[7.0.13, )", "requested": "[7.0.13, )",
@ -66,34 +44,29 @@
}, },
"Microsoft.Extensions.Logging": { "Microsoft.Extensions.Logging": {
"type": "Direct", "type": "Direct",
"requested": "[7.0.0, )", "requested": "[8.0.0, )",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "Nw2muoNrOG5U5qa2ZekXwudUn2BJcD41e65zwmDHb1fQegTX66UokLWZkJRpqSSHXDOWZ5V0iqhbxOEky91atA==", "contentHash": "tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==",
"dependencies": { "dependencies": {
"Microsoft.Extensions.DependencyInjection": "7.0.0", "Microsoft.Extensions.DependencyInjection": "8.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging.Abstractions": "7.0.0", "Microsoft.Extensions.Options": "8.0.0"
"Microsoft.Extensions.Options": "7.0.0" }
},
"System.Net.Http.Json": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "48Bxrd6zcGeQzS4GMEDVjuqCcAw/9wcEWnIu48FQJ5IzfKPiMR1nGtz9LrvGzU4+3TLbx/9FDlGmCUeLin1Eqg==",
"dependencies": {
"System.Text.Json": "8.0.0"
} }
}, },
"System.Security.Cryptography.ProtectedData": { "System.Security.Cryptography.ProtectedData": {
"type": "Direct", "type": "Direct",
"requested": "[7.0.1, )", "requested": "[8.0.0, )",
"resolved": "7.0.1", "resolved": "8.0.0",
"contentHash": "3evI3sBfKqwYSwuBcYgShbmEgtXcg8N5Qu+jExLdkBXPty2yGDXq5m1/4sx9Exb8dqdeMPUs/d9DQ0wy/9Adwg==" "contentHash": "+TUFINV2q2ifyXauQXRwy4CiBhqvDEDZeVJU7qfxya4aRYOKzVBpN+4acx25VcPB9ywUN6C0n8drWl110PhZEg=="
},
"Grpc.Core.Api": {
"type": "Transitive",
"resolved": "2.59.0",
"contentHash": "n0QpwXqri/Uu7pXWbE6PWVANEhKggC6QRX7qsSR4vyzZRDN2jBPoUNvrJP7RBw7g8Dgg8e2bWYuGKq4ph6VXeA=="
},
"Grpc.Net.Common": {
"type": "Transitive",
"resolved": "2.59.0",
"contentHash": "9j1wKAeCzjnx/j8CC8chXRoLCuzJ9VhhlhwMkbW37mS1Ox4vv0i2pcefpDY5INIeE1BmPNIuPtqFLOUktkiKrQ==",
"dependencies": {
"Grpc.Core.Api": "2.59.0"
}
}, },
"Humanizer.Core": { "Humanizer.Core": {
"type": "Transitive", "type": "Transitive",
@ -190,16 +163,16 @@
}, },
"Microsoft.Extensions.DependencyInjection": { "Microsoft.Extensions.DependencyInjection": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "elNeOmkeX3eDVG6pYVeV82p29hr+UKDaBhrZyWvWLw/EVZSYEkZlQdkp0V39k/Xehs2Qa0mvoCvkVj3eQxNQ1Q==", "contentHash": "V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==",
"dependencies": { "dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0" "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
} }
}, },
"Microsoft.Extensions.DependencyInjection.Abstractions": { "Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "h3j/QfmFN4S0w4C2A6X7arXij/M/OVw3uQHSOFxnND4DyAzO1F9eMX7Eti7lU/OkSthEE0WzRsfT/Dmx86jzCw==" "contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg=="
}, },
"Microsoft.Extensions.DependencyModel": { "Microsoft.Extensions.DependencyModel": {
"type": "Transitive", "type": "Transitive",
@ -212,22 +185,25 @@
}, },
"Microsoft.Extensions.Logging.Abstractions": { "Microsoft.Extensions.Logging.Abstractions": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==" "contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
}
}, },
"Microsoft.Extensions.Options": { "Microsoft.Extensions.Options": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "lP1yBnTTU42cKpMozuafbvNtQ7QcBjr/CcK3bYOGEMH55Fjt+iecXjT6chR7vbgCMqy3PG3aNQSZgo/EuY/9qQ==", "contentHash": "JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==",
"dependencies": { "dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Primitives": "7.0.0" "Microsoft.Extensions.Primitives": "8.0.0"
} }
}, },
"Microsoft.Extensions.Primitives": { "Microsoft.Extensions.Primitives": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==" "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g=="
}, },
"Mono.TextTemplating": { "Mono.TextTemplating": {
"type": "Transitive", "type": "Transitive",
@ -279,15 +255,15 @@
}, },
"System.Text.Encodings.Web": { "System.Text.Encodings.Web": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==" "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
}, },
"System.Text.Json": { "System.Text.Json": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "DaGSsVqKsn/ia6RG8frjwmJonfos0srquhw09TlT8KRw5I43E+4gs+/bZj4K0vShJ5H9imCuXupb4RmS+dBy3w==", "contentHash": "OdrZO2WjkiEG6ajEFRABTRCi/wuXQPxeV6g8xvUJqdxMvvuCCEk86zPla8UiIQJz3durtUEbNyY/3lIhS0yZvQ==",
"dependencies": { "dependencies": {
"System.Text.Encodings.Web": "7.0.0" "System.Text.Encodings.Web": "8.0.0"
} }
}, },
"ecommons": { "ecommons": {
@ -308,8 +284,8 @@
}, },
"System.Text.Encodings.Web": { "System.Text.Encodings.Web": {
"type": "Transitive", "type": "Transitive",
"resolved": "7.0.0", "resolved": "8.0.0",
"contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==" "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
} }
} }
} }

View File

@ -0,0 +1,13 @@
namespace Pal.Common.Net.Models;
public sealed class CreateAccountError
{
public ECreateAccountError Error { get; set; }
}
public enum ECreateAccountError
{
Unknown,
UpgradeRequired,
InvalidHash
}

View File

@ -0,0 +1,6 @@
namespace Pal.Common.Net.Models;
public sealed class CreateAccountReply
{
public required Guid AccountId { get; init; }
}

View File

@ -0,0 +1,9 @@
using System.ComponentModel.DataAnnotations;
namespace Pal.Common.Net.Models;
public sealed class CreateAccountRequest
{
[Required]
public Version? Version { get; set; }
}

View File

@ -0,0 +1,13 @@
namespace Pal.Common.Net.Models;
public sealed class LoginError
{
public required ELoginError Error { get; init; }
}
public enum ELoginError
{
Unknown,
InvalidAccountId,
UpgradeRequired,
}

View File

@ -0,0 +1,6 @@
namespace Pal.Common.Net.Models;
public sealed class LoginReply
{
public required string AuthToken { get; init; }
}

View File

@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Pal.Common.Net.Models;
public sealed class LoginRequest
{
[Required]
public Guid? AccountId { get; set; }
[Required]
public Version? Version { get; set; }
}

View File

@ -0,0 +1,7 @@
namespace Pal.Common.Net.Models;
public sealed class Version
{
public int Major { get; set; }
public int Minor { get; set; }
}

View File

@ -1,65 +0,0 @@
syntax = "proto3";
package account;
service AccountService {
// Accounts are a way to distinguish different players.
//
// Their primary purpose is tracking who has seen a trap/coffer appear to ensure reliability,
// as well as allowing some basic protection against garabage data.
//
// We never store any character data/xiv account data in an account.
rpc CreateAccount(CreateAccountRequest) returns (CreateAccountReply);
rpc Login(LoginRequest) returns (LoginReply);
// Ensures that the auth token we use is valid in calls.
rpc Verify(VerifyRequest) returns (VerifyReply);
}
message CreateAccountRequest {
Version version = 1;
}
message CreateAccountReply {
bool success = 1;
string accountId = 2;
CreateAccountError error = 3;
}
enum CreateAccountError {
CREATE_ACCOUNT_ERROR_NONE = 0;
CREATE_ACCOUNT_ERROR_UNKNOWN = 1;
CREATE_ACCOUNT_ERROR_UPGRADE_REQUIRED = 2;
CREATE_ACCOUNT_ERROR_INVALID_HASH = 3;
}
message LoginRequest {
string accountId = 1;
Version version = 2;
}
message LoginReply {
bool success = 1;
string authToken = 2;
reserved 3; // expiresAt
LoginError error = 4;
}
enum LoginError {
LOGIN_ERROR_NONE = 0;
LOGIN_ERROR_UNKNOWN = 1;
LOGIN_ERROR_INVALID_ACCOUNT_ID = 2;
LOGIN_ERROR_UPGRADE_REQUIRED = 3;
}
message VerifyRequest {
}
message VerifyReply {
}
message Version {
int32 major = 1;
int32 minor = 2;
}

2
Server

@ -1 +1 @@
Subproject commit 299069b57b2d47f47ddd4b5069827c09ac17e66e Subproject commit ad12f4fa2b89fbdd8bab4c10e379a6557c644873