werift 0.28.0 → 0.29.0

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.
Files changed (492) hide show
  1. package/README.md +182 -2
  2. package/lib/common/src/transport.d.ts +39 -5
  3. package/lib/common/src/transport.js +32 -7
  4. package/lib/common/src/transport.js.map +1 -1
  5. package/lib/dtls/src/carrier/direct.d.ts +67 -0
  6. package/lib/dtls/src/carrier/direct.js +226 -0
  7. package/lib/dtls/src/carrier/direct.js.map +1 -0
  8. package/lib/dtls/src/carrier/types.d.ts +81 -0
  9. package/lib/dtls/src/carrier/types.js +7 -0
  10. package/lib/dtls/src/carrier/types.js.map +1 -0
  11. package/lib/dtls/src/cipher/const.d.ts +6 -0
  12. package/lib/dtls/src/cipher/const.js +13 -2
  13. package/lib/dtls/src/cipher/const.js.map +1 -1
  14. package/lib/dtls/src/cipher/prf.js +11 -2
  15. package/lib/dtls/src/cipher/prf.js.map +1 -1
  16. package/lib/dtls/src/cipher/tls13/aead.d.ts +41 -0
  17. package/lib/dtls/src/cipher/tls13/aead.js +128 -0
  18. package/lib/dtls/src/cipher/tls13/aead.js.map +1 -0
  19. package/lib/dtls/src/cipher/tls13/hkdf.d.ts +30 -0
  20. package/lib/dtls/src/cipher/tls13/hkdf.js +76 -0
  21. package/lib/dtls/src/cipher/tls13/hkdf.js.map +1 -0
  22. package/lib/dtls/src/cipher/tls13/keySchedule.d.ts +70 -0
  23. package/lib/dtls/src/cipher/tls13/keySchedule.js +114 -0
  24. package/lib/dtls/src/cipher/tls13/keySchedule.js.map +1 -0
  25. package/lib/dtls/src/cipher/tls13/signature.d.ts +30 -0
  26. package/lib/dtls/src/cipher/tls13/signature.js +149 -0
  27. package/lib/dtls/src/cipher/tls13/signature.js.map +1 -0
  28. package/lib/dtls/src/client.d.ts +253 -0
  29. package/lib/dtls/src/client.js +1257 -16
  30. package/lib/dtls/src/client.js.map +1 -1
  31. package/lib/dtls/src/context/dtls.d.ts +45 -0
  32. package/lib/dtls/src/context/dtls.js +114 -0
  33. package/lib/dtls/src/context/dtls.js.map +1 -1
  34. package/lib/dtls/src/context/transport.d.ts +13 -0
  35. package/lib/dtls/src/context/transport.js +29 -1
  36. package/lib/dtls/src/context/transport.js.map +1 -1
  37. package/lib/dtls/src/engine/v1_3/connection-base.d.ts +520 -0
  38. package/lib/dtls/src/engine/v1_3/connection-base.js +1644 -0
  39. package/lib/dtls/src/engine/v1_3/connection-base.js.map +1 -0
  40. package/lib/dtls/src/engine/v1_3/connection.d.ts +181 -0
  41. package/lib/dtls/src/engine/v1_3/connection.js +680 -0
  42. package/lib/dtls/src/engine/v1_3/connection.js.map +1 -0
  43. package/lib/dtls/src/engine/v1_3/early-data-buffer.d.ts +38 -0
  44. package/lib/dtls/src/engine/v1_3/early-data-buffer.js +166 -0
  45. package/lib/dtls/src/engine/v1_3/early-data-buffer.js.map +1 -0
  46. package/lib/dtls/src/engine/v1_3/flight/certificate.d.ts +4 -0
  47. package/lib/dtls/src/engine/v1_3/flight/certificate.js +62 -0
  48. package/lib/dtls/src/engine/v1_3/flight/certificate.js.map +1 -0
  49. package/lib/dtls/src/engine/v1_3/flight/client/flight1.d.ts +8 -0
  50. package/lib/dtls/src/engine/v1_3/flight/client/flight1.js +119 -0
  51. package/lib/dtls/src/engine/v1_3/flight/client/flight1.js.map +1 -0
  52. package/lib/dtls/src/engine/v1_3/flight/client/flight4.d.ts +8 -0
  53. package/lib/dtls/src/engine/v1_3/flight/client/flight4.js +251 -0
  54. package/lib/dtls/src/engine/v1_3/flight/client/flight4.js.map +1 -0
  55. package/lib/dtls/src/engine/v1_3/flight/client/flight5.d.ts +5 -0
  56. package/lib/dtls/src/engine/v1_3/flight/client/flight5.js +99 -0
  57. package/lib/dtls/src/engine/v1_3/flight/client/flight5.js.map +1 -0
  58. package/lib/dtls/src/engine/v1_3/flight/dispatch.d.ts +12 -0
  59. package/lib/dtls/src/engine/v1_3/flight/dispatch.js +138 -0
  60. package/lib/dtls/src/engine/v1_3/flight/dispatch.js.map +1 -0
  61. package/lib/dtls/src/engine/v1_3/flight/extensions.d.ts +13 -0
  62. package/lib/dtls/src/engine/v1_3/flight/extensions.js +46 -0
  63. package/lib/dtls/src/engine/v1_3/flight/extensions.js.map +1 -0
  64. package/lib/dtls/src/engine/v1_3/flight/finished.d.ts +6 -0
  65. package/lib/dtls/src/engine/v1_3/flight/finished.js +16 -0
  66. package/lib/dtls/src/engine/v1_3/flight/finished.js.map +1 -0
  67. package/lib/dtls/src/engine/v1_3/flight/post-hs.d.ts +12 -0
  68. package/lib/dtls/src/engine/v1_3/flight/post-hs.js +94 -0
  69. package/lib/dtls/src/engine/v1_3/flight/post-hs.js.map +1 -0
  70. package/lib/dtls/src/engine/v1_3/flight/server/flight2.d.ts +21 -0
  71. package/lib/dtls/src/engine/v1_3/flight/server/flight2.js +227 -0
  72. package/lib/dtls/src/engine/v1_3/flight/server/flight2.js.map +1 -0
  73. package/lib/dtls/src/engine/v1_3/flight/server/flight4.d.ts +6 -0
  74. package/lib/dtls/src/engine/v1_3/flight/server/flight4.js +455 -0
  75. package/lib/dtls/src/engine/v1_3/flight/server/flight4.js.map +1 -0
  76. package/lib/dtls/src/engine/v1_3/flight/server/flight5.d.ts +5 -0
  77. package/lib/dtls/src/engine/v1_3/flight/server/flight5.js +48 -0
  78. package/lib/dtls/src/engine/v1_3/flight/server/flight5.js.map +1 -0
  79. package/lib/dtls/src/engine/v1_3/flight-tx.d.ts +119 -0
  80. package/lib/dtls/src/engine/v1_3/flight-tx.js +782 -0
  81. package/lib/dtls/src/engine/v1_3/flight-tx.js.map +1 -0
  82. package/lib/dtls/src/engine/v1_3/host.d.ts +86 -0
  83. package/lib/dtls/src/engine/v1_3/host.js +11 -0
  84. package/lib/dtls/src/engine/v1_3/host.js.map +1 -0
  85. package/lib/dtls/src/engine/v1_3/record-rx.d.ts +77 -0
  86. package/lib/dtls/src/engine/v1_3/record-rx.js +818 -0
  87. package/lib/dtls/src/engine/v1_3/record-rx.js.map +1 -0
  88. package/lib/dtls/src/engine/v1_3/transcript.d.ts +22 -0
  89. package/lib/dtls/src/engine/v1_3/transcript.js +65 -0
  90. package/lib/dtls/src/engine/v1_3/transcript.js.map +1 -0
  91. package/lib/dtls/src/engine/v1_3/types.d.ts +169 -0
  92. package/lib/dtls/src/engine/v1_3/types.js +113 -0
  93. package/lib/dtls/src/engine/v1_3/types.js.map +1 -0
  94. package/lib/dtls/src/flight/client/flight1.d.ts +7 -1
  95. package/lib/dtls/src/flight/client/flight1.js +9 -3
  96. package/lib/dtls/src/flight/client/flight1.js.map +1 -1
  97. package/lib/dtls/src/flight/client/flight3.d.ts +8 -0
  98. package/lib/dtls/src/flight/client/flight3.js +24 -4
  99. package/lib/dtls/src/flight/client/flight3.js.map +1 -1
  100. package/lib/dtls/src/flight/client/flight5.js +13 -1
  101. package/lib/dtls/src/flight/client/flight5.js.map +1 -1
  102. package/lib/dtls/src/flight/flight.d.ts +16 -0
  103. package/lib/dtls/src/flight/flight.js +109 -8
  104. package/lib/dtls/src/flight/flight.js.map +1 -1
  105. package/lib/dtls/src/flight/server/commitClientHello.d.ts +35 -0
  106. package/lib/dtls/src/flight/server/commitClientHello.js +149 -0
  107. package/lib/dtls/src/flight/server/commitClientHello.js.map +1 -0
  108. package/lib/dtls/src/flight/server/flight2.d.ts +12 -3
  109. package/lib/dtls/src/flight/server/flight2.js +29 -105
  110. package/lib/dtls/src/flight/server/flight2.js.map +1 -1
  111. package/lib/dtls/src/flight/server/flight4.js +14 -2
  112. package/lib/dtls/src/flight/server/flight4.js.map +1 -1
  113. package/lib/dtls/src/flight/server/flight6.js +8 -0
  114. package/lib/dtls/src/flight/server/flight6.js.map +1 -1
  115. package/lib/dtls/src/handshake/const.d.ts +10 -0
  116. package/lib/dtls/src/handshake/const.js +10 -0
  117. package/lib/dtls/src/handshake/const.js.map +1 -1
  118. package/lib/dtls/src/handshake/extensions/cookie.d.ts +113 -0
  119. package/lib/dtls/src/handshake/extensions/cookie.js +326 -0
  120. package/lib/dtls/src/handshake/extensions/cookie.js.map +1 -0
  121. package/lib/dtls/src/handshake/extensions/ids.d.ts +7 -0
  122. package/lib/dtls/src/handshake/extensions/ids.js +11 -0
  123. package/lib/dtls/src/handshake/extensions/ids.js.map +1 -0
  124. package/lib/dtls/src/handshake/extensions/keyShare.d.ts +28 -0
  125. package/lib/dtls/src/handshake/extensions/keyShare.js +156 -0
  126. package/lib/dtls/src/handshake/extensions/keyShare.js.map +1 -0
  127. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.d.ts +27 -0
  128. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.js +67 -0
  129. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.js.map +1 -0
  130. package/lib/dtls/src/handshake/extensions/supportedVersions.d.ts +20 -0
  131. package/lib/dtls/src/handshake/extensions/supportedVersions.js +90 -0
  132. package/lib/dtls/src/handshake/extensions/supportedVersions.js.map +1 -0
  133. package/lib/dtls/src/handshake/extensions/unique.d.ts +7 -0
  134. package/lib/dtls/src/handshake/extensions/unique.js +19 -0
  135. package/lib/dtls/src/handshake/extensions/unique.js.map +1 -0
  136. package/lib/dtls/src/handshake/extensions/useSrtp.d.ts +26 -3
  137. package/lib/dtls/src/handshake/extensions/useSrtp.js +68 -12
  138. package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
  139. package/lib/dtls/src/handshake/message/tls13/ack.d.ts +50 -0
  140. package/lib/dtls/src/handshake/message/tls13/ack.js +107 -0
  141. package/lib/dtls/src/handshake/message/tls13/ack.js.map +1 -0
  142. package/lib/dtls/src/handshake/message/tls13/certificate.d.ts +17 -0
  143. package/lib/dtls/src/handshake/message/tls13/certificate.js +112 -0
  144. package/lib/dtls/src/handshake/message/tls13/certificate.js.map +1 -0
  145. package/lib/dtls/src/handshake/message/tls13/certificateRequest.d.ts +17 -0
  146. package/lib/dtls/src/handshake/message/tls13/certificateRequest.js +99 -0
  147. package/lib/dtls/src/handshake/message/tls13/certificateRequest.js.map +1 -0
  148. package/lib/dtls/src/handshake/message/tls13/certificateVerify.d.ts +21 -0
  149. package/lib/dtls/src/handshake/message/tls13/certificateVerify.js +77 -0
  150. package/lib/dtls/src/handshake/message/tls13/certificateVerify.js.map +1 -0
  151. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.d.ts +19 -0
  152. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.js +56 -0
  153. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.js.map +1 -0
  154. package/lib/dtls/src/handshake/message/tls13/keyUpdate.d.ts +13 -0
  155. package/lib/dtls/src/handshake/message/tls13/keyUpdate.js +54 -0
  156. package/lib/dtls/src/handshake/message/tls13/keyUpdate.js.map +1 -0
  157. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.d.ts +33 -0
  158. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.js +158 -0
  159. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.js.map +1 -0
  160. package/lib/dtls/src/handshake/random.d.ts +14 -0
  161. package/lib/dtls/src/handshake/random.js +24 -0
  162. package/lib/dtls/src/handshake/random.js.map +1 -1
  163. package/lib/dtls/src/handshake/validation.d.ts +26 -0
  164. package/lib/dtls/src/handshake/validation.js +32 -0
  165. package/lib/dtls/src/handshake/validation.js.map +1 -0
  166. package/lib/dtls/src/index.d.ts +6 -1
  167. package/lib/dtls/src/index.js +116 -44
  168. package/lib/dtls/src/index.js.map +1 -1
  169. package/lib/dtls/src/internal.d.ts +7 -0
  170. package/lib/dtls/src/internal.js +57 -0
  171. package/lib/dtls/src/internal.js.map +1 -0
  172. package/lib/dtls/src/peer.d.ts +49 -0
  173. package/lib/dtls/src/peer.js +54 -0
  174. package/lib/dtls/src/peer.js.map +1 -0
  175. package/lib/dtls/src/record/antiReplayWindow.d.ts +33 -0
  176. package/lib/dtls/src/record/antiReplayWindow.js +119 -0
  177. package/lib/dtls/src/record/antiReplayWindow.js.map +1 -0
  178. package/lib/dtls/src/record/const.d.ts +6 -0
  179. package/lib/dtls/src/record/const.js +6 -0
  180. package/lib/dtls/src/record/const.js.map +1 -1
  181. package/lib/dtls/src/record/message/fragment.d.ts +0 -2
  182. package/lib/dtls/src/record/message/fragment.js +36 -17
  183. package/lib/dtls/src/record/message/fragment.js.map +1 -1
  184. package/lib/dtls/src/record/message/reassembler.d.ts +62 -0
  185. package/lib/dtls/src/record/message/reassembler.js +249 -0
  186. package/lib/dtls/src/record/message/reassembler.js.map +1 -0
  187. package/lib/dtls/src/record/receive.js +24 -16
  188. package/lib/dtls/src/record/receive.js.map +1 -1
  189. package/lib/dtls/src/record/v1_3/header.d.ts +34 -0
  190. package/lib/dtls/src/record/v1_3/header.js +95 -0
  191. package/lib/dtls/src/record/v1_3/header.js.map +1 -0
  192. package/lib/dtls/src/record/v1_3/record.d.ts +133 -0
  193. package/lib/dtls/src/record/v1_3/record.js +370 -0
  194. package/lib/dtls/src/record/v1_3/record.js.map +1 -0
  195. package/lib/dtls/src/retransmission.d.ts +26 -0
  196. package/lib/dtls/src/retransmission.js +39 -0
  197. package/lib/dtls/src/retransmission.js.map +1 -0
  198. package/lib/dtls/src/server.d.ts +38 -0
  199. package/lib/dtls/src/server.js +367 -20
  200. package/lib/dtls/src/server.js.map +1 -1
  201. package/lib/dtls/src/socket.d.ts +379 -35
  202. package/lib/dtls/src/socket.js +1105 -132
  203. package/lib/dtls/src/socket.js.map +1 -1
  204. package/lib/dtls/src/version.d.ts +89 -0
  205. package/lib/dtls/src/version.js +204 -0
  206. package/lib/dtls/src/version.js.map +1 -0
  207. package/lib/ice/src/consent.d.ts +78 -1
  208. package/lib/ice/src/consent.js +236 -24
  209. package/lib/ice/src/consent.js.map +1 -1
  210. package/lib/ice/src/dns/lookup.d.ts +10 -0
  211. package/lib/ice/src/dns/lookup.js +130 -3
  212. package/lib/ice/src/dns/lookup.js.map +1 -1
  213. package/lib/ice/src/exceptions.d.ts +9 -0
  214. package/lib/ice/src/exceptions.js +14 -1
  215. package/lib/ice/src/exceptions.js.map +1 -1
  216. package/lib/ice/src/failover.d.ts +270 -0
  217. package/lib/ice/src/failover.js +674 -0
  218. package/lib/ice/src/failover.js.map +1 -0
  219. package/lib/ice/src/gatheringError.d.ts +28 -0
  220. package/lib/ice/src/gatheringError.js +17 -0
  221. package/lib/ice/src/gatheringError.js.map +1 -0
  222. package/lib/ice/src/ice.d.ts +265 -9
  223. package/lib/ice/src/ice.js +1624 -236
  224. package/lib/ice/src/ice.js.map +1 -1
  225. package/lib/ice/src/iceBase.d.ts +197 -6
  226. package/lib/ice/src/iceBase.js +157 -7
  227. package/lib/ice/src/iceBase.js.map +1 -1
  228. package/lib/ice/src/index.d.ts +2 -0
  229. package/lib/ice/src/index.js +4 -1
  230. package/lib/ice/src/index.js.map +1 -1
  231. package/lib/ice/src/internal/datagram.d.ts +37 -0
  232. package/lib/ice/src/internal/datagram.js +45 -0
  233. package/lib/ice/src/internal/datagram.js.map +1 -0
  234. package/lib/ice/src/internal/hostInterfaces.d.ts +13 -2
  235. package/lib/ice/src/internal/hostInterfaces.js +16 -4
  236. package/lib/ice/src/internal/hostInterfaces.js.map +1 -1
  237. package/lib/ice/src/internal/sped-bind.d.ts +44 -0
  238. package/lib/ice/src/internal/sped-bind.js +53 -0
  239. package/lib/ice/src/internal/sped-bind.js.map +1 -0
  240. package/lib/ice/src/internal/sped-binding-cache.d.ts +27 -0
  241. package/lib/ice/src/internal/sped-binding-cache.js +102 -0
  242. package/lib/ice/src/internal/sped-binding-cache.js.map +1 -0
  243. package/lib/ice/src/internal/sped.d.ts +15 -0
  244. package/lib/ice/src/internal/sped.js +62 -0
  245. package/lib/ice/src/internal/sped.js.map +1 -0
  246. package/lib/ice/src/nomination/selectionController.d.ts +111 -0
  247. package/lib/ice/src/nomination/selectionController.js +172 -0
  248. package/lib/ice/src/nomination/selectionController.js.map +1 -0
  249. package/lib/ice/src/nomination/selectionReplacement.d.ts +40 -0
  250. package/lib/ice/src/nomination/selectionReplacement.js +65 -7
  251. package/lib/ice/src/nomination/selectionReplacement.js.map +1 -1
  252. package/lib/ice/src/sped/draft00/codec.d.ts +20 -0
  253. package/lib/ice/src/sped/draft00/codec.js +59 -0
  254. package/lib/ice/src/sped/draft00/codec.js.map +1 -0
  255. package/lib/ice/src/sped/draft00/constants.d.ts +14 -0
  256. package/lib/ice/src/sped/draft00/constants.js +18 -0
  257. package/lib/ice/src/sped/draft00/constants.js.map +1 -0
  258. package/lib/ice/src/sped/draft00/index.d.ts +6 -0
  259. package/lib/ice/src/sped/draft00/index.js +26 -0
  260. package/lib/ice/src/sped/draft00/index.js.map +1 -0
  261. package/lib/ice/src/sped/draft00/mtu.d.ts +38 -0
  262. package/lib/ice/src/sped/draft00/mtu.js +96 -0
  263. package/lib/ice/src/sped/draft00/mtu.js.map +1 -0
  264. package/lib/ice/src/sped/draft00/session.d.ts +86 -0
  265. package/lib/ice/src/sped/draft00/session.js +353 -0
  266. package/lib/ice/src/sped/draft00/session.js.map +1 -0
  267. package/lib/ice/src/sped/draft00/types.d.ts +16 -0
  268. package/lib/ice/src/sped/draft00/types.js +3 -0
  269. package/lib/ice/src/sped/draft00/types.js.map +1 -0
  270. package/lib/ice/src/sped/runtime.d.ts +188 -0
  271. package/lib/ice/src/sped/runtime.js +643 -0
  272. package/lib/ice/src/sped/runtime.js.map +1 -0
  273. package/lib/ice/src/stun/protocol.d.ts +29 -0
  274. package/lib/ice/src/stun/protocol.js +91 -4
  275. package/lib/ice/src/stun/protocol.js.map +1 -1
  276. package/lib/ice/src/stun/rawAttributeValue.d.ts +1 -0
  277. package/lib/ice/src/stun/rawAttributeValue.js +6 -0
  278. package/lib/ice/src/stun/rawAttributeValue.js.map +1 -0
  279. package/lib/ice/src/stun/tcpProtocol.d.ts +1 -0
  280. package/lib/ice/src/stun/tcpProtocol.js +14 -2
  281. package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
  282. package/lib/ice/src/stun/transaction.d.ts +4 -0
  283. package/lib/ice/src/stun/transaction.js +23 -0
  284. package/lib/ice/src/stun/transaction.js.map +1 -1
  285. package/lib/ice/src/turn/protocol.d.ts +21 -2
  286. package/lib/ice/src/turn/protocol.js +93 -8
  287. package/lib/ice/src/turn/protocol.js.map +1 -1
  288. package/lib/ice/src/types/model.d.ts +9 -0
  289. package/lib/ice/src/types/model.js.map +1 -1
  290. package/lib/ice/src/utils.d.ts +13 -0
  291. package/lib/ice/src/utils.js +13 -0
  292. package/lib/ice/src/utils.js.map +1 -1
  293. package/lib/ice-server/src/stun/message.d.ts +15 -2
  294. package/lib/ice-server/src/stun/message.js +156 -25
  295. package/lib/ice-server/src/stun/message.js.map +1 -1
  296. package/lib/ice-server/src/stun/rawAttributeValue.d.ts +6 -0
  297. package/lib/ice-server/src/stun/rawAttributeValue.js +12 -0
  298. package/lib/ice-server/src/stun/rawAttributeValue.js.map +1 -0
  299. package/lib/index.mjs +19568 -3106
  300. package/lib/nonstandard/index.mjs +2539 -1175
  301. package/lib/polyfill/dom.mjs +33210 -16872
  302. package/lib/polyfill/index.mjs +33345 -17013
  303. package/lib/rtp/src/extra/processor/fsRetry.d.ts +20 -0
  304. package/lib/rtp/src/extra/processor/fsRetry.js +73 -0
  305. package/lib/rtp/src/extra/processor/fsRetry.js.map +1 -0
  306. package/lib/rtp/src/extra/processor/webm.d.ts +6 -0
  307. package/lib/rtp/src/extra/processor/webm.js +6 -2
  308. package/lib/rtp/src/extra/processor/webm.js.map +1 -1
  309. package/lib/rtp/src/extra/processor/webmCallback.d.ts +11 -0
  310. package/lib/rtp/src/extra/processor/webmCallback.js +23 -31
  311. package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
  312. package/lib/rtp/src/extra/processor/webmFileWriter.d.ts +24 -0
  313. package/lib/rtp/src/extra/processor/webmFileWriter.js +94 -0
  314. package/lib/rtp/src/extra/processor/webmFileWriter.js.map +1 -0
  315. package/lib/sctp/src/chunk.d.ts +5 -0
  316. package/lib/sctp/src/chunk.js +10 -0
  317. package/lib/sctp/src/chunk.js.map +1 -1
  318. package/lib/sctp/src/index.d.ts +1 -1
  319. package/lib/sctp/src/index.js +4 -1
  320. package/lib/sctp/src/index.js.map +1 -1
  321. package/lib/sctp/src/sctp.d.ts +81 -5
  322. package/lib/sctp/src/sctp.js +273 -28
  323. package/lib/sctp/src/sctp.js.map +1 -1
  324. package/lib/webrtc/src/api/compatibilityOptions.d.ts +11 -1
  325. package/lib/webrtc/src/api/compatibilityOptions.js +11 -1
  326. package/lib/webrtc/src/api/compatibilityOptions.js.map +1 -1
  327. package/lib/webrtc/src/api/peerConfig.d.ts +210 -13
  328. package/lib/webrtc/src/api/peerConfig.js +100 -5
  329. package/lib/webrtc/src/api/peerConfig.js.map +1 -1
  330. package/lib/webrtc/src/api/peerConnectionEvents.d.ts +10 -1
  331. package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -1
  332. package/lib/webrtc/src/dataChannel.d.ts +122 -10
  333. package/lib/webrtc/src/dataChannel.js +214 -20
  334. package/lib/webrtc/src/dataChannel.js.map +1 -1
  335. package/lib/webrtc/src/media/domEventTarget.d.ts +55 -0
  336. package/lib/webrtc/src/media/domEventTarget.js +216 -0
  337. package/lib/webrtc/src/media/domEventTarget.js.map +1 -0
  338. package/lib/webrtc/src/media/index.d.ts +2 -0
  339. package/lib/webrtc/src/media/index.js +1 -0
  340. package/lib/webrtc/src/media/index.js.map +1 -1
  341. package/lib/webrtc/src/media/parameters.d.ts +5 -0
  342. package/lib/webrtc/src/media/parameters.js +10 -0
  343. package/lib/webrtc/src/media/parameters.js.map +1 -1
  344. package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +10 -0
  345. package/lib/webrtc/src/media/receiver/receiverTwcc.js +4 -10
  346. package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
  347. package/lib/webrtc/src/media/router.d.ts +6 -0
  348. package/lib/webrtc/src/media/router.js +39 -1
  349. package/lib/webrtc/src/media/router.js.map +1 -1
  350. package/lib/webrtc/src/media/rtpReceiver.d.ts +56 -6
  351. package/lib/webrtc/src/media/rtpReceiver.js +165 -15
  352. package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
  353. package/lib/webrtc/src/media/rtpSender.d.ts +1 -1
  354. package/lib/webrtc/src/media/rtpSender.js +4 -3
  355. package/lib/webrtc/src/media/rtpSender.js.map +1 -1
  356. package/lib/webrtc/src/media/rtpTransceiver.d.ts +29 -11
  357. package/lib/webrtc/src/media/rtpTransceiver.js +31 -9
  358. package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
  359. package/lib/webrtc/src/media/stats.d.ts +13 -0
  360. package/lib/webrtc/src/media/stats.js.map +1 -1
  361. package/lib/webrtc/src/media/track.d.ts +103 -11
  362. package/lib/webrtc/src/media/track.js +241 -19
  363. package/lib/webrtc/src/media/track.js.map +1 -1
  364. package/lib/webrtc/src/media/trackConstraints.d.ts +80 -0
  365. package/lib/webrtc/src/media/trackConstraints.js +141 -0
  366. package/lib/webrtc/src/media/trackConstraints.js.map +1 -0
  367. package/lib/webrtc/src/negotiation/internalState.d.ts +0 -4
  368. package/lib/webrtc/src/negotiation/internalState.js +0 -11
  369. package/lib/webrtc/src/negotiation/internalState.js.map +1 -1
  370. package/lib/webrtc/src/negotiation/remoteCandidates.d.ts +20 -1
  371. package/lib/webrtc/src/negotiation/remoteCandidates.js +29 -1
  372. package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -1
  373. package/lib/webrtc/src/negotiation/transportActivation.d.ts +4 -0
  374. package/lib/webrtc/src/negotiation/transportActivation.js +112 -11
  375. package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
  376. package/lib/webrtc/src/negotiationTransaction.d.ts +25 -4
  377. package/lib/webrtc/src/negotiationTransaction.js +27 -6
  378. package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
  379. package/lib/webrtc/src/nonstandard/dummyMedia.d.ts +6 -0
  380. package/lib/webrtc/src/nonstandard/dummyMedia.js +14 -19
  381. package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
  382. package/lib/webrtc/src/nonstandard/navigator.d.ts +1 -1
  383. package/lib/webrtc/src/nonstandard/recorder/index.js +5 -1
  384. package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
  385. package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +6 -1
  386. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +31 -2
  387. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
  388. package/lib/webrtc/src/nonstandard/userMedia/packetizer.d.ts +16 -0
  389. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js +25 -0
  390. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
  391. package/lib/webrtc/src/nonstandard/userMedia.js +6 -13
  392. package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
  393. package/lib/webrtc/src/peerConnection.d.ts +44 -8
  394. package/lib/webrtc/src/peerConnection.js +88 -9
  395. package/lib/webrtc/src/peerConnection.js.map +1 -1
  396. package/lib/webrtc/src/polyfill/api.d.ts +2 -1
  397. package/lib/webrtc/src/polyfill/api.js +3 -3
  398. package/lib/webrtc/src/polyfill/api.js.map +1 -1
  399. package/lib/webrtc/src/polyfill/dom.d.ts +21 -7
  400. package/lib/webrtc/src/polyfill/dom.js +15 -0
  401. package/lib/webrtc/src/polyfill/dom.js.map +1 -1
  402. package/lib/webrtc/src/polyfill/globals.d.ts +6 -2
  403. package/lib/webrtc/src/polyfill/globals.js.map +1 -1
  404. package/lib/webrtc/src/polyfill/index.d.ts +1 -1
  405. package/lib/webrtc/src/polyfill/index.js +1 -1
  406. package/lib/webrtc/src/polyfill/index.js.map +1 -1
  407. package/lib/webrtc/src/polyfill/install.d.ts +5 -1
  408. package/lib/webrtc/src/polyfill/install.js +2 -2
  409. package/lib/webrtc/src/polyfill/install.js.map +1 -1
  410. package/lib/webrtc/src/polyfill/mediaDevices.js +28 -4
  411. package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
  412. package/lib/webrtc/src/polyfill/peerConnectionConfig.d.ts +6 -0
  413. package/lib/webrtc/src/polyfill/peerConnectionConfig.js +15 -4
  414. package/lib/webrtc/src/polyfill/peerConnectionConfig.js.map +1 -1
  415. package/lib/webrtc/src/polyfill/selectSettings.d.ts +4 -14
  416. package/lib/webrtc/src/polyfill/selectSettings.js +10 -106
  417. package/lib/webrtc/src/polyfill/selectSettings.js.map +1 -1
  418. package/lib/webrtc/src/polyfill/sourceIo.d.ts +1 -2
  419. package/lib/webrtc/src/polyfill/sourceIo.js +6 -6
  420. package/lib/webrtc/src/polyfill/sourceIo.js.map +1 -1
  421. package/lib/webrtc/src/sctpManager.d.ts +31 -18
  422. package/lib/webrtc/src/sctpManager.js +158 -38
  423. package/lib/webrtc/src/sctpManager.js.map +1 -1
  424. package/lib/webrtc/src/sdp.d.ts +38 -2
  425. package/lib/webrtc/src/sdp.js +84 -3
  426. package/lib/webrtc/src/sdp.js.map +1 -1
  427. package/lib/webrtc/src/sdpManager.d.ts +19 -9
  428. package/lib/webrtc/src/sdpManager.js +26 -4
  429. package/lib/webrtc/src/sdpManager.js.map +1 -1
  430. package/lib/webrtc/src/secureTransportManager.d.ts +11 -2
  431. package/lib/webrtc/src/secureTransportManager.js +84 -5
  432. package/lib/webrtc/src/secureTransportManager.js.map +1 -1
  433. package/lib/webrtc/src/transceiverManager.d.ts +5 -2
  434. package/lib/webrtc/src/transceiverManager.js +42 -14
  435. package/lib/webrtc/src/transceiverManager.js.map +1 -1
  436. package/lib/webrtc/src/transport/dtls-application-gate.d.ts +1 -0
  437. package/lib/webrtc/src/transport/dtls-application-gate.js +143 -0
  438. package/lib/webrtc/src/transport/dtls-application-gate.js.map +1 -0
  439. package/lib/webrtc/src/transport/dtls-attempt.d.ts +1 -0
  440. package/lib/webrtc/src/transport/dtls-attempt.js +79 -0
  441. package/lib/webrtc/src/transport/dtls-attempt.js.map +1 -0
  442. package/lib/webrtc/src/transport/dtls-certificate.d.ts +24 -0
  443. package/lib/webrtc/src/transport/dtls-certificate.js +98 -0
  444. package/lib/webrtc/src/transport/dtls-certificate.js.map +1 -0
  445. package/lib/webrtc/src/transport/dtls-fingerprint.d.ts +7 -0
  446. package/lib/webrtc/src/transport/dtls-fingerprint.js +66 -0
  447. package/lib/webrtc/src/transport/dtls-fingerprint.js.map +1 -0
  448. package/lib/webrtc/src/transport/dtls-ice-transport.d.ts +1 -0
  449. package/lib/webrtc/src/transport/dtls-ice-transport.js +123 -0
  450. package/lib/webrtc/src/transport/dtls-ice-transport.js.map +1 -0
  451. package/lib/webrtc/src/transport/dtls-media-queue.d.ts +1 -0
  452. package/lib/webrtc/src/transport/dtls-media-queue.js +95 -0
  453. package/lib/webrtc/src/transport/dtls-media-queue.js.map +1 -0
  454. package/lib/webrtc/src/transport/dtls-readiness.d.ts +1 -0
  455. package/lib/webrtc/src/transport/dtls-readiness.js +173 -0
  456. package/lib/webrtc/src/transport/dtls-readiness.js.map +1 -0
  457. package/lib/webrtc/src/transport/dtls-sped-handshake.d.ts +1 -0
  458. package/lib/webrtc/src/transport/dtls-sped-handshake.js +146 -0
  459. package/lib/webrtc/src/transport/dtls-sped-handshake.js.map +1 -0
  460. package/lib/webrtc/src/transport/dtls-srtp.d.ts +1 -0
  461. package/lib/webrtc/src/transport/dtls-srtp.js +133 -0
  462. package/lib/webrtc/src/transport/dtls-srtp.js.map +1 -0
  463. package/lib/webrtc/src/transport/dtls-stats.d.ts +1 -0
  464. package/lib/webrtc/src/transport/dtls-stats.js +134 -0
  465. package/lib/webrtc/src/transport/dtls-stats.js.map +1 -0
  466. package/lib/webrtc/src/transport/dtls-types.d.ts +23 -0
  467. package/lib/webrtc/src/transport/dtls-types.js +11 -0
  468. package/lib/webrtc/src/transport/dtls-types.js.map +1 -0
  469. package/lib/webrtc/src/transport/dtls.d.ts +150 -55
  470. package/lib/webrtc/src/transport/dtls.js +1017 -556
  471. package/lib/webrtc/src/transport/dtls.js.map +1 -1
  472. package/lib/webrtc/src/transport/ice.d.ts +35 -2
  473. package/lib/webrtc/src/transport/ice.js +147 -14
  474. package/lib/webrtc/src/transport/ice.js.map +1 -1
  475. package/lib/webrtc/src/transport/iceCandidateAttribute.d.ts +4 -2
  476. package/lib/webrtc/src/transport/iceCandidateAttribute.js.map +1 -1
  477. package/lib/webrtc/src/transport/sctp.d.ts +126 -2
  478. package/lib/webrtc/src/transport/sctp.js +747 -134
  479. package/lib/webrtc/src/transport/sctp.js.map +1 -1
  480. package/lib/webrtc/src/transport/sped.d.ts +139 -0
  481. package/lib/webrtc/src/transport/sped.js +757 -0
  482. package/lib/webrtc/src/transport/sped.js.map +1 -0
  483. package/lib/webrtc/src/types/util.d.ts +6 -0
  484. package/lib/webrtc/src/types/util.js.map +1 -1
  485. package/lib/webrtc/src/utils.d.ts +1 -1
  486. package/lib/webrtc/src/webidl.d.ts +15 -0
  487. package/lib/webrtc/src/webidl.js +34 -0
  488. package/lib/webrtc/src/webidl.js.map +1 -0
  489. package/package.json +7 -3
  490. package/lib/webrtc/src/polyfill/rtcSessionDescription.d.ts +0 -18
  491. package/lib/webrtc/src/polyfill/rtcSessionDescription.js +0 -36
  492. package/lib/webrtc/src/polyfill/rtcSessionDescription.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  * The constructor options of `PeerConfig` that choose between the behavior the
