React Native Api Reference - v2.0.0
    Preparing search index...

    Class BaseKeyProvider

    BaseKeyProvider holds the end-to-end encryption keys for a room — a shared room key, or per-participant keys consulted only when no shared key is set.

    Keys must be registered before the room joins. Build the provider, set the shared key on it, then register it with setKeyProvider. Registering after join affects only later publishes.

    Whether media is actually being encrypted — as opposed to a provider merely having been set — is answered by useRoom's e2eeEnabled. The per-stream encrypt/decrypt result arrives on useParticipant's onE2EEStateChanged.

    import { RoomProvider, VideoSDK, BaseKeyProvider } from "@videosdk.live/react-native-sdk";

    const keyProvider = new BaseKeyProvider();
    keyProvider.setSharedKey("<YOUR_SECURE_KEY>");
    await VideoSDK.setKeyProvider(keyProvider);

    function Room() {
    return (
    <RoomProvider
    config={{ roomId: "room-id", participantName: "Participant Name", micEnabled: true, camEnabled: true }}
    token={"token"}
    >
    <RoomView />
    </RoomProvider>
    );
    }
    Index
      • Removes the key set for one participant, the same as setParticipantKey with a null key. This device stops decrypting that participant until a new key is set.

      • Takes effect mid-room only on the provider passed to setKeyProvider; on any other provider it only forgets the stored key.

      Parameters

      • participantId: string

        Id of the participant whose key is removed.

      Returns Promise<void>

      • This method can be used to set one encryption key shared by every participant in the room.

      • Every participant must set the same key. A shared key takes precedence over any per-participant key set with setParticipantKey.

      • Synchronous and store-only: nothing reaches the core until the provider is handed to setKeyProvider.

      Parameters

      • key: string

        The shared encryption key. Empty is rejected with ERROR_INVALID_PARAMETER (3073).

      Returns void