diff --git a/Directory.Build.props b/Directory.Build.props
index 3d1af457..3c84b8a5 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -14,7 +14,7 @@
MIT
© Meta Vens and contributors
true
- 1.0.16
+ 1.0.17
true
diff --git a/tests/GameCult.Networking.Tests/NetworkingTests.cs b/tests/GameCult.Networking.Tests/NetworkingTests.cs
index 5c79ab50..480f9d42 100644
--- a/tests/GameCult.Networking.Tests/NetworkingTests.cs
+++ b/tests/GameCult.Networking.Tests/NetworkingTests.cs
@@ -3207,10 +3207,15 @@ namespace GameCult.Networking.Tests
}
[Test]
- public void CultMeshAuthorityLeaseCatalog_Authorizes_PeerRoleAndShard()
+ public void CultMeshAuthorityResolver_Authorizes_PeerRoleAndShard()
{
var now = DateTimeOffset.Parse("2026-05-20T12:00:00.0000000Z");
var catalog = CultMesh.CreateAuthorityLeaseCatalog();
+ var resolver = new CultMeshAuthorityResolver(
+ catalog,
+ new AcceptingAuthoritySignatureVerifier(),
+ new NoAuthorityRevocations(),
+ new ManualCultMeshClock(now));
using var peers = CultMesh.CreatePeerCatalog();
var peer = new CultMeshPeerCard(
"peer-primary",
@@ -3221,7 +3226,8 @@ namespace GameCult.Networking.Tests
authorityLeaseId: "lease-primary");
peers.Upsert(peer);
- Assert.That(peers.FindAuthorized("aetheria-main", CultMeshPeerRoles.ShardPrimary, catalog, "players-us-east", now), Is.Empty);
+ Assert.That(peers.FindAuthorized(
+ "aetheria-main", CultMeshPeerRoles.ShardPrimary, resolver, 1, "players-us-east"), Is.Empty);
catalog.Upsert(new CultMeshAuthorityLease(
"lease-primary",
"aetheria-main",
@@ -3231,15 +3237,24 @@ namespace GameCult.Networking.Tests
"gc-operator",
now.AddMinutes(-5),
now.AddMinutes(5),
- signature: "sig"));
+ signature: "sig",
+ authorityEpoch: 1));
- Assert.That(catalog.IsAuthorized(peer, CultMeshPeerRoles.ShardPrimary, "players-us-east", now), Is.True);
- Assert.That(peers.FindAuthorized("aetheria-main", CultMeshPeerRoles.ShardPrimary, catalog, "players-us-east", now).Single(), Is.SameAs(peer));
- Assert.That(peers.FirstAuthorized("aetheria-main", CultMeshPeerRoles.ShardPrimary, catalog, "players-us-east", now), Is.SameAs(peer));
- Assert.That(peers.FirstAuthorized("aetheria-main", CultMeshPeerRoles.ReadReplica, catalog, "players-us-east", now), Is.Null);
- Assert.That(catalog.IsAuthorized(peer, CultMeshPeerRoles.ShardPrimary, "players-eu", now), Is.False);
- Assert.That(catalog.IsAuthorized(peer, CultMeshPeerRoles.ReadReplica, "players-us-east", now), Is.False);
- Assert.That(catalog.IsAuthorized(peer, CultMeshPeerRoles.ShardPrimary, "players-us-east", now.AddMinutes(6)), Is.False);
+ Assert.That(resolver.Resolve(new CultMeshAuthorityRequest(
+ peer, CultMeshPeerRoles.ShardPrimary, "players-us-east", 1)).IsAuthorized, Is.True);
+ Assert.That(peers.FindAuthorized(
+ "aetheria-main", CultMeshPeerRoles.ShardPrimary, resolver, 1, "players-us-east").Single(), Is.SameAs(peer));
+ Assert.That(peers.FirstAuthorized(
+ "aetheria-main", CultMeshPeerRoles.ShardPrimary, resolver, 1, "players-us-east"), Is.SameAs(peer));
+ Assert.That(peers.FirstAuthorized(
+ "aetheria-main", CultMeshPeerRoles.ReadReplica, resolver, 1, "players-us-east"), Is.Null);
+ Assert.That(resolver.Resolve(new CultMeshAuthorityRequest(
+ peer, CultMeshPeerRoles.ShardPrimary, "players-eu", 1)).IsAuthorized, Is.False);
+ Assert.That(resolver.Resolve(new CultMeshAuthorityRequest(
+ peer, CultMeshPeerRoles.ReadReplica, "players-us-east", 1)).IsAuthorized, Is.False);
+#pragma warning disable CS0618
+ Assert.That(catalog.IsAuthorized(peer, CultMeshPeerRoles.ShardPrimary, "players-us-east", now), Is.False);
+#pragma warning restore CS0618
}
[Test]
@@ -3271,6 +3286,11 @@ namespace GameCult.Networking.Tests
using var peers = CultMesh.CreatePeerCatalog();
var leases = CultMesh.CreateAuthorityLeaseCatalog();
var now = DateTimeOffset.UtcNow;
+ var authority = new CultMeshAuthorityResolver(
+ leases,
+ new AcceptingAuthoritySignatureVerifier(),
+ new NoAuthorityRevocations(),
+ new ManualCultMeshClock(now));
var peer = new CultMeshPeerCard(
"csharp-cultmesh-rudp-server",
"local",
@@ -3283,10 +3303,10 @@ namespace GameCult.Networking.Tests
"csharp-cultmesh-rudp-client",
connectionId,
peers,
- leases,
+ authority,
+ 1,
"local",
"schema",
- at: now,
options: new CultMeshRudpSocketOptions
{
ResendDelayMs = 25,
@@ -3302,7 +3322,9 @@ namespace GameCult.Networking.Tests
[],
"csharp-authority",
now.AddSeconds(-1),
- now.AddSeconds(30)));
+ now.AddSeconds(30),
+ signature: "sig",
+ authorityEpoch: 1));
using var serverPumpCts = new CancellationTokenSource();
var serverPump = Task.Run(() =>
@@ -3319,10 +3341,10 @@ namespace GameCult.Networking.Tests
"csharp-cultmesh-rudp-client",
connectionId,
peers,
- leases,
+ authority,
+ 1,
"local",
"schema",
- at: now,
options: new CultMeshRudpClientOptions
{
ConnectPayload = Encoding.UTF8.GetBytes("join"),
@@ -5085,6 +5107,17 @@ namespace GameCult.Networking.Tests
}
}
+ private sealed class AcceptingAuthoritySignatureVerifier : ICultMeshAuthoritySignatureVerifier
+ {
+ public bool Verify(CultMeshAuthorityLease lease) =>
+ string.Equals(lease.Signature, "sig", StringComparison.Ordinal);
+ }
+
+ private sealed class NoAuthorityRevocations : ICultMeshAuthorityRevocationSource
+ {
+ public bool IsRevoked(string leaseId, long authorityEpoch) => false;
+ }
+
[MessagePack.MessagePackObject]
public sealed class PlayerDataPayload
{
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.dll b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.dll
index 7f85858e..a04121ee 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.dll and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.dll differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.pdb b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.pdb
index 34f842cf..52e90dd3 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.pdb and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.MessagePack.pdb differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.dll b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.dll
index 09336d25..13dda8a4 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.dll and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.dll differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.pdb b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.pdb
index 9096bc98..e5fa0f25 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.pdb and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Caching.pdb differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.dll b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.dll
index e30e230b..bbb19751 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.dll and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.dll differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.pdb b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.pdb
index 98a6d3b4..48df96f5 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.pdb and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Logging.pdb differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.dll b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.dll
index 01e93659..4c209fbe 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.dll and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.dll differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.pdb b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.pdb
index 46453cdc..23a5cc92 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.pdb and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Mesh.pdb differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.dll b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.dll
index 645e5f86..9d8d79cb 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.dll and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.dll differ
diff --git a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.pdb b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.pdb
index 9f124d1a..4175bf71 100644
Binary files a/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.pdb and b/unity/org.gamecult.cultlib/Runtime/Plugins/GameCult.Networking.pdb differ
diff --git a/unity/org.gamecult.cultlib/package.json b/unity/org.gamecult.cultlib/package.json
index 03f02fa6..66fcfa90 100644
--- a/unity/org.gamecult.cultlib/package.json
+++ b/unity/org.gamecult.cultlib/package.json
@@ -1,7 +1,7 @@
{
"name": "org.gamecult.cultlib",
"displayName": "CultLib",
- "version": "1.0.16",
+ "version": "1.0.17",
"unity": "2021.3",
"description": "CultCache, CultNet, and CultMesh managed runtime assemblies for Unity.",
"license": "MIT",