You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.ts 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import {
  2. PARTICIPANT_VERIFIED,
  3. SET_EVERYONE_ENABLED_E2EE,
  4. SET_EVERYONE_SUPPORT_E2EE,
  5. SET_MAX_MODE,
  6. SET_MEDIA_ENCRYPTION_KEY,
  7. START_VERIFICATION,
  8. TOGGLE_E2EE } from './actionTypes';
  9. /**
  10. * Dispatches an action to enable / disable E2EE.
  11. *
  12. * @param {boolean} enabled - Whether E2EE is to be enabled or not.
  13. * @returns {Object}
  14. */
  15. export function toggleE2EE(enabled: boolean) {
  16. return {
  17. type: TOGGLE_E2EE,
  18. enabled
  19. };
  20. }
  21. /**
  22. * Set new value whether everyone has E2EE enabled.
  23. *
  24. * @param {boolean} everyoneEnabledE2EE - The new value.
  25. * @returns {{
  26. * type: SET_EVERYONE_ENABLED_E2EE,
  27. * everyoneEnabledE2EE: boolean
  28. * }}
  29. */
  30. export function setEveryoneEnabledE2EE(everyoneEnabledE2EE: boolean) {
  31. return {
  32. type: SET_EVERYONE_ENABLED_E2EE,
  33. everyoneEnabledE2EE
  34. };
  35. }
  36. /**
  37. * Set new value whether everyone support E2EE.
  38. *
  39. * @param {boolean} everyoneSupportE2EE - The new value.
  40. * @returns {{
  41. * type: SET_EVERYONE_SUPPORT_E2EE,
  42. * everyoneSupportE2EE: boolean
  43. * }}
  44. */
  45. export function setEveryoneSupportE2EE(everyoneSupportE2EE: boolean) {
  46. return {
  47. type: SET_EVERYONE_SUPPORT_E2EE,
  48. everyoneSupportE2EE
  49. };
  50. }
  51. /**
  52. * Dispatches an action to set E2EE maxMode.
  53. *
  54. * @param {string} maxMode - The new value.
  55. * @returns {Object}
  56. */
  57. export function setE2EEMaxMode(maxMode: string) {
  58. return {
  59. type: SET_MAX_MODE,
  60. maxMode
  61. };
  62. }
  63. /**
  64. * Dispatches an action to set media encryption key.
  65. *
  66. * @param {Object} keyInfo - Json containing key information.
  67. * @param {string} [keyInfo.encryptionKey] - The exported encryption key.
  68. * @param {number} [keyInfo.index] - The index of the encryption key.
  69. * @returns {{
  70. * type: SET_MEDIA_ENCRYPTION_KEY,
  71. * keyInfo: Object
  72. * }}
  73. */
  74. export function setMediaEncryptionKey(keyInfo: Object) {
  75. return {
  76. type: SET_MEDIA_ENCRYPTION_KEY,
  77. keyInfo
  78. };
  79. }
  80. /**
  81. * Dispatches an action to start participant e2ee verficiation process.
  82. *
  83. * @param {string} pId - The participant id.
  84. * @returns {{
  85. * type: START_VERIFICATION,
  86. * pId: string
  87. * }}
  88. */
  89. export function startVerification(pId: string) {
  90. return {
  91. type: START_VERIFICATION,
  92. pId
  93. };
  94. }
  95. /**
  96. * Dispatches an action to set participant e2ee verification status.
  97. *
  98. * @param {string} pId - The participant id.
  99. * @param {boolean} isVerified - The verifcation status.
  100. * @returns {{
  101. * type: PARTICIPANT_VERIFIED,
  102. * pId: string,
  103. * isVerified: boolean
  104. * }}
  105. */
  106. export function participantVerified(pId: string, isVerified: boolean) {
  107. return {
  108. type: PARTICIPANT_VERIFIED,
  109. pId,
  110. isVerified
  111. };
  112. }