Sergi Delgado Segura
0e5a99b778
Fixes potential runtime errors for dictionaries changing size
2020-04-21 13:40:43 +02:00
Sergi Delgado Segura
96cb8d4afd
Adds user_id to ExtendedAppointment after authentication
...
The ExtendedAppointment is passed to the Watcher without user_id, since the user is not yet authenticated.
The Watcher has to add the user_id to the ExtendedAppointment after the user is authenticated.
2020-04-20 17:59:57 +02:00
Sergi Delgado Segura
6ef6e68e18
Adds Responder.get_summary. Fixes bug on Responder.get_expired_trackers
2020-04-20 17:59:56 +02:00
Sergi Delgado Segura
797cb9786e
Adds new gatekeeper tests
2020-04-20 17:59:47 +02:00
Sergi Delgado Segura
66dce42526
Adds get_summary to extended appointment
...
The Watcher used to create the summary, but that was not modular enough and introduced issues when testing
2020-04-20 17:58:41 +02:00
Sergi Delgado Segura
2e6095971d
Improves docstrings
2020-04-20 17:58:41 +02:00
Sergi Delgado Segura
eea12a695e
Improves API returns for 404 and extends tests to cover it
2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
8fad4d79cc
Small fixes and docs
2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
a9b255e267
Removes gatekeeper from API
2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
8e3caadc5c
Adds ExtendedAppointent unit tests and simplifies Appointment's
2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
3f15459f2c
Creates ExtendedAppointment as an appointment with user information
2020-04-20 17:58:16 +02:00
Sergi Delgado Segura
86e97e37bf
Removes start/end time from appointment
2020-04-20 17:56:58 +02:00
Sergi Delgado Segura
9cbd9ed18a
Adds end time to the user (subscription) information. It will replace the appointment one.
2020-04-20 17:56:58 +02:00
Sergi Delgado Segura
a1a87ba9da
Can't -> cannot
2020-04-20 17:30:17 +02:00
Sergi Delgado Segura
08701f0fee
Refactors Cryptographer to remove logs and avoid multi return types
...
Cryptographer now uses exceptions to report errors and does not use the log anymore
2020-04-20 17:30:16 +02:00
Sergi Delgado Segura
71507d4c32
Gets rid of blob classes. Close #66
2020-04-20 17:30:16 +02:00
Sergi Delgado Segura
ed8ff228d8
First commands with basic structure.
...
- Moves DBManager to common.
2020-04-20 17:30:15 +02:00
Sergi Delgado Segura
472efd847b
Typos
2020-04-20 17:01:55 +02:00
Sergi Delgado Segura
bed21e9625
Adds API HOST and PORT as configurable parameters.
...
Uses API_BIND/API_PORT for the server and API_CONNECT/API_PORT for the user, for consistency.
2020-04-20 17:01:55 +02:00
Sergi Delgado Segura
630c3f6e0c
Fixes last known block initialization on Watcher
2020-04-07 11:40:44 +02:00
Sergi Delgado Segura
75eebf80cd
Adds last_known_block to Watcher and stores last block on db on fresh bootstrap Watcher and Responder
2020-04-07 11:40:44 +02:00
Sergi Delgado Segura
10e856ae74
Fixes typos according to the review
2020-04-03 16:38:46 +02:00
Sergi Delgado Segura
fe73ee7298
Fixes comments, docstrings and some renamings
2020-04-02 15:20:09 +02:00
Sergi Delgado Segura
099ec5d1ce
PEP8 fixes
2020-04-02 10:02:50 +02:00
Sergi Delgado Segura
9a29e59781
Adds additional checks to DBManagers (Appointments and Users)
2020-04-01 21:30:18 +02:00
Sergi Delgado Segura
3009bb83ba
Addaps api and daemon to use userDB
2020-04-01 18:26:36 +02:00
Sergi Delgado Segura
a46bab6b20
Adds user database and modifies registered_user content to be a dict instead of an int
...
Future additional data may be stored, so it's better if we store it as something that can hold it
2020-04-01 18:25:14 +02:00
Sergi Delgado Segura
7031b552f7
Splits DBManager in parent and child classes so a UserDBManager can be implemented
...
- DBManager preserves the basic methods, while the appointment related ones have been moved to AppointmentDBM.
- AppointmentDBM handles json loads and dumps for appointments and trackers, so the corresponding methods can be removed from their classes.
- Updates docs.
2020-04-01 17:18:37 +02:00
Sergi Delgado Segura
2d67fe8638
rpc_passwd -> rpc_password. The former can be confusing since the bitcoind parameter is rpcpassword. Avoiding that.
2020-04-01 11:14:20 +02:00
Sergi Delgado Segura
502f507b21
Adds missing size field in Builder when loading data from the database
2020-03-31 15:00:30 +02:00
Sergi Delgado Segura
b56123055d
Adds flake8 and fixes style issues
2020-03-31 13:06:44 +02:00
Sergi Delgado Segura
354724075e
Moves route assignment to API constructor so it can be properly tested
2020-03-30 22:16:22 +02:00
Sergi Delgado Segura
c9b3bb625f
Fixes slots difference calculation
2020-03-30 22:15:59 +02:00
Sergi Delgado Segura
f55e37b0fc
Adds unit test for watcher.get_appointment_summary
2020-03-30 16:22:52 +02:00
Sergi Delgado Segura
495ea3800e
Fixes get_appointment response structure: {"locator": l, "status": s, "data": appointment_data}
2020-03-30 16:22:38 +02:00
Sergi Delgado Segura
33966e59e1
Moves (and renames) check_user_pk to common so cli can use it too. Fixes the regex so it only accepts {02, 03} as prefix
2020-03-30 13:06:01 +02:00
Sergi Delgado Segura
e924b57efc
Appointment updates only do not decrease slots if not necessary
...
- For a given appointment, checks if it is an update and computes the difference of sizes if so.
- Additional slots are only filled if the new version is bigger. Slots are freed if the update is smaller.
- Adds get_appoiment_summary to get information in memory information of an appointment (so the API can check if a request is an update)
- The API computes the uuid and requests it to the tower.
- Size field has been added to all in memory appointments
2020-03-30 12:49:53 +02:00
Sergi Delgado Segura
6547e75a19
Adds user exist restriction to fill/free slots and update comments/docs
2020-03-27 17:28:07 +01:00
Sergi Delgado Segura
7e6a4849e6
Adds register unit tests, missing add and get appointment tests and sets MAX_APPOINTMENTS to 100 for testing
2020-03-27 14:58:35 +01:00
Sergi Delgado Segura
3946599f91
Sets a more realistic valut for max_appointments and add default_slots in config
2020-03-27 14:57:19 +01:00
Sergi Delgado Segura
4c21326974
Moves slots added on register from gatekeeper to config
2020-03-27 14:57:11 +01:00
Sergi Delgado Segura
50c35a5ac1
Makes sure the received data in posts have the proper format and content
2020-03-27 14:04:37 +01:00
Sergi Delgado Segura
a19e4f2c2e
Updates docs and comments in api
2020-03-27 13:11:27 +01:00
Sergi Delgado Segura
9e798916d1
Fixes API return HTTP return types and messages
2020-03-27 12:07:26 +01:00
Sergi Delgado Segura
a6f9cbf44e
Prevents adding the same uuid twice in the map (appointment update)
2020-03-26 19:06:38 +01:00
Sergi Delgado Segura
3d8c0a9498
Applies new uuid apporach to the Watcher
2020-03-26 19:06:38 +01:00
Sergi Delgado Segura
460a98d42f
Improves and simplifies the API by using the exceptions provided from the Inspector and Gatekeeper.
...
- Refactors and simplifies `add_appointment`
- Modifies `get_appointment` as a POST interface and to require user signatures.
- Defines a new way of creating uuids to avoid storing user_pu:uuids maps.
- The uuids are now defined as RIPMED160(locator|user_pk) instead of using `uuid4`.
- Add missing docs and fixes the existing ones
2020-03-26 19:06:31 +01:00
Sergi Delgado Segura
9bc3bf2e6e
Refactors and improves the gatekeeper
...
Following the same apporach as the Inspector, the gatekeeper now raises exceptions depending on the error encountered.
Also generalises `identify_user` so it can be used with any kind of user-signed message.
Finally lifts the restriction of having available slots on `identify_user` (that only applied to `add_appointent`).
2020-03-26 17:21:18 +01:00
Sergi Delgado Segura
b3d67b4ce3
Refactors Inspector so it returns exceptions for invalid data instead of error codes
...
Defines InspectionFailed, and exception that it's raised for invalid parameters. The design looks much cleaner now.
2020-03-26 17:10:16 +01:00
Sergi Delgado Segura
f7260bc1ce
Improves and simplifies add_appointment
2020-03-25 21:16:50 +01:00