Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STREAM-350] - Accept a JWT for video conferencing. Fixed changelog and updated docs. #907

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

zservies
Copy link
Collaborator

No description provided.

@@ -376,8 +376,8 @@ export class GenesysCloudWebrtcSdk extends (EventEmitter as { new(): StrictEvent
* @returns a promise with an object with the newly created `conversationId`
*/
async startVideoConference (roomJid: string, inviteeJid?: string): Promise<{ conversationId: string }> {
if (this.isGuest) {
throw createAndEmitSdkError.call(this, SdkErrorTypes.not_supported, 'video conferencing not supported for guests');
if (!this._config.jwt && !this._config.accessToken) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change here? More curious than anything but to me it appears that isGuest should still suffice here? isGuest is the result of !this.isJwtAuth && !this._config.accessToken and isJwtAuth in turn is !!this._config.jwt. These look to be the same unless I am misunderstanding or missing something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right, I didn't bother looking into what this.isGuest was.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally fair! I mean definitely a NIT but I curious more than anything and wanted to make sure I wasn't missing something

@@ -55,7 +55,8 @@ export interface IMediaChangeEventParticipant {
}

export class VideoSessionHandler extends BaseSessionHandler {
requestedSessions: { [roomJid: string]: boolean } = {};
/** Map of requested room IDs, either jid or conferenceId (JWT) */
requestedSessions: { [roomId: string]: boolean } = {};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't exactly love roomId as a name, but it can now either be a roomJid or a conferenceId. Thinking about it more, maybe we should have more checks below to see if we are using a JWT.

@@ -60,7 +61,7 @@ describe('Client', () => {
constructSdk = (config?: ISdkConfig) => {
/* if we have no config, then use some defaults */
if (config === undefined) {
config = { logger: mockLogger as any, accessToken: 'secure', environment: 'mypurecloud.com', optOutOfTelemetry: true };
config = { logger: mockLogger as any, accessToken: 'secure', jwt: 'test-jwt', environment: 'mypurecloud.com', optOutOfTelemetry: true };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Unexpected any. Specify a different type.

Suggested change
config = { logger: mockLogger as any, accessToken: 'secure', jwt: 'test-jwt', environment: 'mypurecloud.com', optOutOfTelemetry: true };
config = { logger: mockLogger as unknown, accessToken: 'secure', jwt: 'test-jwt', environment: 'mypurecloud.com', optOutOfTelemetry: true };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants