PeerID 6/n: Unifiy validation (#743)

This commit is contained in:
Islam
2025-10-02 13:36:49 +02:00
committed by GitHub
parent e4ec2ef3fe
commit 8cfee095d3
6 changed files with 3 additions and 74 deletions
@@ -407,7 +407,7 @@ final class NoiseEncryptionService {
func initiateHandshake(with peerID: String) throws -> Data {
// Validate peer ID
guard NoiseSecurityValidator.validatePeerID(peerID) else {
guard PeerID(str: peerID).isValid else {
SecureLogger.warning(.authenticationFailed(peerID: peerID))
throw NoiseSecurityError.invalidPeerID
}
@@ -430,7 +430,7 @@ final class NoiseEncryptionService {
func processHandshakeMessage(from peerID: String, message: Data) throws -> Data? {
// Validate peer ID
guard NoiseSecurityValidator.validatePeerID(peerID) else {
guard PeerID(str: peerID).isValid else {
SecureLogger.warning(.authenticationFailed(peerID: peerID))
throw NoiseSecurityError.invalidPeerID
}