Closed i5hi closed 1 year ago
the library is defined in src/lib.rs, here you can see all the structs and functions exposed by the library.
The examples folders are examples of how you can use the library - notice the first few lines of import statements. We only import generate_puzzle and SlidePuzzle.
All verification is - is checking if the provided solution is within a margin of error of the actual solution - logic for which is contained in the POST puzzle/solution route.
Copy this logic into lib.rs as a verify function and import it into the example.
To know if you got it right, run the example and manually test via curl.
Note: The example has nothing to do with the library itself, it is just an example of how to use the library.
Ignore how the example server stores the solution as an 'Arc<Mutex<HashSet>>>'
this is up to the user of the library.
Users can store the request id and solution in memory as the example or in redis or in postgres or whatever,
what the library is concerned with is just verification of the provided solution against the actual solution within a margin of error.
Thanks @yashwanthambati
Currently verification is left to the user; as illustrated in the
POST puzzle/solution
route inexamples/actix.rs
This should instead be implemented and provided as part of the library.
It can have a signature as follows: