netfishing/network/network_profile_protocol.gd
Voyager 84695c473b Expand per-part fur customization
Load authored pattern masks by body component, add custom fur colors and the themed picker UI, and advance the signed profile protocol to version 6.
2026-08-15 14:27:53 -04:00

56 lines
1.6 KiB
GDScript

class_name NetworkProfileProtocol
extends RefCounted
const RELIABLE_CHANNEL: int = 0
const MAX_SUGGESTIONS: int = 3
const MAX_REQUEST_ID_LENGTH: int = 64
static func valid_request_id(value: Variant) -> bool:
return (
typeof(value) == TYPE_STRING
and not str(value).is_empty()
and str(value).length() <= MAX_REQUEST_ID_LENGTH
)
static func valid_snapshot(value: Variant) -> bool:
return CharacterCustomizationCatalog.validate_snapshot(value)
static func valid_check_request(data: Variant) -> bool:
return (
typeof(data) == TYPE_DICTIONARY
and valid_request_id(data.get("request_id"))
and typeof(data.get("session_id")) == TYPE_STRING
and typeof(data.get("display_name")) == TYPE_STRING
and NetworkProfilePreferences.is_valid_display_name(data["display_name"])
)
static func valid_apply_request(data: Variant) -> bool:
return (
valid_check_request(data)
and typeof(data.get("appearance")) == TYPE_DICTIONARY
and valid_snapshot(data["appearance"])
and typeof(data.get("use_anyway")) == TYPE_BOOL
and NetworkIdentityCrypto.valid_fingerprint(
data.get("sender_fingerprint")
)
and typeof(data.get("sender_signature")) == TYPE_PACKED_BYTE_ARRAY
)
static func signature_fields(data: Dictionary) -> Array:
var appearance: Dictionary = data.get("appearance", {})
var result: Array = [
str(data.get("session_id", "")),
str(data.get("request_id", "")),
str(data.get("sender_fingerprint", "")),
str(data.get("display_name", "")),
]
result.append_array(
CharacterCustomizationCatalog.appearance_signature_values(appearance)
)
result.append(bool(data.get("use_anyway", false)))
return result