telesignsdk
Advanced tools
Comparing version 2.0.2 to 2.2.0
{ | ||
"name": "telesignsdk", | ||
"version": "2.0.2", | ||
"version": "2.2.0", | ||
"description": "Official TeleSign SDK for Rest APIs including Messaging (SMS), Score, PhoneID, Voice, and AppVerify", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -36,2 +36,4 @@ [<img src="/node_banner.jpg">](https://developer.telesign.com) | ||
Node.js **6+** is required for the TeleSign Node.js SDK. | ||
Authentication | ||
@@ -66,3 +68,3 @@ -------------- | ||
``` | ||
node examples/appverify/1_send_message.js | ||
node examples/messaging/1_send_message.js | ||
``` | ||
@@ -69,0 +71,0 @@ |
@@ -17,2 +17,3 @@ const RestClient = require("./RestClient.js"); | ||
this.phoneid_resource = "/v1/phoneid/"; | ||
this.contentType = "application/json"; | ||
} | ||
@@ -32,11 +33,3 @@ | ||
*/ | ||
phoneID(callback, phoneNumber, accountLifecycleEvent = null, originatingIP = null) { | ||
var params = {}; | ||
if (originatingIP != null) { | ||
params.originating_ip = originatingIP; | ||
} | ||
if (accountLifecycleEvent != null) { | ||
params.account_lifecycle_event = accountLifecycleEvent; | ||
} | ||
phoneID(callback, phoneNumber, params = null) { | ||
this.execute(callback, "POST", this.phoneid_resource + encodeURI(phoneNumber), params); | ||
@@ -46,2 +39,2 @@ } | ||
module.exports = PhoneIDClient; | ||
module.exports = PhoneIDClient; |
@@ -26,2 +26,3 @@ const os = require('os'); | ||
this.timeout = timeout; | ||
this.contentType = "application/x-www-form-urlencoded"; | ||
@@ -69,3 +70,4 @@ try { | ||
resource, | ||
urlEncodedFields, | ||
contentType, | ||
encodedFields, | ||
date = null, | ||
@@ -84,8 +86,8 @@ nonce = null, | ||
var contentType = (methodName == "POST" || methodName == "PUT") ? | ||
"application/x-www-form-urlencoded" : ""; | ||
contentType : ""; | ||
var authMethod = "HMAC-SHA256"; | ||
var urlencoded = ""; | ||
if (urlEncodedFields != null && urlEncodedFields.length > 0) { | ||
urlencoded = "\n" + urlEncodedFields; | ||
if (encodedFields != null && encodedFields.length > 0) { | ||
urlencoded = "\n" + encodedFields; | ||
} | ||
@@ -134,6 +136,10 @@ var stringToSignBuilder = methodName + | ||
var telesignURL = this.restEndpoint + resource; | ||
var bodyData = null; | ||
var bodyData = this.contentType=="application/json" ? "{}" : null; | ||
if (methodName == "POST" || methodName == "PUT") { | ||
if (params != null && Object.keys(params).length > 0) { | ||
if (this.contentType == "application/x-www-form-urlencoded") { | ||
bodyData = querystring.stringify(params); | ||
} else { | ||
bodyData = JSON.stringify(params); | ||
} | ||
} | ||
@@ -154,2 +160,3 @@ } | ||
resource, | ||
this.contentType, | ||
bodyData, | ||
@@ -163,3 +170,4 @@ null, | ||
uri: telesignURL, | ||
method: methodName | ||
method: methodName, | ||
timeout: this.timeout | ||
}; | ||
@@ -166,0 +174,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14
638
127
95972