3
3
  * specifications (W3C WebRTC, JSEP, the RTP RFCs) define and browsers
4
4
  * implement, and werift's own behavior kept for existing applications. Each
5
- * one takes two values:
5
+ * one takes `"standard"` and the values naming other behaviors:
6
6
  * - `"standard"`: the specification / browser behavior, in every option.
7
7
  * - a value naming werift's own behavior in that option:
8
8
  * - `certificateScope: "process"`: one default DTLS certificate shared by
@@ -15,6 +15,14 @@
15
15
  * - `keyFrameRequestRouting: "fallback"`: a PLI / FIR for an unknown SSRC
16
16
  * falls back to the RTX owner or the only video sender of the transport
17
17
  * it arrived on (`"standard"`: not delivered).
18
+ * - `dtlsHandshakeValidation: "lenient"`: the DTLS 1.2 handshake ignores a
19
+ * malformed `supported_versions`, accepts duplicate extensions and reads
20
+ * `use_srtp` without length checks (`"standard"`: RFC-strict, these fail
21
+ * the handshake).
22
+ * - `dataChannelBinaryType: "nodebuffer"`: a new data channel's
23
+ * `binaryType` delivers binary messages as Node.js `Buffer`s
24
+ * (`"standard"`: the W3C default, `"arraybuffer"`). It also takes
25
+ * `"arraybuffer"` and `"blob"`, the `binaryType` values they name.
18
26
  *
