@ajna-inc/webrtc 0.2.1 → 0.6.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/.npmvc/attestations.jsonld +32 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/index.d.mts +11 -0
- package/build/index.mjs +12 -0
- package/build/webrtc/WebRTCApi.d.mts +131 -0
- package/build/webrtc/WebRTCApi.d.mts.map +1 -0
- package/build/webrtc/WebRTCApi.mjs +161 -0
- package/build/webrtc/WebRTCApi.mjs.map +1 -0
- package/build/webrtc/WebRTCEvents.d.mts +115 -0
- package/build/webrtc/WebRTCEvents.d.mts.map +1 -0
- package/build/webrtc/WebRTCEvents.mjs +20 -0
- package/build/webrtc/WebRTCEvents.mjs.map +1 -0
- package/build/webrtc/WebRTCModule.d.mts +63 -0
- package/build/webrtc/WebRTCModule.d.mts.map +1 -0
- package/build/webrtc/WebRTCModule.mjs +51 -0
- package/build/webrtc/WebRTCModule.mjs.map +1 -0
- package/build/webrtc/handlers/AnswerHandler.mjs +23 -0
- package/build/webrtc/handlers/AnswerHandler.mjs.map +1 -0
- package/build/webrtc/handlers/EndHandler.mjs +23 -0
- package/build/webrtc/handlers/EndHandler.mjs.map +1 -0
- package/build/webrtc/handlers/IceHandler.mjs +23 -0
- package/build/webrtc/handlers/IceHandler.mjs.map +1 -0
- package/build/webrtc/handlers/OfferHandler.mjs +23 -0
- package/build/webrtc/handlers/OfferHandler.mjs.map +1 -0
- package/build/webrtc/handlers/ProposeHandler.mjs +23 -0
- package/build/webrtc/handlers/ProposeHandler.mjs.map +1 -0
- package/build/webrtc/handlers/RenegotiateHandler.mjs +23 -0
- package/build/webrtc/handlers/RenegotiateHandler.mjs.map +1 -0
- package/build/webrtc/handlers/index.mjs +6 -0
- package/build/webrtc/messages/AnswerMessage.d.mts +29 -0
- package/build/webrtc/messages/AnswerMessage.d.mts.map +1 -0
- package/build/webrtc/messages/AnswerMessage.mjs +44 -0
- package/build/webrtc/messages/AnswerMessage.mjs.map +1 -0
- package/build/webrtc/messages/EndMessage.d.mts +19 -0
- package/build/webrtc/messages/EndMessage.d.mts.map +1 -0
- package/build/webrtc/messages/EndMessage.mjs +31 -0
- package/build/webrtc/messages/EndMessage.mjs.map +1 -0
- package/build/webrtc/messages/IceMessage.d.mts +21 -0
- package/build/webrtc/messages/IceMessage.d.mts.map +1 -0
- package/build/webrtc/messages/IceMessage.mjs +38 -0
- package/build/webrtc/messages/IceMessage.mjs.map +1 -0
- package/build/webrtc/messages/OfferMessage.d.mts +56 -0
- package/build/webrtc/messages/OfferMessage.d.mts.map +1 -0
- package/build/webrtc/messages/OfferMessage.mjs +86 -0
- package/build/webrtc/messages/OfferMessage.mjs.map +1 -0
- package/build/webrtc/messages/ProposeMessage.d.mts +70 -0
- package/build/webrtc/messages/ProposeMessage.d.mts.map +1 -0
- package/build/webrtc/messages/ProposeMessage.mjs +76 -0
- package/build/webrtc/messages/ProposeMessage.mjs.map +1 -0
- package/build/webrtc/messages/RenegotiateMessage.d.mts +59 -0
- package/build/webrtc/messages/RenegotiateMessage.d.mts.map +1 -0
- package/build/webrtc/messages/RenegotiateMessage.mjs +56 -0
- package/build/webrtc/messages/RenegotiateMessage.mjs.map +1 -0
- package/build/webrtc/messages/index.d.mts +6 -0
- package/build/webrtc/messages/index.mjs +6 -0
- package/build/webrtc/repository/WebRTCCallRecord.d.mts +32 -0
- package/build/webrtc/repository/WebRTCCallRecord.d.mts.map +1 -0
- package/build/webrtc/repository/WebRTCCallRecord.mjs +31 -0
- package/build/webrtc/repository/WebRTCCallRecord.mjs.map +1 -0
- package/build/webrtc/repository/WebRTCCallRepository.d.mts +10 -0
- package/build/webrtc/repository/WebRTCCallRepository.d.mts.map +1 -0
- package/build/webrtc/repository/WebRTCCallRepository.mjs +23 -0
- package/build/webrtc/repository/WebRTCCallRepository.mjs.map +1 -0
- package/build/webrtc/services/WebRTCService.d.mts +93 -0
- package/build/webrtc/services/WebRTCService.d.mts.map +1 -0
- package/build/webrtc/services/WebRTCService.mjs +244 -0
- package/build/webrtc/services/WebRTCService.mjs.map +1 -0
- package/package.json +19 -15
- package/README.md +0 -222
- package/build/index.d.ts +0 -8
- package/build/index.js +0 -29
- package/build/index.js.map +0 -1
- package/build/webrtc/WebRTCApi.d.ts +0 -125
- package/build/webrtc/WebRTCApi.js +0 -186
- package/build/webrtc/WebRTCApi.js.map +0 -1
- package/build/webrtc/WebRTCEvents.d.ts +0 -110
- package/build/webrtc/WebRTCEvents.js +0 -19
- package/build/webrtc/WebRTCEvents.js.map +0 -1
- package/build/webrtc/WebRTCModule.d.ts +0 -56
- package/build/webrtc/WebRTCModule.js +0 -40
- package/build/webrtc/WebRTCModule.js.map +0 -1
- package/build/webrtc/handlers/AnswerHandler.d.ts +0 -9
- package/build/webrtc/handlers/AnswerHandler.js +0 -31
- package/build/webrtc/handlers/AnswerHandler.js.map +0 -1
- package/build/webrtc/handlers/EndHandler.d.ts +0 -9
- package/build/webrtc/handlers/EndHandler.js +0 -31
- package/build/webrtc/handlers/EndHandler.js.map +0 -1
- package/build/webrtc/handlers/IceHandler.d.ts +0 -9
- package/build/webrtc/handlers/IceHandler.js +0 -31
- package/build/webrtc/handlers/IceHandler.js.map +0 -1
- package/build/webrtc/handlers/OfferHandler.d.ts +0 -9
- package/build/webrtc/handlers/OfferHandler.js +0 -31
- package/build/webrtc/handlers/OfferHandler.js.map +0 -1
- package/build/webrtc/handlers/ProposeHandler.d.ts +0 -9
- package/build/webrtc/handlers/ProposeHandler.js +0 -31
- package/build/webrtc/handlers/ProposeHandler.js.map +0 -1
- package/build/webrtc/handlers/RenegotiateHandler.d.ts +0 -9
- package/build/webrtc/handlers/RenegotiateHandler.js +0 -31
- package/build/webrtc/handlers/RenegotiateHandler.js.map +0 -1
- package/build/webrtc/handlers/index.d.ts +0 -6
- package/build/webrtc/handlers/index.js +0 -23
- package/build/webrtc/handlers/index.js.map +0 -1
- package/build/webrtc/messages/AnswerMessage.d.ts +0 -23
- package/build/webrtc/messages/AnswerMessage.js +0 -52
- package/build/webrtc/messages/AnswerMessage.js.map +0 -1
- package/build/webrtc/messages/EndMessage.d.ts +0 -13
- package/build/webrtc/messages/EndMessage.js +0 -37
- package/build/webrtc/messages/EndMessage.js.map +0 -1
- package/build/webrtc/messages/IceMessage.d.ts +0 -15
- package/build/webrtc/messages/IceMessage.js +0 -43
- package/build/webrtc/messages/IceMessage.js.map +0 -1
- package/build/webrtc/messages/OfferMessage.d.ts +0 -49
- package/build/webrtc/messages/OfferMessage.js +0 -102
- package/build/webrtc/messages/OfferMessage.js.map +0 -1
- package/build/webrtc/messages/ProposeMessage.d.ts +0 -63
- package/build/webrtc/messages/ProposeMessage.js +0 -84
- package/build/webrtc/messages/ProposeMessage.js.map +0 -1
- package/build/webrtc/messages/RenegotiateMessage.d.ts +0 -52
- package/build/webrtc/messages/RenegotiateMessage.js +0 -65
- package/build/webrtc/messages/RenegotiateMessage.js.map +0 -1
- package/build/webrtc/messages/index.d.ts +0 -6
- package/build/webrtc/messages/index.js +0 -23
- package/build/webrtc/messages/index.js.map +0 -1
- package/build/webrtc/repository/WebRTCCallRecord.d.ts +0 -29
- package/build/webrtc/repository/WebRTCCallRecord.js +0 -30
- package/build/webrtc/repository/WebRTCCallRecord.js.map +0 -1
- package/build/webrtc/repository/WebRTCCallRepository.d.ts +0 -5
- package/build/webrtc/repository/WebRTCCallRepository.js +0 -30
- package/build/webrtc/repository/WebRTCCallRepository.js.map +0 -1
- package/build/webrtc/services/WebRTCService.d.ts +0 -86
- package/build/webrtc/services/WebRTCService.js +0 -229
- package/build/webrtc/services/WebRTCService.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "https://npmvc.com/schemas/attestation-bundle/v1",
|
|
3
|
+
"package": {
|
|
4
|
+
"name": "@ajna-inc/webrtc",
|
|
5
|
+
"version": "0.6.1"
|
|
6
|
+
},
|
|
7
|
+
"bundledAt": "2026-04-21T19:19:17.322Z",
|
|
8
|
+
"envelopes": [
|
|
9
|
+
{
|
|
10
|
+
"payloadType": "application/vc+json",
|
|
11
|
+
"payload": "eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL25wbXZjLmNvbS9zY2hlbWFzL3N1cHBseWNoYWluL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImJ1aWxkQ29tbWFuZCI6InRzZG93biAtLWNvbmZpZy1sb2FkZXIgdW5jb25maWciLCJidWlsZGVyIjp7ImlkIjoiZGlkOmtleTp6Nk1raEo1WUJTZEJMSEhKYmppNDVraUpuUmRMVURQdVRWaTdkUDg0TWpTdUV1Y28iLCJraW5kIjoibG9jYWwifSwiaWQiOiJwa2c6bnBtL0Bham5hLWluYy93ZWJydGNAMC42LjEiLCJyZXByb2R1Y2libGUiOmZhbHNlLCJzbHNhTGV2ZWwiOjIsInNvdXJjZVJlcG8iOnsiY29tbWl0IjoiZWYzY2M1NjlhOTlhNWY4NTBkN2MyM2ZkYzcyNTg4MDllM2YwMTU0ZSIsInR5cGUiOiJnaXQiLCJ1cmwiOiJ1bmtub3duIn0sInRhcmJhbGwiOnsiZGlnZXN0Ijp7fSwibmFtZSI6IkBham5hLWluYy93ZWJydGMiLCJ2ZXJzaW9uIjoiMC42LjEifSwidG9vbGNoYWluIjp7Im5vZGUiOiIyMC4xOS41IiwibnBtIjoiMTAuMjIuMCJ9fSwiaWQiOiJ1cm46dXVpZDpjNTBkM2MwMS0wOWUyLTQ2NzAtYWYwZi1hZTUzMDMxOTZhNDMiLCJpc3N1ZXIiOiJkaWQ6a2V5Ono2TWtoSjVZQlNkQkxISEpiamk0NWtpSm5SZExVRFB1VFZpN2RQODRNalN1RXVjbyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQcm92ZW5hbmNlQ3JlZGVudGlhbCJdLCJ2YWxpZEZyb20iOiIyMDI2LTA0LTIxVDE5OjE5OjE3LjMwNFoifQ==",
|
|
12
|
+
"signatures": [
|
|
13
|
+
{
|
|
14
|
+
"keyid": "did:key:z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco#z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco",
|
|
15
|
+
"alg": "Ed25519",
|
|
16
|
+
"sig": "6zCd7uNljxF//zXO8k3A2maqNIVVrVRcDOyYTkatBfsJ5c8ynpmqoBM+3ATjs1hM7ZNi1d2dDxIHxdh4d1OYCA=="
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"payloadType": "application/vc+json",
|
|
22
|
+
"payload": "eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL25wbXZjLmNvbS9zY2hlbWFzL3N1cHBseWNoYWluL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImRlY2xhcmVkU2NyaXB0cyI6WyJidWlsZCIsInByZXB1Ymxpc2hPbmx5IiwicHJlcGFjayJdLCJpZCI6InBrZzpucG0vQGFqbmEtaW5jL3dlYnJ0Y0AwLjYuMSIsInBvc3RJbnN0YWxsUG9saWN5IjoiZm9yYmlkZGVuIiwidGFyYmFsbCI6eyJkaWdlc3QiOnt9LCJuYW1lIjoiQGFqbmEtaW5jL3dlYnJ0YyIsInZlcnNpb24iOiIwLjYuMSJ9LCJ3aGl0ZWxpc3RlZFNjcmlwdHMiOltdfSwiaWQiOiJ1cm46dXVpZDo2YTNkN2I5YS0wMzEzLTRjY2MtOTU4OS1lNzU4MTkwOTY5MDQiLCJpc3N1ZXIiOiJkaWQ6a2V5Ono2TWtoSjVZQlNkQkxISEpiamk0NWtpSm5SZExVRFB1VFZpN2RQODRNalN1RXVjbyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJMaWZlY3ljbGVQb2xpY3lDcmVkZW50aWFsIl0sInZhbGlkRnJvbSI6IjIwMjYtMDQtMjFUMTk6MTk6MTcuMzIxWiJ9",
|
|
23
|
+
"signatures": [
|
|
24
|
+
{
|
|
25
|
+
"keyid": "did:key:z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco#z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco",
|
|
26
|
+
"alg": "Ed25519",
|
|
27
|
+
"sig": "+D8Y156rO0e+aKBFQzCjJfnoXqd0iqyqrXOZm+nuYoC++TuvIscnX5iVM7XAQuT4upicJn9XyYFi/Bsgo2edDg=="
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/decorate.js
|
|
2
|
+
function __decorate(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { __decorate };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IcePolicy, IceServerConfig, OfferMessage, OfferMessageOptions } from "./webrtc/messages/OfferMessage.mjs";
|
|
2
|
+
import { MediaType, ProposeMessage, ProposeMessageOptions } from "./webrtc/messages/ProposeMessage.mjs";
|
|
3
|
+
import { AnswerMessage, AnswerMessageOptions } from "./webrtc/messages/AnswerMessage.mjs";
|
|
4
|
+
import { IceMessage, IceMessageOptions } from "./webrtc/messages/IceMessage.mjs";
|
|
5
|
+
import { RenegotiateMessage, RenegotiateMessageOptions, RenegotiateReason } from "./webrtc/messages/RenegotiateMessage.mjs";
|
|
6
|
+
import { EndMessage, EndMessageOptions } from "./webrtc/messages/EndMessage.mjs";
|
|
7
|
+
import "./webrtc/messages/index.mjs";
|
|
8
|
+
import { WebRTCApi } from "./webrtc/WebRTCApi.mjs";
|
|
9
|
+
import { WebRTCIceServerConfig, WebRTCModule, WebRTCModuleConfig, WebRTCModuleConfigToken } from "./webrtc/WebRTCModule.mjs";
|
|
10
|
+
import { CallEndedEvent, IceServerEventConfig, IncomingAnswerEvent, IncomingIceEvent, IncomingOfferEvent, IncomingProposeEvent, RenegotiateRequestedEvent, WebRTCEvents } from "./webrtc/WebRTCEvents.mjs";
|
|
11
|
+
export { AnswerMessage, AnswerMessageOptions, type CallEndedEvent, EndMessage, EndMessageOptions, IceMessage, IceMessageOptions, type IcePolicy, type IceServerConfig, type IceServerEventConfig, type IncomingAnswerEvent, type IncomingIceEvent, type IncomingOfferEvent, type IncomingProposeEvent, type MediaType, OfferMessage, OfferMessageOptions, ProposeMessage, ProposeMessageOptions, RenegotiateMessage, RenegotiateMessageOptions, type RenegotiateReason, type RenegotiateRequestedEvent, WebRTCApi, WebRTCEvents, type WebRTCIceServerConfig, WebRTCModule, type WebRTCModuleConfig, WebRTCModuleConfigToken };
|
package/build/index.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IceServerConfig, OfferMessage } from "./webrtc/messages/OfferMessage.mjs";
|
|
2
|
+
import { ProposeMessage } from "./webrtc/messages/ProposeMessage.mjs";
|
|
3
|
+
import { AnswerMessage } from "./webrtc/messages/AnswerMessage.mjs";
|
|
4
|
+
import { IceMessage } from "./webrtc/messages/IceMessage.mjs";
|
|
5
|
+
import { RenegotiateMessage } from "./webrtc/messages/RenegotiateMessage.mjs";
|
|
6
|
+
import { EndMessage } from "./webrtc/messages/EndMessage.mjs";
|
|
7
|
+
import "./webrtc/messages/index.mjs";
|
|
8
|
+
import { WebRTCEvents } from "./webrtc/WebRTCEvents.mjs";
|
|
9
|
+
import { WebRTCApi } from "./webrtc/WebRTCApi.mjs";
|
|
10
|
+
import { WebRTCModule, WebRTCModuleConfigToken } from "./webrtc/WebRTCModule.mjs";
|
|
11
|
+
|
|
12
|
+
export { AnswerMessage, EndMessage, IceMessage, IceServerConfig, OfferMessage, ProposeMessage, RenegotiateMessage, WebRTCApi, WebRTCEvents, WebRTCModule, WebRTCModuleConfigToken };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { WebRTCCallRecord } from "./repository/WebRTCCallRecord.mjs";
|
|
2
|
+
import { IcePolicy, IceServerConfig } from "./messages/OfferMessage.mjs";
|
|
3
|
+
import { MediaType } from "./messages/ProposeMessage.mjs";
|
|
4
|
+
import { RenegotiateReason } from "./messages/RenegotiateMessage.mjs";
|
|
5
|
+
import { WebRTCService } from "./services/WebRTCService.mjs";
|
|
6
|
+
import { WebRTCModuleConfig } from "./WebRTCModule.mjs";
|
|
7
|
+
import { DidCommConnectionService, DidCommMessageSender } from "@credo-ts/didcomm";
|
|
8
|
+
import { AgentContext } from "@credo-ts/core";
|
|
9
|
+
|
|
10
|
+
//#region src/webrtc/WebRTCApi.d.ts
|
|
11
|
+
declare class WebRTCApi {
|
|
12
|
+
private connectionService;
|
|
13
|
+
private messageSender;
|
|
14
|
+
private webrtcService;
|
|
15
|
+
private agentContext;
|
|
16
|
+
private config;
|
|
17
|
+
constructor(connectionService: DidCommConnectionService, messageSender: DidCommMessageSender, webrtcService: WebRTCService, agentContext: AgentContext);
|
|
18
|
+
/**
|
|
19
|
+
* Get the configured default ICE servers
|
|
20
|
+
*/
|
|
21
|
+
getDefaultIceServers(): WebRTCModuleConfig['iceServers'];
|
|
22
|
+
/**
|
|
23
|
+
* Propose a call to a peer (before sending offer)
|
|
24
|
+
* This allows sharing ICE servers and negotiating capabilities before the SDP exchange
|
|
25
|
+
*/
|
|
26
|
+
proposeCall(options: {
|
|
27
|
+
connectionId: string;
|
|
28
|
+
threadId?: string;
|
|
29
|
+
parentThreadId?: string;
|
|
30
|
+
/** Requested media types */
|
|
31
|
+
media?: MediaType[];
|
|
32
|
+
/** Whether data channel is requested */
|
|
33
|
+
data?: boolean;
|
|
34
|
+
/** Topology: 'mesh' (P2P) or 'sfu' */
|
|
35
|
+
topology?: 'mesh' | 'sfu';
|
|
36
|
+
/** Whether trickle ICE is supported (defaults to module config) */
|
|
37
|
+
trickle?: boolean;
|
|
38
|
+
/** ICE policy (defaults to module config) */
|
|
39
|
+
policy?: IcePolicy;
|
|
40
|
+
/** ICE servers - uses module defaults if not provided */
|
|
41
|
+
iceServers?: IceServerConfig[];
|
|
42
|
+
/** Optional reason/context */
|
|
43
|
+
reason?: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
threadId: string;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Start a call by sending an SDP offer
|
|
49
|
+
*/
|
|
50
|
+
startCall(options: {
|
|
51
|
+
connectionId: string;
|
|
52
|
+
threadId: string;
|
|
53
|
+
parentThreadId?: string;
|
|
54
|
+
sdp: string;
|
|
55
|
+
/** ICE servers - uses module defaults if not provided */
|
|
56
|
+
iceServers?: IceServerConfig[];
|
|
57
|
+
/** ICE policy (defaults to module config) */
|
|
58
|
+
policy?: IcePolicy;
|
|
59
|
+
/** Whether trickle ICE is enabled (defaults to module config) */
|
|
60
|
+
trickle?: boolean;
|
|
61
|
+
}): Promise<WebRTCCallRecord>;
|
|
62
|
+
/**
|
|
63
|
+
* Accept a call by sending an SDP answer
|
|
64
|
+
*/
|
|
65
|
+
acceptCall(options: {
|
|
66
|
+
connectionId: string;
|
|
67
|
+
threadId: string;
|
|
68
|
+
parentThreadId?: string;
|
|
69
|
+
sdp: string;
|
|
70
|
+
/** Optional ICE servers from callee (if different from caller's) */
|
|
71
|
+
iceServers?: IceServerConfig[];
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Send an ICE candidate
|
|
75
|
+
*/
|
|
76
|
+
sendIce(options: {
|
|
77
|
+
connectionId: string;
|
|
78
|
+
threadId: string;
|
|
79
|
+
parentThreadId?: string;
|
|
80
|
+
candidate?: Record<string, unknown>;
|
|
81
|
+
endOfCandidates?: boolean;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Request renegotiation (for ICE restart, adding/removing tracks, etc.)
|
|
85
|
+
*
|
|
86
|
+
* Use this when:
|
|
87
|
+
* - ICE connection failed and needs restart
|
|
88
|
+
* - Adding screenshare or switching cameras
|
|
89
|
+
* - Network changed (WiFi to cellular)
|
|
90
|
+
* - Changing codec or bandwidth settings
|
|
91
|
+
*/
|
|
92
|
+
renegotiate(options: {
|
|
93
|
+
connectionId: string;
|
|
94
|
+
threadId: string;
|
|
95
|
+
parentThreadId?: string;
|
|
96
|
+
/** Reason for renegotiation */
|
|
97
|
+
reason: RenegotiateReason | string;
|
|
98
|
+
/** Whether to perform ICE restart (required for recovering failed connections) */
|
|
99
|
+
iceRestart?: boolean;
|
|
100
|
+
/** New ICE servers (useful when switching networks) */
|
|
101
|
+
iceServers?: IceServerConfig[];
|
|
102
|
+
/** Updated ICE policy */
|
|
103
|
+
policy?: IcePolicy;
|
|
104
|
+
}): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Request ICE restart (convenience method for renegotiate with iceRestart=true)
|
|
107
|
+
*
|
|
108
|
+
* Use when the WebRTC connection has failed or disconnected
|
|
109
|
+
*/
|
|
110
|
+
restartIce(options: {
|
|
111
|
+
connectionId: string;
|
|
112
|
+
threadId: string;
|
|
113
|
+
parentThreadId?: string;
|
|
114
|
+
/** New ICE servers (optional, useful when original servers are unreachable) */
|
|
115
|
+
iceServers?: IceServerConfig[];
|
|
116
|
+
/** Updated ICE policy */
|
|
117
|
+
policy?: IcePolicy;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* End a call
|
|
121
|
+
*/
|
|
122
|
+
endCall(options: {
|
|
123
|
+
connectionId: string;
|
|
124
|
+
threadId: string;
|
|
125
|
+
parentThreadId?: string;
|
|
126
|
+
reason?: string;
|
|
127
|
+
}): Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { WebRTCApi };
|
|
131
|
+
//# sourceMappingURL=WebRTCApi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebRTCApi.d.mts","names":[],"sources":["../../src/webrtc/WebRTCApi.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAca,SAAA;;;EAAA,QAAA,aAAS;EAIS,QAAA,YAAA;EACJ,QAAA,MAAA;EACA,WAAA,CAAA,iBAAA,EAFI,wBAEJ,EAAA,aAAA,EADA,oBACA,EAAA,aAAA,EAAA,aAAA,EAAA,YAAA,EACD,YADC;EACD;;;EAyCb,oBAAA,CAAA,CAAA,EArBoB,kBAqBpB,CAAA,YAAA,CAAA;EAEI;;;;EA0CK,WAAA,CAAA,OAAA,EAAA;IAGnB,YAAA,EAAA,MAAA;IAqCc,QAAA,CAAA,EAAA,MAAA;IACd,cAAA,CAAA,EAAA,MAAA;IAwBa;IAEb,KAAA,CAAA,EAvHS,SAuHT,EAAA;IA6BS;IAIK,IAAA,CAAA,EAAA,OAAA;IAEJ;IACV,QAAA,CAAA,EAAA,MAAA,GAAA,KAAA;IA2Bc;IAEJ,OAAA,CAAA,EAAA,OAAA;IACV;IAWiH,MAAA,CAAA,EA5LvG,SA4LuG;IAAA;iBA1LnG;;;MAGd;;;;;;;;;;;;iBAqCc;;aAEJ;;;MAGV,QAHmB,gBAAA;;;;;;;;;;iBAwCL;MACd;;;;;;;;gBAwBa;;MAEb;;;;;;;;;;;;;;;YA6BS;;;;iBAIK;;aAEJ;MACV;;;;;;;;;;;iBA2Bc;;aAEJ;MACV;;;;;;;;;MAWiH"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs";
|
|
2
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs";
|
|
3
|
+
import "./messages/index.mjs";
|
|
4
|
+
import { WebRTCService } from "./services/WebRTCService.mjs";
|
|
5
|
+
import { WebRTCModuleConfigToken } from "./WebRTCModule.mjs";
|
|
6
|
+
import { DidCommConnectionService, DidCommMessageSender, getOutboundDidCommMessageContext } from "@credo-ts/didcomm";
|
|
7
|
+
import { AgentContext } from "@credo-ts/core";
|
|
8
|
+
import { injectable } from "tsyringe";
|
|
9
|
+
|
|
10
|
+
//#region src/webrtc/WebRTCApi.ts
|
|
11
|
+
var _ref, _ref2, _ref3, _ref4;
|
|
12
|
+
let WebRTCApi = class WebRTCApi$1 {
|
|
13
|
+
constructor(connectionService, messageSender, webrtcService, agentContext) {
|
|
14
|
+
this.connectionService = connectionService;
|
|
15
|
+
this.messageSender = messageSender;
|
|
16
|
+
this.webrtcService = webrtcService;
|
|
17
|
+
this.agentContext = agentContext;
|
|
18
|
+
try {
|
|
19
|
+
this.config = this.agentContext.dependencyManager.resolve(WebRTCModuleConfigToken);
|
|
20
|
+
} catch {
|
|
21
|
+
this.config = {
|
|
22
|
+
iceServers: [{ urls: "stun:stun.l.google.com:19302" }, { urls: "stun:stun1.l.google.com:19302" }],
|
|
23
|
+
defaultPolicy: "all",
|
|
24
|
+
defaultTrickle: true
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the configured default ICE servers
|
|
30
|
+
*/
|
|
31
|
+
getDefaultIceServers() {
|
|
32
|
+
return this.config.iceServers;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Propose a call to a peer (before sending offer)
|
|
36
|
+
* This allows sharing ICE servers and negotiating capabilities before the SDP exchange
|
|
37
|
+
*/
|
|
38
|
+
async proposeCall(options) {
|
|
39
|
+
const connection = await this.connectionService.getById(this.agentContext, options.connectionId);
|
|
40
|
+
const iceServers = options.iceServers ?? this.config.iceServers;
|
|
41
|
+
const policy = options.policy ?? this.config.defaultPolicy;
|
|
42
|
+
const trickle = options.trickle ?? this.config.defaultTrickle;
|
|
43
|
+
const { message } = this.webrtcService.createPropose({
|
|
44
|
+
threadId: options.threadId,
|
|
45
|
+
parentThreadId: options.parentThreadId,
|
|
46
|
+
media: options.media,
|
|
47
|
+
data: options.data,
|
|
48
|
+
topology: options.topology ?? "mesh",
|
|
49
|
+
trickle,
|
|
50
|
+
policy,
|
|
51
|
+
iceServers,
|
|
52
|
+
reason: options.reason
|
|
53
|
+
});
|
|
54
|
+
const outbound = await getOutboundDidCommMessageContext(this.agentContext, {
|
|
55
|
+
message,
|
|
56
|
+
connectionRecord: connection
|
|
57
|
+
});
|
|
58
|
+
await this.messageSender.sendMessage(outbound);
|
|
59
|
+
return { threadId: message.threadId ?? message.id };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Start a call by sending an SDP offer
|
|
63
|
+
*/
|
|
64
|
+
async startCall(options) {
|
|
65
|
+
const connection = await this.connectionService.getById(this.agentContext, options.connectionId);
|
|
66
|
+
const iceServers = options.iceServers ?? this.config.iceServers;
|
|
67
|
+
const policy = options.policy ?? this.config.defaultPolicy;
|
|
68
|
+
const trickle = options.trickle ?? this.config.defaultTrickle;
|
|
69
|
+
const { message, record } = this.webrtcService.createOffer(this.agentContext, connection, options.threadId, options.parentThreadId, options.sdp, iceServers, policy, trickle);
|
|
70
|
+
const outbound = await getOutboundDidCommMessageContext(this.agentContext, {
|
|
71
|
+
message,
|
|
72
|
+
associatedRecord: record,
|
|
73
|
+
connectionRecord: connection
|
|
74
|
+
});
|
|
75
|
+
await this.messageSender.sendMessage(outbound);
|
|
76
|
+
return record;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Accept a call by sending an SDP answer
|
|
80
|
+
*/
|
|
81
|
+
async acceptCall(options) {
|
|
82
|
+
const connection = await this.connectionService.getById(this.agentContext, options.connectionId);
|
|
83
|
+
const { message } = this.webrtcService.createAnswer(this.agentContext, connection, options.threadId, options.parentThreadId, options.sdp, options.iceServers);
|
|
84
|
+
const outbound = await getOutboundDidCommMessageContext(this.agentContext, {
|
|
85
|
+
message,
|
|
86
|
+
connectionRecord: connection
|
|
87
|
+
});
|
|
88
|
+
await this.messageSender.sendMessage(outbound);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Send an ICE candidate
|
|
92
|
+
*/
|
|
93
|
+
async sendIce(options) {
|
|
94
|
+
const connection = await this.connectionService.getById(this.agentContext, options.connectionId);
|
|
95
|
+
const message = this.webrtcService.createIce(options.threadId, options.parentThreadId, options.candidate, options.endOfCandidates);
|
|
96
|
+
const outbound = await getOutboundDidCommMessageContext(this.agentContext, {
|
|
97
|
+
message,
|
|
98
|
+
connectionRecord: connection
|
|
99
|
+
});
|
|
100
|
+
await this.messageSender.sendMessage(outbound);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Request renegotiation (for ICE restart, adding/removing tracks, etc.)
|
|
104
|
+
*
|
|
105
|
+
* Use this when:
|
|
106
|
+
* - ICE connection failed and needs restart
|
|
107
|
+
* - Adding screenshare or switching cameras
|
|
108
|
+
* - Network changed (WiFi to cellular)
|
|
109
|
+
* - Changing codec or bandwidth settings
|
|
110
|
+
*/
|
|
111
|
+
async renegotiate(options) {
|
|
112
|
+
const connection = await this.connectionService.getById(this.agentContext, options.connectionId);
|
|
113
|
+
const message = this.webrtcService.createRenegotiate({
|
|
114
|
+
threadId: options.threadId,
|
|
115
|
+
parentThreadId: options.parentThreadId,
|
|
116
|
+
reason: options.reason,
|
|
117
|
+
iceRestart: options.iceRestart,
|
|
118
|
+
iceServers: options.iceServers,
|
|
119
|
+
policy: options.policy
|
|
120
|
+
});
|
|
121
|
+
const outbound = await getOutboundDidCommMessageContext(this.agentContext, {
|
|
122
|
+
message,
|
|
123
|
+
connectionRecord: connection
|
|
124
|
+
});
|
|
125
|
+
await this.messageSender.sendMessage(outbound);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Request ICE restart (convenience method for renegotiate with iceRestart=true)
|
|
129
|
+
*
|
|
130
|
+
* Use when the WebRTC connection has failed or disconnected
|
|
131
|
+
*/
|
|
132
|
+
async restartIce(options) {
|
|
133
|
+
return this.renegotiate({
|
|
134
|
+
...options,
|
|
135
|
+
reason: "ice-restart",
|
|
136
|
+
iceRestart: true
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* End a call
|
|
141
|
+
*/
|
|
142
|
+
async endCall(options) {
|
|
143
|
+
const connection = await this.connectionService.getById(this.agentContext, options.connectionId);
|
|
144
|
+
const message = this.webrtcService.createEnd(options.threadId, options.parentThreadId, options.reason);
|
|
145
|
+
const outbound = await getOutboundDidCommMessageContext(this.agentContext, {
|
|
146
|
+
message,
|
|
147
|
+
connectionRecord: connection
|
|
148
|
+
});
|
|
149
|
+
await this.messageSender.sendMessage(outbound);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
WebRTCApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
153
|
+
typeof (_ref = typeof DidCommConnectionService !== "undefined" && DidCommConnectionService) === "function" ? _ref : Object,
|
|
154
|
+
typeof (_ref2 = typeof DidCommMessageSender !== "undefined" && DidCommMessageSender) === "function" ? _ref2 : Object,
|
|
155
|
+
typeof (_ref3 = typeof WebRTCService !== "undefined" && WebRTCService) === "function" ? _ref3 : Object,
|
|
156
|
+
typeof (_ref4 = typeof AgentContext !== "undefined" && AgentContext) === "function" ? _ref4 : Object
|
|
157
|
+
])], WebRTCApi);
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
export { WebRTCApi };
|
|
161
|
+
//# sourceMappingURL=WebRTCApi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebRTCApi.mjs","names":["WebRTCApi","connectionService: DidCommConnectionService","messageSender: DidCommMessageSender","webrtcService: WebRTCService","agentContext: AgentContext","message: IceMessage"],"sources":["../../src/webrtc/WebRTCApi.ts"],"sourcesContent":["import { AgentContext } from '@credo-ts/core'\nimport { DidCommConnectionService, DidCommMessageSender } from '@credo-ts/didcomm'\n\nimport { injectable } from 'tsyringe'\nimport { getOutboundDidCommMessageContext } from '@credo-ts/didcomm'\n\nimport { WebRTCService } from './services/WebRTCService'\nimport { IceMessage } from './messages'\nimport type { IcePolicy, IceServerConfig } from './messages/OfferMessage'\nimport type { MediaType } from './messages/ProposeMessage'\nimport type { RenegotiateReason } from './messages/RenegotiateMessage'\nimport { WebRTCModuleConfigToken, type WebRTCModuleConfig } from './WebRTCModule'\n\n@injectable()\nexport class WebRTCApi {\n private config: WebRTCModuleConfig\n\n public constructor(\n private connectionService: DidCommConnectionService,\n private messageSender: DidCommMessageSender,\n private webrtcService: WebRTCService,\n private agentContext: AgentContext\n ) {\n // Get config from dependency manager, with fallback defaults\n try {\n this.config = this.agentContext.dependencyManager.resolve(WebRTCModuleConfigToken)\n } catch {\n this.config = {\n iceServers: [\n { urls: 'stun:stun.l.google.com:19302' },\n { urls: 'stun:stun1.l.google.com:19302' },\n ],\n defaultPolicy: 'all',\n defaultTrickle: true,\n }\n }\n }\n\n /**\n * Get the configured default ICE servers\n */\n public getDefaultIceServers(): WebRTCModuleConfig['iceServers'] {\n return this.config.iceServers\n }\n\n /**\n * Propose a call to a peer (before sending offer)\n * This allows sharing ICE servers and negotiating capabilities before the SDP exchange\n */\n public async proposeCall(options: {\n connectionId: string\n threadId?: string\n parentThreadId?: string\n /** Requested media types */\n media?: MediaType[]\n /** Whether data channel is requested */\n data?: boolean\n /** Topology: 'mesh' (P2P) or 'sfu' */\n topology?: 'mesh' | 'sfu'\n /** Whether trickle ICE is supported (defaults to module config) */\n trickle?: boolean\n /** ICE policy (defaults to module config) */\n policy?: IcePolicy\n /** ICE servers - uses module defaults if not provided */\n iceServers?: IceServerConfig[]\n /** Optional reason/context */\n reason?: string\n }) {\n const connection = await this.connectionService.getById(this.agentContext, options.connectionId)\n\n // Use module defaults for missing options\n const iceServers = options.iceServers ?? (this.config.iceServers as IceServerConfig[] | undefined)\n const policy = options.policy ?? this.config.defaultPolicy\n const trickle = options.trickle ?? this.config.defaultTrickle\n\n const { message } = this.webrtcService.createPropose({\n threadId: options.threadId,\n parentThreadId: options.parentThreadId,\n media: options.media,\n data: options.data,\n topology: options.topology ?? 'mesh',\n trickle,\n policy,\n iceServers,\n reason: options.reason,\n })\n\n const outbound = await getOutboundDidCommMessageContext(this.agentContext, {\n message,\n connectionRecord: connection,\n })\n await this.messageSender.sendMessage(outbound)\n return { threadId: message.threadId ?? message.id }\n }\n\n /**\n * Start a call by sending an SDP offer\n */\n public async startCall(options: {\n connectionId: string\n threadId: string\n parentThreadId?: string\n sdp: string\n /** ICE servers - uses module defaults if not provided */\n iceServers?: IceServerConfig[]\n /** ICE policy (defaults to module config) */\n policy?: IcePolicy\n /** Whether trickle ICE is enabled (defaults to module config) */\n trickle?: boolean\n }) {\n const connection = await this.connectionService.getById(this.agentContext, options.connectionId)\n\n // Use module defaults for missing options\n const iceServers = options.iceServers ?? (this.config.iceServers as IceServerConfig[] | undefined)\n const policy = options.policy ?? this.config.defaultPolicy\n const trickle = options.trickle ?? this.config.defaultTrickle\n\n const { message, record } = this.webrtcService.createOffer(\n this.agentContext,\n connection,\n options.threadId,\n options.parentThreadId,\n options.sdp,\n iceServers,\n policy,\n trickle\n )\n\n const outbound = await getOutboundDidCommMessageContext(this.agentContext, {\n message,\n associatedRecord: record,\n connectionRecord: connection,\n })\n await this.messageSender.sendMessage(outbound)\n return record\n }\n\n /**\n * Accept a call by sending an SDP answer\n */\n public async acceptCall(options: {\n connectionId: string\n threadId: string\n parentThreadId?: string\n sdp: string\n /** Optional ICE servers from callee (if different from caller's) */\n iceServers?: IceServerConfig[]\n }) {\n const connection = await this.connectionService.getById(this.agentContext, options.connectionId)\n const { message } = this.webrtcService.createAnswer(\n this.agentContext,\n connection,\n options.threadId,\n options.parentThreadId,\n options.sdp,\n options.iceServers\n )\n const outbound = await getOutboundDidCommMessageContext(this.agentContext, {\n message,\n connectionRecord: connection,\n })\n await this.messageSender.sendMessage(outbound)\n }\n\n /**\n * Send an ICE candidate\n */\n public async sendIce(options: {\n connectionId: string\n threadId: string\n parentThreadId?: string\n candidate?: Record<string, unknown>\n endOfCandidates?: boolean\n }) {\n const connection = await this.connectionService.getById(this.agentContext, options.connectionId)\n const message: IceMessage = this.webrtcService.createIce(\n options.threadId,\n options.parentThreadId,\n options.candidate,\n options.endOfCandidates\n )\n const outbound = await getOutboundDidCommMessageContext(this.agentContext, {\n message,\n connectionRecord: connection,\n })\n await this.messageSender.sendMessage(outbound)\n }\n\n /**\n * Request renegotiation (for ICE restart, adding/removing tracks, etc.)\n *\n * Use this when:\n * - ICE connection failed and needs restart\n * - Adding screenshare or switching cameras\n * - Network changed (WiFi to cellular)\n * - Changing codec or bandwidth settings\n */\n public async renegotiate(options: {\n connectionId: string\n threadId: string\n parentThreadId?: string\n /** Reason for renegotiation */\n reason: RenegotiateReason | string\n /** Whether to perform ICE restart (required for recovering failed connections) */\n iceRestart?: boolean\n /** New ICE servers (useful when switching networks) */\n iceServers?: IceServerConfig[]\n /** Updated ICE policy */\n policy?: IcePolicy\n }) {\n const connection = await this.connectionService.getById(this.agentContext, options.connectionId)\n const message = this.webrtcService.createRenegotiate({\n threadId: options.threadId,\n parentThreadId: options.parentThreadId,\n reason: options.reason,\n iceRestart: options.iceRestart,\n iceServers: options.iceServers,\n policy: options.policy,\n })\n const outbound = await getOutboundDidCommMessageContext(this.agentContext, {\n message,\n connectionRecord: connection,\n })\n await this.messageSender.sendMessage(outbound)\n }\n\n /**\n * Request ICE restart (convenience method for renegotiate with iceRestart=true)\n *\n * Use when the WebRTC connection has failed or disconnected\n */\n public async restartIce(options: {\n connectionId: string\n threadId: string\n parentThreadId?: string\n /** New ICE servers (optional, useful when original servers are unreachable) */\n iceServers?: IceServerConfig[]\n /** Updated ICE policy */\n policy?: IcePolicy\n }) {\n return this.renegotiate({\n ...options,\n reason: 'ice-restart',\n iceRestart: true,\n })\n }\n\n /**\n * End a call\n */\n public async endCall(options: { connectionId: string; threadId: string; parentThreadId?: string; reason?: string }) {\n const connection = await this.connectionService.getById(this.agentContext, options.connectionId)\n const message = this.webrtcService.createEnd(options.threadId, options.parentThreadId, options.reason)\n const outbound = await getOutboundDidCommMessageContext(this.agentContext, {\n message,\n connectionRecord: connection,\n })\n await this.messageSender.sendMessage(outbound)\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { IcePolicy } from "./messages/OfferMessage.mjs";
|
|
2
|
+
import { MediaType } from "./messages/ProposeMessage.mjs";
|
|
3
|
+
import { RenegotiateReason } from "./messages/RenegotiateMessage.mjs";
|
|
4
|
+
import { DidCommInboundMessageContext } from "@credo-ts/didcomm";
|
|
5
|
+
|
|
6
|
+
//#region src/webrtc/WebRTCEvents.d.ts
|
|
7
|
+
declare enum WebRTCEvents {
|
|
8
|
+
/** Incoming call proposal (before offer) */
|
|
9
|
+
IncomingPropose = "WebRTCEvents.IncomingPropose",
|
|
10
|
+
/** Incoming SDP offer */
|
|
11
|
+
IncomingOffer = "WebRTCEvents.IncomingOffer",
|
|
12
|
+
/** Incoming SDP answer */
|
|
13
|
+
IncomingAnswer = "WebRTCEvents.IncomingAnswer",
|
|
14
|
+
/** Incoming ICE candidate */
|
|
15
|
+
IncomingIce = "WebRTCEvents.IncomingIce",
|
|
16
|
+
/** Renegotiation requested (track changes, ICE restart) */
|
|
17
|
+
RenegotiateRequested = "WebRTCEvents.RenegotiateRequested",
|
|
18
|
+
/** Call ended */
|
|
19
|
+
CallEnded = "WebRTCEvents.CallEnded",
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ICE server configuration in events
|
|
23
|
+
*/
|
|
24
|
+
interface IceServerEventConfig {
|
|
25
|
+
urls: string | string[];
|
|
26
|
+
username?: string;
|
|
27
|
+
credential?: string;
|
|
28
|
+
credentialType?: 'password' | 'oauth';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Event emitted when a call proposal is received
|
|
32
|
+
*/
|
|
33
|
+
interface IncomingProposeEvent {
|
|
34
|
+
context: DidCommInboundMessageContext;
|
|
35
|
+
thid: string;
|
|
36
|
+
pthid?: string;
|
|
37
|
+
/** Requested media types */
|
|
38
|
+
media?: MediaType[];
|
|
39
|
+
/** Whether data channel is requested */
|
|
40
|
+
data?: boolean;
|
|
41
|
+
/** Topology: 'mesh' or 'sfu' */
|
|
42
|
+
topology?: 'mesh' | 'sfu';
|
|
43
|
+
/** Whether trickle ICE is supported */
|
|
44
|
+
trickle?: boolean;
|
|
45
|
+
/** ICE policy */
|
|
46
|
+
policy?: IcePolicy;
|
|
47
|
+
/** ICE servers for NAT traversal */
|
|
48
|
+
iceServers?: IceServerEventConfig[];
|
|
49
|
+
/** Optional reason/context */
|
|
50
|
+
reason?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Event emitted when an SDP offer is received
|
|
54
|
+
*/
|
|
55
|
+
interface IncomingOfferEvent {
|
|
56
|
+
context: DidCommInboundMessageContext;
|
|
57
|
+
thid: string;
|
|
58
|
+
pthid?: string;
|
|
59
|
+
sdp: string;
|
|
60
|
+
/** ICE servers for NAT traversal */
|
|
61
|
+
iceServers?: IceServerEventConfig[];
|
|
62
|
+
/** ICE policy */
|
|
63
|
+
policy?: IcePolicy;
|
|
64
|
+
/** Whether trickle ICE is enabled */
|
|
65
|
+
trickle?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Event emitted when an SDP answer is received
|
|
69
|
+
*/
|
|
70
|
+
interface IncomingAnswerEvent {
|
|
71
|
+
context: DidCommInboundMessageContext;
|
|
72
|
+
thid: string;
|
|
73
|
+
pthid?: string;
|
|
74
|
+
sdp: string;
|
|
75
|
+
/** Optional ICE servers from callee */
|
|
76
|
+
iceServers?: IceServerEventConfig[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Event emitted when an ICE candidate is received
|
|
80
|
+
*/
|
|
81
|
+
interface IncomingIceEvent {
|
|
82
|
+
context: DidCommInboundMessageContext;
|
|
83
|
+
thid: string;
|
|
84
|
+
pthid?: string;
|
|
85
|
+
candidate: Record<string, unknown>;
|
|
86
|
+
endOfCandidates?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Event emitted when renegotiation is requested
|
|
90
|
+
*/
|
|
91
|
+
interface RenegotiateRequestedEvent {
|
|
92
|
+
context: DidCommInboundMessageContext;
|
|
93
|
+
thid: string;
|
|
94
|
+
pthid?: string;
|
|
95
|
+
/** Reason for renegotiation */
|
|
96
|
+
reason: RenegotiateReason | string;
|
|
97
|
+
/** Whether ICE restart is requested */
|
|
98
|
+
iceRestart?: boolean;
|
|
99
|
+
/** New ICE servers (if changed) */
|
|
100
|
+
iceServers?: IceServerEventConfig[];
|
|
101
|
+
/** Updated ICE policy */
|
|
102
|
+
policy?: IcePolicy;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Event emitted when a call ends
|
|
106
|
+
*/
|
|
107
|
+
interface CallEndedEvent {
|
|
108
|
+
context: DidCommInboundMessageContext;
|
|
109
|
+
thid: string;
|
|
110
|
+
pthid?: string;
|
|
111
|
+
reason?: string;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { CallEndedEvent, IceServerEventConfig, IncomingAnswerEvent, IncomingIceEvent, IncomingOfferEvent, IncomingProposeEvent, RenegotiateRequestedEvent, WebRTCEvents };
|
|
115
|
+
//# sourceMappingURL=WebRTCEvents.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebRTCEvents.d.mts","names":[],"sources":["../../src/webrtc/WebRTCEvents.ts"],"sourcesContent":[],"mappings":";;;;;;aAKY,YAAA;;EAAA,eAAY,GAAA,8BAAA;EAkBP;EAUA,aAAA,GAAA,4BAAoB;EAC1B;EAID,cAAA,GAAA,6BAAA;EAQC;EAEI,WAAA,GAAA,0BAAA;EAAoB;EAQlB,oBAAA,GAAkB,mCAAA;EACxB;EAKI,SAAA,GAAA,wBAAA;;;AAUf;AAYA;AAWiB,UAxEA,oBAAA,CAwEyB;EAC/B,IAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAID,QAAA,CAAA,EAAA,MAAA;EAIK,UAAA,CAAA,EAAA,MAAA;EAEJ,cAAA,CAAA,EAAA,UAAA,GAAA,OAAA;;AAMX;;;UA/EiB,oBAAA;WACN;;;;UAID;;;;;;;;WAQC;;eAEI;;;;;;;UAQE,kBAAA;WACN;;;;;eAKI;;WAEJ;;;;;;;UAQM,mBAAA;WACN;;;;;eAKI;;;;;UAME,gBAAA;WACN;;;aAGE;;;;;;UAOI,yBAAA;WACN;;;;UAID;;;;eAIK;;WAEJ;;;;;UAMM,cAAA;WACN"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/webrtc/WebRTCEvents.ts
|
|
2
|
+
let WebRTCEvents = /* @__PURE__ */ function(WebRTCEvents$1) {
|
|
3
|
+
/** Incoming call proposal (before offer) */
|
|
4
|
+
WebRTCEvents$1["IncomingPropose"] = "WebRTCEvents.IncomingPropose";
|
|
5
|
+
/** Incoming SDP offer */
|
|
6
|
+
WebRTCEvents$1["IncomingOffer"] = "WebRTCEvents.IncomingOffer";
|
|
7
|
+
/** Incoming SDP answer */
|
|
8
|
+
WebRTCEvents$1["IncomingAnswer"] = "WebRTCEvents.IncomingAnswer";
|
|
9
|
+
/** Incoming ICE candidate */
|
|
10
|
+
WebRTCEvents$1["IncomingIce"] = "WebRTCEvents.IncomingIce";
|
|
11
|
+
/** Renegotiation requested (track changes, ICE restart) */
|
|
12
|
+
WebRTCEvents$1["RenegotiateRequested"] = "WebRTCEvents.RenegotiateRequested";
|
|
13
|
+
/** Call ended */
|
|
14
|
+
WebRTCEvents$1["CallEnded"] = "WebRTCEvents.CallEnded";
|
|
15
|
+
return WebRTCEvents$1;
|
|
16
|
+
}({});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { WebRTCEvents };
|
|
20
|
+
//# sourceMappingURL=WebRTCEvents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebRTCEvents.mjs","names":[],"sources":["../../src/webrtc/WebRTCEvents.ts"],"sourcesContent":["import type { DidCommInboundMessageContext } from '@credo-ts/didcomm'\nimport type { IcePolicy } from './messages/OfferMessage'\nimport type { MediaType } from './messages/ProposeMessage'\nimport type { RenegotiateReason } from './messages/RenegotiateMessage'\n\nexport enum WebRTCEvents {\n /** Incoming call proposal (before offer) */\n IncomingPropose = 'WebRTCEvents.IncomingPropose',\n /** Incoming SDP offer */\n IncomingOffer = 'WebRTCEvents.IncomingOffer',\n /** Incoming SDP answer */\n IncomingAnswer = 'WebRTCEvents.IncomingAnswer',\n /** Incoming ICE candidate */\n IncomingIce = 'WebRTCEvents.IncomingIce',\n /** Renegotiation requested (track changes, ICE restart) */\n RenegotiateRequested = 'WebRTCEvents.RenegotiateRequested',\n /** Call ended */\n CallEnded = 'WebRTCEvents.CallEnded'\n}\n\n/**\n * ICE server configuration in events\n */\nexport interface IceServerEventConfig {\n urls: string | string[]\n username?: string\n credential?: string\n credentialType?: 'password' | 'oauth'\n}\n\n/**\n * Event emitted when a call proposal is received\n */\nexport interface IncomingProposeEvent {\n context: DidCommInboundMessageContext\n thid: string\n pthid?: string\n /** Requested media types */\n media?: MediaType[]\n /** Whether data channel is requested */\n data?: boolean\n /** Topology: 'mesh' or 'sfu' */\n topology?: 'mesh' | 'sfu'\n /** Whether trickle ICE is supported */\n trickle?: boolean\n /** ICE policy */\n policy?: IcePolicy\n /** ICE servers for NAT traversal */\n iceServers?: IceServerEventConfig[]\n /** Optional reason/context */\n reason?: string\n}\n\n/**\n * Event emitted when an SDP offer is received\n */\nexport interface IncomingOfferEvent {\n context: DidCommInboundMessageContext\n thid: string\n pthid?: string\n sdp: string\n /** ICE servers for NAT traversal */\n iceServers?: IceServerEventConfig[]\n /** ICE policy */\n policy?: IcePolicy\n /** Whether trickle ICE is enabled */\n trickle?: boolean\n}\n\n/**\n * Event emitted when an SDP answer is received\n */\nexport interface IncomingAnswerEvent {\n context: DidCommInboundMessageContext\n thid: string\n pthid?: string\n sdp: string\n /** Optional ICE servers from callee */\n iceServers?: IceServerEventConfig[]\n}\n\n/**\n * Event emitted when an ICE candidate is received\n */\nexport interface IncomingIceEvent {\n context: DidCommInboundMessageContext\n thid: string\n pthid?: string\n candidate: Record<string, unknown>\n endOfCandidates?: boolean\n}\n\n/**\n * Event emitted when renegotiation is requested\n */\nexport interface RenegotiateRequestedEvent {\n context: DidCommInboundMessageContext\n thid: string\n pthid?: string\n /** Reason for renegotiation */\n reason: RenegotiateReason | string\n /** Whether ICE restart is requested */\n iceRestart?: boolean\n /** New ICE servers (if changed) */\n iceServers?: IceServerEventConfig[]\n /** Updated ICE policy */\n policy?: IcePolicy\n}\n\n/**\n * Event emitted when a call ends\n */\nexport interface CallEndedEvent {\n context: DidCommInboundMessageContext\n thid: string\n pthid?: string\n reason?: string\n}\n"],"mappings":";AAKA,IAAY,wDAAL;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IcePolicy } from "./messages/OfferMessage.mjs";
|
|
2
|
+
import { WebRTCApi } from "./WebRTCApi.mjs";
|
|
3
|
+
import { AgentContext, DependencyManager, Module } from "@credo-ts/core";
|
|
4
|
+
|
|
5
|
+
//#region src/webrtc/WebRTCModule.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ICE server configuration for module-level defaults
|
|
9
|
+
*/
|
|
10
|
+
interface WebRTCIceServerConfig {
|
|
11
|
+
/** STUN/TURN server URL(s) */
|
|
12
|
+
urls: string | string[];
|
|
13
|
+
/** Username for TURN authentication */
|
|
14
|
+
username?: string;
|
|
15
|
+
/** Credential for TURN authentication */
|
|
16
|
+
credential?: string;
|
|
17
|
+
/** Credential type */
|
|
18
|
+
credentialType?: 'password' | 'oauth';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Configuration options for WebRTCModule
|
|
22
|
+
*/
|
|
23
|
+
interface WebRTCModuleConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Default ICE servers (STUN/TURN) to use for all calls
|
|
26
|
+
* These are used when no iceServers are provided in API calls
|
|
27
|
+
*
|
|
28
|
+
* Example:
|
|
29
|
+
* ```ts
|
|
30
|
+
* iceServers: [
|
|
31
|
+
* { urls: 'stun:stun.l.google.com:19302' },
|
|
32
|
+
* { urls: 'turn:turn.example.org:3478', username: 'user', credential: 'pass' }
|
|
33
|
+
* ]
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
iceServers?: WebRTCIceServerConfig[];
|
|
37
|
+
/**
|
|
38
|
+
* Default ICE policy for NAT traversal
|
|
39
|
+
* - 'all': Use all available candidates (default)
|
|
40
|
+
* - 'relay-preferred': Prefer relay candidates but allow others
|
|
41
|
+
* - 'relay-only': Only use relay (TURN) candidates - best for strict NAT/firewall
|
|
42
|
+
*/
|
|
43
|
+
defaultPolicy?: IcePolicy;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to enable trickle ICE by default
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
defaultTrickle?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Injection token for WebRTC module configuration
|
|
52
|
+
*/
|
|
53
|
+
declare const WebRTCModuleConfigToken: unique symbol;
|
|
54
|
+
declare class WebRTCModule implements Module {
|
|
55
|
+
readonly api: typeof WebRTCApi;
|
|
56
|
+
readonly config: WebRTCModuleConfig;
|
|
57
|
+
constructor(config?: WebRTCModuleConfig);
|
|
58
|
+
register(dependencyManager: DependencyManager): void;
|
|
59
|
+
initialize(agentContext: AgentContext): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { WebRTCIceServerConfig, WebRTCModule, WebRTCModuleConfig, WebRTCModuleConfigToken };
|
|
63
|
+
//# sourceMappingURL=WebRTCModule.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebRTCModule.d.mts","names":[],"sources":["../../src/webrtc/WebRTCModule.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;AAciB,UAdA,qBAAA,CA2BF;EAoBF;EAEA,IAAA,EAAA,MAAA,GAAa,MAAA,EAAA;EACL;EACK,QAAA,CAAA,EAAA,MAAA;EAEG;EAYQ,UAAA,CAAA,EAAA,MAAA;EASG;EAAe,cAAA,CAAA,EAAA,UAAA,GAAA,OAAA;;;;;UA5DtC,kBAAA;;;;;;;;;;;;;eAaF;;;;;;;kBAQG;;;;;;;;;;cAYL;cAEA,YAAA,YAAwB;uBAChB;mBACK;uBAEG;8BAYQ;2BASG,eAAe"}
|