{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "https://friendnet.org/schema/external-auth-request.schema.json",
	"title": "ExternalAuthRequest",
	"type": "object",
	"additionalProperties": false,
	"required": ["type", "ip", "room", "username", "password"],
	"properties": {
		"$schema": {
			"type": "string"
		},
		"type": {
			"description": "The request type.\nShould always be \"auth\".\nOther values are reserved for future use.",
			"const": "auth"
		},
		"ip": {
			"description": "The addresses to listen on. Each entry should be HOST:PORT. IPv6 addresses should be enclosed in square brackets (like \"[::1]:20038\").",
			"$ref": "#/$defs/Ip"
		},
		"room": {
			"description": "The room the user is trying to authenticate to.",
			"$ref": "#/$defs/RoomName"
		},
		"username": {
			"description": "The user's username.",
			"$ref": "#/$defs/Username"
		},
		"password": {
			"description": "The user's password.",
			"type": "string"
		}
	},
	"$defs": {
		"Ip": {
			"type": "string",
			"pattern": "^(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|([a-f0-9:]{2,})$"
		},
		"HttpOrUnixUrl": {
			"type": "string",
			"pattern": "^(http|https|unix)://.+$"
		},
		"RoomName": {
			"type": "string",
			"pattern": "^[a-z0-9_]{1,16}$"
		},
		"Username": {
			"type": "string",
			"pattern": "^[a-z0-9_]{1,16}$"
		}
	}
}
