Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API endpoint to upload pre-existing keys #975

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Jul 29, 2024

You can test it with:

curl -X POST http://localhost:1212/api/v1/keys?token=MyAccessToken \
     -H "Content-Type: application/json" \
     -d '{
           "key": "Xc1L4PbQJSFGlrgSRZl8wxSFAuMa21z7",
           "seconds_valid": 7200
         }'

The key field is optional. If it's not provided, a random key will be generated.

Subtasks

  • New endpoint to upload a pre-existing key.
  • Add E2E test.
  • Add new endpoint to rustdoc.
  • Mark the current endpoint to generate random keys as deprecated.

@josecelano josecelano self-assigned this Jul 29, 2024
@josecelano josecelano linked an issue Jul 29, 2024 that may be closed by this pull request
@josecelano josecelano force-pushed the 974-overhaul-tracker-keys-upload-pre-exisiting-keys branch from d1b1538 to b27aefa Compare July 29, 2024 16:01
@josecelano josecelano requested a review from da2ce7 July 29, 2024 16:01
You can test it with:

```console
curl -X POST http://localhost:1212/api/v1/keys?token=MyAccessToken \
     -H "Content-Type: application/json" \
     -d '{
           "key": "Xc1L4PbQJSFGlrgSRZl8wxSFAuMa21z7",
           "seconds_valid": 7200
         }'
```

The `key` field is optional. If it's not provided a random key will be
generated.
@josecelano josecelano force-pushed the 974-overhaul-tracker-keys-upload-pre-exisiting-keys branch from b27aefa to 09beb52 Compare July 29, 2024 16:04
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 80.85106% with 9 lines in your changes missing coverage. Please review.

Project coverage is 77.40%. Comparing base (a964659) to head (04f50e4).

Files Patch % Lines
src/servers/apis/v1/context/auth_key/responses.rs 33.33% 6 Missing ⚠️
src/servers/apis/v1/context/auth_key/handlers.rs 90.47% 2 Missing ⚠️
src/servers/apis/v1/context/auth_key/forms.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #975      +/-   ##
===========================================
+ Coverage    77.35%   77.40%   +0.04%     
===========================================
  Files          183      184       +1     
  Lines         9738     9793      +55     
===========================================
+ Hits          7533     7580      +47     
- Misses        2205     2213       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano josecelano force-pushed the 974-overhaul-tracker-keys-upload-pre-exisiting-keys branch from 0b42017 to 583b305 Compare July 30, 2024 10:05
@josecelano josecelano force-pushed the 974-overhaul-tracker-keys-upload-pre-exisiting-keys branch from ad76321 to 04f50e4 Compare July 30, 2024 10:31
@josecelano josecelano marked this pull request as ready for review July 30, 2024 11:22
@josecelano
Copy link
Member Author

ACK 04f50e4

@josecelano josecelano merged commit 1f5de8c into torrust:develop Jul 30, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overhaul tracker keys: upload pre-generated keys
1 participant