19
27
  * Each option documents its default and whether `setConfiguration()` may
20
28
  * change it. Any other value is a `TypeError`; the names used up to v0.27.0
@@ -26,6 +34,8 @@ export declare const CompatibilityOptionValues: {
26
34
  readonly mLineReuse: readonly ["standard", "aggressive"];
27
35
  readonly transceiverPairing: readonly ["standard", "byKind"];
28
36
  readonly keyFrameRequestRouting: readonly ["standard", "fallback"];
37
+ readonly dtlsHandshakeValidation: readonly ["standard", "lenient"];
38
+ readonly dataChannelBinaryType: readonly ["standard", "nodebuffer", "arraybuffer", "blob"];
29
39
  };
30
40
  /** An option listed in {@link CompatibilityOptionValues}. */
31
41
  export type CompatibilityOption = keyof typeof CompatibilityOptionValues;
@@ -5,7 +5,7 @@ exports.CompatibilityOptionValues = void 0;
5
5
  * The constructor options of `PeerConfig` that choose between the behavior the
6
6
  * specifications (W3C WebRTC, JSEP, the RTP RFCs) define and browsers
7
7
  * implement, and werift's own behavior kept for existing applications. Each
8
- * one takes two values:
8
+ * one takes `"standard"` and the values naming other behaviors:
9
9
  * - `"standard"`: the specification / browser behavior, in every option.
