mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 04:45:20 +00:00
* Extract each type to a separate file * NoiseSessionManager: Remove unused functions --------- Co-authored-by: jack <212554440+jackjackbits@users.noreply.github.com>
23 lines
598 B
Swift
23 lines
598 B
Swift
//
|
|
// NoiseSecurityValidator.swift
|
|
// bitchat
|
|
//
|
|
// This is free and unencumbered software released into the public domain.
|
|
// For more information, see <https://unlicense.org>
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct NoiseSecurityValidator {
|
|
|
|
/// Validate message size
|
|
static func validateMessageSize(_ data: Data) -> Bool {
|
|
return data.count <= NoiseSecurityConstants.maxMessageSize
|
|
}
|
|
|
|
/// Validate handshake message size
|
|
static func validateHandshakeMessageSize(_ data: Data) -> Bool {
|
|
return data.count <= NoiseSecurityConstants.maxHandshakeMessageSize
|
|
}
|
|
}
|