There are two APIs available and to participate in the game you need to implement both:
You can find all DTOs here. Feel free to use this types while playing the game.
You can register yourself to one of the teams using this endpoint. The UUID you receive back should be persisted on your side throughout your game. If you loose your ID you also loose your progress. NOTE: Your name has to be unique
POST /team/register
{
name: "Unique name",
team: "attacker" // or "defender"
}
{
message: "Success",
code: 200,
id: "e256557a-e5c6-4475-a525-9857ea87cdad"
}
You can use this endpoint as an attacker to list all available challenges
GET /challenges
{
message: "Success",
code: 200,
challenges: [
{
id: "fbb89d0f-3f11-43dc-a7fa-f31265df740b",
name: "Reverse sorter",
description: "You receive a random length string array in the first parameter of the hints. Your aim is to change the order of the array and send it back as the first parameter of the solution array",
example: {
hints: ["123456"],
solutions: ["654321"]
}
}
]
}
You can use this endpoint as a defender to install new challenges in the system
NOTE: You will be expected to handle hint and solution evaluation requests as soon as you installed a new module. So ideally you want to get ready for those steps, and this is the last step in your challenge creation flow.
POST /challenges
{
name: "Reverse sorter",
defenderId: "e256557a-e5c6-4475-a525-9857ea87cdad",
description: "You receive a random length string array in the first parameter of the hints. Your aim is to change the order of the array and send it back as the first parameter of the solution array",
example: {
hints: ["123456"],
solutions: ["654321"]
}
}
{
message: "Success",
code: 200,
id: "fbb89d0f-3f11-43dc-a7fa-f31265df740b"
}
You need to persist this ID from the response, as the system will use it to refer to your challenges when you are requested to provide hints or solution evaluations.
Websocket is available through ws://host/team/join
. For this game we use Gorilla Socket and it is recommended.
You can find all socket events typed here.
You are encouraged to use this file either as a dependency or as a copy paste.
Emitted when the player is ready to join the live game.
Example message:
{
"type": "join",
"id": "e256557a-e5c6-4475-a525-9857ea87cdad"
}
Emitted when an error happened during the flow.
Example message:
{
"type": "error",
"message": "Could not parse Attack Event"
}
Emitted to initiate an attack towards a challenge
Example message:
{
"type": "attack",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad"
}
Emitted when an attacker receives results
Example message:
{
"type": "attack_result",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad",
"success": true,
"message": ""
}
{
"type": "attack_result",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad",
"success": false,
"message": "Solutions array was too long"
}
Emitted when hints are returned to the attacker
Example message:
{
"type": "attack_challenge",
"hints": ["123456"],
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad"
}
Emitted when an attacker sends in solutions for hints
Example message:
{
"type": "attack_solution",
"hints": ["123456"],
"solutions": ["654321"],
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad"
}
Emitted when a defender was offline either at requesting hints or at requesting solution validation
Example message:
{
"type": "defender_failed_to_defend",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad"
}
Emitted when the defender is requested to provide hints for an attacker
Example message:
{
"type": "defend_action_request",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad",
"combatId": "8049a606-6861-4536-8bcc-6449f50ae240"
}
Emitted when the defender is providing hints for a challenge
Example message:
{
"type": "defend_action",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad",
"combatId": "8049a606-6861-4536-8bcc-6449f50ae240",
"hints": ["123456"]
}
Emitted when the defender is requested to evaluate a given solution
Example message:
{
"type": "solution_evaluation_request",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad",
"combatId": "8049a606-6861-4536-8bcc-6449f50ae240",
"hints": ["123456"],
"solutions": ["654321"]
}
Emitted when the defender finished evaluation and ready to provide a result for the solutions
Example message:
{
"type": "solution_evaluation",
"targetId": "e256557a-e5c6-4475-a525-9857ea87cdad",
"combatId": "8049a606-6861-4536-8bcc-6449f50ae240",
"success": false,
"message": "Solutions array is too short"
}
You can find examples for attacking and defending here.