@@ -18,24 +18,7 @@ container=""
1818sastoken =" "
1919```
2020
21- ## API
22-
23- ### Upload
24-
25- ` POST /upload `
26-
27- Upload a file to the server.
28-
29- field path: the path to store the file in the server.
30- field file0: the file to upload.
31-
32- ### Download
33-
34- ` GET /path/to/file `
35-
36- Download a file from the server.
37-
38- ### Authentication
21+ ## Creating user tokens
3922
4023The server uses JWT token based authentication. The token is passed in the ` Authorization ` header as a Bearer token.
4124JWT secret is configured in the ` config.toml ` file.
@@ -45,7 +28,7 @@ JWT secret is configured in the `config.toml` file.
4528```
4629This will generate a JWT token for the user.
4730
48- #### Testing Token Validity
31+ ### Testing Token Validity
4932
5033You can verify if a token is valid using the ` /v1/checkauth ` endpoint:
5134
@@ -58,46 +41,6 @@ curl -X GET http://localhost:3000/v1/checkauth \
5841- ` 200 OK ` with body ` Authorized: user@email.com ` - Token is valid
5942- ` 401 Unauthorized ` with body ` Unauthorized ` - Token is invalid or missing
6043
61- ### Testing upload and download using curl
62-
63- ``` bash
64- # Upload
65- curl -X POST http://files.kernelci.org/upload \
66- -H " Authorization: Bearer <JWT_TOKEN>" \
67- -F " path=testfolder" \
68- -F " file0=@local_folder/local_file"
69-
70- # File will be uploaded to Azure Blob Storage as testfolder/local_folder/local_file
71-
72- # Download
73- curl http://files.kernelci.org/testfolder/local_folder/local_file
74- ```
75-
76- ## Principle of operation
77-
78- ``` mermaid
79- sequenceDiagram
80- participant User
81- participant Proxy Server
82- participant Local Cache
83- participant Azure Blob Storage
84-
85- %% Upload Flow
86- User->>Proxy Server: Upload File (POST Request)
87- Proxy Server->>Azure Blob Storage: Store File in Cloud
88- Azure Blob Storage-->>Proxy Server: Confirmation
89- Proxy Server-->>User: Upload Successful
44+ ## API
9045
91- %% Download Flow
92- User->>Proxy Server: Request File (GET Request)
93- Proxy Server->>Local Cache: Check if File Exists
94- alt File Found in Cache
95- Local Cache-->>Proxy Server: Return Cached File
96- Proxy Server-->>User: Send File
97- else File Not in Cache
98- Proxy Server->>Azure Blob Storage: Fetch File from Cloud
99- Azure Blob Storage-->>Proxy Server: Send File Data
100- Proxy Server->>Local Cache: Save File Locally
101- Proxy Server-->>User: Send File
102- end
103- ```
46+ See [ docs] ( docs/ ) for the API documentation.
0 commit comments