10
10
  * - a value naming werift's own behavior in that option:
11
11
  * - `certificateScope: "process"`: one default DTLS certificate shared by
@@ -18,6 +18,14 @@ exports.CompatibilityOptionValues = void 0;
18
18
  * - `keyFrameRequestRouting: "fallback"`: a PLI / FIR for an unknown SSRC
19
19
  * falls back to the RTX owner or the only video sender of the transport
20
20
  * it arrived on (`"standard"`: not delivered).
21
+ * - `dtlsHandshakeValidation: "lenient"`: the DTLS 1.2 handshake ignores a
22
+ * malformed `supported_versions`, accepts duplicate extensions and reads
23
+ * `use_srtp` without length checks (`"standard"`: RFC-strict, these fail
24
+ * the handshake).
25
+ * - `dataChannelBinaryType: "nodebuffer"`: a new data channel's
26
+ * `binaryType` delivers binary messages as Node.js `Buffer`s
27
+ * (`"standard"`: the W3C default, `"arraybuffer"`). It also takes
28
+ * `"arraybuffer"` and `"blob"`, the `binaryType` values they name.
21
29
  *
22
30
  * Each option documents its default and whether `setConfiguration()` may
23
31
  * change it. Any other value is a `TypeError`; the names used up to v0.27.0
