diff --git a/package.json b/package.json index 107308a..cfb213a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xtr-dev/rondevu-client", - "version": "0.7.11", + "version": "0.7.12", "description": "TypeScript client for Rondevu topic-based peer discovery and signaling server", "type": "module", "main": "dist/index.js", diff --git a/src/auth.ts b/src/auth.ts index 10e1d3c..8fc5c33 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -29,21 +29,16 @@ export class RondevuAuth { /** * Register a new peer and receive credentials - * @param customPeerId - Optional custom peer ID (1-128 characters). If not provided, a random ID will be generated. - * @throws Error if registration fails (e.g., peer ID already in use) + * Generates a cryptographically random peer ID (128-bit) + * @throws Error if registration fails */ - async register(customPeerId?: string): Promise { - const body: { peerId?: string } = {}; - if (customPeerId !== undefined) { - body.peerId = customPeerId; - } - + async register(): Promise { const response = await this.fetchFn(`${this.baseUrl}/register`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify(body), + body: JSON.stringify({}), }); if (!response.ok) { diff --git a/src/rondevu.ts b/src/rondevu.ts index 0428e26..6f30a93 100644 --- a/src/rondevu.ts +++ b/src/rondevu.ts @@ -100,10 +100,10 @@ export class Rondevu { /** * Register and initialize authenticated client - * @param customPeerId - Optional custom peer ID (1-128 characters). If not provided, a random ID will be generated. + * Generates a cryptographically random peer ID (128-bit) */ - async register(customPeerId?: string): Promise { - this.credentials = await this.auth.register(customPeerId); + async register(): Promise { + this.credentials = await this.auth.register(); // Create offers API instance this._offers = new RondevuOffers(