{"version":3,"file":"events.mjs","sources":["../../../src/e2ee/events.ts"],"sourcesContent":["import type Participant from '../room/participant/Participant';\nimport type { CryptorError } from './errors';\nimport type { KeyInfo, RatchetResult } from './types';\n\nexport enum KeyProviderEvent {\n  SetKey = 'setKey',\n  /** Event for requesting to ratchet the key used to encrypt the stream */\n  RatchetRequest = 'ratchetRequest',\n  /** Emitted when a key is ratcheted. Could be after auto-ratcheting on decryption failure or\n   *  following a `RatchetRequest`, will contain the ratcheted key material */\n  KeyRatcheted = 'keyRatcheted',\n}\n\nexport type KeyProviderCallbacks = {\n  [KeyProviderEvent.SetKey]: (keyInfo: KeyInfo, updateCurrentKeyIndex: boolean) => void;\n  [KeyProviderEvent.RatchetRequest]: (participantIdentity?: string, keyIndex?: number) => void;\n  [KeyProviderEvent.KeyRatcheted]: (\n    ratchetedResult: RatchetResult,\n    participantIdentity?: string,\n    keyIndex?: number,\n  ) => void;\n};\n\nexport enum KeyHandlerEvent {\n  /** Emitted when a key has been ratcheted. Is emitted when any key has been ratcheted\n   * i.e. when the FrameCryptor tried to ratchet when decryption is failing  */\n  KeyRatcheted = 'keyRatcheted',\n}\n\nexport type ParticipantKeyHandlerCallbacks = {\n  [KeyHandlerEvent.KeyRatcheted]: (\n    ratchetResult: RatchetResult,\n    participantIdentity: string,\n    keyIndex?: number,\n  ) => void;\n};\n\nexport enum EncryptionEvent {\n  ParticipantEncryptionStatusChanged = 'participantEncryptionStatusChanged',\n  EncryptionError = 'encryptionError',\n}\n\nexport type E2EEManagerCallbacks = {\n  [EncryptionEvent.ParticipantEncryptionStatusChanged]: (\n    enabled: boolean,\n    participant: Participant,\n  ) => void;\n  [EncryptionEvent.EncryptionError]: (error: Error, participantIdentity?: string) => void;\n};\n\nexport type CryptorCallbacks = {\n  [CryptorEvent.Error]: (error: CryptorError) => void;\n};\n\nexport enum CryptorEvent {\n  Error = 'cryptorError',\n}\n"],"names":["KeyProviderEvent","KeyHandlerEvent","EncryptionEvent","CryptorEvent"],"mappings":"IAIYA;AAAZ,CAAA,UAAYA,gBAAgB,EAAA;AAC1BA,EAAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB;AACAA,EAAAA,gBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC;AACjC;AAC4E;AAC5EA,EAAAA,gBAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AAC/B,CAAC,EAPWA,gBAAgB,KAAhBA,gBAAgB,GAAA,EAAA,CAAA,CAAA;IAmBhBC;AAAZ,CAAA,UAAYA,eAAe,EAAA;AACzB;AAC6E;AAC7EA,EAAAA,eAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AAC/B,CAAC,EAJWA,eAAe,KAAfA,eAAe,GAAA,EAAA,CAAA,CAAA;IAcfC;AAAZ,CAAA,UAAYA,eAAe,EAAA;AACzBA,EAAAA,eAAA,CAAA,oCAAA,CAAA,GAAA,oCAAyE;AACzEA,EAAAA,eAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;AACrC,CAAC,EAHWA,eAAe,KAAfA,eAAe,GAAA,EAAA,CAAA,CAAA;IAiBfC;AAAZ,CAAA,UAAYA,YAAY,EAAA;AACtBA,EAAAA,YAAA,CAAA,OAAA,CAAA,GAAA,cAAsB;AACxB,CAAC,EAFWA,YAAY,KAAZA,YAAY,GAAA,EAAA,CAAA,CAAA"}