HOME 5 miesięcy temu
rodzic
commit
b436206ce2
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      PCC.Shared/App/Security/TimestampNonceManager.cs

+ 2 - 2
PCC.Shared/App/Security/TimestampNonceManager.cs

@@ -84,7 +84,7 @@ public class TimestampNonceManager : IDisposable
             : TimestampNonceResult.ReplayAttackDetected;
     }
 
-    /// <summary> 验证nonce并提取payload: null时间误差过大,false检测到重放攻击,true没问题 </summary>
+    /// <summary> 验证nonce并提取payload </summary>
     public (TimestampNonceResult, DateTimeOffset timestamp, ReadOnlyMemory<byte> payload) CheckValidAndExtractPayload(ReadOnlyMemory<byte> payloadAndNonce)
     {
         ThrowIfDisposed();
@@ -99,7 +99,7 @@ public class TimestampNonceManager : IDisposable
         // 检查时间戳是否在允许的时间窗口内, 超过最大时间差则拒绝
         if (Math.Abs((DateTimeOffset.UtcNow - timestamp).TotalMilliseconds) > _maxTimeSkew.TotalMilliseconds) return (TimestampNonceResult.TimestampSkew, timestamp, payload);
 
-        // 如果 nonce 已存在,则为重放攻击,返回 false;否则添加并返回 true
+        // 如果 nonce 已存在,则为重放攻击
         return (_holds.TryAdd(nonce, DateTime.UtcNow) ? TimestampNonceResult.OK : TimestampNonceResult.ReplayAttackDetected, timestamp, payload);
     }