livekit-dgn/lib/DummyKeyProvider.ts
lukasIO 041d41a5fe
Add e2ee option (#106)
* Add checkbox for e2ee

* add also to custom tab

* fix SSR
2023-08-30 11:25:22 +02:00

16 lines
505 B
TypeScript

// just for demonstration purposes, extremely insecure
import { BaseKeyProvider, createKeyMaterialFromString } from 'livekit-client';
export class DummyKeyProvider extends BaseKeyProvider {
readonly participantKeys = new Map([
['dev1', 'dev1key'],
['dev2', 'dev2key'],
]);
async setKey(participantId: string) {
// @ts-ignore
const cryptoKey = await createKeyMaterialFromString(this.participantKeys.get(participantId));
this.onSetEncryptionKey(cryptoKey, participantId);
}
}