|
|
@@ -16,13 +16,41 @@ const DEBOUNCE_PERIOD = 5000;
|
|
16
|
16
|
/**
|
|
17
|
17
|
* This module integrates {@link E2EEContext} with {@link OlmAdapter} in order to distribute the keys for encryption.
|
|
18
|
18
|
*/
|
|
|
19
|
+
|
|
|
20
|
+ /*
|
|
|
21
|
+// zq.aoij aaa=a
|
|
|
22
|
+try {
|
|
|
23
|
+glob_rx?.fns?.loadEvent?.("mkh start.2",{ManagedKeyHandler})
|
|
|
24
|
+
|
|
|
25
|
+} catch (err){
|
|
|
26
|
+glob_rx?.fns?.loadEvent?.("mkh start.err",{err})
|
|
|
27
|
+
|
|
|
28
|
+}
|
|
|
29
|
+ */
|
|
|
30
|
+
|
|
|
31
|
+// glob_rx?.fns?.loadEvent?.("mkh start.2",{ManagedKeyHandler})
|
|
|
32
|
+// glob_rx?.fns?.loadEvent?.("mkh start.2",{})
|
|
|
33
|
+
|
|
19
|
34
|
export class ManagedKeyHandler extends KeyHandler {
|
|
20
|
35
|
/**
|
|
21
|
36
|
* Build a new AutomaticKeyHandler instance, which will be used in a given conference.
|
|
22
|
37
|
*/
|
|
23
|
38
|
constructor(conference) {
|
|
|
39
|
+
|
|
|
40
|
+
|
|
24
|
41
|
super(conference);
|
|
|
42
|
+ // console.log("ManagedKeyHandler _CONSTRUCTED???????")
|
|
|
43
|
+ if (glob_rx?.ljm?.i){
|
|
|
44
|
+ glob_rx.ljm.i.mkh_inst = this
|
|
|
45
|
+ console.log("ManagedKeyHandler ljm constructed")
|
|
|
46
|
+ // console.trace("mkh_trc.")
|
|
|
47
|
+ }
|
|
|
48
|
+ glob_rx?.fns?.loadEvent?.("mkh constructed",{that:this})
|
|
25
|
49
|
|
|
|
50
|
+ if (glob_rx?.fns?.glob_dev_fncb("mkh_dev")){
|
|
|
51
|
+ this._fakeKey = undefined
|
|
|
52
|
+ this.mkh_dev =true
|
|
|
53
|
+ }
|
|
26
|
54
|
this._key = undefined;
|
|
27
|
55
|
this._conferenceJoined = false;
|
|
28
|
56
|
|
|
|
@@ -70,6 +98,7 @@ export class ManagedKeyHandler extends KeyHandler {
|
|
70
|
98
|
* @returns {Object}
|
|
71
|
99
|
*/
|
|
72
|
100
|
get sasVerification() {
|
|
|
101
|
+ console.log("ljm:sasVerification")
|
|
73
|
102
|
return this._olmAdapter;
|
|
74
|
103
|
}
|
|
75
|
104
|
|
|
|
@@ -148,6 +177,7 @@ export class ManagedKeyHandler extends KeyHandler {
|
|
148
|
177
|
* @private
|
|
149
|
178
|
*/
|
|
150
|
179
|
async _rotateKeyImpl() {
|
|
|
180
|
+ console.log("ljm_dbg _rotateKeyImpl")
|
|
151
|
181
|
logger.debug('Rotating key');
|
|
152
|
182
|
|
|
153
|
183
|
this._key = this._generateKey();
|
|
|
@@ -162,6 +192,7 @@ export class ManagedKeyHandler extends KeyHandler {
|
|
162
|
192
|
* @private
|
|
163
|
193
|
*/
|
|
164
|
194
|
async _ratchetKeyImpl() {
|
|
|
195
|
+ console.log("ljm_dbg _ratchetKeyImpl")
|
|
165
|
196
|
logger.debug('Ratchetting key');
|
|
166
|
197
|
|
|
167
|
198
|
const material = await importKey(this._key);
|
|
|
@@ -169,7 +200,10 @@ export class ManagedKeyHandler extends KeyHandler {
|
|
169
|
200
|
|
|
170
|
201
|
this._key = new Uint8Array(newKey);
|
|
171
|
202
|
|
|
172
|
|
- const index = this._olmAdapter.updateCurrentKey(this._key);
|
|
|
203
|
+
|
|
|
204
|
+ // updateCurrentKey updateCurrentMediaKey
|
|
|
205
|
+ const index = this._olmAdapter.updateCurrentMediaKey(this._key);
|
|
|
206
|
+ // const index = this._olmAdapter.updateCurrentKey(this._key);
|
|
173
|
207
|
|
|
174
|
208
|
this.e2eeCtx.setKey(this.conference.myUserId(), this._key, index);
|
|
175
|
209
|
}
|
|
|
@@ -228,6 +262,16 @@ export class ManagedKeyHandler extends KeyHandler {
|
|
228
|
262
|
* @private
|
|
229
|
263
|
*/
|
|
230
|
264
|
_generateKey() {
|
|
|
265
|
+ if (this.mkh_dev){
|
|
|
266
|
+ // temporary test key
|
|
|
267
|
+ return glob_u.tvar.e2ee.key1
|
|
|
268
|
+ }
|
|
231
|
269
|
return window.crypto.getRandomValues(new Uint8Array(32));
|
|
232
|
270
|
}
|
|
233
|
271
|
}
|
|
|
272
|
+
|
|
|
273
|
+if (window?.glob_rx?.ljm?.j){
|
|
|
274
|
+ glob_rx.ljm.j.mkh = {KeyHandler,OlmAdapter,importKey, ratchet,debounce,JitsiConferenceEvents,ManagedKeyHandler,}
|
|
|
275
|
+}
|
|
|
276
|
+
|
|
|
277
|
+glob_rx?.fns?.loadEvent?.("mkh eof",{ManagedKeyHandler})
|