Giter Club home page Giter Club logo

sora-e2ee's Introduction

Sora E2EE ライブラリ

GitHub tag License

時雨堂のオープンソースソフトウェアについて

利用前に https://github.com/shiguredo/oss をお読みください。

概要

WebRTC SFU Sora 利用時に E2EE をブラウザで実現するためのライブラリです。 これ単体では利用できず Sora JS SDK から呼び出して利用します。

WebAssembly (Wasm) として利用することを想定して実装されています。

ビルド

Go バージョン 1.19 以降が必要になります。

make を実行すれば dist/ 以下に wasm.wasm が生成されます。 この wasm.wasmsora-js-sdkSora.initE2EE(...) に指定してください。

ドキュメント

詳細な仕様についてはドキュメントをご確認ください

https://sora-e2ee.shiguredo.jp/

FAQ

  • このライブラリのライセンスはなんですか?
    • Apache License 2.0 です
  • E2EE を利用するメリットはなんですか?
    • WebRTC SFU 側で音声や映像の解析が困難になります
  • E2EE の鍵合意プロトコルはなにを使用していますか?
    • Signal プロトコルの X3DH を利用しています
  • E2EE のメッセージ暗号アルゴリズムはなにを使用していますか?
    • Signal プロトコルの Double Ratchet アルゴリズムを利用しています
  • E2EE 用のキーペアはどうやって生成すればいいですか?
    • キーペアは WebAssembly で動的に生成されます
  • E2EE に利用する暗号方式は何を採用していますか?
    • AES-GCM 128 を採用しています
  • E2EE に利用する暗号鍵を生成する鍵導出関数はなんですか?
    • HKDF を利用します
  • E2EE に利用する IV の生成方法はなんですか?
    • HKDF を利用して生成された 96 ビットの値と前半 64 ビットを 0 パディングした 32 ビットのカウンターの XOR を利用します
  • E2EE 用のキーペアはどう扱われますか?
    • 利用するキーペアは WebAssembly 側で動的に生成されます
  • E2EE 用の鍵は Sora に送られますか?
    • 送られません Sora には {e2ee: true} という値のみが Sora に送られます
    • この値は E2EE を利用しているかどうかを認証サーバ側で把握するために利用されます
  • E2EE 用の wasm バイナリはどう用意すればいいですか?
    • 自前でビルドしてください Go が必要になります
    • その後 Sora JavaScript SDK で Sora.initE2EE("wasm.wasm") のように初期化して下さい
  • E2EE で利用するキーの利用回数が 2^32-1 回を超えたらどうなりますか?
    • 切断します
  • E2EE はどうやって実現していますか?
    • Insertable Streams API を利用しています
  • E2EE を利用すると遅くなりますか?
    • 暗号化/復号が入るので遅くはなりますが Web Worker を利用することで可能な範囲で高速化はしています
  • E2EE を利用すると CPU 使用率は上がりますか?
    • E2EE 用の暗号化/復号を行うため CPU 使用率は上がります
  • 暗号ライブラリは何を利用していますか?
    • WebCrypto を利用しています
  • 定期的な鍵交換は行いますか?
    • チャネルへの参加、離脱が発生するたびにマテリアルキーが更新されます
  • Secure Frame は利用していますか?
    • 採用しています
    • 暗号化には AES-GCM 128 を採用しています

利用可能環境

  • Chrome M87 以降
  • Edge 87 以降

利用技術

Sora JavaScript SDK からの利用方法

// E2EE 用 Wasm 読み込み
Sora.initE2EE("https://example.com/wasm.wasm");
// Sora.initE2EE("wasm.wasm"); でも良い

let sora = Sora.connection('wss://example.com/signaling');
let channelId = 'sora-e2ee';
let sendrecv = sora.sendrecv(channelId, null, {e2ee: true});

navigator.mediaDevices.getUserMedia({audio: true, video: true})
  .then(mediaStream => {
    // connect
    sendrecv.connect(mediaStream)
      .then(stream => {
        // stream を video.src に追加する等の処理
      });
  })
  .catch(e => {
    console.error(e);
  });

// disconnect
sendrecv.disconnect()
  .then(() => {
    // video を止める等の処理
  });

// event
sendrecv.on('disconnect', function(e) {
  console.error(e);
});

ライセンス

Copyright 2020-2022, Hiroshi Yoshida (Original Author)
Copyright 2020-2022, Shiguredo Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

sora-e2ee's People

Contributors

dependabot[bot] avatar hexa avatar renovate[bot] avatar voluntas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.