{"version":3,"file":"constants.mjs","sources":["../../../src/e2ee/constants.ts"],"sourcesContent":["import type { KeyProviderOptions } from './types';\n\nexport const ENCRYPTION_ALGORITHM = 'AES-GCM';\n\n// How many consecutive frames can fail decrypting before a particular key gets marked as invalid\nexport const DECRYPTION_FAILURE_TOLERANCE = 10;\n\n// We copy the first bytes of the VP8 payload unencrypted.\n// For keyframes this is 10 bytes, for non-keyframes (delta) 3. See\n//   https://tools.ietf.org/html/rfc6386#section-9.1\n// This allows the bridge to continue detecting keyframes (only one byte needed in the JVB)\n// and is also a bit easier for the VP8 decoder (i.e. it generates funny garbage pictures\n// instead of being unable to decode).\n// This is a bit for show and we might want to reduce to 1 unconditionally in the final version.\n//\n// For audio (where frame.type is not set) we do not encrypt the opus TOC byte:\n//   https://tools.ietf.org/html/rfc6716#section-3.1\nexport const UNENCRYPTED_BYTES = {\n  key: 10,\n  delta: 3,\n  audio: 1, // frame.type is not set on audio, so this is set manually\n  empty: 0,\n} as const;\n\n/* We use a 12 byte bit IV. This is signalled in plain together with the\n packet. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#parameters */\nexport const IV_LENGTH = 12;\n\n// flag set to indicate that e2ee has been setup for sender/receiver;\nexport const E2EE_FLAG = 'lk_e2ee';\n\n/**\n * trackId a receiver's/sender's encoded stream pipeline was last set up for.\n * Needed to recover the right cryptor when a transceiver gets reused.\n */\nexport const E2EE_TRACK_ID = 'lk_e2ee_track_id';\n\nexport const SALT = 'LKFrameEncryptionKey';\n\nexport const KEY_PROVIDER_DEFAULTS: KeyProviderOptions = {\n  sharedKey: false,\n  ratchetSalt: SALT,\n  ratchetWindowSize: 8,\n  failureTolerance: DECRYPTION_FAILURE_TOLERANCE,\n  keyringSize: 16,\n  keySize: 128,\n} as const;\n\nexport const MAX_SIF_COUNT = 100;\nexport const MAX_SIF_DURATION = 2000;\n"],"names":["ENCRYPTION_ALGORITHM","DECRYPTION_FAILURE_TOLERANCE","E2EE_FLAG","E2EE_TRACK_ID","SALT","KEY_PROVIDER_DEFAULTS","sharedKey","ratchetSalt","ratchetWindowSize","failureTolerance","keyringSize","keySize"],"mappings":"AAEO,MAAMA,oBAAoB,GAAG;AAEpC;AACO,MAAMC,4BAA4B,GAAG;AAuB5C;AACO,MAAMC,SAAS,GAAG;AAEzB;;;AAGG;AACI,MAAMC,aAAa,GAAG;AAEtB,MAAMC,IAAI,GAAG;AAEb,MAAMC,qBAAqB,GAAuB;AACvDC,EAAAA,SAAS,EAAE,KAAK;AAChBC,EAAAA,WAAW,EAAEH,IAAI;AACjBI,EAAAA,iBAAiB,EAAE,CAAC;AACpBC,EAAAA,gBAAgB,EAAER,4BAA4B;AAC9CS,EAAAA,WAAW,EAAE,EAAE;AACfC,EAAAA,OAAO,EAAE;"}