@xtr-dev/rondevu-client 0.7.11 → 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/dist/auth.d.ts +3 -3
- package/dist/auth.js +4 -8
- package/dist/rondevu.d.ts +2 -2
- package/dist/rondevu.js +3 -3
- package/package.json +1 -1
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/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;
|