Commit Graph

60 Commits

Author SHA1 Message Date
Sergi Delgado Segura
88c19d5a0d teos - moves errors to common so it can be used by clients 2020-04-29 13:03:39 +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
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
80e72f089d Splits exceptions in common + client 2020-04-20 17:30:15 +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
f350182012 sign_recoverable can raise a ValueError, handling it. 2020-04-03 21:56:42 +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
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
0e392d1f2a Cryptographer.sigrec_decode assumed signatures where properly encoded.
- Fixes a bug in sigrec_decode where the decoding function assumend that the first by was formatted as 31 + SigRec. Non properly encoded signatures made the function to crash due to an overflow (int_to_bytes(x) for negative x)
2020-04-01 17:04:33 +02:00
Sergi Delgado Segura
b56123055d Adds flake8 and fixes style issues 2020-03-31 13:06:44 +02:00
Sergi Delgado Segura
c0ada5f818 Improves logging messages 2020-03-30 13:06:35 +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
ae68cd33da Captures TypeErrors in Cryptographer.get_compressed_pk and adds unit tests 2020-03-27 16:50:47 +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
bbe93ae3f1 Adds RIPMED160 hash function 2020-03-26 17:13:38 +01:00
Sergi Delgado Segura
4fad6b7b6f Fixes docstring 2020-03-26 17:09:15 +01:00
Sergi Delgado Segura
83b3913cb5 Adds basic authentication logic.
+ Users need to be registered in order to send appointments (free registration for now)
+ The tower gives them a number of appointments to work with
+ Non-registered users and users with no enough appoitnemnts slots return the same error (to avoid proving)

- Authentication does not cover get_* requests yet
- No tests
- No docs
2020-03-25 17:13:35 +01:00
Sergi Delgado Segura
02eefd5807 Moves extend paths from tools to ConfigLoader 2020-03-23 13:04:50 +01:00
Sergi Delgado Segura
8316892ef2 Uses path.join for safely join paths on common/tools 2020-03-23 12:05:39 +01:00
Sergi Delgado Segura
27e249e665 Adds missing try/catch when casting data from config file in ConfigLoader 2020-03-22 19:09:48 +01:00
Sergi Delgado Segura
00a48ce6f5 Modifies ConfigParser so config file is passed as parameter (to be used by both teos and cli)
- Modifies ConfigParser
- Adapts __init__ and teosd at teos/
2020-03-21 22:02:46 +01:00
Sergi Delgado Segura
b43731397c Updates teos to work with the new conf file format and redefines how objects are built
Configuration parameters are now load from a .conf file (see template.conf as an example).

The code has 3 config levels: default (teos/__init__.py), config file (<data_dir>/teos.conf) and command line.
Most of the config parameters are only modificable trough the config file for now.
The priority order is: command line, config file, default.

Objects that need config parameters are now built in teosd instead of inside other classes. Therefore teosd acts like a factory and config parameters don't have to be passed around between objects. This also implies that a lot of the object creation logic has been changed.

This should simplify unit testing.
2020-03-20 21:38:28 +01:00
Sergi Delgado Segura
6499820540 Adds ConfigLoader to handle loading configurations parameters. Switches from conf.py to .conf files 2020-03-20 21:38:22 +01:00
Sergi Delgado Segura
7c7ff909d7 pisa -> teos 2020-03-17 15:47:38 +01:00
Sergi Delgado Segura
b712e3df0c Changes sign/verify functions to match the ones used by lnd and c-lightning
- Replaces cryptography for coincurve for the signature / recovery operations
- Fixes return types of ecrypt, decrypt to be str (gets rid of rtype)
2020-02-21 13:11:06 +01:00
Sergi Delgado Segura
de2036b19b Fixes cli console log levels so Cryptographer's sensitive info is only logged in disk 2020-02-14 12:42:47 +01:00
Sergi Delgado Segura
02e159faac Moves EncryptedBlob to common 2020-02-13 16:32:51 +01:00
Sergi Delgado Segura
d447debe54 Temporal fix for Cryptographer logs. Close #91 2020-02-11 20:22:51 +01:00
Sergi Delgado Segura
ab21cbfc8f Moves load_key_file to Cryptographer and updates pisad to use it 2020-02-10 16:31:48 +01:00
Sergi Delgado Segura
5c75b1f40d Removes Logger dependency from setup_data_folder
Logger was only used to log when a new folder was created, and was making that the setup needed to be done on the main of pisad and cli instead of __init__, which seems a better fit
2020-01-23 20:12:21 +01:00
Sergi Delgado Segura
dce7b4d39e Adds missing tools docs 2020-01-23 19:00:55 +01:00
Sergi Delgado Segura
1f46e6eb26 Moves logging setup to common
The setup it's identical for cli and pisad
2020-01-23 18:14:34 +01:00
Sergi Delgado Segura
fddf2e6968 Fixes logger not properly working for cli
The Logger was set to use c_logger and f_logger from pisad, so the cli file logs were never created
2020-01-23 18:13:30 +01:00
Sergi Delgado Segura
a3f2d20499 Moves/adds methods to deal with config to common 2020-01-23 18:05:44 +01:00
Sergi Delgado Segura
2559d143aa Fixes logging 2020-01-21 19:06:29 +01:00
Sergi Delgado Segura
90e1245a84 Fixes some bugs based on E2E testing 2020-01-16 17:08:44 +01:00
Sergi Delgado Segura
a49f86dd88 Merge branch 'master' into 64-data-to-disk 2020-01-15 12:44:29 +01:00
Turtle
40d7ca1912 Refactor add_appointment cli code 2020-01-15 03:35:31 -05:00
Sergi Delgado Segura
15f9a9efe1 Removes triggered from to_json
Triggered has been deatached from the appointment having it's own entry into the db, so not part of the appointment data anymore
2020-01-09 18:13:24 +01:00
Sergi Delgado Segura
a69f1ba28b Moves appointment to common and creates serialize
Appointment serialization used to be part of the cryptographer (signature_format) but it makes more sense to be an appointment method. Therefore cli also need Appointment

Also fixes comments based on reviews
2019-12-17 16:21:54 +01:00
Sergi Delgado Segura
46a7fa824f Removes unnecessary encoding when unhexlifying
binascii.unhexlify(x) is equal to binascii.unhexlify(x.encode())
2019-12-17 11:35:28 +01:00
Sergi Delgado Segura
1184b4648a Fixes logs and removes redundant tailing dots 2019-12-16 19:45:30 +01:00
Sergi Delgado Segura
a9df67d787 Properly fromats console logs 2019-12-16 19:44:50 +01:00
Sergi Delgado Segura
77b191dde2 Moves Logger to common 2019-12-16 14:15:30 +01:00
Sergi Delgado Segura
b363cc2d94 Adds missing tool tests 2019-12-16 12:57:28 +01:00