Socket
Socket
Sign inDemoInstall

two-auth

Package Overview
Dependencies
293
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

16

functions/databases/mongoose/create.js

@@ -10,11 +10,11 @@ // Takes in a userID and phone number associated with that user

return new Promise((resolve, reject) => {
if (typeof phone !== 'string') {
reject(new Error('typeof phone must be string'));
if (typeof phone !== "string") {
reject(new Error("typeof phone must be string"));
}
if (phone.substring(0, 2) !== '+1') {
reject(new Error('phone must be string formatted as such: +1XXXXXXXXXX'));
if (phone.substring(0, 2) !== "+1") {
reject(new Error("phone must be string formatted as such: +1XXXXXXXXXX"));
}
client.verify.services
.create({ friendlyName: `${appName}` })
.then((service) => {
.then(service => {
const { sid } = service;

@@ -24,8 +24,8 @@ TwoAuthUser.create({

sid,
phone,
phone
})
.then((user) => {
.then(user => {
resolve(user);
})
.catch((err) => {
.catch(err => {
reject(err);

@@ -32,0 +32,0 @@ });

@@ -21,4 +21,22 @@ const twilio = require("twilio");

const connect = (AccSID, AuthToken, mongoURI = null) => {
return new Client(AccSID, AuthToken, mongoURI);
const connect = (
AccSID,
AuthToken,
options = {
appName: "",
connectionURI: null,
isPostgres: false
}
) => {
if (typeof options === "string")
throw new Error(
"Options config must be an object, as specified in the documentation."
);
if (!options.hasOwnProperty("isPostgres")) {
options.isPostgres = false;
}
if (!options.hasOwnProperty("appName")) {
options.appName = "";
}
return new Client(AccSID, AuthToken, options);
};

@@ -33,21 +51,3 @@

class Client {
constructor(
AccSID,
AuthToken,
options = {
appName: "",
connectionURI: null,
isPostgres: false
}
) {
if (typeof options === "string")
throw new Error(
"Options config must be an object, as specified in the documentation."
);
if (!options.hasOwnProperty("isPostgres")) {
options.isPostgres = false;
}
if (!options.hasOwnProperty("appName")) {
options.appName = "";
}
constructor(AccSID, AuthToken, options) {
this.appName = options.appName;

@@ -54,0 +54,0 @@ this.AccSID = AccSID;

{
"name": "two-auth",
"version": "2.0.1",
"version": "2.0.2",
"description": "Implement two-factor SMS authentication with the Twilio API in three lines of code.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc