module-develop-kit 0.5.10 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs-virtual-dir/Config.js +4 -0
- package/dist/commonjs-virtual-dir/Constants.js +5 -0
- package/dist/commonjs-virtual-dir/DTMF.js +4 -0
- package/dist/commonjs-virtual-dir/JsSIP.js +5 -0
- package/dist/commonjs-virtual-dir/Parser2.js +4 -0
- package/dist/commonjs-virtual-dir/Socket.js +4 -0
- package/dist/commonjs-virtual-dir/Utils.js +4 -0
- package/dist/commonjs-virtual-dir/___vite-browser-external.js +6 -0
- package/dist/commonjs-virtual-dir/__vite-browser-external.js +4 -0
- package/dist/commonjs-virtual-dir/_commonjs-dynamic-modules.js +6 -0
- package/dist/commonjs-virtual-dir/_commonjsHelpers.js +33 -0
- package/dist/commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js +4 -0
- package/dist/commonjs-virtual-dir/_virtual_pc-compatibility-detection.js +4 -0
- package/dist/commonjs-virtual-dir/aes.js +4 -0
- package/dist/commonjs-virtual-dir/blowfish.js +4 -0
- package/dist/commonjs-virtual-dir/browser.js +4 -0
- package/dist/commonjs-virtual-dir/cipher-core.js +4 -0
- package/dist/commonjs-virtual-dir/core.js +4 -0
- package/dist/commonjs-virtual-dir/enc-base64.js +4 -0
- package/dist/commonjs-virtual-dir/enc-base64url.js +4 -0
- package/dist/commonjs-virtual-dir/enc-utf16.js +4 -0
- package/dist/commonjs-virtual-dir/events.js +4 -0
- package/dist/commonjs-virtual-dir/evpkdf.js +4 -0
- package/dist/commonjs-virtual-dir/format-hex.js +4 -0
- package/dist/commonjs-virtual-dir/grammar.js +4 -0
- package/dist/commonjs-virtual-dir/hmac.js +4 -0
- package/dist/commonjs-virtual-dir/index.js +5 -0
- package/dist/commonjs-virtual-dir/index2.js +5 -0
- package/dist/commonjs-virtual-dir/index3.js +7 -0
- package/dist/commonjs-virtual-dir/index4.js +7 -0
- package/dist/commonjs-virtual-dir/index5.js +4 -0
- package/dist/commonjs-virtual-dir/index6.js +4 -0
- package/dist/commonjs-virtual-dir/index7.js +4 -0
- package/dist/commonjs-virtual-dir/index8.js +4 -0
- package/dist/commonjs-virtual-dir/lib-typedarrays.js +4 -0
- package/dist/commonjs-virtual-dir/md5.js +4 -0
- package/dist/commonjs-virtual-dir/mode-cfb.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ctr-gladman.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ctr.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ecb.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ofb.js +4 -0
- package/dist/commonjs-virtual-dir/pad-ansix923.js +4 -0
- package/dist/commonjs-virtual-dir/pad-iso10126.js +4 -0
- package/dist/commonjs-virtual-dir/pad-iso97971.js +4 -0
- package/dist/commonjs-virtual-dir/pad-nopadding.js +4 -0
- package/dist/commonjs-virtual-dir/pad-zeropadding.js +4 -0
- package/dist/commonjs-virtual-dir/parser.js +4 -0
- package/dist/commonjs-virtual-dir/pbkdf2.js +4 -0
- package/dist/commonjs-virtual-dir/rabbit-legacy.js +4 -0
- package/dist/commonjs-virtual-dir/rabbit.js +4 -0
- package/dist/commonjs-virtual-dir/rc4.js +4 -0
- package/dist/commonjs-virtual-dir/ripemd160.js +4 -0
- package/dist/commonjs-virtual-dir/sha1.js +4 -0
- package/dist/commonjs-virtual-dir/sha224.js +4 -0
- package/dist/commonjs-virtual-dir/sha256.js +4 -0
- package/dist/commonjs-virtual-dir/sha3.js +4 -0
- package/dist/commonjs-virtual-dir/sha384.js +4 -0
- package/dist/commonjs-virtual-dir/sha512.js +4 -0
- package/dist/commonjs-virtual-dir/tripledes.js +4 -0
- package/dist/commonjs-virtual-dir/x64-core.js +4 -0
- package/dist/main.js +25 -0
- package/dist/src/outside-call/CallManagement.js +249 -0
- package/dist/src/outside-call/constants.js +42 -0
- package/dist/src/outside-call/index.js +74 -0
- package/dist/src/outside-call/utils.js +50 -0
- package/dist/src/shield/crypto.js +28 -0
- package/dist/src/shield/index.js +59 -0
- package/dist/src/shield/no-debugger.js +26 -0
- package/dist/src/utils/eventBus.js +59 -0
- package/dist/src/vite-plugins/getCompatibilityPlugins.js +13 -0
- package/dist/src/vite-plugins/vitePluginCompatibilityDetection.js +28 -0
- package/dist/vendor/base64-js/index.js +52 -0
- package/dist/vendor/crypto-js/aes.js +69 -0
- package/dist/vendor/crypto-js/blowfish.js +1131 -0
- package/dist/vendor/crypto-js/cipher-core.js +544 -0
- package/dist/vendor/crypto-js/core.js +508 -0
- package/dist/vendor/crypto-js/enc-base64.js +80 -0
- package/dist/vendor/crypto-js/enc-base64url.js +87 -0
- package/dist/vendor/crypto-js/enc-utf16.js +99 -0
- package/dist/vendor/crypto-js/evpkdf.js +70 -0
- package/dist/vendor/crypto-js/format-hex.js +53 -0
- package/dist/vendor/crypto-js/hmac.js +83 -0
- package/dist/vendor/crypto-js/index.js +49 -0
- package/dist/vendor/crypto-js/lib-typedarrays.js +27 -0
- package/dist/vendor/crypto-js/md5.js +71 -0
- package/dist/vendor/crypto-js/mode-cfb.js +36 -0
- package/dist/vendor/crypto-js/mode-ctr-gladman.js +45 -0
- package/dist/vendor/crypto-js/mode-ctr.js +28 -0
- package/dist/vendor/crypto-js/mode-ecb.js +27 -0
- package/dist/vendor/crypto-js/mode-ofb.js +26 -0
- package/dist/vendor/crypto-js/pad-ansix923.js +25 -0
- package/dist/vendor/crypto-js/pad-iso10126.js +25 -0
- package/dist/vendor/crypto-js/pad-iso97971.js +23 -0
- package/dist/vendor/crypto-js/pad-nopadding.js +21 -0
- package/dist/vendor/crypto-js/pad-zeropadding.js +28 -0
- package/dist/vendor/crypto-js/pbkdf2.js +74 -0
- package/dist/vendor/crypto-js/rabbit-legacy.js +73 -0
- package/dist/vendor/crypto-js/rabbit.js +75 -0
- package/dist/vendor/crypto-js/rc4.js +63 -0
- package/dist/vendor/crypto-js/ripemd160.js +398 -0
- package/dist/vendor/crypto-js/sha1.js +49 -0
- package/dist/vendor/crypto-js/sha224.js +36 -0
- package/dist/vendor/crypto-js/sha256.js +57 -0
- package/dist/vendor/crypto-js/sha3.js +116 -0
- package/dist/vendor/crypto-js/sha384.js +37 -0
- package/dist/vendor/crypto-js/sha512.js +147 -0
- package/dist/vendor/crypto-js/tripledes.js +729 -0
- package/dist/vendor/crypto-js/x64-core.js +235 -0
- package/dist/vendor/debug/src/browser.js +146 -0
- package/dist/vendor/debug/src/common.js +97 -0
- package/dist/vendor/events/events.js +216 -0
- package/dist/vendor/gm-crypt/index.js +10 -0
- package/dist/vendor/gm-crypt/src/crypt.js +60 -0
- package/dist/vendor/gm-crypt/src/sm4.js +513 -0
- package/dist/vendor/jsbn/index.js +714 -0
- package/dist/vendor/jssip/lib/Constants.js +180 -0
- package/dist/vendor/jssip/lib-es5/Config.js +263 -0
- package/dist/vendor/jssip/lib-es5/Constants.js +180 -0
- package/dist/vendor/jssip/lib-es5/Dialog/RequestSender.js +84 -0
- package/dist/vendor/jssip/lib-es5/Dialog.js +179 -0
- package/dist/vendor/jssip/lib-es5/DigestAuthentication.js +93 -0
- package/dist/vendor/jssip/lib-es5/Exceptions.js +131 -0
- package/dist/vendor/jssip/lib-es5/Grammar.js +1937 -0
- package/dist/vendor/jssip/lib-es5/JsSIP.js +37 -0
- package/dist/vendor/jssip/lib-es5/Logger.js +44 -0
- package/dist/vendor/jssip/lib-es5/Message.js +229 -0
- package/dist/vendor/jssip/lib-es5/NameAddrHeader.js +107 -0
- package/dist/vendor/jssip/lib-es5/Options.js +227 -0
- package/dist/vendor/jssip/lib-es5/Parser.js +202 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/DTMF.js +175 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/Info.js +149 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/ReferNotifier.js +52 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/ReferSubscriber.js +187 -0
- package/dist/vendor/jssip/lib-es5/RTCSession.js +1799 -0
- package/dist/vendor/jssip/lib-es5/Registrator.js +194 -0
- package/dist/vendor/jssip/lib-es5/RequestSender.js +99 -0
- package/dist/vendor/jssip/lib-es5/SIPMessage.js +623 -0
- package/dist/vendor/jssip/lib-es5/Socket.js +38 -0
- package/dist/vendor/jssip/lib-es5/Timers.js +25 -0
- package/dist/vendor/jssip/lib-es5/Transactions.js +481 -0
- package/dist/vendor/jssip/lib-es5/Transport.js +220 -0
- package/dist/vendor/jssip/lib-es5/UA.js +663 -0
- package/dist/vendor/jssip/lib-es5/URI.js +221 -0
- package/dist/vendor/jssip/lib-es5/Utils.js +263 -0
- package/dist/vendor/jssip/lib-es5/WebSocketInterface.js +120 -0
- package/dist/vendor/jssip/lib-es5/sanityCheck.js +170 -0
- package/dist/vendor/jssip/package.json.js +9 -0
- package/dist/vendor/ms/index.js +85 -0
- package/dist/vendor/sdp-transform/lib/grammar.js +449 -0
- package/dist/vendor/sdp-transform/lib/index.js +14 -0
- package/dist/vendor/sdp-transform/lib/parser.js +70 -0
- package/dist/vendor/sdp-transform/lib/writer.js +74 -0
- package/dist/vendor/sm-crypto/src/index.js +14 -0
- package/dist/vendor/sm-crypto/src/sm2/asn1.js +86 -0
- package/dist/vendor/sm-crypto/src/sm2/ec.js +205 -0
- package/dist/vendor/sm-crypto/src/sm2/index.js +114 -0
- package/dist/vendor/sm-crypto/src/sm2/sm3.js +71 -0
- package/dist/vendor/sm-crypto/src/sm2/utils.js +95 -0
- package/dist/vendor/sm-crypto/src/sm3/index.js +50 -0
- package/dist/vendor/sm-crypto/src/sm4/index.js +408 -0
- package/dist/vite-plugins/index.d.ts +1 -1
- package/dist/vite-plugins/index.js +6 -0
- package/package.json +6 -5
- package/dist/index.es.js +0 -18159
- package/dist/vite-plugins/index.es.js +0 -33
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { __require as C } from "./Logger.js";
|
|
2
|
+
import { __require as p } from "./SIPMessage.js";
|
|
3
|
+
import { __require as E } from "./Constants.js";
|
|
4
|
+
import { __require as R } from "./Transactions.js";
|
|
5
|
+
import { __require as D } from "./Dialog/RequestSender.js";
|
|
6
|
+
import { __require as k } from "./Utils.js";
|
|
7
|
+
var h, v;
|
|
8
|
+
function w() {
|
|
9
|
+
if (v) return h;
|
|
10
|
+
v = 1;
|
|
11
|
+
function T(i, t) {
|
|
12
|
+
if (!(i instanceof t))
|
|
13
|
+
throw new TypeError("Cannot call a class as a function");
|
|
14
|
+
}
|
|
15
|
+
function d(i, t) {
|
|
16
|
+
for (var e = 0; e < t.length; e++) {
|
|
17
|
+
var r = t[e];
|
|
18
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(i, r.key, r);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function f(i, t, e) {
|
|
22
|
+
return t && d(i.prototype, t), e && d(i, e), i;
|
|
23
|
+
}
|
|
24
|
+
var S = C(), g = p(), n = E(), u = R(), A = D(), l = k(), c = new S("Dialog"), _ = {
|
|
25
|
+
// Dialog states.
|
|
26
|
+
STATUS_EARLY: 1,
|
|
27
|
+
STATUS_CONFIRMED: 2,
|
|
28
|
+
STATUS_TERMINATED: 3
|
|
29
|
+
};
|
|
30
|
+
return h = /* @__PURE__ */ function() {
|
|
31
|
+
f(i, null, [{
|
|
32
|
+
key: "C",
|
|
33
|
+
// Expose C object.
|
|
34
|
+
get: function() {
|
|
35
|
+
return _;
|
|
36
|
+
}
|
|
37
|
+
}]);
|
|
38
|
+
function i(t, e, r) {
|
|
39
|
+
var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : _.STATUS_CONFIRMED;
|
|
40
|
+
if (T(this, i), this._owner = t, this._ua = t._ua, this._uac_pending_reply = !1, this._uas_pending_reply = !1, !e.hasHeader("contact"))
|
|
41
|
+
return {
|
|
42
|
+
error: "unable to create a Dialog without Contact header field"
|
|
43
|
+
};
|
|
44
|
+
e instanceof g.IncomingResponse && (a = e.status_code < 200 ? _.STATUS_EARLY : _.STATUS_CONFIRMED);
|
|
45
|
+
var s = e.parseHeader("contact");
|
|
46
|
+
r === "UAS" ? (this._id = {
|
|
47
|
+
call_id: e.call_id,
|
|
48
|
+
local_tag: e.to_tag,
|
|
49
|
+
remote_tag: e.from_tag,
|
|
50
|
+
toString: function() {
|
|
51
|
+
return this.call_id + this.local_tag + this.remote_tag;
|
|
52
|
+
}
|
|
53
|
+
}, this._state = a, this._remote_seqnum = e.cseq, this._local_uri = e.parseHeader("to").uri, this._remote_uri = e.parseHeader("from").uri, this._remote_target = s.uri, this._route_set = e.getHeaders("record-route"), this._ack_seqnum = this._remote_seqnum) : r === "UAC" && (this._id = {
|
|
54
|
+
call_id: e.call_id,
|
|
55
|
+
local_tag: e.from_tag,
|
|
56
|
+
remote_tag: e.to_tag,
|
|
57
|
+
toString: function() {
|
|
58
|
+
return this.call_id + this.local_tag + this.remote_tag;
|
|
59
|
+
}
|
|
60
|
+
}, this._state = a, this._local_seqnum = e.cseq, this._local_uri = e.parseHeader("from").uri, this._remote_uri = e.parseHeader("to").uri, this._remote_target = s.uri, this._route_set = e.getHeaders("record-route").reverse(), this._ack_seqnum = null), this._ua.newDialog(this), c.debug("new ".concat(r, " dialog created with status ").concat(this._state === _.STATUS_EARLY ? "EARLY" : "CONFIRMED"));
|
|
61
|
+
}
|
|
62
|
+
return f(i, [{
|
|
63
|
+
key: "isTerminated",
|
|
64
|
+
value: function() {
|
|
65
|
+
return this._status === _.STATUS_TERMINATED;
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "update",
|
|
69
|
+
value: function(e, r) {
|
|
70
|
+
this._state = _.STATUS_CONFIRMED, c.debug("dialog ".concat(this._id.toString(), " changed to CONFIRMED state")), r === "UAC" && (this._route_set = e.getHeaders("record-route").reverse());
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "terminate",
|
|
74
|
+
value: function() {
|
|
75
|
+
c.debug("dialog ".concat(this._id.toString(), " deleted")), this._ua.destroyDialog(this), this._state = _.STATUS_TERMINATED;
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "sendRequest",
|
|
79
|
+
value: function(e) {
|
|
80
|
+
var r = this, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = l.cloneArray(a.extraHeaders), o = l.cloneObject(a.eventHandlers), q = a.body || null, m = this._createRequest(e, s, q);
|
|
81
|
+
o.onAuthenticated = function() {
|
|
82
|
+
r._local_seqnum += 1;
|
|
83
|
+
};
|
|
84
|
+
var y = new A(this, m, o);
|
|
85
|
+
return y.send(), m;
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "receiveRequest",
|
|
89
|
+
value: function(e) {
|
|
90
|
+
this._checkInDialogRequest(e) && (e.method === n.ACK && this._ack_seqnum !== null ? this._ack_seqnum = null : e.method === n.INVITE && (this._ack_seqnum = e.cseq), this._owner.receiveRequest(e));
|
|
91
|
+
}
|
|
92
|
+
// RFC 3261 12.2.1.1.
|
|
93
|
+
}, {
|
|
94
|
+
key: "_createRequest",
|
|
95
|
+
value: function(e, r, a) {
|
|
96
|
+
r = l.cloneArray(r), this._local_seqnum || (this._local_seqnum = Math.floor(Math.random() * 1e4));
|
|
97
|
+
var s = e === n.CANCEL || e === n.ACK ? this._local_seqnum : this._local_seqnum += 1, o = new g.OutgoingRequest(e, this._remote_target, this._ua, {
|
|
98
|
+
cseq: s,
|
|
99
|
+
call_id: this._id.call_id,
|
|
100
|
+
from_uri: this._local_uri,
|
|
101
|
+
from_tag: this._id.local_tag,
|
|
102
|
+
to_uri: this._remote_uri,
|
|
103
|
+
to_tag: this._id.remote_tag,
|
|
104
|
+
route_set: this._route_set
|
|
105
|
+
}, r, a);
|
|
106
|
+
return o;
|
|
107
|
+
}
|
|
108
|
+
// RFC 3261 12.2.2.
|
|
109
|
+
}, {
|
|
110
|
+
key: "_checkInDialogRequest",
|
|
111
|
+
value: function(e) {
|
|
112
|
+
var r = this;
|
|
113
|
+
if (!this._remote_seqnum)
|
|
114
|
+
this._remote_seqnum = e.cseq;
|
|
115
|
+
else if (e.cseq < this._remote_seqnum)
|
|
116
|
+
if (e.method === n.ACK) {
|
|
117
|
+
if (this._ack_seqnum === null || e.cseq !== this._ack_seqnum)
|
|
118
|
+
return !1;
|
|
119
|
+
} else
|
|
120
|
+
return e.reply(500), !1;
|
|
121
|
+
else e.cseq > this._remote_seqnum && (this._remote_seqnum = e.cseq);
|
|
122
|
+
if (e.method === n.INVITE || e.method === n.UPDATE && e.body) {
|
|
123
|
+
if (this._uac_pending_reply === !0)
|
|
124
|
+
e.reply(491);
|
|
125
|
+
else if (this._uas_pending_reply === !0) {
|
|
126
|
+
var a = (Math.random() * 10 | 0) + 1;
|
|
127
|
+
return e.reply(500, null, ["Retry-After:".concat(a)]), !1;
|
|
128
|
+
} else {
|
|
129
|
+
this._uas_pending_reply = !0;
|
|
130
|
+
var s = function o() {
|
|
131
|
+
(e.server_transaction.state === u.C.STATUS_ACCEPTED || e.server_transaction.state === u.C.STATUS_COMPLETED || e.server_transaction.state === u.C.STATUS_TERMINATED) && (e.server_transaction.removeListener("stateChanged", o), r._uas_pending_reply = !1);
|
|
132
|
+
};
|
|
133
|
+
e.server_transaction.on("stateChanged", s);
|
|
134
|
+
}
|
|
135
|
+
e.hasHeader("contact") && e.server_transaction.on("stateChanged", function() {
|
|
136
|
+
e.server_transaction.state === u.C.STATUS_ACCEPTED && (r._remote_target = e.parseHeader("contact").uri);
|
|
137
|
+
});
|
|
138
|
+
} else e.method === n.NOTIFY && e.hasHeader("contact") && e.server_transaction.on("stateChanged", function() {
|
|
139
|
+
e.server_transaction.state === u.C.STATUS_COMPLETED && (r._remote_target = e.parseHeader("contact").uri);
|
|
140
|
+
});
|
|
141
|
+
return !0;
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "id",
|
|
145
|
+
get: function() {
|
|
146
|
+
return this._id;
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "local_seqnum",
|
|
150
|
+
get: function() {
|
|
151
|
+
return this._local_seqnum;
|
|
152
|
+
},
|
|
153
|
+
set: function(e) {
|
|
154
|
+
this._local_seqnum = e;
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "owner",
|
|
158
|
+
get: function() {
|
|
159
|
+
return this._owner;
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
key: "uac_pending_reply",
|
|
163
|
+
get: function() {
|
|
164
|
+
return this._uac_pending_reply;
|
|
165
|
+
},
|
|
166
|
+
set: function(e) {
|
|
167
|
+
this._uac_pending_reply = e;
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "uas_pending_reply",
|
|
171
|
+
get: function() {
|
|
172
|
+
return this._uas_pending_reply;
|
|
173
|
+
}
|
|
174
|
+
}]), i;
|
|
175
|
+
}(), h;
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
w as __require
|
|
179
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __require as w } from "./Logger.js";
|
|
2
|
+
import { __require as D } from "./Utils.js";
|
|
3
|
+
var o, l;
|
|
4
|
+
function x() {
|
|
5
|
+
if (l) return o;
|
|
6
|
+
l = 1;
|
|
7
|
+
function _(i, n) {
|
|
8
|
+
if (!(i instanceof n))
|
|
9
|
+
throw new TypeError("Cannot call a class as a function");
|
|
10
|
+
}
|
|
11
|
+
function f(i, n) {
|
|
12
|
+
for (var t = 0; t < n.length; t++) {
|
|
13
|
+
var e = n[t];
|
|
14
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function d(i, n, t) {
|
|
18
|
+
return n && f(i.prototype, n), i;
|
|
19
|
+
}
|
|
20
|
+
var p = w(), s = D(), a = new p("DigestAuthentication");
|
|
21
|
+
return o = /* @__PURE__ */ function() {
|
|
22
|
+
function i(n) {
|
|
23
|
+
_(this, i), this._credentials = n, this._cnonce = null, this._nc = 0, this._ncHex = "00000000", this._algorithm = null, this._realm = null, this._nonce = null, this._opaque = null, this._stale = null, this._qop = null, this._method = null, this._uri = null, this._ha1 = null, this._response = null;
|
|
24
|
+
}
|
|
25
|
+
return d(i, [{
|
|
26
|
+
key: "get",
|
|
27
|
+
value: function(t) {
|
|
28
|
+
switch (t) {
|
|
29
|
+
case "realm":
|
|
30
|
+
return this._realm;
|
|
31
|
+
case "ha1":
|
|
32
|
+
return this._ha1;
|
|
33
|
+
default:
|
|
34
|
+
a.warn('get() | cannot get "%s" parameter', t);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Performs Digest authentication given a SIP request and the challenge
|
|
40
|
+
* received in a response to that request.
|
|
41
|
+
* Returns true if auth was successfully generated, false otherwise.
|
|
42
|
+
*/
|
|
43
|
+
}, {
|
|
44
|
+
key: "authenticate",
|
|
45
|
+
value: function(t, e) {
|
|
46
|
+
var m = t.method, g = t.ruri, r = t.body, q = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
47
|
+
if (this._algorithm = e.algorithm, this._realm = e.realm, this._nonce = e.nonce, this._opaque = e.opaque, this._stale = e.stale, this._algorithm) {
|
|
48
|
+
if (this._algorithm !== "MD5")
|
|
49
|
+
return a.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'), !1;
|
|
50
|
+
} else
|
|
51
|
+
this._algorithm = "MD5";
|
|
52
|
+
if (!this._nonce)
|
|
53
|
+
return a.warn("authenticate() | challenge without Digest nonce, authentication aborted"), !1;
|
|
54
|
+
if (!this._realm)
|
|
55
|
+
return a.warn("authenticate() | challenge without Digest realm, authentication aborted"), !1;
|
|
56
|
+
if (!this._credentials.password) {
|
|
57
|
+
if (!this._credentials.ha1)
|
|
58
|
+
return a.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"), !1;
|
|
59
|
+
if (this._credentials.realm !== this._realm)
|
|
60
|
+
return a.warn('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]', this._credentials.realm, this._realm), !1;
|
|
61
|
+
}
|
|
62
|
+
if (e.qop)
|
|
63
|
+
if (e.qop.indexOf("auth-int") > -1)
|
|
64
|
+
this._qop = "auth-int";
|
|
65
|
+
else if (e.qop.indexOf("auth") > -1)
|
|
66
|
+
this._qop = "auth";
|
|
67
|
+
else
|
|
68
|
+
return a.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'), !1;
|
|
69
|
+
else
|
|
70
|
+
this._qop = null;
|
|
71
|
+
this._method = m, this._uri = g, this._cnonce = q || s.createRandomToken(12), this._nc += 1;
|
|
72
|
+
var u = Number(this._nc).toString(16);
|
|
73
|
+
this._ncHex = "00000000".substr(0, 8 - u.length) + u, this._nc === 4294967296 && (this._nc = 1, this._ncHex = "00000001"), this._credentials.password ? this._ha1 = s.calculateMD5("".concat(this._credentials.username, ":").concat(this._realm, ":").concat(this._credentials.password)) : this._ha1 = this._credentials.ha1;
|
|
74
|
+
var h, c;
|
|
75
|
+
return this._qop === "auth" ? (h = "".concat(this._method, ":").concat(this._uri), c = s.calculateMD5(h), a.debug('authenticate() | using qop=auth [a2:"%s"]', h), this._response = s.calculateMD5("".concat(this._ha1, ":").concat(this._nonce, ":").concat(this._ncHex, ":").concat(this._cnonce, ":auth:").concat(c))) : this._qop === "auth-int" ? (h = "".concat(this._method, ":").concat(this._uri, ":").concat(s.calculateMD5(r || "")), c = s.calculateMD5(h), a.debug('authenticate() | using qop=auth-int [a2:"%s"]', h), this._response = s.calculateMD5("".concat(this._ha1, ":").concat(this._nonce, ":").concat(this._ncHex, ":").concat(this._cnonce, ":auth-int:").concat(c))) : this._qop === null && (h = "".concat(this._method, ":").concat(this._uri), c = s.calculateMD5(h), a.debug('authenticate() | using qop=null [a2:"%s"]', h), this._response = s.calculateMD5("".concat(this._ha1, ":").concat(this._nonce, ":").concat(c))), a.debug("authenticate() | response generated"), !0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Return the Proxy-Authorization or WWW-Authorization header value.
|
|
79
|
+
*/
|
|
80
|
+
}, {
|
|
81
|
+
key: "toString",
|
|
82
|
+
value: function() {
|
|
83
|
+
var t = [];
|
|
84
|
+
if (!this._response)
|
|
85
|
+
throw new Error("response field does not exist, cannot generate Authorization header");
|
|
86
|
+
return t.push("algorithm=".concat(this._algorithm)), t.push('username="'.concat(this._credentials.username, '"')), t.push('realm="'.concat(this._realm, '"')), t.push('nonce="'.concat(this._nonce, '"')), t.push('uri="'.concat(this._uri, '"')), t.push('response="'.concat(this._response, '"')), this._opaque && t.push('opaque="'.concat(this._opaque, '"')), this._qop && (t.push("qop=".concat(this._qop)), t.push('cnonce="'.concat(this._cnonce, '"')), t.push("nc=".concat(this._ncHex))), "Digest ".concat(t.join(", "));
|
|
87
|
+
}
|
|
88
|
+
}]), i;
|
|
89
|
+
}(), o;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
x as __require
|
|
93
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
var v, R;
|
|
2
|
+
function I() {
|
|
3
|
+
if (R) return v;
|
|
4
|
+
R = 1;
|
|
5
|
+
function f(n) {
|
|
6
|
+
"@babel/helpers - typeof";
|
|
7
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? f = function(r) {
|
|
8
|
+
return typeof r;
|
|
9
|
+
} : f = function(r) {
|
|
10
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
11
|
+
}, f(n);
|
|
12
|
+
}
|
|
13
|
+
function p(n, t) {
|
|
14
|
+
if (!(n instanceof t))
|
|
15
|
+
throw new TypeError("Cannot call a class as a function");
|
|
16
|
+
}
|
|
17
|
+
function s(n, t) {
|
|
18
|
+
if (typeof t != "function" && t !== null)
|
|
19
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
20
|
+
n.prototype = Object.create(t && t.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), t && c(n, t);
|
|
21
|
+
}
|
|
22
|
+
function l(n) {
|
|
23
|
+
var t = h();
|
|
24
|
+
return function() {
|
|
25
|
+
var o = a(n), e;
|
|
26
|
+
if (t) {
|
|
27
|
+
var u = a(this).constructor;
|
|
28
|
+
e = Reflect.construct(o, arguments, u);
|
|
29
|
+
} else
|
|
30
|
+
e = o.apply(this, arguments);
|
|
31
|
+
return m(this, e);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function m(n, t) {
|
|
35
|
+
return t && (f(t) === "object" || typeof t == "function") ? t : O(n);
|
|
36
|
+
}
|
|
37
|
+
function O(n) {
|
|
38
|
+
if (n === void 0)
|
|
39
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
40
|
+
return n;
|
|
41
|
+
}
|
|
42
|
+
function i(n) {
|
|
43
|
+
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
44
|
+
return i = function(o) {
|
|
45
|
+
if (o === null || !g(o)) return o;
|
|
46
|
+
if (typeof o != "function")
|
|
47
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
48
|
+
if (typeof t < "u") {
|
|
49
|
+
if (t.has(o)) return t.get(o);
|
|
50
|
+
t.set(o, e);
|
|
51
|
+
}
|
|
52
|
+
function e() {
|
|
53
|
+
return y(o, arguments, a(this).constructor);
|
|
54
|
+
}
|
|
55
|
+
return e.prototype = Object.create(o.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), c(e, o);
|
|
56
|
+
}, i(n);
|
|
57
|
+
}
|
|
58
|
+
function y(n, t, r) {
|
|
59
|
+
return h() ? y = Reflect.construct : y = function(e, u, E) {
|
|
60
|
+
var _ = [null];
|
|
61
|
+
_.push.apply(_, u);
|
|
62
|
+
var P = Function.bind.apply(e, _), d = new P();
|
|
63
|
+
return E && c(d, E.prototype), d;
|
|
64
|
+
}, y.apply(null, arguments);
|
|
65
|
+
}
|
|
66
|
+
function h() {
|
|
67
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
68
|
+
if (typeof Proxy == "function") return !0;
|
|
69
|
+
try {
|
|
70
|
+
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
71
|
+
})), !0;
|
|
72
|
+
} catch {
|
|
73
|
+
return !1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function g(n) {
|
|
77
|
+
return Function.toString.call(n).indexOf("[native code]") !== -1;
|
|
78
|
+
}
|
|
79
|
+
function c(n, t) {
|
|
80
|
+
return c = Object.setPrototypeOf || function(o, e) {
|
|
81
|
+
return o.__proto__ = e, o;
|
|
82
|
+
}, c(n, t);
|
|
83
|
+
}
|
|
84
|
+
function a(n) {
|
|
85
|
+
return a = Object.setPrototypeOf ? Object.getPrototypeOf : function(r) {
|
|
86
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
87
|
+
}, a(n);
|
|
88
|
+
}
|
|
89
|
+
var S = /* @__PURE__ */ function(n) {
|
|
90
|
+
s(r, n);
|
|
91
|
+
var t = l(r);
|
|
92
|
+
function r(o, e) {
|
|
93
|
+
var u;
|
|
94
|
+
return p(this, r), u = t.call(this), u.code = 1, u.name = "CONFIGURATION_ERROR", u.parameter = o, u.value = e, u.message = u.value ? "Invalid value ".concat(JSON.stringify(u.value), ' for parameter "').concat(u.parameter, '"') : "Missing parameter: ".concat(u.parameter), u;
|
|
95
|
+
}
|
|
96
|
+
return r;
|
|
97
|
+
}(/* @__PURE__ */ i(Error)), b = /* @__PURE__ */ function(n) {
|
|
98
|
+
s(r, n);
|
|
99
|
+
var t = l(r);
|
|
100
|
+
function r(o) {
|
|
101
|
+
var e;
|
|
102
|
+
return p(this, r), e = t.call(this), e.code = 2, e.name = "INVALID_STATE_ERROR", e.status = o, e.message = "Invalid status: ".concat(o), e;
|
|
103
|
+
}
|
|
104
|
+
return r;
|
|
105
|
+
}(/* @__PURE__ */ i(Error)), N = /* @__PURE__ */ function(n) {
|
|
106
|
+
s(r, n);
|
|
107
|
+
var t = l(r);
|
|
108
|
+
function r(o) {
|
|
109
|
+
var e;
|
|
110
|
+
return p(this, r), e = t.call(this), e.code = 3, e.name = "NOT_SUPPORTED_ERROR", e.message = o, e;
|
|
111
|
+
}
|
|
112
|
+
return r;
|
|
113
|
+
}(/* @__PURE__ */ i(Error)), w = /* @__PURE__ */ function(n) {
|
|
114
|
+
s(r, n);
|
|
115
|
+
var t = l(r);
|
|
116
|
+
function r(o) {
|
|
117
|
+
var e;
|
|
118
|
+
return p(this, r), e = t.call(this), e.code = 4, e.name = "NOT_READY_ERROR", e.message = o, e;
|
|
119
|
+
}
|
|
120
|
+
return r;
|
|
121
|
+
}(/* @__PURE__ */ i(Error));
|
|
122
|
+
return v = {
|
|
123
|
+
ConfigurationError: S,
|
|
124
|
+
InvalidStateError: b,
|
|
125
|
+
NotSupportedError: N,
|
|
126
|
+
NotReadyError: w
|
|
127
|
+
}, v;
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
I as __require
|
|
131
|
+
};
|