選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

actions.ts 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import {
  2. PARTICIPANT_VERIFIED,
  3. SET_MAX_MODE,
  4. SET_MEDIA_ENCRYPTION_KEY,
  5. START_VERIFICATION,
  6. TOGGLE_E2EE } from './actionTypes';
  7. /**
  8. * Dispatches an action to enable / disable E2EE.
  9. *
  10. * @param {boolean} enabled - Whether E2EE is to be enabled or not.
  11. * @returns {Object}
  12. */
  13. export function toggleE2EE(enabled: boolean) {
  14. return {
  15. type: TOGGLE_E2EE,
  16. enabled
  17. };
  18. }
  19. /**
  20. * Dispatches an action to set E2EE maxMode.
  21. *
  22. * @param {string} maxMode - The new value.
  23. * @returns {Object}
  24. */
  25. export function setE2EEMaxMode(maxMode: string) {
  26. return {
  27. type: SET_MAX_MODE,
  28. maxMode
  29. };
  30. }
  31. /**
  32. * Dispatches an action to set media encryption key.
  33. *
  34. * @param {Object} keyInfo - Json containing key information.
  35. * @param {string} [keyInfo.encryptionKey] - The exported encryption key.
  36. * @param {number} [keyInfo.index] - The index of the encryption key.
  37. * @returns {{
  38. * type: SET_MEDIA_ENCRYPTION_KEY,
  39. * keyInfo: Object
  40. * }}
  41. */
  42. export function setMediaEncryptionKey(keyInfo: Object) {
  43. return {
  44. type: SET_MEDIA_ENCRYPTION_KEY,
  45. keyInfo
  46. };
  47. }
  48. /**
  49. * Dispatches an action to start participant e2ee verficiation process.
  50. *
  51. * @param {string} pId - The participant id.
  52. * @returns {{
  53. * type: START_VERIFICATION,
  54. * pId: string
  55. * }}
  56. */
  57. export function startVerification(pId: string) {
  58. return {
  59. type: START_VERIFICATION,
  60. pId
  61. };
  62. }
  63. /**
  64. * Dispatches an action to set participant e2ee verification status.
  65. *
  66. * @param {string} pId - The participant id.
  67. * @param {boolean} isVerified - The verifcation status.
  68. * @returns {{
  69. * type: PARTICIPANT_VERIFIED,
  70. * pId: string,
  71. * isVerified: boolean
  72. * }}
  73. */
  74. export function participantVerified(pId: string, isVerified: boolean) {
  75. return {
  76. type: PARTICIPANT_VERIFIED,
  77. pId,
  78. isVerified
  79. };
  80. }