Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions lib/jwt/AccessToken.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@ declare namespace AccessToken {
pushCredentialSid?: string;
}

export class IpMessagingGrant extends Grant<
ChatGrantOptions,
ChatGrantPayload,
'ip_messaging'
> implements ChatGrantOptions {
serviceSid?: string;
endpointId?: string;
deploymentRoleSid?: string;
pushCredentialSid?: string;
}

export interface VideoGrantOptions {
room?: string;
}
Expand Down
23 changes: 0 additions & 23 deletions lib/jwt/AccessToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,6 @@ _.extend(ChatGrant.prototype, {
}
});

/**
* @deprecated - Use ChatGrant instead.
*
* @constructor
* @param {object} options - ...
* @param {string} options.serviceSid - The service unique ID
* @param {string} options.endpointId - The endpoint ID
* @param {string} options.deploymentRoleSid - SID of the deployment role to be
* assigned to the user
* @param {string} options.pushCredentialSid - The Push Credentials SID
*/
function IpMessagingGrant(options) {
ChatGrant.call(this, options);
}

IpMessagingGrant.prototype = _.create(ChatGrant.prototype, _.assign({
'_super': ChatGrant.prototype,
'constructor': ChatGrant
}));

IpMessagingGrant.prototype.key = 'ip_messaging';

/**
* @constructor
* @param {object} options - ...
Expand Down Expand Up @@ -222,7 +200,6 @@ function AccessToken(accountSid, keySid, secret, options) {
}

// Class level properties
AccessToken.IpMessagingGrant = util.deprecate(IpMessagingGrant, 'IpMessagingGrant is deprecated, use ChatGrant instead.');
AccessToken.ChatGrant = ChatGrant;
AccessToken.VoiceGrant = VoiceGrant;
AccessToken.SyncGrant = SyncGrant;
Expand Down
81 changes: 0 additions & 81 deletions spec/unit/jwt/AccessToken.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,29 +159,6 @@ describe('AccessToken', function() {
});
});

it('should create token with ip messaging grant', function() {
var token = new twilio.jwt.AccessToken(accountSid, keySid, 'secret');
token.identity = 'ID@example.com';

var grant = new twilio.jwt.AccessToken.IpMessagingGrant();
grant.serviceSid = 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
grant.endpointId = 'endpointId';
grant.pushCredentialSid = 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
grant.deploymentRoleSid = 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
token.addGrant(grant);

var decoded = jwt.verify(token.toJwt(), 'secret');
expect(decoded.grants).toEqual({
identity: 'ID@example.com',
ip_messaging: {
service_sid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
endpoint_id: 'endpointId',
push_credential_sid: 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
}
});
});

it('should create token with video grant', function() {
var token = new twilio.jwt.AccessToken(accountSid, keySid, 'secret');
token.identity = 'ID@example.com';
Expand Down Expand Up @@ -310,64 +287,6 @@ describe('AccessToken', function() {
});
});

describe('IpMessagingGrant', function() {
describe('toPayload', function() {
it('should set properties in the constructor', function() {
var grant = new twilio.jwt.AccessToken.IpMessagingGrant({
deploymentRoleSid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
serviceSid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
endpointId: 'endpointId',
pushCredentialSid: 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
});
expect(grant.toPayload()).toEqual({
service_sid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
endpoint_id: 'endpointId',
push_credential_sid: 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
});
});

it('should only populate set properties', function() {
var grant = new twilio.jwt.AccessToken.IpMessagingGrant();
expect(grant.toPayload()).toEqual({});

grant.deploymentRoleSid = 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
expect(grant.toPayload()).toEqual({
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
});

grant.serviceSid = 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
expect(grant.toPayload()).toEqual({
service_sid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
});

grant.endpointId = 'endpointId';
expect(grant.toPayload()).toEqual({
service_sid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
endpoint_id: 'endpointId'
});

grant.endpointId = undefined;
grant.pushCredentialSid = 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
expect(grant.toPayload()).toEqual({
service_sid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
push_credential_sid: 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
});

grant.endpointId = 'endpointId';
expect(grant.toPayload()).toEqual({
service_sid: 'SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
deployment_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
endpoint_id: 'endpointId',
push_credential_sid: 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
});
});
});
});

describe('ChatGrant', function() {
describe('toPayload', function() {
it('should set properties in the constructor', function() {
Expand Down