Skip to content

Latest commit

 

History

History
131 lines (69 loc) · 4.17 KB

api.md

File metadata and controls

131 lines (69 loc) · 4.17 KB

Sframe

SFrame library

createClient

Create a new SFrame client context.

This method will create client which communicates with web worker in which the SFrame context will be executed.

Parameters

  • senderId Number Numeric id for this sender.
  • config Object Congiguration parameters [Optional].
    • config.skipVp8PayloadHeader Boolean Sends the vp8 payload header in clear (Note: it will be applied to all video frames as encoded chunks does not contain codec info yet).

Returns Promise<Client> Promise that resolves to the client object when the web worker is initialized.

Client

Extends EventTarget

The SFrame client object which acts as a proxy for web worker context.

setSenderEncryptionKey

Set the sender encryption key.

Parameters

  • key (ArrayBuffer | Uint8Array | CryptoKey) 32 bytes encryption key. If the value is a CryptoKey the algorithm must be "HKDF".

Returns Promise<void> Promise which will be resolved when the key is set on the web worker.

ratchetSenderEncryptionKey

Ratchert the sender encryption key.

Returns Promise<void> Promise which will be resolved when the key is ratcheted on the web worker.

setSenderSigningKey

Set the sender signing key.

Parameters

  • key (ArrayBuffer | Uint8Array | CryptoKey) Private key used for singing. If the value is a CryptoKey the algorithm must be "ECDSA".

Returns Promise<void> Promise which will be resolved when the signing key is set on the web worker.

addReceiver

Add receiver for a remote sender.

Parameters

  • receiverkKeyId Number The remote senderId.

Returns Promise<void> Promise which will be resolved when the receiver is added on the web worker.

setReceiverEncryptionKey

Set the receiver encryption key associated to a remote sender.

Parameters

  • receiverkKeyId Number The remote senderId.
  • key (ArrayBuffer | Uint8Array | CryptoKey) 32 bytes encryption key. If the value is a CryptoKey the algorithm must be "HKDF".

Returns Promise<void> Promise which will be resolved when the key is set on the web worker.

setReceiverVerifyKey

Set the receiver signing key associated to a remote sender.

Parameters

  • receiverkKeyId Number The remote senderId.
  • key (ArrayBuffer | Uint8Array | CryptoKey) Private key used for singing. If the value is a CryptoKey the algorithm must be "ECDSA".

Returns Promise<void> Promise which will be resolved when the signing key is set on the web worker.

deleteReceiver

Remove receiver for a remote sender.

Parameters

  • receiverkKeyId Number The remote senderId.

Returns Promise<void> Promise which will be resolved when the receiver is removed on the web worker.

encrypt

Encrypt frames for a RTCRtpSender.

Parameters

  • id String An unique identifier associated to this sender (for example transceiver.mid).
  • sender RTCRtpSender The sender object, associated track must be not null.

decrypt

Decrypt frames fpr a RTCPRtpReceiver.

Parameters

  • id String An unique identifier associated to this sender (for example transceiver.mid), it will be used for the authentication and signing events.
  • receiver RTCRtpReceiver The receiver object.

close

Close client and terminate web worker.