@@ -29,5 +37,7 @@ exports.CompatibilityOptionValues = {
29
37
  mLineReuse: ["standard", "aggressive"],
30
38
  transceiverPairing: ["standard", "byKind"],
31
39
  keyFrameRequestRouting: ["standard", "fallback"],
40
+ dtlsHandshakeValidation: ["standard", "lenient"],
41
+ dataChannelBinaryType: ["standard", "nodebuffer", "arraybuffer", "blob"],
32
42
  };
33
43
  //# sourceMappingURL=compatibilityOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityOptions.js","sourceRoot":"","sources":["../../../../src/api/compatibilityOptions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,yBAAyB,GAAG;IACvC,gBAAgB,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;IACzC,UAAU,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;IACtC,kBAAkB,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC1C,sBAAsB,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;CACxC,CAAC","sourcesContent":["/**\n * The constructor options of `PeerConfig` that choose between the behavior the\n * specifications (W3C WebRTC, JSEP, the RTP RFCs) define and browsers\n * implement, and werift's own behavior kept for existing applications. Each\n * one takes two values:\n * - `\"standard\"`: the specification / browser behavior, in every option.\n * - a value naming werift's own behavior in that option:\n * - `certificateScope: \"process\"`: one default DTLS certificate shared by\n * the process (`\"standard\"`: one per `RTCPeerConnection`).\n * - `mLineReuse: \"aggressive\"`: an accepted `inactive` m-line is also\n * written with port 0, so its position is reused (`\"standard\"`: it keeps\n * its port).\n * - `transceiverPairing: \"byKind\"`: a remote offer's m-section takes any\n * unassociated transceiver of its kind (`\"standard\"`: JSEP 5.10).\n * - `keyFrameRequestRouting: \"fallback\"`: a PLI / FIR for an unknown SSRC\n * falls back to the RTX owner or the only video sender of the transport\n * it arrived on (`\"standard\"`: not delivered).\n *\n * Each option documents its default and whether `setConfiguration()` may\n * change it. Any other value is a `TypeError`; the names used up to v0.27.0\n * are still accepted (see `DeprecatedCompatibilityValues` in\n * `api/peerConfig.ts`).\n */\nexport const CompatibilityOptionValues = {\n certificateScope: [\"standard\", \"process\"],\n mLineReuse: [\"standard\", \"aggressive\"],\n transceiverPairing: [\"standard\", \"byKind\"],\n keyFrameRequestRouting: [\"standard\", \"fallback\"],\n} as const;\n\n/** An option listed in {@link CompatibilityOptionValues}. */\nexport type CompatibilityOption = keyof typeof CompatibilityOptionValues;\n\n/** The values of a compatibility option. */\nexport type CompatibilityOptionValue<K extends CompatibilityOption> =\n (typeof CompatibilityOptionValues)[K][number];\n"]}
