-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Enable end-to-end encryption for WebRTC streams.
Signed-off-by: Joachim Bauch <bauch@struktur.de>
- Loading branch information
Showing
14 changed files
with
1,515 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2020 Jitsi team at 8x8 and the community. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Based on code from https://github.com/jitsi/jitsi-meet | ||
*/ | ||
|
||
/** | ||
* Promise-like object which can be passed around for resolving it later. It | ||
* implements the "thenable" interface, so it can be used wherever a Promise | ||
* could be used. | ||
* | ||
* In addition a "reject on timeout" functionality is provided. | ||
*/ | ||
export default class Deferred { | ||
/** | ||
* Instantiates a Deferred object. | ||
*/ | ||
constructor() { | ||
this.promise = new Promise((resolve, reject) => { | ||
this.resolve = (...args) => { | ||
this.clearRejectTimeout(); | ||
resolve(...args); | ||
}; | ||
this.reject = (...args) => { | ||
this.clearRejectTimeout(); | ||
reject(...args); | ||
}; | ||
}); | ||
this.then = this.promise.then.bind(this.promise); | ||
this.catch = this.promise.catch.bind(this.promise); | ||
} | ||
|
||
/** | ||
* Clears the reject timeout. | ||
*/ | ||
clearRejectTimeout() { | ||
clearTimeout(this._timeout); | ||
} | ||
|
||
/** | ||
* Rejects the promise after the given timeout. | ||
*/ | ||
setRejectTimeout(ms) { | ||
this._timeout = setTimeout(() => { | ||
this.reject(new Error('timeout')); | ||
}, ms); | ||
} | ||
} |
Oops, something went wrong.