fix(calendar-sync) remove unneeded function

A GUID is just a UUID v4, so let's use that.
pull/10891/head jitsi-meet_6885
Saúl Ibarra Corretgé 3 years ago committed by Дамян Минков
parent fe2c5f6447
commit 9d829003b4
  1. 38
      react/features/calendar-sync/web/microsoftCalendar.js

@ -3,6 +3,7 @@
import { Client } from '@microsoft/microsoft-graph-client';
import base64js from 'base64-js';
import type { Dispatch } from 'redux';
import { v4 as uuidV4 } from 'uuid';
import { findWindows } from 'windows-iana';
import { createDeferred } from '../../../../modules/util/helpers';
@ -153,8 +154,8 @@ export const microsoftCalendarApi = {
const signInDeferred = createDeferred();
const guids = {
authState: generateGuid(),
authNonce: generateGuid()
authState: uuidV4(),
authNonce: uuidV4()
};
dispatch(setCalendarAPIAuthState(guids));
@ -339,21 +340,6 @@ function formatCalendarEntry(entry) {
};
}
/**
* Generate a guid to be used for verifying token validity.
*
* @private
* @returns {string} The generated string.
*/
function generateGuid() {
const buf = new Uint16Array(8);
window.crypto.getRandomValues(buf);
return `${s4(buf[0])}${s4(buf[1])}-${s4(buf[2])}-${s4(buf[3])}-${
s4(buf[4])}-${s4(buf[5])}${s4(buf[6])}${s4(buf[7])}`;
}
/**
* Constructs and returns the URL to use for renewing an auth token.
*
@ -582,24 +568,6 @@ function requestCalendarEvents( // eslint-disable-line max-params
}));
}
/**
* Converts the passed in number to a string and ensure it is at least 4
* characters in length, prepending 0's as needed.
*
* @param {number} num - The number to pad and convert to a string.
* @private
* @returns {string} - The number converted to a string.
*/
function s4(num) {
let ret = num.toString(16);
while (ret.length < 4) {
ret = `0${ret}`;
}
return ret;
}
/**
* Convert a Base64URL encoded string to a UTF-8 encoded string including CJK or Latin.
*

Loading…
Cancel
Save