1
+ {"version":3,"file":"compatibilityOptions.js","sourceRoot":"","sources":["../../../../src/api/compatibilityOptions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACU,QAAA,yBAAyB,GAAG;IACvC,gBAAgB,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;IACzC,UAAU,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;IACtC,kBAAkB,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC1C,sBAAsB,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IAChD,uBAAuB,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;IAChD,qBAAqB,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,CAAC;CAChE,CAAC","sourcesContent":["/**\n * The constructor options of `PeerConfig` that choose between the behavior the\n * specifications (W3C WebRTC, JSEP, the RTP RFCs) define and browsers\n * implement, and werift's own behavior kept for existing applications. Each\n * one takes `\"standard\"` and the values naming other behaviors:\n * - `\"standard\"`: the specification / browser behavior, in every option.\n * - a value naming werift's own behavior in that option:\n * - `certificateScope: \"process\"`: one default DTLS certificate shared by\n * the process (`\"standard\"`: one per `RTCPeerConnection`).\n * - `mLineReuse: \"aggressive\"`: an accepted `inactive` m-line is also\n * written with port 0, so its position is reused (`\"standard\"`: it keeps\n * its port).\n * - `transceiverPairing: \"byKind\"`: a remote offer's m-section takes any\n * unassociated transceiver of its kind (`\"standard\"`: JSEP 5.10).\n * - `keyFrameRequestRouting: \"fallback\"`: a PLI / FIR for an unknown SSRC\n * falls back to the RTX owner or the only video sender of the transport\n * it arrived on (`\"standard\"`: not delivered).\n * - `dtlsHandshakeValidation: \"lenient\"`: the DTLS 1.2 handshake ignores a\n * malformed `supported_versions`, accepts duplicate extensions and reads\n * `use_srtp` without length checks (`\"standard\"`: RFC-strict, these fail\n * the handshake).\n * - `dataChannelBinaryType: \"nodebuffer\"`: a new data channel's\n * `binaryType` delivers binary messages as Node.js `Buffer`s\n * (`\"standard\"`: the W3C default, `\"arraybuffer\"`). It also takes\n * `\"arraybuffer\"` and `\"blob\"`, the `binaryType` values they name.\n *\n * Each option documents its default and whether `setConfiguration()` may\n * change it. Any other value is a `TypeError`; the names used up to v0.27.0\n * are still accepted (see `DeprecatedCompatibilityValues` in\n * `api/peerConfig.ts`).\n */\nexport const CompatibilityOptionValues = {\n certificateScope: [\"standard\", \"process\"],\n mLineReuse: [\"standard\", \"aggressive\"],\n transceiverPairing: [\"standard\", \"byKind\"],\n keyFrameRequestRouting: [\"standard\", \"fallback\"],\n dtlsHandshakeValidation: [\"standard\", \"lenient\"],\n dataChannelBinaryType: [\"standard\", \"nodebuffer\", \"arraybuffer\", \"blob\"],\n} as const;\n\n/** An option listed in {@link CompatibilityOptionValues}. */\nexport type CompatibilityOption = keyof typeof CompatibilityOptionValues;\n\n/** The values of a compatibility option. */\nexport type CompatibilityOptionValue<K extends CompatibilityOption> =\n (typeof CompatibilityOptionValues)[K][number];\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { Address, InterfaceAddresses, TlsConnectionOptions } from "../imports/common";
2
- import type { CandidatePair, Message, MessageIntegrityMode, Protocol } from "../imports/ice";
2
+ import type { DtlsVersion } from "../imports/dtls";
3
+ import type { CandidatePair, IceFailoverOptions, Message, MessageIntegrityMode, Protocol } from "../imports/ice";
3
4
  import type { RTCRtpCodecParameters, RTCRtpHeaderExtensionParameters } from "../media/parameters";
4
5
  import type { KeyFrameRequestRouting } from "../media/router";
5
6
  import type { RTCRtpSenderOptions } from "../media/rtpSender";
@@ -95,6 +96,18 @@ export interface PeerConfig {
95
96
  * Defaults to 8 when undefined.
96
97
  */
97
98
  iceTurnConnectTimeout: number | undefined;
99
+ /**
100
+ * Seconds ICE waits for a connectivity check from the peer when it has no
101
+ * candidate pair of its own to check after both sides ended their
102
+ * candidates (the peer offered only active TCP candidates, as Firefox does
103
+ * for ICE-TCP, or none werift can reach). Without a check in that time the
104
+ * ICE transport fails. With `iceLite`, which sends no checks, ICE waits the
105
+ * same time whenever it has no candidate pair, also while it still
106
+ * gathers. The deadline is fixed when the wait begins; once gathering ended
107
+ * without a socket that could receive a check, ICE fails at once. Defaults
108
+ * to 30 when undefined; 0 fails at once.
109
+ */
110
+ iceIncomingCheckTimeout: number | undefined;
98
111
  /**
99
112
  * werift extension. With `iceNomination: "regular"`: milliseconds the
100
113
  * controlling ICE agent keeps checking before it nominates a candidate pair,
@@ -124,6 +137,16 @@ export interface PeerConfig {
124
137
  * the attribute regardless. Defaults to false.
125
138
  */
126
139
  iceRenomination: boolean;
140
+ /**
141
+ * werift extension. Thresholds of the failover of the selected candidate
142
+ * pair without an ICE restart (with semi-aggressive nomination or
143
+ * renomination): how soon a pair is unwritable (`unwritableMinChecks`,
144
+ * `unwritableTimeout`) and how soon a selected pair that stopped receiving
145
+ * moves to a backup (`receivingTimeout`, `receivingSwitchingDelay`). Maps
146
+ * to `IceOptions.failover`; each unset or invalid value keeps its default
147
+ * (libwebrtc's: 5 checks, 5000 ms, 2500 ms, 1000 ms).
148
+ */
149
+ iceFailover: IceFailoverOptions | undefined;
127
150
  turnTransport: "udp" | "tcp" | "tls" | undefined;
128
151
  turnTlsOptions: TlsConnectionOptions | undefined;
129
152
  /**
@@ -140,6 +163,45 @@ export interface PeerConfig {
140
163
  * Return `true` if a STUN response should be sent, false if it should be skipped. */
141
164
  iceFilterStunResponse: ((message: Message, addr: Address, protocol: Protocol) => boolean) | undefined;
142
165
  iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;
166
+ /**
167
+ * Opt-in SPED (DTLS handshake embedded in ICE Binding).
168
+ * Omit or false: ICE completes, then DTLS starts (current serial path).
169
+ * true: this PeerConnection only overlaps ICE checks with DTLS 1.3 handshake.
170
+ * Requires explicit DTLS 1.3 in `dtls.protocolVersions`
171
+ * (`dtls.protocolVersions` defaults to empty / DTLS 1.2 only).
172
+ * Cannot be combined with `dtls.helloRetryRequest: true`
173
+ * (SPED uses ICE-authenticated address validation, not a DTLS cookie).
174
+ * Both are validated by the constructor and `setConfiguration()`, which
175
+ * throw synchronously and leave the configuration unchanged.
176
+ */
177
+ sped?: boolean;
178
+ /**
179
+ * WARP early outbound and encrypted-media buffering policy.
180
+ * - `allowEarlyServerData` (default false): the DTLS server may send
181
+ * application data / media before the SDP fingerprint is verified.
182
+ * Requires {@link PeerConfig.sped} `true` and DTLS 1.3; the constructor
183
+ * and `setConfiguration()` throw synchronously otherwise.
184
+ * - `earlyMediaPolicy` (default `"drop"`): `"buffer"` retains inbound
185
+ * encrypted media received before authentication (bounded) instead of
186
+ * dropping it. Inbound data is never delivered before authentication.
187
+ * - `sendBeforeNomination` (default false): once the DTLS handshake is
188
+ * done on this side (the DTLS client right after its Finished) and the
189
+ * peer is authenticated, send application data and media on a valid
190
+ * candidate pair (its own connectivity check succeeded) instead of
191
+ * waiting for ICE nomination and consent (RFC 8445 §12.1, SPED
192
+ * draft-00 §3.1.2.2). Applies only until a selected pair exists; never
193
+ * during an ICE restart or on relay pairs. A peer that drops data
194
+ * arriving before its own nomination only loses it like any packet loss
195
+ * (SCTP retransmits). Requires {@link PeerConfig.sped} `true`; the
196
+ * constructor and `setConfiguration()` throw synchronously otherwise.
197
+ * `setConfiguration()` merges these fields and applies them to every open
198
+ * DTLS transport, including ones a pending description prepared.
199
+ */
200
+ warp?: {
201
+ allowEarlyServerData?: boolean;
202
+ earlyMediaPolicy?: "drop" | "buffer";
203
+ sendBeforeNomination?: boolean;
204
+ };
143
205
  /**
144
206
  * Integrity attributes of the ICE connectivity checks and consent requests
145
207
  * werift sends (RFC 8489 short-term credentials). Applies to ICE transports
@@ -163,6 +225,20 @@ export interface PeerConfig {
163
225
  iceOptionIce2: boolean;
164
226
  dtls: Partial<{
165
227
  keys: DtlsKeys;
228
+ /**
229
+ * DTLS protocol versions in preference order.
230
+ * Unspecified / empty keeps DTLS 1.2 only. DTLS 1.3 requires explicit opt-in.
231
+ * Independent of {@link PeerConfig.sped} (SPED also requires DTLS 1.3; validated by the constructor / setConfiguration()).
232
+ */
233
+ protocolVersions: readonly DtlsVersion[];
234
+ /**
235
+ * DTLS 1.3 HelloRetryRequest cookie exchange.
236
+ * Default false: ICE-authenticated path omits cookie HRR and saves 1 RTT.
237
+ * true: send a cookie-bearing HRR (mapped internally to addressValidation: "dtls-cookie").
238
+ * Group-only HRR for key_share correction is independent of this option.
239
+ * Cannot be combined with {@link PeerConfig.sped} `true`.
240
+ */
241
+ helloRetryRequest?: boolean;
166
242
  }>;
167
243
  icePasswordPrefix: string | undefined;
168
244
  bundlePolicy: BundlePolicy;
@@ -184,6 +260,25 @@ export interface PeerConfig {
184
260
  midSuffix: boolean;
185
261
  /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */
186
262
  maxMessageSize: number;
263
+ /**
264
+ * The initial `binaryType` of every data channel this connection creates,
265
+ * by `createDataChannel()` or announced by the remote peer (a compatibility
266
+ * option, see {@link CompatibilityOptionValues} and
267
+ * {@link RTCDataChannelBinaryType}).
268
+ * - `"nodebuffer"` (default, werift's own value): binary messages arrive as
269
+ * a Node.js `Buffer`, as before this option existed.
270
+ * - `"standard"`: the browser default, `"arraybuffer"` (W3C); the channel's
271
+ * `binaryType` reads `"arraybuffer"`.
272
+ * - `"arraybuffer"` / `"blob"`: binary messages arrive as an `ArrayBuffer`
273
+ * / a `Blob` (`werift/polyfill` uses `"arraybuffer"`).
274
+ *
275
+ * Another value is a `TypeError`. `compatibility: "standard"` sets it to
276
+ * `"standard"` when it is not given. `setConfiguration()` may change it; the
277
+ * new value applies to channels created afterwards, and an existing
278
+ * channel changes with its own `binaryType` setter.
279
+ * @see tests/datachannel/binaryType.test.ts "dataChannelBinaryType: standard gives channels the W3C default arraybuffer"
280
+ */
281
+ dataChannelBinaryType: DataChannelBinaryTypeOption;
187
282
  /**
188
283
  * When true, padding-only RTP is omitted from onReceiveRtp and later media
189
284
  * sequence numbers are compacted. Default false preserves wire RTP events.
@@ -245,6 +340,19 @@ export interface PeerConfig {
245
340
  * `"strict"` (= `"standard"`).
246
341
  */
247
342
  keyFrameRequestRouting: KeyFrameRequestRouting;
343
+ /**
344
+ * How strictly the DTLS 1.2 handshake validates the peer's messages (see
345
+ * {@link CompatibilityOptionValues}). Cannot be changed after construction.
346
+ * - `"lenient"` (default): a malformed `supported_versions` is ignored and
347
+ * DTLS 1.2 negotiated, duplicate extensions are accepted and `use_srtp`
348
+ * is read without length checks, as before the strict checks.
349
+ * - `"standard"`: RFC-strict; these fail the handshake (a malformed
350
+ * `supported_versions` with a `protocol_version` alert).
351
+ *
352
+ * A `supported_versions` without an overlapping version fails either way,
353
+ * and DTLS 1.3 always validates strictly.
354
+ */
355
+ dtlsHandshakeValidation: DtlsHandshakeValidation;
248
356
  /**
249
357
  * Which m-lines of a BUNDLE group carry the local ICE candidates.
250
358
  * Cannot be changed after construction. See {@link BundleCandidates}.
@@ -256,7 +364,8 @@ export interface PeerConfig {
256
364
  bundleCandidates: BundleCandidates;
257
365
  /**
258
366
  * Sets every compatibility option (`certificateScope`, `mLineReuse`,
259
- * `transceiverPairing`, `keyFrameRequestRouting`, see
367
+ * `transceiverPairing`, `keyFrameRequestRouting`,
368
+ * `dtlsHandshakeValidation`, `dataChannelBinaryType`, see
260
369
  * {@link CompatibilityOptionValues}) to the specification / browser behavior
261
370
  * at once. Cannot be changed after construction.
262
371
  * - `undefined` (default): each option keeps its own default.
@@ -266,19 +375,22 @@ export interface PeerConfig {
266
375
  * An option given explicitly always takes precedence over `compatibility`:
267
376
  * a value given in the same configuration (an old name included) is kept,
268
377
  * and `setConfiguration()` treats the options as if `compatibility` were
269
- * not set (`keyFrameRequestRouting` may change, the others cannot). An
378
+ * not set (`keyFrameRequestRouting` and `dataChannelBinaryType` may
379
+ * change, the others cannot). An
270
380
  * option given as `undefined` counts as not given.
271
381
  *
272
382
  * ```ts
273
383
  * new RTCPeerConnection({ compatibility: "standard" });
274
- * // certificateScope, mLineReuse, transceiverPairing and
275
- * // keyFrameRequestRouting are all "standard"
384
+ * // certificateScope, mLineReuse, transceiverPairing,
385
+ * // keyFrameRequestRouting, dtlsHandshakeValidation and
386
+ * // dataChannelBinaryType are all "standard"
276
387
  * new RTCPeerConnection({ compatibility: "standard", certificateScope: "process" });
277
- * // certificateScope is "process", the other three are "standard"
388
+ * // certificateScope is "process", the others are "standard"
278
389
  * ```
279
390
  *
280
391
  * It does not change `iceServers` / `iceUseDefaultStunServer`, which are not
281
392
  * compatibility options.
393
+ * @see tests/datachannel/binaryType.test.ts "compatibility: standard makes data channels deliver ArrayBuffer unless dataChannelBinaryType is given"
282
394
  */
283
395
  compatibility: CompatibilityPreset | undefined;
284
396
  }
@@ -290,6 +402,12 @@ export declare const MLineReuseModes: readonly MLineReuse[];
290
402
  /** How a remote offer pairs m-sections with local transceivers. See {@link PeerConfig.transceiverPairing}. */
291
403
  export type TransceiverPairing = CompatibilityOptionValue<"transceiverPairing">;
292
404
  export declare const TransceiverPairingModes: readonly TransceiverPairing[];
405
+ /** How strictly the DTLS 1.2 handshake validates the peer. See {@link PeerConfig.dtlsHandshakeValidation}. */
406
+ export type DtlsHandshakeValidation = CompatibilityOptionValue<"dtlsHandshakeValidation">;
407
+ export declare const DtlsHandshakeValidationModes: readonly DtlsHandshakeValidation[];
408
+ /** The initial `binaryType` of new data channels. See {@link PeerConfig.dataChannelBinaryType}. */
409
+ export type DataChannelBinaryTypeOption = CompatibilityOptionValue<"dataChannelBinaryType">;
410
+ export declare const DataChannelBinaryTypeModes: readonly DataChannelBinaryTypeOption[];
293
411
  /** The values of {@link PeerConfig.compatibility}. */
294
412
  export type CompatibilityPreset = "standard";
295
413
  export declare const CompatibilityPresets: readonly CompatibilityPreset[];
@@ -348,7 +466,8 @@ export type RTCPeerConnectionConfig = Partial<Omit<PeerConfig, "bundlePolicy" |
348
466
  /** See {@link PeerConfig.keyFrameRequestRouting}. */
349
467
  keyFrameRequestRouting?: KeyFrameRequestRouting | DeprecatedKeyFrameRequestRouting;
350
468
  };
351
- export declare function generateDefaultPeerConfig(): PeerConfig;
469
+ export declare function peerConfigHasDtls13(config: PeerConfig): boolean;
470
+ export declare function generateDefaultPeerConfig(): Required<PeerConfig>;
352
471
  export declare const defaultPeerConfig: PeerConfig;
353
472
  export declare function clonePeerConfiguration(config: PeerConfig): {
354
473
  codecs: {
@@ -367,8 +486,15 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
367
486
  icePortRange: [number, number] | undefined;
368
487
  iceAdditionalHostAddresses: string[] | undefined;
369
488
  dtls: {
489
+ protocolVersions: DtlsVersion[] | undefined;
490
+ helloRetryRequest: boolean | undefined;
370
491
  keys?: DtlsKeys | undefined;
371
492
  };
493
+ warp: {
494
+ allowEarlyServerData?: boolean;
495
+ earlyMediaPolicy?: "drop" | "buffer";
496
+ sendBeforeNomination?: boolean;
497
+ } | undefined;
372
498
  certificates: RTCCertificate[];
373
499
  debug: {
374
500
  inboundPacketLoss?: number | undefined;
@@ -438,6 +564,18 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
438
564
  * Defaults to 8 when undefined.
439
565
  */
440
566
  iceTurnConnectTimeout: number | undefined;
567
+ /**
568
+ * Seconds ICE waits for a connectivity check from the peer when it has no
569
+ * candidate pair of its own to check after both sides ended their
570
+ * candidates (the peer offered only active TCP candidates, as Firefox does
571
+ * for ICE-TCP, or none werift can reach). Without a check in that time the
572
+ * ICE transport fails. With `iceLite`, which sends no checks, ICE waits the
573
+ * same time whenever it has no candidate pair, also while it still
574
+ * gathers. The deadline is fixed when the wait begins; once gathering ended
575
+ * without a socket that could receive a check, ICE fails at once. Defaults
576
+ * to 30 when undefined; 0 fails at once.
577
+ */
578
+ iceIncomingCheckTimeout: number | undefined;
441
579
  /**
442
580
  * werift extension. With `iceNomination: "regular"`: milliseconds the
443
581
  * controlling ICE agent keeps checking before it nominates a candidate pair,
@@ -467,6 +605,16 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
467
605
  * the attribute regardless. Defaults to false.
468
606
  */
469
607
  iceRenomination: boolean;
608
+ /**
609
+ * werift extension. Thresholds of the failover of the selected candidate
610
+ * pair without an ICE restart (with semi-aggressive nomination or
611
+ * renomination): how soon a pair is unwritable (`unwritableMinChecks`,
612
+ * `unwritableTimeout`) and how soon a selected pair that stopped receiving
613
+ * moves to a backup (`receivingTimeout`, `receivingSwitchingDelay`). Maps
614
+ * to `IceOptions.failover`; each unset or invalid value keeps its default
615
+ * (libwebrtc's: 5 checks, 5000 ms, 2500 ms, 1000 ms).
616
+ */
617
+ iceFailover: IceFailoverOptions | undefined;
470
618
  turnTransport: "udp" | "tcp" | "tls" | undefined;
471
619
  turnTlsOptions: TlsConnectionOptions | undefined;
472
620
  /**
@@ -483,6 +631,18 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
483
631
  * Return `true` if a STUN response should be sent, false if it should be skipped. */
484
632
  iceFilterStunResponse: ((message: Message, addr: Address, protocol: Protocol) => boolean) | undefined;
485
633
  iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;
634
+ /**
635
+ * Opt-in SPED (DTLS handshake embedded in ICE Binding).
636
+ * Omit or false: ICE completes, then DTLS starts (current serial path).
637
+ * true: this PeerConnection only overlaps ICE checks with DTLS 1.3 handshake.
638
+ * Requires explicit DTLS 1.3 in `dtls.protocolVersions`
639
+ * (`dtls.protocolVersions` defaults to empty / DTLS 1.2 only).
640
+ * Cannot be combined with `dtls.helloRetryRequest: true`
641
+ * (SPED uses ICE-authenticated address validation, not a DTLS cookie).
642
+ * Both are validated by the constructor and `setConfiguration()`, which
643
+ * throw synchronously and leave the configuration unchanged.
644
+ */
645
+ sped?: boolean;
486
646
  /**
487
647
  * Integrity attributes of the ICE connectivity checks and consent requests
488
648
  * werift sends (RFC 8489 short-term credentials). Applies to ICE transports
@@ -522,6 +682,25 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
522
682
  midSuffix: boolean;
523
683
  /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */
524
684
  maxMessageSize: number;
685
+ /**
686
+ * The initial `binaryType` of every data channel this connection creates,
687
+ * by `createDataChannel()` or announced by the remote peer (a compatibility
688
+ * option, see {@link CompatibilityOptionValues} and
689
+ * {@link RTCDataChannelBinaryType}).
690
+ * - `"nodebuffer"` (default, werift's own value): binary messages arrive as
691
+ * a Node.js `Buffer`, as before this option existed.
692
+ * - `"standard"`: the browser default, `"arraybuffer"` (W3C); the channel's
693
+ * `binaryType` reads `"arraybuffer"`.
694
+ * - `"arraybuffer"` / `"blob"`: binary messages arrive as an `ArrayBuffer`
695
+ * / a `Blob` (`werift/polyfill` uses `"arraybuffer"`).
696
+ *
697
+ * Another value is a `TypeError`. `compatibility: "standard"` sets it to
698
+ * `"standard"` when it is not given. `setConfiguration()` may change it; the
699
+ * new value applies to channels created afterwards, and an existing
700
+ * channel changes with its own `binaryType` setter.
701
+ * @see tests/datachannel/binaryType.test.ts "dataChannelBinaryType: standard gives channels the W3C default arraybuffer"
702
+ */
703
+ dataChannelBinaryType: DataChannelBinaryTypeOption;
525
704
  /**
526
705
  * When true, padding-only RTP is omitted from onReceiveRtp and later media
527
706
  * sequence numbers are compacted. Default false preserves wire RTP events.
@@ -574,6 +753,19 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
574
753
  * `"strict"` (= `"standard"`).
575
754
  */
576
755
  keyFrameRequestRouting: KeyFrameRequestRouting;
756
+ /**
757
+ * How strictly the DTLS 1.2 handshake validates the peer's messages (see
758
+ * {@link CompatibilityOptionValues}). Cannot be changed after construction.
759
+ * - `"lenient"` (default): a malformed `supported_versions` is ignored and
760
+ * DTLS 1.2 negotiated, duplicate extensions are accepted and `use_srtp`
761
+ * is read without length checks, as before the strict checks.
762
+ * - `"standard"`: RFC-strict; these fail the handshake (a malformed
763
+ * `supported_versions` with a `protocol_version` alert).
764
+ *
765
+ * A `supported_versions` without an overlapping version fails either way,
766
+ * and DTLS 1.3 always validates strictly.
767
+ */
768
+ dtlsHandshakeValidation: DtlsHandshakeValidation;
577
769
  /**
578
770
  * Which m-lines of a BUNDLE group carry the local ICE candidates.
579
771
  * Cannot be changed after construction. See {@link BundleCandidates}.
@@ -585,7 +777,8 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
585
777
  bundleCandidates: BundleCandidates;
586
778
  /**
587
779
  * Sets every compatibility option (`certificateScope`, `mLineReuse`,
588
- * `transceiverPairing`, `keyFrameRequestRouting`, see
780
+ * `transceiverPairing`, `keyFrameRequestRouting`,
781
+ * `dtlsHandshakeValidation`, `dataChannelBinaryType`, see
589
782
  * {@link CompatibilityOptionValues}) to the specification / browser behavior
590
783
  * at once. Cannot be changed after construction.
591
784
  * - `undefined` (default): each option keeps its own default.
@@ -595,26 +788,30 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
595
788
  * An option given explicitly always takes precedence over `compatibility`:
596
789
  * a value given in the same configuration (an old name included) is kept,
597
790
  * and `setConfiguration()` treats the options as if `compatibility` were
598
- * not set (`keyFrameRequestRouting` may change, the others cannot). An
791
+ * not set (`keyFrameRequestRouting` and `dataChannelBinaryType` may
792
+ * change, the others cannot). An
599
793
  * option given as `undefined` counts as not given.
600
794
  *
601
795
  * ```ts
602
796
  * new RTCPeerConnection({ compatibility: "standard" });
603
- * // certificateScope, mLineReuse, transceiverPairing and
604
- * // keyFrameRequestRouting are all "standard"
797
+ * // certificateScope, mLineReuse, transceiverPairing,
798
+ * // keyFrameRequestRouting, dtlsHandshakeValidation and
799
+ * // dataChannelBinaryType are all "standard"
605
800
  * new RTCPeerConnection({ compatibility: "standard", certificateScope: "process" });
606
- * // certificateScope is "process", the other three are "standard"
801
+ * // certificateScope is "process", the others are "standard"
607
802
  * ```
608
803
  *
609
804
  * It does not change `iceServers` / `iceUseDefaultStunServer`, which are not
610
805
  * compatibility options.
806
+ * @see tests/datachannel/binaryType.test.ts "compatibility: standard makes data channels deliver ArrayBuffer unless dataChannelBinaryType is given"
611
807
  */
612
808
  compatibility: CompatibilityPreset | undefined;
613
809
  };
614
- export declare function mergePeerConfiguration(config: PeerConfig, input: RTCPeerConnectionConfig, { isReconfiguration, hasLocalDescription, hasSctpTransport, }: {
810
+ export declare function mergePeerConfiguration(config: PeerConfig, input: RTCPeerConnectionConfig, { isReconfiguration, hasLocalDescription, hasSctpTransport, dtlsTransportCreated, }: {
615
811
  isReconfiguration: boolean;
616
812
  hasLocalDescription: boolean;
617
813
  hasSctpTransport: boolean;
814
+ dtlsTransportCreated: boolean;
618
815
  }): Partial<PeerConfig> & {
619
816
  sctp?: RTCSctpConfiguration;
620
817
  };
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultPeerConfig = exports.findCodecByMimeType = exports.DeprecatedCompatibilityValues = exports.CompatibilityPresets = exports.TransceiverPairingModes = exports.MLineReuseModes = exports.CertificateScopeModes = void 0;
3
+ exports.defaultPeerConfig = exports.findCodecByMimeType = exports.DeprecatedCompatibilityValues = exports.CompatibilityPresets = exports.DataChannelBinaryTypeModes = exports.DtlsHandshakeValidationModes = exports.TransceiverPairingModes = exports.MLineReuseModes = exports.CertificateScopeModes = void 0;
4
+ exports.resolveDataChannelBinaryType = resolveDataChannelBinaryType;
5
+ exports.peerConfigHasDtls13 = peerConfigHasDtls13;
4
6
  exports.generateDefaultPeerConfig = generateDefaultPeerConfig;
5
7
  exports.clonePeerConfiguration = clonePeerConfiguration;
6
8
  exports.mergePeerConfiguration = mergePeerConfiguration;
@@ -20,6 +22,23 @@ exports.CertificateScopeModes = compatibilityOptions_1.CompatibilityOptionValues
20
22
  /** How local SDP marks inactive / stopped m-lines. See {@link PeerConfig.mLineReuse}. */
21
23
  exports.MLineReuseModes = compatibilityOptions_1.CompatibilityOptionValues.mLineReuse;
22
24
  exports.TransceiverPairingModes = compatibilityOptions_1.CompatibilityOptionValues.transceiverPairing;
25
+ exports.DtlsHandshakeValidationModes = compatibilityOptions_1.CompatibilityOptionValues.dtlsHandshakeValidation;
26
+ exports.DataChannelBinaryTypeModes = compatibilityOptions_1.CompatibilityOptionValues.dataChannelBinaryType;
27
+ /**
28
+ * @internal
29
+ * The `binaryType` a {@link PeerConfig.dataChannelBinaryType} gives a new
30
+ * channel: `"standard"` is the W3C default `"arraybuffer"`.
31
+ */
32
+ function resolveDataChannelBinaryType(option) {
33
+ return option === "standard" ? "arraybuffer" : option;
34
+ }
35
+ /** The compatibility options `setConfiguration()` may change. */
36
+ const CHANGEABLE_COMPATIBILITY_OPTIONS = [
37
+ // the router uses the new value from the next request
38
+ "keyFrameRequestRouting",
39
+ // channels created afterwards take the new value
40
+ "dataChannelBinaryType",
41
+ ];
23
42
  exports.CompatibilityPresets = [
24
43
  "standard",
25
44
  ];
@@ -71,6 +90,13 @@ function assignDynamicPayloadTypes(config) {
71
90
  }
72
91
  }
73
92
  }
93
+ function peerConfigHasDtls13(config) {
94
+ const versions = config.dtls.protocolVersions;
95
+ if (!versions || versions.length === 0) {
96
+ return false;
97
+ }
98
+ return versions.some((version) => version === "1.3");
99
+ }
74
100
  function generateDefaultPeerConfig() {
75
101
  return {
76
102
  codecs: (0, codec_1.defaultCodecs)(),
@@ -91,9 +117,11 @@ function generateDefaultPeerConfig() {
91
117
  iceTcpPassive: true,
92
118
  iceStunGatherTimeout: undefined,
93
119
  iceTurnConnectTimeout: undefined,
120
+ iceIncomingCheckTimeout: undefined,
94
121
  iceNominationDelayMs: undefined,
95
122
  iceNomination: undefined,
96
123
  iceRenomination: false,
124
+ iceFailover: undefined,
97
125
  turnTransport: undefined,
98
126
  turnTlsOptions: undefined,
99
127
  turnUdpFamily: undefined,
@@ -104,6 +132,12 @@ function generateDefaultPeerConfig() {
104
132
  icePasswordPrefix: undefined,
105
133
  iceUseLinkLocalAddress: undefined,
106
134
  dtls: {},
135
+ sped: false,
136
+ warp: {
137
+ allowEarlyServerData: false,
138
+ earlyMediaPolicy: "drop",
139
+ sendBeforeNomination: false,
140
+ },
107
141
  bundlePolicy: "max-compat",
108
142
  rtcpMuxPolicy: "require",
109
143
  iceCandidatePoolSize: 0,
@@ -113,6 +147,7 @@ function generateDefaultPeerConfig() {
113
147
  midSuffix: false,
114
148
  forceTurnTCP: false,
115
149
  maxMessageSize: sctp_1.DEFAULT_MAX_MESSAGE_SIZE,
150
+ dataChannelBinaryType: "nodebuffer",
116
151
  filterProbePaddingOnReceiveRtp: false,
117
152
  bandwidthEstimator: "lightweight",
118
153
  sctp: { mtu: src_1.DEFAULT_SCTP_MTU },
@@ -120,6 +155,7 @@ function generateDefaultPeerConfig() {
120
155
  mLineReuse: "standard",
121
156
  transceiverPairing: "byKind",
122
157
  keyFrameRequestRouting: "fallback",
158
+ dtlsHandshakeValidation: "lenient",
123
159
  bundleCandidates: "legacy",
124
160
  compatibility: undefined,
125
161
  };
@@ -158,8 +194,22 @@ function normalizePeerConfiguration(config) {
158
194
  if ("iceCandidatePoolSize" in input) {
159
195
  normalizedConfig.iceCandidatePoolSize = coerceUnsignedShort(input.iceCandidatePoolSize, "iceCandidatePoolSize");
160
196
  }
197
+ if ("sped" in input) {
198
+ normalizedConfig.sped = input.sped === true;
199
+ }
200
+ if ("warp" in input) {
201
+ if (input.warp?.earlyMediaPolicy !== undefined &&
202
+ input.warp.earlyMediaPolicy !== "drop" &&
203
+ input.warp.earlyMediaPolicy !== "buffer") {
204
+ throw (0, errors_1.createWebRtcTypeError)('warp.earlyMediaPolicy must be "drop" or "buffer"');
205
+ }
206
+ normalizedConfig.warp = input.warp ? { ...input.warp } : {};
207
+ }
161
208
  return normalizedConfig;
162
209
  }
210
+ function dtlsProtocolVersionsKey(versions) {
211
+ return (versions ?? []).join(",");
212
+ }
163
213
  function coerceUnsignedShort(value, name) {
164
214
  const coerced = Number(value);
165
215
  if (!Number.isFinite(coerced) ||
@@ -199,7 +249,14 @@ function clonePeerConfiguration(config) {
199
249
  iceAdditionalHostAddresses: config.iceAdditionalHostAddresses
200
250
  ? [...config.iceAdditionalHostAddresses]
201
251
  : undefined,
202
- dtls: { ...config.dtls },
252
+ dtls: {
253
+ ...config.dtls,
254
+ protocolVersions: config.dtls.protocolVersions
255
+ ? [...config.dtls.protocolVersions]
256
+ : undefined,
257
+ helloRetryRequest: config.dtls.helloRetryRequest,
258
+ },
259
+ warp: config.warp ? { ...config.warp } : undefined,
203
260
  certificates: [...config.certificates],
204
261
  debug: { ...config.debug },
205
262
  sctp: { ...config.sctp },
@@ -218,8 +275,11 @@ const CLEARABLE_TURN_KEYS = [
218
275
  "turnTlsOptions",
219
276
  "turnUdpFamily",
220
277
  ];
221
- function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDescription, hasSctpTransport, }) {
278
+ function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDescription, hasSctpTransport, dtlsTransportCreated, }) {
222
279
  const normalizedConfig = normalizePeerConfiguration(input);
280
+ if (normalizedConfig.warp !== undefined) {
281
+ normalizedConfig.warp = { ...config.warp, ...normalizedConfig.warp };
282
+ }
223
283
  if (normalizedConfig.rtcpMuxPolicy &&
224
284
  normalizedConfig.rtcpMuxPolicy !== "require") {
225
285
  throw new Error("rtcpMuxPolicy must be require");
@@ -261,9 +321,8 @@ function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDesc
261
321
  if (!values.includes(value)) {
262
322
  throw (0, errors_1.createWebRtcTypeError)(`${option} must be one of ${values.join(", ")}`);
263
323
  }
264
- // keyFrameRequestRouting は接続中に切り替えられる (router が次の要求から使う)
265
324
  if (isReconfiguration &&
266
- option !== "keyFrameRequestRouting" &&
325
+ !CHANGEABLE_COMPATIBILITY_OPTIONS.includes(option) &&
267
326
  value !== config[option]) {
268
327
  throw (0, errors_1.createWebRtcDomException)("InvalidModificationError", `${option} cannot be changed`);
269
328
  }
@@ -305,6 +364,42 @@ function mergePeerConfiguration(config, input, { isReconfiguration, hasLocalDesc
305
364
  if ((normalizedConfig.iceCandidatePoolSize ?? 0) > 0) {
306
365
  throw new Error("iceCandidatePoolSize > 0 is not supported");
307
366
  }
367
+ // deepMerge skips undefined source values. Nested dtls must use the same
368
+ // contract so `{ protocolVersions: undefined }` cannot drop DTLS 1.3.
369
+ const nextDtls = { ...config.dtls };
370
+ if (normalizedConfig.dtls !== undefined) {
371
+ (0, utils_1.deepMerge)(nextDtls, normalizedConfig.dtls);
372
+ normalizedConfig.dtls = nextDtls;
373
+ }
374
+ const nextWarp = { ...config.warp, ...normalizedConfig.warp };
375
+ const nextSped = normalizedConfig.sped ?? config.sped;
376
+ const nextHasDtls13 = (nextDtls.protocolVersions ?? []).some((version) => String(version) === "1.3");
377
+ if (nextSped === true && !nextHasDtls13) {
378
+ throw new Error("PeerConfig.sped requires DTLS 1.3 in dtls.protocolVersions");
379
+ }
380
+ if (nextSped === true && nextDtls.helloRetryRequest) {
381
+ throw new Error("PeerConfig.sped cannot be combined with dtls.helloRetryRequest");
382
+ }
383
+ if (nextWarp.allowEarlyServerData === true &&
384
+ (nextSped !== true || !nextHasDtls13)) {
385
+ throw new Error("warp.allowEarlyServerData requires PeerConfig.sped and DTLS 1.3");
386
+ }
387
+ if (nextWarp.sendBeforeNomination === true && nextSped !== true) {
388
+ throw new Error("warp.sendBeforeNomination requires PeerConfig.sped");
389
+ }
390
+ if (dtlsTransportCreated) {
391
+ if ("sped" in normalizedConfig && normalizedConfig.sped !== config.sped) {
392
+ throw new Error("sped cannot be changed after a DTLS transport is created");
393
+ }
394
+ if (dtlsProtocolVersionsKey(nextDtls.protocolVersions) !==
395
+ dtlsProtocolVersionsKey(config.dtls.protocolVersions)) {
396
+ throw new Error("dtls.protocolVersions cannot be changed after a DTLS transport is created");
397
+ }
398
+ if (Boolean(nextDtls.helloRetryRequest) !==
399
+ Boolean(config.dtls.helloRetryRequest)) {
400
+ throw new Error("dtls.helloRetryRequest cannot be changed after a DTLS transport is created");
401
+ }
402
+ }
308
403
  if (normalizedConfig.sctp !== undefined) {
309
404
  const requestedSctpMtu = normalizedConfig.sctp.mtu ?? src_1.DEFAULT_SCTP_MTU;
310
405
  (0, src_1.validateSctpMtu)(requestedSctpMtu);