mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-10 02:43:25 +00:00
Integrate secret parameter into peer classes
- Add secret field to PeerOptions interface - Pass secret when creating offers in CreatingOfferState - Pass secret when answering offers in AnsweringState - Bump version to 0.7.7 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/rondevu-client",
|
"name": "@xtr-dev/rondevu-client",
|
||||||
"version": "0.7.6",
|
"version": "0.7.7",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@xtr-dev/rondevu-client",
|
"name": "@xtr-dev/rondevu-client",
|
||||||
"version": "0.7.6",
|
"version": "0.7.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xtr-dev/rondevu-client": "^0.5.1"
|
"@xtr-dev/rondevu-client": "^0.5.1"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/rondevu-client",
|
"name": "@xtr-dev/rondevu-client",
|
||||||
"version": "0.7.6",
|
"version": "0.7.7",
|
||||||
"description": "TypeScript client for Rondevu topic-based peer discovery and signaling server",
|
"description": "TypeScript client for Rondevu topic-based peer discovery and signaling server",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class AnsweringState extends PeerState {
|
|||||||
|
|
||||||
// Send answer to server BEFORE setLocalDescription
|
// Send answer to server BEFORE setLocalDescription
|
||||||
// This registers us as the answerer so ICE candidates will be accepted
|
// This registers us as the answerer so ICE candidates will be accepted
|
||||||
await this.peer.offersApi.answer(offerId, answer.sdp!);
|
await this.peer.offersApi.answer(offerId, answer.sdp!, options.secret);
|
||||||
|
|
||||||
// Enable trickle ICE - set up handler before ICE gathering starts
|
// Enable trickle ICE - set up handler before ICE gathering starts
|
||||||
this.setupIceCandidateHandler();
|
this.setupIceCandidateHandler();
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ export class CreatingOfferState extends PeerState {
|
|||||||
const offers = await this.peer.offersApi.create([{
|
const offers = await this.peer.offersApi.create([{
|
||||||
sdp: offer.sdp!,
|
sdp: offer.sdp!,
|
||||||
topics: options.topics,
|
topics: options.topics,
|
||||||
ttl: options.ttl || 300000
|
ttl: options.ttl || 300000,
|
||||||
|
secret: options.secret
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
const offerId = offers[0].id;
|
const offerId = offers[0].id;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export interface PeerOptions {
|
|||||||
topics: string[];
|
topics: string[];
|
||||||
/** How long the offer should live (milliseconds) */
|
/** How long the offer should live (milliseconds) */
|
||||||
ttl?: number;
|
ttl?: number;
|
||||||
|
/** Optional secret to protect the offer (max 128 characters) */
|
||||||
|
secret?: string;
|
||||||
/** Whether to create a data channel automatically (for offerer) */
|
/** Whether to create a data channel automatically (for offerer) */
|
||||||
createDataChannel?: boolean;
|
createDataChannel?: boolean;
|
||||||
/** Label for the automatically created data channel */
|
/** Label for the automatically created data channel */
|
||||||
|
|||||||
Reference in New Issue
Block a user