@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 +47 -0
- package/dist/api.d.ts +3391 -0
- package/dist/api.js +5639 -0
- package/dist/base.d.ts +42 -0
- package/dist/base.js +46 -0
- package/dist/common.d.ts +34 -0
- package/dist/common.js +139 -0
- package/dist/configuration.d.ts +98 -0
- package/dist/configuration.js +44 -0
- package/dist/esm/api.d.ts +3391 -0
- package/dist/esm/api.js +5555 -0
- package/dist/esm/base.d.ts +42 -0
- package/dist/esm/base.js +41 -0
- package/dist/esm/common.d.ts +34 -0
- package/dist/esm/common.js +126 -0
- package/dist/esm/configuration.d.ts +98 -0
- package/dist/esm/configuration.js +40 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +15 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +31 -0
- package/package.json +32 -0
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.
|