Inex Code
2db40650ad
Merge remote-tracking branch 'origin/master' into redis/connection-pool
2022-12-30 21:24:49 +03:00
def
2fc635da71
docs: add CONTRIBUTING.md
2022-12-30 21:21:34 +03:00
def
bcfb8e62e9
refactor(repository): Tokens repository JSON backend ( #18 )
...
Co-authored-by: def <dettlaff@riseup.net>
Co-authored-by: Inex Code <inex.code@selfprivacy.org>
Reviewed-on: #18
Co-authored-by: def <dettlaff@riseup.net>
Co-committed-by: def <dettlaff@riseup.net>
2022-12-30 21:20:17 +03:00
Inex Code
24353ca56a
chore: bump API version
2022-12-30 21:10:55 +03:00
Inex Code
45c6133881
Merge pull request 'Migrate to AbstractTokenRepository API' ( #28 ) from redis/token-repo into redis/connection-pool
...
Reviewed-on: #28
2022-12-30 20:06:43 +02:00
Inex Code
cb403a94bd
fix: typing
2022-12-30 21:06:16 +03:00
Inex Code
7b526b7bd9
Merge branch 'redis/connection-pool' into redis/token-repo
2022-12-30 18:31:46 +02:00
Inex Code
999dd95cab
ci: Add redis to CI pipeline
2022-12-27 07:13:03 +03:00
Houkime
67872d7c55
test(tokens-repo): use mnemonic_from_hex consistently
2022-12-26 16:22:16 +00:00
Houkime
3ecfb2eacb
refactor(tokens-repo): delete auth utils
2022-12-26 15:54:33 +00:00
Houkime
450ff41ebd
feat(tokens-repo): make device names unique before storage
2022-12-26 15:51:12 +00:00
Houkime
8235c3595c
refactor(tokens-repo): delete is_token_valid from auth utils
2022-12-26 15:20:58 +00:00
Houkime
7d9bccf4ec
fix(tokens-repo): make is_token_valid infallible
2022-12-26 15:18:02 +00:00
Houkime
87ea88c50a
refactor(tokens-repo): delete get token name from auth utils
2022-12-26 14:56:39 +00:00
Houkime
25326b75ca
refactor(tokens-repo): delete create token from auth utils
2022-12-26 14:55:40 +00:00
Houkime
b3d6251d11
refactor(tokens-repo): delete generare recovery key from auth utils
2022-12-26 14:54:07 +00:00
Houkime
b11e5a5f77
refactor(tokens-repo): delete recovery key quieries from auth utils
2022-12-26 14:51:37 +00:00
Houkime
69577c2854
refactor(tokens-repo): delete get_recovery_key_status from auth utils
2022-12-26 14:29:05 +00:00
Houkime
7cf295450b
refactor(tokens-repo): do not use tokens repo directly from graphql
2022-12-26 14:13:46 +00:00
Houkime
f33d5155b0
refactor(tokens-repo): delete use_new_device_auth_token from auth utils
2022-12-26 14:03:55 +00:00
Houkime
5d4ed73435
fix(tokens-repo): properly expire new device keys
2022-12-26 14:01:36 +00:00
Houkime
c037a12f4d
refactor(tokens-repo): break out _store_new_device_key()
2022-12-26 12:31:09 +00:00
Houkime
29723b9f3a
refactor(tokens-repo): delete use_mnemonic_recoverery_token from auth utils
2022-12-26 11:01:07 +00:00
Houkime
cb1906144c
refactor(tokens-repo): delete get_new_device_auth_token from auth utils
2022-12-26 10:27:10 +00:00
Houkime
3f6aa9bd06
refactor(tokens-repo): delete delete_new_device_auth_token from auth utils
2022-12-26 10:13:37 +00:00
Houkime
5dedbda41f
refactor(tokens-repo): delete get_tokens_info() from auth utils
2022-12-23 12:41:29 +00:00
Houkime
e817de6228
refactor(tokens-repo): use token repo in get_api_tokens_with_caller_flag
2022-12-23 12:29:32 +00:00
Houkime
f928ca160a
refactor(tokens-repo): use token repo in get_api_recovery_token_status action
2022-12-23 12:00:35 +00:00
Houkime
a2ac47b0f5
refactor(tokens-repo): delete delete_token from auth utils
2022-12-23 11:14:52 +00:00
houkime
66480c9904
Merge pull request 'Implement redis token repository' ( #26 ) from redis/token-repo into redis/connection-pool
...
Reviewed-on: #26
2022-12-21 19:39:14 +02:00
Houkime
5a1f64b1e7
refactor(tokens-repo): delete is_name_exists() from auth utils
2022-12-21 17:09:49 +00:00
Houkime
22a309466e
fix(tokens-repo): fix is_name_exists() being fallible
2022-12-21 17:04:18 +00:00
Houkime
2a239e35ad
refactor(tokens-repo): delete is_token_name_pair_valid from auth
2022-12-21 16:17:56 +00:00
Houkime
20410ec790
fix(tokens-repo): fix name pair validation being able to raise a notfound error
2022-12-21 16:10:41 +00:00
Houkime
3021584adc
refactor(tokens-repo): delete refresh_token() from auth
2022-12-21 15:23:42 +00:00
Houkime
16f71b0b09
refactor(tokens-repo): use tokens-repo to create recovery token
2022-12-21 13:53:39 +00:00
Houkime
39277419ac
refactor(tokens-repo): use tokens-repo to refresh tokens
2022-12-21 13:09:51 +00:00
Houkime
d3bf867bb5
fix(tokens-repo): do not change the date on token refresh
2022-12-21 13:05:00 +00:00
Houkime
009a89fa02
refactor(tokens-repo): use token repo for graphql use_recovery_api_key
2022-12-21 10:33:06 +00:00
Houkime
a97705ef25
fix(tokens-repository): fix getting and setting recovery token expiration date
2022-12-21 10:24:05 +00:00
Houkime
ab70687c61
fix(tokens-repository) :make NONE-uses-left eternally valid and test for it
2022-12-19 12:57:32 +00:00
Houkime
5a25e2a270
feat(tokens-repo): getting stored device key
2022-12-16 13:05:06 +00:00
Houkime
0ae7c43ebf
refactor(tokens-repo): break out generic hash_as_model casting
2022-12-16 13:05:00 +00:00
Houkime
6f6a9f5ef0
test(tokens-repo): do not require order in test_delete_not_found_token
2022-12-16 13:04:56 +00:00
Houkime
fda5d315a9
fix(tokens-repo): return device key instead of NewDeviceKey class
2022-12-16 13:04:51 +00:00
Houkime
13e84e2697
feat(tokens-repo): recovery key uses decrement
2022-12-16 13:04:47 +00:00
Houkime
eba1d01b3d
feat(tokens-repo): recovery key creation
2022-12-16 13:04:43 +00:00
Houkime
8dfb3eb936
feat(tokens-repo): fuller reset
2022-12-16 13:04:39 +00:00
Houkime
4579fec569
feat(tokens-repo): get recovery key
2022-12-16 13:04:35 +00:00
Houkime
257096084f
refactor(tokens-repo): split out date field detection
2022-12-16 13:04:26 +00:00
Houkime
bf6c230ae0
fix(tokens-repo): raise token not found when deleting nonexistent token
...
even if device name exists
2022-12-16 13:04:26 +00:00
Houkime
95e200bfc5
feat(tokens-repo): reset function
2022-12-16 13:04:19 +00:00
Houkime
9ffd67fa19
feat(tokens-repo): get new device key
2022-12-16 13:04:14 +00:00
Houkime
b98ccb88d1
refactor(tokens-repo): separate getting model dict
2022-12-16 13:04:04 +00:00
Houkime
3cb7f29593
refactor(tokens-repo): detach preparing a dict before a model cast
2022-12-16 13:03:57 +00:00
Houkime
e504585437
test(tokens-repo): do not require order
2022-12-16 13:03:53 +00:00
Houkime
647e02f25b
feat(tokens-repo): redis delete token
2022-12-16 13:03:46 +00:00
Houkime
ba6a5261fa
refactor(tokens-repo): redis token key func
2022-12-16 13:03:41 +00:00
Houkime
d8e3cd67e0
feat(tokens-repo): redis store token
2022-12-16 13:03:36 +00:00
Houkime
256c16fa9f
feat(tokens-repo): redis get tokens
2022-12-16 13:03:27 +00:00
Houkime
f2fa47466b
feat(tokens-repo):empty implementation of redis token repo
...
But it initializes and fails tests!
2022-12-16 13:03:27 +00:00
Houkime
ca822cdf6f
refactor(tokens-repository): move use_mnemonic_new_device_key() to abstract class
2022-12-16 13:03:27 +00:00
Houkime
2797c6f88f
fix(tokens-repository): use_mnemonic_new_device_key() now stores a token
2022-12-16 13:03:27 +00:00
Houkime
4498003aca
refactor(tokens-repository): dissect use_mnemonic_new_device_key()
2022-12-16 13:03:27 +00:00
Houkime
772c0dfc64
refactor(tokens-repository): move use_mnemonic_recovery_key() to abstract class
2022-12-16 13:03:27 +00:00
Houkime
671203e990
refactor(tokens-repository): dissect use_mnemonic_recovery_key()
2022-12-16 13:03:26 +00:00
Houkime
9a49067e53
refactor(tokens-repo): move token refreshing to parent class
2022-12-16 13:03:12 +00:00
Houkime
682cd4ae87
refactor(tokens-repo): move create_token to abstract class
2022-12-16 13:02:55 +00:00
Houkime
572ec75c39
refactor(tokens-repo): rewrite token refresh
...
now it is not json-dependent.
2022-12-16 13:02:43 +00:00
Houkime
27a7c24bc3
refactor(tokens-repo): separate token storing
2022-12-16 13:02:21 +00:00
Houkime
4e60d1d37a
refactor(tokens-repo): move token getters to abstract class
...
Not performance-optimal, but not in critical path either.
100 tokens max irl?
2022-12-16 13:02:05 +00:00
Houkime
ff264ec808
refactor(tokens-repo): simplify getting tokens
...
get_token_by_token_string and get_token_by_name are no longer tied to
json.
2022-12-16 13:01:28 +00:00
Houkime
b856a2aad3
test(tokens-repo): re-add delete token test
2022-12-16 13:01:19 +00:00
Houkime
0d748d7ab1
test(tokens-repo): move original token content to json tests
2022-12-16 13:01:09 +00:00
Houkime
c12dca9d9b
refactor(tokens-repo): delete unused timezone import
2022-12-16 13:00:44 +00:00
Houkime
4492bbe995
test(tokens-repo): move null keys and tokens fixtures to json tests
...
and remove corresponding json files from the folder
2022-12-16 13:00:31 +00:00
Houkime
84bfa333fa
test(tokens-repo): move new device key null test to json tests
2022-12-16 13:00:16 +00:00
Houkime
be13d6163e
test(tokens-repo): use a mnemonic device key on an empty repo
2022-12-16 13:00:07 +00:00
Houkime
ce411e9291
test(tokens-repo): using a mnemonic device key
2022-12-16 12:59:57 +00:00
Houkime
cf7b7eb8a7
test(tokens-repo): notfound mnemonic new device key
2022-12-16 12:59:49 +00:00
Houkime
3feebd5290
test(tokens-repo): invalid mnemonic new device key
2022-12-16 12:59:38 +00:00
Houkime
73584872f0
test(tokens-repo): agnosticise simple new device key tests
...
the state of json file is tested separately in test_json_tokens_repository.py
2022-12-16 12:59:27 +00:00
Houkime
dc778b545e
test(tokens-repo): get new device key
2022-12-16 12:59:16 +00:00
Houkime
f96d8b7d7c
test(tokens-repo): make another mock token generator agnostic
2022-12-16 12:58:50 +00:00
Houkime
dd525fe723
test(tokens-repo): agnostic use recovery token
...
converted json-reading asserts to backend-agnostic asserts
2022-12-16 12:58:27 +00:00
Houkime
b9c570720b
test(tokens-repo): move null recovery token test to json tests
...
Because the null state seems to be specific to json and not reproducible
in abstract case.
2022-12-16 12:57:14 +00:00
Houkime
732e72d414
test(tokens-repo): mnemonic non-null invalid
2022-12-16 12:56:50 +00:00
Houkime
6f400911fc
test(tokens-repo): agnostic recovery keys testing
2022-12-16 12:56:25 +00:00
Houkime
c86eb8b786
test(tokens-repo): agnostic refresh token nonexistent
2022-12-16 12:56:04 +00:00
Houkime
fa54220327
test(tokens-repo): agnostic refresh token
2022-12-16 12:55:46 +00:00
Houkime
b43c4014e2
test(tokens-repo): agnostic delete not found
2022-12-16 12:55:28 +00:00
Houkime
db55685488
test(tokens-repo): use 'repo' for consistency
2022-12-16 12:55:07 +00:00
Houkime
3921d9fe4c
test(tokens-repo): agnostic token creation test
2022-12-16 12:54:46 +00:00
Houkime
2e2d344f43
test(tokens-repo): get_tokens metaproperties test
2022-12-16 12:54:25 +00:00
Houkime
55ad2484b8
test(tokens-repo): agnostic test for getting by name
2022-12-16 12:53:33 +00:00
Houkime
8a05a55b80
test(tokens-repo): parameterized fixture
2022-12-16 12:51:56 +00:00
Houkime
4cfe0515ea
test(tokens-repo): split between abstract api and backend-specific tests
2022-12-16 12:50:08 +00:00
def
16e0bd56ce
refactor(repository): Tokens repository JSON backend ( #18 )
...
Co-authored-by: def <dettlaff@riseup.net>
Co-authored-by: Inex Code <inex.code@selfprivacy.org>
Reviewed-on: #18
Co-authored-by: def <dettlaff@riseup.net>
Co-committed-by: def <dettlaff@riseup.net>
2022-12-02 14:19:57 +03:00
Inex Code
9cf4d46c50
redis/jobs-coverage ( #24 )
2022-12-02 13:01:09 +02:00
Houkime
d47368cbe9
Jobs: test get_job() return values
...
Coverage is now at 99%
2022-11-30 17:26:38 +00:00
Houkime
063dfafc19
Jobs: fix return value of remove_by_uid
...
And add a test for said return value.
2022-11-30 17:06:43 +00:00
Houkime
5c86706f4b
Jobs: fix value access in is_busy()
...
Also added a test for is_busy() that highlighted this bug.
2022-11-30 16:41:20 +00:00
Houkime
14c4ae26ab
explicitly mark helper functions private
...
I thought about making them private class members, but that would get
unreadable and do more harm than good.
2022-11-30 16:22:46 +00:00
Inex Code
f0132266e9
Merge pull request 'bind nix-shell's redis to localhost' ( #23 ) from redis/nixshell-redis-bindlocal into redis/connection-pool
...
Reviewed-on: #23
2022-11-30 17:52:29 +02:00
Houkime
870d2c408d
jobs: test nofail at nonexistent update
2022-11-30 15:37:59 +00:00
Houkime
f51e378ff0
jobs: test updating more fields
2022-11-30 15:21:57 +00:00
Houkime
7acbba9960
jobs: minimal update test
2022-11-30 15:12:42 +00:00
Houkime
106a083ca2
jobs: simplify reset
...
Also ups test coverage
2022-11-30 14:47:56 +00:00
Houkime
b6eeec23cc
jobs: singlejob fixture
2022-11-30 14:31:37 +00:00
Houkime
c21b6cb071
jobs: dedicated reset test
2022-11-30 14:17:53 +00:00
Houkime
144f95fb34
bind nix-shell's redis to localhost
...
For security, mainly. Also, limit to one process.
A follow up to #22
2022-11-30 11:20:08 +00:00
Inex Code
60919b88b9
Merge pull request 'Autostart a redis instance in nix shell.' ( #22 ) from redis/nixshell-redis-autostart into redis/connection-pool
...
Reviewed-on: #22
2022-11-28 14:50:57 +02:00
Inex Code
57794c9535
style(graphql): Add missing comma
...
\
2022-11-28 15:49:48 +03:00
Houkime
2e9cdf15ab
Autostart a redis instance in nix shell.
...
As a part of test environment, an unprivileged redis server is started on localhost:6379.
Redis connection pool detects when it is run in a development nix shell
and uses this port instead of a production unix socket. This way, redis
tests pass even on computers without redis installed.
2022-11-28 14:38:21 +02:00
Inex Code
3ce71b0993
Merge pull request 'migrate Jobs to redis' ( #20 ) from redis/jobs into redis/connection-pool
...
Reviewed-on: #20
2022-11-28 14:37:45 +02:00
Houkime
d6ef01c0c7
Add TTL to storage of finished or failed jobs
...
Defaulting to 10 days.
2022-11-23 16:29:50 +00:00
Houkime
244851c7cc
jobs: remove 'jobs' list, and use 'jobs:' prefix
...
Less complexity, easier to add redis-native TTL
2022-11-23 15:04:39 +00:00
Houkime
5afa2338ca
Migrate Jobs to redis
...
Jobs API shall now use redis to store and retrieve jobs. This will make
it possible to add pubsub for jobs updates. For now it uses blocking api
of redis.
2022-11-23 14:43:06 +00:00
Houkime
f7b7e5a0be
migrate Jobs to redis
2022-11-16 13:54:54 +00:00
Inex Code
9ee0240bbd
Merge pull request 'houkime-providers-api' ( #19 ) from houkime/selfprivacy-rest-api:houkime-providers-api into redis/connection-pool
...
Reviewed-on: #19
2022-11-02 17:35:58 +02:00
Houkime
41e5f89b7b
migrate backblaze settings to new json format
...
And adjust methods and tests
2022-11-02 13:52:33 +00:00
Houkime
07af2e59be
tests: fix backblaze bucket
2022-11-02 13:52:33 +00:00
Houkime
a723311b36
reroute system provider query
2022-11-02 13:52:33 +00:00
Houkime
589093b853
delete old cloudflare field
2022-11-02 13:52:33 +00:00
Houkime
6c6f45781c
add new fields to the rest of the test jsons. Missed some
2022-11-02 13:52:33 +00:00
Houkime
2d7bc0f154
remove cloudflare tokens from the rest of the test jsons. nobody seems to care
2022-11-02 13:52:33 +00:00
Houkime
5efa85f877
add provider fields to the rest of test jsons
2022-11-02 13:52:33 +00:00
Houkime
f4a7986cfa
Remove old cloudflare apiKey field from system test jsons
...
Strangely, no test were broken. Probably more testing is needed for
token-dependent methods.
2022-11-02 13:52:33 +00:00
Houkime
2ec0548c09
add provider fields to the test jsons under system
2022-11-02 13:52:33 +00:00
Houkime
dd15e0ab65
reroute dns provider query
2022-11-02 13:52:33 +00:00
Houkime
9540e26ce1
add digitalocean and backblaze options
2022-11-02 13:52:33 +00:00
Houkime
7d58eb3d92
fix wrong cloudflare field key
2022-11-02 13:52:33 +00:00
Houkime
decb98afe2
add providers.py to the list of migrations
...
Makes providers.py actually run.
2022-11-02 13:52:33 +00:00
Houkime
b0c26b876a
add providers migration
2022-11-02 13:52:33 +00:00
Inex Code
27255cb533
docs: add note about tracking time to CONTRIBUTING
...
spent @5m
2022-11-01 14:59:23 +03:00
Inex Code
83736e1e8f
docs: add a pull request section to contributing.md
2022-11-01 11:38:37 +03:00
Inex Code
19a4ec5377
feat: Add redis pool singleton
2022-10-28 11:24:45 +03:00
Inex Code
8cdacb73dd
refactor: Use singleton metaclass for all singleton classes
2022-10-27 18:31:52 +03:00