@qidcloud/sdk 1.1.0 → 1.1.1
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 +19 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @qidcloud/sdk
|
|
2
2
|
|
|
3
|
-
Official JavaScript/TypeScript SDK for
|
|
3
|
+
Official JavaScript/TypeScript SDK for QidCloud Authentication - Quantum-resistant, passwordless authentication for modern applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @qidcloud/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import {
|
|
14
|
+
import { QidCloud } from '@qidcloud/sdk';
|
|
15
15
|
|
|
16
16
|
// Initialize with your API key
|
|
17
|
-
const qgate = new
|
|
17
|
+
const qgate = new QidCloud({
|
|
18
18
|
apiKey: 'your-api-key-here'
|
|
19
19
|
// baseUrl is optional, defaults to https://qgate.onrender.com
|
|
20
20
|
});
|
|
@@ -42,18 +42,18 @@ await qgate.logout();
|
|
|
42
42
|
|
|
43
43
|
## API Reference
|
|
44
44
|
|
|
45
|
-
### `new
|
|
45
|
+
### `new QidCloud(config)`
|
|
46
46
|
|
|
47
|
-
Initialize the
|
|
47
|
+
Initialize the QidCloud client.
|
|
48
48
|
|
|
49
49
|
**Parameters:**
|
|
50
|
-
- `config.apiKey` (required): Your
|
|
50
|
+
- `config.apiKey` (required): Your QidCloud API key
|
|
51
51
|
- `config.baseUrl` (optional): Custom backend URL, defaults to `https://qgate.onrender.com`
|
|
52
52
|
- `config.storage` (optional): Custom storage implementation (defaults to localStorage in browser, memory in Node.js)
|
|
53
53
|
|
|
54
54
|
**Example:**
|
|
55
55
|
```typescript
|
|
56
|
-
const qgate = new
|
|
56
|
+
const qgate = new QidCloud({
|
|
57
57
|
apiKey: 'qg-abc123...',
|
|
58
58
|
baseUrl: 'https://custom-backend.com' // optional
|
|
59
59
|
});
|
|
@@ -156,7 +156,7 @@ if (await qgate.hasIdentity()) {
|
|
|
156
156
|
Provide your own storage implementation:
|
|
157
157
|
|
|
158
158
|
```typescript
|
|
159
|
-
import {
|
|
159
|
+
import { QidCloud, IStorage } from '@qidcloud/sdk';
|
|
160
160
|
|
|
161
161
|
class CustomStorage implements IStorage {
|
|
162
162
|
async getItem(key: string): Promise<string | null> {
|
|
@@ -172,7 +172,7 @@ class CustomStorage implements IStorage {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
const qgate = new
|
|
175
|
+
const qgate = new QidCloud({
|
|
176
176
|
apiKey: 'your-key',
|
|
177
177
|
storage: new CustomStorage()
|
|
178
178
|
});
|
|
@@ -213,13 +213,13 @@ if (hasIdentity) {
|
|
|
213
213
|
Full TypeScript support included:
|
|
214
214
|
|
|
215
215
|
```typescript
|
|
216
|
-
import {
|
|
216
|
+
import { QidCloud, QidConfig, UserProfile } from '@qidcloud/sdk';
|
|
217
217
|
|
|
218
|
-
const config:
|
|
218
|
+
const config: QidConfig = {
|
|
219
219
|
apiKey: 'your-key'
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
const qgate = new
|
|
222
|
+
const qgate = new QidCloud(config);
|
|
223
223
|
|
|
224
224
|
const profile: UserProfile = await qgate.getProfile();
|
|
225
225
|
```
|
|
@@ -237,9 +237,9 @@ const profile: UserProfile = await qgate.getProfile();
|
|
|
237
237
|
|
|
238
238
|
```typescript
|
|
239
239
|
import { useState, useEffect } from 'react';
|
|
240
|
-
import {
|
|
240
|
+
import { QidCloud } from '@qidcloud/sdk';
|
|
241
241
|
|
|
242
|
-
const qgate = new
|
|
242
|
+
const qgate = new QidCloud({ apiKey: process.env.REACT_APP_QGATE_KEY });
|
|
243
243
|
|
|
244
244
|
function App() {
|
|
245
245
|
const [user, setUser] = useState(null);
|
|
@@ -279,9 +279,9 @@ function App() {
|
|
|
279
279
|
### Node.js Backend
|
|
280
280
|
|
|
281
281
|
```javascript
|
|
282
|
-
const {
|
|
282
|
+
const { QidCloud } = require('@qidcloud/sdk');
|
|
283
283
|
|
|
284
|
-
const qgate = new
|
|
284
|
+
const qgate = new QidCloud({
|
|
285
285
|
apiKey: process.env.QGATE_API_KEY
|
|
286
286
|
});
|
|
287
287
|
|
|
@@ -307,4 +307,4 @@ ISC
|
|
|
307
307
|
|
|
308
308
|
---
|
|
309
309
|
|
|
310
|
-
**Built with ❤️ by the
|
|
310
|
+
**Built with ❤️ by the QidCloud Team**
|