@xtr-dev/rondevu-client 0.7.10 → 0.7.12
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 +4 -2
- package/dist/auth.d.ts +3 -3
- package/dist/auth.js +4 -8
- package/dist/offers.d.ts +2 -0
- package/dist/rondevu.d.ts +2 -2
- package/dist/rondevu.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -411,7 +411,8 @@ const offers = await client.offers.create([{
|
|
|
411
411
|
sdp: 'v=0...', // Your WebRTC offer SDP
|
|
412
412
|
topics: ['movie-xyz', 'hd-content'],
|
|
413
413
|
ttl: 300000, // 5 minutes
|
|
414
|
-
secret: 'my-secret-password' // Optional: protect offer (max 128 chars)
|
|
414
|
+
secret: 'my-secret-password', // Optional: protect offer (max 128 chars)
|
|
415
|
+
info: 'Looking for peers in EU region' // Optional: public info (max 128 chars)
|
|
415
416
|
}]);
|
|
416
417
|
|
|
417
418
|
// Discover peers by topic
|
|
@@ -489,7 +490,8 @@ const offers = await client.offers.create([
|
|
|
489
490
|
sdp: 'v=0...',
|
|
490
491
|
topics: ['topic-1', 'topic-2'],
|
|
491
492
|
ttl: 300000, // optional, default 5 minutes
|
|
492
|
-
secret: 'my-secret-password' // optional, max 128 chars
|
|
493
|
+
secret: 'my-secret-password', // optional, max 128 chars
|
|
494
|
+
info: 'Looking for peers in EU region' // optional, public info, max 128 chars
|
|
493
495
|
}
|
|
494
496
|
]);
|
|
495
497
|
```
|
package/dist/auth.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ export declare class RondevuAuth {
|
|
|
9
9
|
constructor(baseUrl: string, fetchFn?: FetchFunction);
|
|
10
10
|
/**
|
|
11
11
|
* Register a new peer and receive credentials
|
|
12
|
-
*
|
|
13
|
-
* @throws Error if registration fails
|
|
12
|
+
* Generates a cryptographically random peer ID (128-bit)
|
|
13
|
+
* @throws Error if registration fails
|
|
14
14
|
*/
|
|
15
|
-
register(
|
|
15
|
+
register(): Promise<Credentials>;
|
|
16
16
|
/**
|
|
17
17
|
* Create Authorization header value
|
|
18
18
|
*/
|
package/dist/auth.js
CHANGED
|
@@ -11,20 +11,16 @@ export class RondevuAuth {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Register a new peer and receive credentials
|
|
14
|
-
*
|
|
15
|
-
* @throws Error if registration fails
|
|
14
|
+
* Generates a cryptographically random peer ID (128-bit)
|
|
15
|
+
* @throws Error if registration fails
|
|
16
16
|
*/
|
|
17
|
-
async register(
|
|
18
|
-
const body = {};
|
|
19
|
-
if (customPeerId !== undefined) {
|
|
20
|
-
body.peerId = customPeerId;
|
|
21
|
-
}
|
|
17
|
+
async register() {
|
|
22
18
|
const response = await this.fetchFn(`${this.baseUrl}/register`, {
|
|
23
19
|
method: 'POST',
|
|
24
20
|
headers: {
|
|
25
21
|
'Content-Type': 'application/json',
|
|
26
22
|
},
|
|
27
|
-
body: JSON.stringify(
|
|
23
|
+
body: JSON.stringify({}),
|
|
28
24
|
});
|
|
29
25
|
if (!response.ok) {
|
|
30
26
|
const error = await response.json().catch(() => ({ error: 'Unknown error' }));
|
package/dist/offers.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface CreateOfferRequest {
|
|
|
4
4
|
topics: string[];
|
|
5
5
|
ttl?: number;
|
|
6
6
|
secret?: string;
|
|
7
|
+
info?: string;
|
|
7
8
|
}
|
|
8
9
|
export interface Offer {
|
|
9
10
|
id: string;
|
|
@@ -15,6 +16,7 @@ export interface Offer {
|
|
|
15
16
|
lastSeen: number;
|
|
16
17
|
secret?: string;
|
|
17
18
|
hasSecret?: boolean;
|
|
19
|
+
info?: string;
|
|
18
20
|
answererPeerId?: string;
|
|
19
21
|
answerSdp?: string;
|
|
20
22
|
answeredAt?: number;
|
package/dist/rondevu.d.ts
CHANGED
|
@@ -72,9 +72,9 @@ export declare class Rondevu {
|
|
|
72
72
|
get offers(): RondevuOffers;
|
|
73
73
|
/**
|
|
74
74
|
* Register and initialize authenticated client
|
|
75
|
-
*
|
|
75
|
+
* Generates a cryptographically random peer ID (128-bit)
|
|
76
76
|
*/
|
|
77
|
-
register(
|
|
77
|
+
register(): Promise<Credentials>;
|
|
78
78
|
/**
|
|
79
79
|
* Check if client is authenticated
|
|
80
80
|
*/
|
package/dist/rondevu.js
CHANGED
|
@@ -25,10 +25,10 @@ export class Rondevu {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Register and initialize authenticated client
|
|
28
|
-
*
|
|
28
|
+
* Generates a cryptographically random peer ID (128-bit)
|
|
29
29
|
*/
|
|
30
|
-
async register(
|
|
31
|
-
this.credentials = await this.auth.register(
|
|
30
|
+
async register() {
|
|
31
|
+
this.credentials = await this.auth.register();
|
|
32
32
|
// Create offers API instance
|
|
33
33
|
this._offers = new RondevuOffers(this.baseUrl, this.credentials, this.fetchFn);
|
|
34
34
|
return this.credentials;
|