@rootaccessd/client 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @rootaccessd/client
2
+
3
+ TypeScript/Axios API client for any RootAccess-compatible CTF backend, auto-generated
4
+ from the OpenAPI spec.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @rootaccessd/client axios
10
+ ```
11
+
12
+ ## Quick Start
13
+
14
+ ```typescript
15
+ import { AuthApi, ChallengesApi, Configuration } from '@rootaccessd/client';
16
+
17
+ // 1. Point at your backend
18
+ const baseConfig = new Configuration({ basePath: 'http://localhost:8080' });
19
+
20
+ // 2. Login and extract token
21
+ const authApi = new AuthApi(baseConfig);
22
+ const { data } = await authApi.authLoginPost({ username: 'you', password: 'secret' });
23
+ const token = data.token;
24
+
25
+ // 3. Use Bearer auth for protected endpoints
26
+ const authedConfig = new Configuration({
27
+ basePath: 'http://localhost:8080',
28
+ apiKey: () => `Bearer ${token}`,
29
+ });
30
+
31
+ const challengesApi = new ChallengesApi(authedConfig);
32
+ const challenges = await challengesApi.challengesGet();
33
+ ```
34
+
35
+ ## Using the RootAccess Angular Frontend
36
+
37
+ Clone the repo and set your backend URL in
38
+ `frontend/src/environments/environment.ts`:
39
+
40
+ ```ts
41
+ export const environment = {
42
+ apiUrl: 'http://your-backend:8080',
43
+ wsUrl: 'ws://your-backend:8080',
44
+ };
45
+ ```
46
+
47
+ Then `npm start` — it talks to your backend automatically.