Socket
Socket
Sign inDemoInstall

twilio

Package Overview
Dependencies
Maintainers
1
Versions
301
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twilio - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

examples/public/examples.css

65

lib/Capability.js

@@ -1,5 +0,68 @@

function Capability() {
var jwt = require('jwt-simple'),
qs = require('querystring');
function Capability(accountSid, authToken) {
this.accountSid = accountSid;
this.authToken = authToken;
this.capabilities = [];
}
function scopeUriFor(service, privilege, params) {
var scopeUri = 'scope:'+service+':'+privilege;
if (params) {
scopeUri = scopeUri+'?'+qs.stringify(params);
}
return scopeUri;
}
Capability.prototype.allowClientIncoming = function(clientName) {
this.clientName = clientName;
this.capabilities.push(scopeUriFor('client', 'incoming', {
clientName:clientName
}));
};
Capability.prototype.allowClientOutgoing = function(appSid, params) {
this.outgoingScopeParams = {
appSid:appSid
};
if (params) {
this.outgoingScopeParams.appParams = qs.stringify(params);
}
};
Capability.prototype.allowEventStream = function(filters) {
var scopeParams = {
path:'/2010-04-01/Events'
};
if (filters) {
scopeParams.params = filters;
}
this.capabilities.push(scopeUriFor('stream', 'subscribe', scopeParams));
};
Capability.prototype.generate = function(timeout) {
var capabilities = this.capabilities.slice(0),
expires = timeout||3600;
//Build outgoing scope params lazily to use clientName (if it exists)
if (this.outgoingScopeParams) {
if (this.clientName) {
this.outgoingScopeParams.clientName = this.clientName;
}
capabilities.push(scopeUriFor('client', 'outgoing', this.outgoingScopeParams));
}
var payload = {
scope: capabilities.join(' '),
iss: this.accountSid,
exp: Math.floor(new Date() / 1000) + expires
};
return jwt.encode(payload, this.authToken);
};
module.exports = Capability;

8

lib/resources/generate.js

@@ -34,5 +34,7 @@ var _ = require('underscore');

for (var key in params) {
//assume first letter in variable name needs uppercasing, otherwise assume fine
var twilioKey = key.charAt(0).toUpperCase() + key.slice(1);
twilioParams[twilioKey] = params[key];
if (params.hasOwnProperty(key)) {
//assume first letter in variable name needs uppercasing, otherwise assume fine
var twilioKey = key.charAt(0).toUpperCase() + key.slice(1);
twilioParams[twilioKey] = params[key];
}
}

@@ -39,0 +41,0 @@

{
"name":"twilio",
"description":"A Twilio helper library",
"version":"0.6.2",
"version":"0.7.0",
"author":"Kevin Whinnery <kevin.whinnery@gmail.com>",

@@ -13,3 +13,3 @@ "contributors":[

"name":"Stephen Walters",
"email":""
"email":"stephenwalters@gmail.com"
}

@@ -23,4 +23,10 @@ ],

"request":"2.x",
"underscore":"1.x"
"underscore":"1.x",
"jwt-simple": "0.1.x"
},
"devDependencies": {
"express":"2.x",
"connect":"2.x",
"ejs": "0.8.x"
},
"scripts":{

@@ -27,0 +33,0 @@ "test":"jasmine-node spec"

@@ -13,5 +13,5 @@ # node-twilio

* 0.5.x - A revamp of the REST client interface (API changes possible in future releases)
* 0.6.x - A revamp of the TwiML generation interface (API changes possible in future releases)
* 0.7.x - Addition of capability token generation for use with Twilio Client (API changes possible in future releases)
* *complete* 0.5.x - A revamp of the REST client interface (API changes possible in future releases)
* *complete* 0.6.x - A revamp of the TwiML generation interface (API changes possible in future releases)
* *complete* 0.7.x - Addition of capability token generation for use with Twilio Client (API changes possible in future releases)
* 1.x - Feature complete for REST API integration, TwiML generation, and Twilio Client back end support (API locked, no breaking changes in 1.x releases)

@@ -18,0 +18,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc