Socket
Socket
Sign inDemoInstall

authy-client

Package Overview
Dependencies
144
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.10 to 1.1.0

dist/src/bin/cli.js

96

CHANGELOG.md
# Changelog
## [v1.0.10](https://github.com/seegno/authy-client/tree/v1.0.10) (2017-01-30)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.9...v1.0.10)
## [v1.1.0](https://github.com/ruimarinho/authy-client/tree/v1.1.0) (2018-01-04)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.10...v1.1.0)
**Merged pull requests:**
- Fix example phone numbers [\#32](https://github.com/seegno/authy-client/pull/32) ([ruimarinho](https://github.com/ruimarinho))
- Remove required assert from activity data and ip [\#30](https://github.com/seegno/authy-client/pull/30) ([ruimarinho](https://github.com/ruimarinho))
- Remove required assert from is\_ported on start phone verification [\#29](https://github.com/seegno/authy-client/pull/29) ([ruimarinho](https://github.com/ruimarinho))
- Add expired status to approval requests [\#28](https://github.com/seegno/authy-client/pull/28) ([ruimarinho](https://github.com/ruimarinho))
- Clarify description of the activity IP [\#27](https://github.com/seegno/authy-client/pull/27) ([ruimarinho](https://github.com/ruimarinho))
- Replace api\_key querystring or body parameter by more secure header [\#26](https://github.com/seegno/authy-client/pull/26) ([ruimarinho](https://github.com/ruimarinho))
- Actually post data as application/json, not form-data [\#25](https://github.com/seegno/authy-client/pull/25) ([holm](https://github.com/holm))
- Update dependencies [\#45](https://github.com/ruimarinho/authy-client/pull/45) ([ruimarinho](https://github.com/ruimarinho))
- Update ownership [\#44](https://github.com/ruimarinho/authy-client/pull/44) ([ruimarinho](https://github.com/ruimarinho))
- Update google-libphonenumber@3.0.10 [\#43](https://github.com/ruimarinho/authy-client/pull/43) ([ruimarinho](https://github.com/ruimarinho))
- Improve .npmignore whitelist [\#41](https://github.com/ruimarinho/authy-client/pull/41) ([ruimarinho](https://github.com/ruimarinho))
- Remove deleteUser assert [\#40](https://github.com/ruimarinho/authy-client/pull/40) ([holm](https://github.com/holm))
- Add command-line interface [\#31](https://github.com/ruimarinho/authy-client/pull/31) ([ruimarinho](https://github.com/ruimarinho))
## [v1.0.9](https://github.com/seegno/authy-client/tree/v1.0.9) (2017-01-12)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.8...v1.0.9)
## [v1.0.10](https://github.com/ruimarinho/authy-client/tree/v1.0.10) (2017-01-30)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.9...v1.0.10)
**Merged pull requests:**
- Replace `request-debug` with `request-logger` [\#24](https://github.com/seegno/authy-client/pull/24) ([pedrobranco](https://github.com/pedrobranco))
- Fix example phone numbers [\#32](https://github.com/ruimarinho/authy-client/pull/32) ([ruimarinho](https://github.com/ruimarinho))
- Remove required assert from activity data and ip [\#30](https://github.com/ruimarinho/authy-client/pull/30) ([ruimarinho](https://github.com/ruimarinho))
- Remove required assert from is\_ported on start phone verification [\#29](https://github.com/ruimarinho/authy-client/pull/29) ([ruimarinho](https://github.com/ruimarinho))
- Add expired status to approval requests [\#28](https://github.com/ruimarinho/authy-client/pull/28) ([ruimarinho](https://github.com/ruimarinho))
- Clarify description of the activity IP [\#27](https://github.com/ruimarinho/authy-client/pull/27) ([ruimarinho](https://github.com/ruimarinho))
- Replace api\_key querystring or body parameter by more secure header [\#26](https://github.com/ruimarinho/authy-client/pull/26) ([ruimarinho](https://github.com/ruimarinho))
- Actually post data as application/json, not form-data [\#25](https://github.com/ruimarinho/authy-client/pull/25) ([holm](https://github.com/holm))
## [v1.0.8](https://github.com/seegno/authy-client/tree/v1.0.8) (2016-12-11)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.7...v1.0.8)
## [v1.0.9](https://github.com/ruimarinho/authy-client/tree/v1.0.9) (2017-01-12)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.8...v1.0.9)
**Merged pull requests:**
- Update \_app\_serial\_id constraint to accept integer values [\#23](https://github.com/seegno/authy-client/pull/23) ([ruimarinho](https://github.com/ruimarinho))
- Fix typo in README [\#22](https://github.com/seegno/authy-client/pull/22) ([fixe](https://github.com/fixe))
- Replace `request-debug` with `request-logger` [\#24](https://github.com/ruimarinho/authy-client/pull/24) ([pedrobranco](https://github.com/pedrobranco))
## [v1.0.7](https://github.com/seegno/authy-client/tree/v1.0.7) (2016-10-19)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.6...v1.0.7)
## [v1.0.8](https://github.com/ruimarinho/authy-client/tree/v1.0.8) (2016-12-11)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.7...v1.0.8)
**Merged pull requests:**
- Update device constraint to accept null values [\#21](https://github.com/seegno/authy-client/pull/21) ([ruimarinho](https://github.com/ruimarinho))
- Update \_app\_serial\_id constraint to accept integer values [\#23](https://github.com/ruimarinho/authy-client/pull/23) ([ruimarinho](https://github.com/ruimarinho))
- Fix typo in README [\#22](https://github.com/ruimarinho/authy-client/pull/22) ([fixe](https://github.com/fixe))
## [v1.0.6](https://github.com/seegno/authy-client/tree/v1.0.6) (2016-09-28)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.5...v1.0.6)
## [v1.0.7](https://github.com/ruimarinho/authy-client/tree/v1.0.7) (2016-10-19)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.6...v1.0.7)
**Merged pull requests:**
- Add .npmignore to produce smaller packages [\#18](https://github.com/seegno/authy-client/pull/18) ([ruimarinho](https://github.com/ruimarinho))
- Update dependencies [\#17](https://github.com/seegno/authy-client/pull/17) ([ruimarinho](https://github.com/ruimarinho))
- Update JSCS@3.0.7 [\#16](https://github.com/seegno/authy-client/pull/16) ([fixe](https://github.com/fixe))
- Fix tests not passing [\#15](https://github.com/seegno/authy-client/pull/15) ([pedrobranco](https://github.com/pedrobranco))
- Fix request-debug logging [\#13](https://github.com/seegno/authy-client/pull/13) ([pedrobranco](https://github.com/pedrobranco))
- Update device constraint to accept null values [\#21](https://github.com/ruimarinho/authy-client/pull/21) ([ruimarinho](https://github.com/ruimarinho))
## [v1.0.5](https://github.com/seegno/authy-client/tree/v1.0.5) (2016-08-01)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.4...v1.0.5)
## [v1.0.6](https://github.com/ruimarinho/authy-client/tree/v1.0.6) (2016-09-28)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.5...v1.0.6)
**Merged pull requests:**
- Add support for x-authy-signature-nonce as a string [\#11](https://github.com/seegno/authy-client/pull/11) ([ruimarinho](https://github.com/ruimarinho))
- Add .npmignore to produce smaller packages [\#18](https://github.com/ruimarinho/authy-client/pull/18) ([ruimarinho](https://github.com/ruimarinho))
- Update dependencies [\#17](https://github.com/ruimarinho/authy-client/pull/17) ([ruimarinho](https://github.com/ruimarinho))
- Update JSCS@3.0.7 [\#16](https://github.com/ruimarinho/authy-client/pull/16) ([fixe](https://github.com/fixe))
- Fix tests not passing [\#15](https://github.com/ruimarinho/authy-client/pull/15) ([pedrobranco](https://github.com/pedrobranco))
- Fix request-debug logging [\#13](https://github.com/ruimarinho/authy-client/pull/13) ([pedrobranco](https://github.com/pedrobranco))
## [v1.0.4](https://github.com/seegno/authy-client/tree/v1.0.4) (2016-07-31)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.3...v1.0.4)
## [v1.0.5](https://github.com/ruimarinho/authy-client/tree/v1.0.5) (2016-08-01)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.4...v1.0.5)
## [v1.0.3](https://github.com/seegno/authy-client/tree/v1.0.3) (2016-07-31)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.2...v1.0.3)
**Merged pull requests:**
## [v1.0.2](https://github.com/seegno/authy-client/tree/v1.0.2) (2016-06-04)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.1...v1.0.2)
- Add support for x-authy-signature-nonce as a string [\#11](https://github.com/ruimarinho/authy-client/pull/11) ([ruimarinho](https://github.com/ruimarinho))
## [v1.0.1](https://github.com/seegno/authy-client/tree/v1.0.1) (2016-05-17)
[Full Changelog](https://github.com/seegno/authy-client/compare/v1.0.0...v1.0.1)
## [v1.0.4](https://github.com/ruimarinho/authy-client/tree/v1.0.4) (2016-07-31)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.3...v1.0.4)
## [v1.0.3](https://github.com/ruimarinho/authy-client/tree/v1.0.3) (2016-07-31)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.2...v1.0.3)
## [v1.0.2](https://github.com/ruimarinho/authy-client/tree/v1.0.2) (2016-06-04)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.1...v1.0.2)
## [v1.0.1](https://github.com/ruimarinho/authy-client/tree/v1.0.1) (2016-05-17)
[Full Changelog](https://github.com/ruimarinho/authy-client/compare/v1.0.0...v1.0.1)
**Merged pull requests:**
- Update dependencies [\#5](https://github.com/seegno/authy-client/pull/5) ([ruimarinho](https://github.com/ruimarinho))
- Replace isparta by nyc as it is not maintained anymore [\#4](https://github.com/seegno/authy-client/pull/4) ([ruimarinho](https://github.com/ruimarinho))
- Update dependencies [\#5](https://github.com/ruimarinho/authy-client/pull/5) ([ruimarinho](https://github.com/ruimarinho))
- Replace isparta by nyc as it is not maintained anymore [\#4](https://github.com/ruimarinho/authy-client/pull/4) ([ruimarinho](https://github.com/ruimarinho))
## [v1.0.0](https://github.com/seegno/authy-client/tree/v1.0.0) (2016-04-26)
## [v1.0.0](https://github.com/ruimarinho/authy-client/tree/v1.0.0) (2016-04-26)
**Merged pull requests:**
- Replace invalid response error by assertion failed error [\#3](https://github.com/seegno/authy-client/pull/3) ([ruimarinho](https://github.com/ruimarinho))
- Update README with ES5 examples [\#2](https://github.com/seegno/authy-client/pull/2) ([ruimarinho](https://github.com/ruimarinho))
- Replace invalid response error by assertion failed error [\#3](https://github.com/ruimarinho/authy-client/pull/3) ([ruimarinho](https://github.com/ruimarinho))
- Update README with ES5 examples [\#2](https://github.com/ruimarinho/authy-client/pull/2) ([ruimarinho](https://github.com/ruimarinho))
{
"name": "authy-client",
"version": "1.0.10",
"version": "1.1.0",
"description": "A complete Authy client with support for TOTP, OneTouch, Phone Verification and Phone Intelligence APIs",

@@ -18,9 +18,8 @@ "keywords": [

],
"homepage": "https://github.com/seegno/authy-client",
"bugs": "https://github.com/seegno/authy-client/issues",
"homepage": "https://github.com/ruimarinho/authy-client",
"bugs": "https://github.com/ruimarinho/authy-client/issues",
"license": "MIT",
"author": {
"name": "Rui Marinho",
"email": "rui.marinho@seegno.com",
"url": "http://seegno.com"
"url": "https://github.com/ruimarinho"
},

@@ -30,4 +29,7 @@ "main": "dist/src/index.js",

"type": "git",
"url": "https://github.com/seegno/authy-client.git"
"url": "https://github.com/ruimarinho/authy-client.git"
},
"bin": {
"authy": "dist/src/bin/cli.js"
},
"scripts": {

@@ -44,7 +46,8 @@ "changelog": "github_changelog_generator --no-issues --header-label='# Changelog' --future-release=v$npm_config_future_release && sed -i '' -e :a -e '$d;N;2,4ba' -e 'P;D' CHANGELOG.md",

"dependencies": {
"@uphold/request-logger": "^1.2.0",
"@uphold/request-logger": "^2.0.0",
"bluebird": "^3.4.6",
"debugnyan": "^1.0.0",
"google-libphonenumber": "^2.0.2",
"google-libphonenumber": "^3.0.10",
"lodash": "^4.16.2",
"prettyjson": "^1.2.1",
"qs": "^6.2.1",

@@ -55,9 +58,11 @@ "request": "^2.75.0",

"url-escape-tag": "^1.0.0",
"validator": "^6.0.0",
"validator": "^9.2.0",
"validator.js": "^2.0.3",
"validator.js-asserts": "^3.0.1"
"validator.js-asserts": "^3.0.1",
"yargs": "^10.0.3"
},
"devDependencies": {
"babel-cli": "^6.14.0",
"babel-eslint": "^7.0.0",
"babel-eslint": "^8.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-async-to-module-method": "^6.8.0",

@@ -67,9 +72,9 @@ "babel-preset-es2015-node4": "^2.1.0",

"babel-register": "^6.14.0",
"eslint": "^3.6.1",
"eslint-config-seegno": "^6.0.0",
"mocha": "^3.1.0",
"nock": "^8.0.0",
"nyc": "^8.3.0",
"eslint": "^4.14.0",
"eslint-config-uphold": "^0.1.0",
"mocha": "^4.1.0",
"nock": "^9.1.5",
"nyc": "^11.4.1",
"pre-commit": "^1.1.3",
"should": "^11.1.0"
"should": "^13.2.0"
},

@@ -86,3 +91,3 @@ "engines": {

"options": {
"mocha": "--compilers js:babel-register --recursive --require should"
"mocha": "--recursive --require babel-register --require should"
},

@@ -89,0 +94,0 @@ "pre-commit": [

@@ -8,6 +8,6 @@ 'use strict';

var _validator = require('validator.js');
var _enums = require('../enums');
var _validator = require('validator.js');
var _lodash = require('lodash');

@@ -49,2 +49,3 @@

return this;
}
}
module.exports = exports['default'];

@@ -44,2 +44,3 @@ 'use strict';

return this;
}
}
module.exports = exports['default'];

@@ -12,2 +12,4 @@ 'use strict';

var _lodash = require('lodash');
var _debugnyan = require('debugnyan');

@@ -17,4 +19,2 @@

var _lodash = require('lodash');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -70,2 +70,3 @@

return this;
}
}
module.exports = exports['default'];

@@ -8,4 +8,2 @@ 'use strict';

var _enums = require('../enums');
var _validator = require('validator.js');

@@ -15,2 +13,4 @@

var _enums = require('../enums');
/**

@@ -50,2 +50,3 @@ * Locale choices.

return this;
}
}
module.exports = exports['default'];

@@ -12,4 +12,2 @@ 'use strict';

var _enums = require('../enums');
var _validator2 = require('validator.js');

@@ -19,2 +17,4 @@

var _enums = require('../enums');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

@@ -60,2 +60,3 @@

return this;
}
}
module.exports = exports['default'];

@@ -10,2 +10,6 @@ 'use strict';

var _validator = require('validator.js');
var _lodash = require('lodash');
var _debugnyan = require('debugnyan');

@@ -15,6 +19,2 @@

var _lodash = require('lodash');
var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -64,3 +64,3 @@

let phone = value;
let countryCode = this.countryOrCallingCode;
let countryCode = this.countryOrCallingCode; // eslint-disable-line prefer-destructuring
let countriesWithSameCallingCode = [];

@@ -127,2 +127,3 @@

return this;
}
}
module.exports = exports['default'];

@@ -8,6 +8,6 @@ 'use strict';

var _validator = require('validator.js');
var _lodash = require('lodash');
var _validator = require('validator.js');
/**

@@ -59,2 +59,3 @@ * Instances.

return this;
}
}
module.exports = exports['default'];

@@ -54,2 +54,3 @@ 'use strict';

// eslint-disable-next-line prefer-destructuring
var _request = this.request;

@@ -83,2 +84,3 @@ const body = _request.body;

return this;
}
}
module.exports = exports['default'];

@@ -58,2 +58,3 @@ 'use strict';

return this;
}
}
module.exports = exports['default'];

@@ -8,4 +8,2 @@ 'use strict';

var _enums = require('../enums');
var _validator = require('validator.js');

@@ -15,2 +13,4 @@

var _enums = require('../enums');
/**

@@ -50,2 +50,3 @@ * Verification via choices.

return this;
}
}
module.exports = exports['default'];

@@ -12,2 +12,4 @@ 'use strict';

var _validator = require('./validator');
var _bluebird = require('bluebird');

@@ -45,4 +47,2 @@

var _validator = require('./validator');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -218,7 +218,3 @@

uri: _urlEscapeTag2.default`users/${authyId}/delete`
}).bind(this).then(_responseParser2.default).tap(response => {
(0, _validator.assert)(response, {
message: [_validator.Assert.required(), _validator.Assert.equalTo('User was added to remove.')]
});
}).asCallback(callback);
}).bind(this).then(_responseParser2.default).asCallback(callback);
});

@@ -854,2 +850,3 @@ }

}
exports.default = Client;
exports.default = Client;
module.exports = exports['default'];

@@ -16,2 +16,3 @@ 'use strict';

UNBANNED: 'unbanned'
};
};
module.exports = exports['default'];

@@ -15,2 +15,3 @@ 'use strict';

PENDING: 'pending'
};
};
module.exports = exports['default'];

@@ -41,2 +41,3 @@ 'use strict';

VIETNAMESE: 'vi'
};
};
module.exports = exports['default'];

@@ -16,2 +16,3 @@ 'use strict';

MEDIUM: 'med'
};
};
module.exports = exports['default'];

@@ -14,2 +14,3 @@ 'use strict';

SMS: 'sms'
};
};
module.exports = exports['default'];

@@ -35,2 +35,3 @@ 'use strict';

}
exports.default = AssertionFailedError;
exports.default = AssertionFailedError;
module.exports = exports['default'];

@@ -7,2 +7,4 @@ 'use strict';

var _lodash = require('lodash');
var _standardError = require('./standard-error');

@@ -12,4 +14,2 @@

var _lodash = require('lodash');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -34,2 +34,3 @@

}
exports.default = HttpError;
exports.default = HttpError;
module.exports = exports['default'];

@@ -21,2 +21,4 @@ 'use strict';

* Module dependencies.
*/
*/
module.exports = exports['default'];

@@ -31,2 +31,3 @@ 'use strict';

}
exports.default = ValidationFailedError;
exports.default = ValidationFailedError;
module.exports = exports['default'];

@@ -7,2 +7,4 @@ 'use strict';

var _requestObfuscator = require('./request-obfuscator');
var _debugnyan = require('debugnyan');

@@ -16,4 +18,2 @@

var _requestObfuscator = require('./request-obfuscator');
var _request = require('request');

@@ -49,2 +49,3 @@

log.debug({ request: request }, `Making request ${request.id} to ${request.method} ${request.uri}`);
});
});
module.exports = exports['default'];

@@ -16,2 +16,4 @@ 'use strict';

var _googleLibphonenumber = require('google-libphonenumber');
var _debugnyan = require('debugnyan');

@@ -21,4 +23,2 @@

var _googleLibphonenumber = require('google-libphonenumber');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -132,2 +132,3 @@

return result;
}
}
module.exports = exports['default'];

@@ -14,2 +14,4 @@ 'use strict';

var _lodash = require('lodash');
var _httpError = require('../errors/http-error');

@@ -19,4 +21,2 @@

var _lodash = require('lodash');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -45,2 +45,3 @@

return body;
}
}
module.exports = exports['default'];

@@ -14,15 +14,15 @@ 'use strict';

var _debugnyan = require('debugnyan');
var _errors = require('./errors');
var _debugnyan2 = _interopRequireDefault(_debugnyan);
var _validator = require('validator.js');
var _validator = require('validator.js-asserts');
var _lodash = require('lodash');
var _validator2 = _interopRequireDefault(_validator);
var _debugnyan = require('debugnyan');
var _lodash = require('lodash');
var _debugnyan2 = _interopRequireDefault(_debugnyan);
var _errors = require('./errors');
var _validator2 = require('validator.js-asserts');
var _validator3 = require('validator.js');
var _validator3 = _interopRequireDefault(_validator2);

@@ -41,5 +41,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const asserts = (0, _lodash.merge)({}, _validator2.default, customAsserts);
const asserts = (0, _lodash.merge)({}, _validator3.default, customAsserts);
const logger = (0, _debugnyan2.default)('authy:validator');
const validator = new _validator3.Validator();
const validator = new _validator.Validator();

@@ -50,3 +50,3 @@ /**

const Assert = exports.Assert = _validator3.Assert.extend(asserts);
const Assert = exports.Assert = _validator.Assert.extend(asserts);

@@ -58,3 +58,3 @@ /**

function assert(data, constraints) {
const errors = validator.validate(data, new _validator3.Constraint(constraints, { deepRequired: true }));
const errors = validator.validate(data, new _validator.Constraint(constraints, { deepRequired: true }));

@@ -73,3 +73,3 @@ if (errors !== true) {

function validate(data, constraints) {
const errors = validator.validate(data, new _validator3.Constraint(constraints, { deepRequired: true }));
const errors = validator.validate(data, new _validator.Constraint(constraints, { deepRequired: true }));

@@ -76,0 +76,0 @@ if (errors !== true) {

'use strict';
var _validator = require('validator.js');
var _enums = require('../../src/enums');
var _lodash = require('lodash');
var _activityAssert = require('../../src/asserts/activity-assert');

@@ -7,4 +13,2 @@

var _enums = require('../../src/enums');
var _should = require('should');

@@ -14,6 +18,2 @@

var _lodash = require('lodash');
var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,0 +20,0 @@

'use strict';
var _validator = require('validator.js');
var _authyIdAssert = require('../../src/asserts/authy-id-assert');

@@ -11,4 +13,2 @@

var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,0 +15,0 @@

'use strict';
var _validator = require('validator.js');
var _countryOrCallingCodeAssert = require('../../src/asserts/country-or-calling-code-assert');

@@ -11,4 +13,2 @@

var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,0 +15,0 @@

'use strict';
var _validator = require('validator.js');
var _enums = require('../../src/enums');
var _lodash = require('lodash');
var _localeAssert = require('../../src/asserts/locale-assert');

@@ -7,4 +13,2 @@

var _enums = require('../../src/enums');
var _should = require('should');

@@ -14,6 +18,2 @@

var _lodash = require('lodash');
var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,0 +20,0 @@

'use strict';
var _validator = require('validator.js');
var _enums = require('../../src/enums');
var _lodash = require('lodash');
var _logoAssert = require('../../src/asserts/logo-assert');

@@ -7,4 +13,2 @@

var _enums = require('../../src/enums');
var _should = require('should');

@@ -14,6 +18,2 @@

var _lodash = require('lodash');
var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,0 +20,0 @@

'use strict';
var _validator = require('validator.js');
var _googleLibphonenumber = require('google-libphonenumber');
var _phoneAssert = require('../../src/asserts/phone-assert');

@@ -11,6 +15,2 @@

var _validator = require('validator.js');
var _googleLibphonenumber = require('google-libphonenumber');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -17,0 +17,0 @@

'use strict';
var _validator = require('validator.js');
var _phoneVerificationTokenAssert = require('../../src/asserts/phone-verification-token-assert');

@@ -11,4 +13,2 @@

var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,0 +15,0 @@

'use strict';
var _validator = require('validator.js');
var _signatureAssert = require('../../src/asserts/signature-assert');

@@ -11,4 +13,2 @@

var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,0 +15,0 @@

'use strict';
var _validator = require('validator.js');
var _totpTokenAssert = require('../../src/asserts/totp-token-assert');

@@ -11,4 +13,2 @@

var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,0 +15,0 @@

'use strict';
var _validator = require('validator.js');
var _lodash = require('lodash');
var _enums = require('../../src/enums');
var _verificationViaAssert = require('../../src/asserts/verification-via-assert');

@@ -11,8 +17,2 @@

var _lodash = require('lodash');
var _enums = require('../../src/enums');
var _validator = require('validator.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -19,0 +19,0 @@

@@ -24,3 +24,3 @@ 'use strict';

return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9].*\//, '/{authyId}/')).post('/protected/json/users/{authyId}/delete', request.body).reply(response.code, response.body);
return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9]+\//, '/{authyId}/')).post('/protected/json/users/{authyId}/delete', request.body).reply(response.code, response.body);
}

@@ -27,0 +27,0 @@

@@ -8,2 +8,4 @@ 'use strict';

var _lodash = require('lodash');
var _nock = require('nock');

@@ -13,4 +15,2 @@

var _lodash = require('lodash');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -17,0 +17,0 @@

@@ -24,3 +24,3 @@ 'use strict';

return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9].*\//, '/{authyId}/')).get('/protected/json/users/{authyId}/status', request.body).query(request.query ? request.query : true).reply(response.code, response.body);
return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9]+\//, '/{authyId}/')).get('/protected/json/users/{authyId}/status', request.body).query(request.query ? request.query : true).reply(response.code, response.body);
}

@@ -27,0 +27,0 @@

@@ -26,3 +26,3 @@ 'use strict';

return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9].*/, '/{authyId}')).get('/protected/json/call/{authyId}').query(request.query ? request.query : true).reply(response.code, response.body);
return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9]+/, '/{authyId}')).get('/protected/json/call/{authyId}').query(request.query ? request.query : true).reply(response.code, response.body);
}

@@ -29,0 +29,0 @@

@@ -26,3 +26,3 @@ 'use strict';

return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9].*/, '/{authyId}')).get('/protected/json/sms/{authyId}').query(request.query ? request.query : true).reply(response.code, response.body);
return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/\/[0-9]+/, '/{authyId}')).get('/protected/json/sms/{authyId}').query(request.query ? request.query : true).reply(response.code, response.body);
}

@@ -29,0 +29,0 @@

@@ -25,3 +25,3 @@ 'use strict';

return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/verify\/.*?\//, 'verify/{token}/').replace(/\/[0-9].*/, '/{authyId}')).get('/protected/json/verify/{token}/{authyId}').query(request.query ? request.query : true).reply(response.code, response.body);
return (0, _nock2.default)(/\.authy\.com/).filteringPath(path => path.replace(/verify\/.*?\//, 'verify/{token}/').replace(/\/[0-9]+/, '/{authyId}')).get('/protected/json/verify/{token}/{authyId}').query(request.query ? request.query : true).reply(response.code, response.body);
}

@@ -28,0 +28,0 @@

@@ -23,2 +23,4 @@ 'use strict';

* Module dependencies.
*/
*/
module.exports = exports['default'];

@@ -5,2 +5,6 @@ 'use strict';

var _errors = require('../src/errors');
var _validator2 = require('../src/validator');
var _should = require('should');

@@ -10,6 +14,2 @@

var _errors = require('../src/errors');
var _validator2 = require('../src/validator');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -16,0 +16,0 @@

{
"name": "authy-client",
"version": "1.0.10",
"version": "1.1.0",
"description": "A complete Authy client with support for TOTP, OneTouch, Phone Verification and Phone Intelligence APIs",

@@ -18,9 +18,8 @@ "keywords": [

],
"homepage": "https://github.com/seegno/authy-client",
"bugs": "https://github.com/seegno/authy-client/issues",
"homepage": "https://github.com/ruimarinho/authy-client",
"bugs": "https://github.com/ruimarinho/authy-client/issues",
"license": "MIT",
"author": {
"name": "Rui Marinho",
"email": "rui.marinho@seegno.com",
"url": "http://seegno.com"
"url": "https://github.com/ruimarinho"
},

@@ -30,4 +29,7 @@ "main": "dist/src/index.js",

"type": "git",
"url": "https://github.com/seegno/authy-client.git"
"url": "https://github.com/ruimarinho/authy-client.git"
},
"bin": {
"authy": "dist/src/bin/cli.js"
},
"scripts": {

@@ -44,7 +46,8 @@ "changelog": "github_changelog_generator --no-issues --header-label='# Changelog' --future-release=v$npm_config_future_release && sed -i '' -e :a -e '$d;N;2,4ba' -e 'P;D' CHANGELOG.md",

"dependencies": {
"@uphold/request-logger": "^1.2.0",
"@uphold/request-logger": "^2.0.0",
"bluebird": "^3.4.6",
"debugnyan": "^1.0.0",
"google-libphonenumber": "^2.0.2",
"google-libphonenumber": "^3.0.10",
"lodash": "^4.16.2",
"prettyjson": "^1.2.1",
"qs": "^6.2.1",

@@ -55,9 +58,11 @@ "request": "^2.75.0",

"url-escape-tag": "^1.0.0",
"validator": "^6.0.0",
"validator": "^9.2.0",
"validator.js": "^2.0.3",
"validator.js-asserts": "^3.0.1"
"validator.js-asserts": "^3.0.1",
"yargs": "^10.0.3"
},
"devDependencies": {
"babel-cli": "^6.14.0",
"babel-eslint": "^7.0.0",
"babel-eslint": "^8.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-async-to-module-method": "^6.8.0",

@@ -67,9 +72,9 @@ "babel-preset-es2015-node4": "^2.1.0",

"babel-register": "^6.14.0",
"eslint": "^3.6.1",
"eslint-config-seegno": "^6.0.0",
"mocha": "^3.1.0",
"nock": "^8.0.0",
"nyc": "^8.3.0",
"eslint": "^4.14.0",
"eslint-config-uphold": "^0.1.0",
"mocha": "^4.1.0",
"nock": "^9.1.5",
"nyc": "^11.4.1",
"pre-commit": "^1.1.3",
"should": "^11.1.0"
"should": "^13.2.0"
},

@@ -86,3 +91,3 @@ "engines": {

"options": {
"mocha": "--compilers js:babel-register --recursive --require should"
"mocha": "--recursive --require babel-register --require should"
},

@@ -89,0 +94,0 @@ "pre-commit": [

# authy-client
A complete Authy client with support for TOTP, OneTouch, Phone Verification and Phone Intelligence APIs.
## Status
[![npm version][npm-image]][npm-url] [![build status][travis-image]][travis-url]
## Installation
Install the package via `npm`:
Install the package via `yarn`:
```sh
yarn add authy-client
```
or via `npm`:
```sh
npm install authy-client --save

@@ -15,7 +24,10 @@ ```

## Usage
### Examples
#### Registering a user and requesting an SMS
**Using await/async (requires `babel`)**:
```js
### Client
The following is a complete example of registering a user and requesting an SMS using any of the three possible async APIs offered by this package.
###### Using await/async (requires `babel`)
```javascript
import { Client } from 'authy-client';

@@ -26,3 +38,7 @@

(async function() {
const { user: { id: authyId } } = await client.registerUser({ countryCode: 'PT', email: 'foo@bar.com', phone: '911234567' });
const { user: { id: authyId } } = await client.registerUser({
countryCode: 'PT',
email: 'foo@bar.com',
phone: '911234567' }
);
const { cellphone } = await client.requestSms({ authyId });

@@ -34,27 +50,32 @@

**Using promises**:
###### Using promises
```js
```javascript
const Client = require('authy-client').Client;
const client = new Client({ key: 'foo' });
client.registerUser({ countryCode: 'PT', email: 'foo@bar.com', phone: '911234567' })
.then(function(response) {
return response.user.id;
})
.then(function(authyId) {
return client.requestSms({ authyId: authyId });
})
.then(function(response) {
console.log(`SMS requested to ${response.cellphone}`);
});
client.registerUser({
countryCode: 'PT',
email: 'foo@bar.com',
phone: '911234567'
}).then(function(response) {
return response.user.id;
}).then(function(authyId) {
return client.requestSms({ authyId: authyId });
}).then(function(response) {
console.log(`SMS requested to ${response.cellphone}`);
});
```
**Using callbacks**:
###### Using callbacks
```js
```javascript
const Client = require('authy-client').Client;
const client = new Client({ key: 'foo' });
client.registerUser({ countryCode: 'PT', email: 'foo@bar.com', phone: '911234567' }, function(err, res) {
client.registerUser({
countryCode: 'PT',
email: 'foo@bar.com',
phone: '911234567'
}, function(err, res) {
if (err) throw err;

@@ -72,4 +93,33 @@

### Command-line interface
Another option of interacting with Authy's API is by using the available command-line interface (cli). It handles most tasks without require any coding.
![demo](cli.gif)
```sh
❯ authy
Commands:
activity <command> Manage activity
application <command> Manage application information
onetouch <command> Manage onetouch requests
phone <command> Manage phone verifications
user <command> Manage users
Options:
--key API Key [string] [required]
--pretty Whether to print pretty results [boolean] [default: true]
--help Show help [boolean]
```
Note that all calls must be authenticated using the API Key. However, if you prefer, you can define the API Key using the environment variable `AUTHY_KEY` such as:
```sh
❯ AUTHY_KEY=foobar authy <command>
```
### Client({ key }, [options])
#### Arguments
### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -83,3 +133,3 @@ 2. `args.key` _(string)_: The private API key obtained from the [Authy Dashboard](https://dashboard.authy.com/).

```js
```javascript
new Client({ key: 'foo' }, { timeout: 10000 });

@@ -89,5 +139,5 @@ ```

### TOTP API
Authy TOTP (Time-based One-time Password) is an API that allows application developers to enable two-factor authentication (2FA) for a user. 2FA, as the name suggests, is an additional step to secure an user's account or action by comparing a code generated or sent to the user's mobile phone against a shared secret.
#### Methods
##### registerUser({ countryCode, email, phone }, [callback])

@@ -98,3 +148,4 @@ Create an Authy user based on the users mobile phone number and email. The returned Authy Id should be stored on your database for subsequent calls.

###### Arguments
#### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -106,6 +157,6 @@ 2. `args.countryCode` _(string)_: the user's phone country code in ISO 3166 alpha 2 format (**recommended** format, e.g. `US`) or a numeric country calling code (use at your own risk).

###### Example
**Using await/async (requires `babel`)**:
##### Example
###### Using await/async (requires `babel`)
```js
```javascript
const { user: { id: authyId } } = await client.registerUser({ countryCode: 'PT', email: 'foo@bar.com', phone: '911234567' });

@@ -116,5 +167,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.registerUser({ countryCode: 'PT', email: 'foo@bar.com', phone: '911234567' })

@@ -129,5 +180,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.registerUser({ countryCode: 'PT', email: 'foo@bar.com', phone: '911234567' }, function(err, res) {

@@ -140,6 +191,14 @@ if (err) throw err;

##### requestSms({ authyId }, [options, callback])
##### Using cli
```sh
❯ AUTHY_KEY=foobar authy user create 911234567 PT foo@bar.com
```
#### requestSms({ authyId }, [options, callback])
Request an SMS with a token for users that don't own a smartphone. If the Authy app is in use by the user, this request is ignored and a push notification is sent instead.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -153,6 +212,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.requestSms({ authyId: 1635 });

@@ -163,5 +223,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.requestSms({ authyId: 1635 })

@@ -176,5 +236,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.requestSms({ authyId: 1635 }, function(err, res) {

@@ -187,6 +247,14 @@ if (err) throw err;

##### requestCall({ authyId }, [options, callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy user request sms 1635
```
#### requestCall({ authyId }, [options, callback])
Request a call with a token for users that don't own a smartphone. If the Authy app is in use by the user, this request is ignored and a push notification is sent instead.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -200,6 +268,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.requestCall({ authyId: 1635 });

@@ -210,5 +279,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.requestCall({ authyId: 1635 })

@@ -223,5 +292,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.requestCall({ authyId: 1635 }, function(err, res) {

@@ -234,6 +303,14 @@ if (err) throw err;

##### verifyToken({ authyId, token }, [options, callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy user request call 1635
```
#### verifyToken({ authyId, token }, [options, callback])
Verify if a token submitted by the user is valid or not.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -246,6 +323,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.verifyToken({ authyId: 1635, token: '1234567' });

@@ -256,5 +334,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.verifyToken({ authyId: 1635, token: '1234567' })

@@ -269,5 +347,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.verifyToken({ authyId: 1635, token: '1234567' }, function(err, res) {

@@ -280,6 +358,14 @@ if (err) throw err;

##### deleteUser({ authyId }, [options, callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy user verify --token 1234567
```
#### deleteUser({ authyId }, [options, callback])
Delete a user from the application.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -291,6 +377,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.deleteUser({ authyId: 1635 });

@@ -301,5 +388,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.deleteUser({ authyId: 1635 })

@@ -314,5 +401,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.deleteUser({ authyId: 1635 }, function(err, res) {

@@ -325,6 +412,14 @@ if (err) throw err;

###### Using cli
```sh
❯ AUTHY_KEY=foobar authy user delete 1635
```
##### registerActivity({ authyId, data, type }, [options, callback])
Register a user activity.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -338,6 +433,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.registerActivity({ authyId: 1635, data: { reason: 'foo' }, type: 'banned' }, { ip: '127.0.0.1' });

@@ -348,5 +444,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.registerActivity({ authyId: 1635, data: { reason: 'foo' }, type: 'banned' }, { ip: '127.0.0.1' })

@@ -361,5 +457,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.registerActivity({ authyId: 1635, data: { reason: 'foo' }, type: 'banned' }, { ip: '127.0.0.1' }, function(err, res) {

@@ -372,6 +468,17 @@ if (err) throw err;

##### getUserStatus({ authyId }, [options, callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy activity create 1635 \
--data.reason foo \
--type banned \
--ip 127.0.0.1
```
#### getUserStatus({ authyId }, [options, callback])
Retrieve the user status, such as the registered country code, phone number, devices and confirmation status.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -383,6 +490,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.getUserStatus({ authyId: 1635 });

@@ -393,5 +501,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.getUserStatus({ authyId: 1635 })

@@ -406,5 +514,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.getUserStatus({ authyId: 1635 }, function(err, res) {

@@ -417,6 +525,14 @@ if (err) throw err;

##### getApplicationDetails([options, callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy user get status 1635
```
#### getApplicationDetails([options, callback])
Retrieve application details such as its name or current billing plan.
###### Arguments
##### Arguments
1. `[options]` _(Object)_: the options object.

@@ -426,6 +542,7 @@ 2. `[options.ip]` _(string)_: the IP of the user requesting to see the application details.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.getApplicationDetails();

@@ -436,5 +553,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.getApplicationDetails()

@@ -449,5 +566,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.getApplicationDetails(function(err, res) {

@@ -460,6 +577,14 @@ if (err) throw err;

##### getApplicationStatistics([options, callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy application get details
```
#### getApplicationStatistics([options, callback])
Retrieve application statistics by month and current quotas.
###### Arguments
##### Arguments
1. `[options]` _(Object)_: the options object.

@@ -469,6 +594,7 @@ 2. `[options.ip]` _(string)_: the IP of the user requesting to see the application statistics.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.getApplicationStatistics();

@@ -479,5 +605,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.getApplicationStatistics()

@@ -492,5 +618,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.getApplicationStatistics(function(err, res) {

@@ -503,10 +629,18 @@ if (err) throw err;

###### Using cli
```sh
❯ AUTHY_KEY=foobar authy application get statistics
```
### Phone Verification API
The Phone Verification API allows for a simple phone verification for situations where the complexity of the TOTP API is not required. First, a code is sent to the user's phone number and then that code is submitted back by the user. Authy verifies that the code matches the one issued for it.
#### Methods
##### startPhoneVerification({ countryCode, phone, via }, [options, callback])
#### startPhoneVerification({ countryCode, phone, via }, [options, callback])
Verify a phone number by sending it a verification code by SMS or call. Custom messages for the SMS are currently not working so support has not been added.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -520,6 +654,7 @@ 2. `args.countryCode` _(string)_: the user's phone country code in ISO 3166 alpha 2 format (**recommended** format, e.g. `US`) or a numeric country calling code (use at your own risk).

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
import { enums } from 'authy-client';

@@ -532,5 +667,5 @@

**Using promises**:
###### Using promises
```js
```javascript
const enums = require('authy-client').enums;

@@ -547,5 +682,5 @@

**Using callbacks**:
###### Using callbacks
```js
```javascript
const enums = require('authy-client').enums;

@@ -560,6 +695,16 @@

##### verifyPhone({ countryCode, phone, token }, [callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy phone verify 7754615609 US \
--locale=en \
--via=sms
```
#### verifyPhone({ countryCode, phone, token }, [callback])
Verify a phone number through a verification code.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -571,6 +716,7 @@ 2. `args.countryCode` _(string)_: the user's phone country code in ISO 3166 alpha 2 format (**recommended** format, e.g. `US`) or a numeric country calling code (use at your own risk).

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.verifyPhone({ countryCode: 'US', phone: '7754615609', token: '1234' });

@@ -581,5 +727,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.verifyPhone({ countryCode: 'US', phone: '7754615609', token: '1234' })

@@ -594,5 +740,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.verifyPhone({ countryCode: 'US', phone: '7754615609', token: '1234' }, function(err, res) {

@@ -605,10 +751,18 @@ if (err) throw err;

###### Using cli
```sh
❯ AUTHY_KEY=foobar authy phone verify 7754615609 US --token 1234
```
### Phone Intelligence API
The Phone Intelligence API allows an application developer to retrieve information about a specific number such as its type (VoIP, landline or mobile) and carrier.
#### Methods
##### getPhoneInformation({ countryCode, phone }, [options, callback])
#### getPhoneInformation({ countryCode, phone }, [options, callback])
Verify a phone number by sending it a verification code by SMS or call. Custom messages for the SMS are currently not working so support has not been added.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -621,6 +775,7 @@ 2. `args.countryCode` _(string)_: the phone's country code in ISO 3166 alpha 2 format (**recommended** format, e.g. `US`) or a numeric country calling code (use at your own risk).

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.getPhoneInformation({ countryCode: 'US', phone: '7754615609' });

@@ -631,5 +786,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.getPhoneInformation({ countryCode: 'US', phone: '7754615609' })

@@ -644,5 +799,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.getPhoneInformation({ countryCode: 'US', phone: '7754615609' }, function(err, res) {

@@ -655,3 +810,10 @@ if (err) throw err;

###### Using cli
```sh
❯ AUTHY_KEY=foobar authy phone get information 7754615609 US
```
### OneTouch API
Authy OneTouch is an API that allows application developers to create simple _approval requests_ so that users can frictionless _approve_ or _deny_ such request. It can be used for a variety of purposes, such as authentication (e.g. login approval) or validation (e.g. financial transaction approval).

@@ -661,7 +823,8 @@

#### Methods
##### createApprovalRequest({ authyId, details, logos, message }, [options, callback])
#### createApprovalRequest({ authyId, details, logos, message }, [options, callback])
Create an approval request for the given Authy Id and send it to the user as a push notification.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -681,6 +844,7 @@ 2. `args.authyId` _(string)_: the user's Authy Id.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.createApprovalRequest({

@@ -713,5 +877,5 @@ authyId: 1635,

**Using promises**:
###### Using promises
```js
```javascript
client.createApprovalRequest({

@@ -746,5 +910,5 @@ authyId: 1635,

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.createApprovalRequest({

@@ -779,6 +943,24 @@ authyId: 1635,

##### getApprovalRequest({ id }, [callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy onetouch create 1635 \
'Login requested for a CapTrade Bank account.' \
--hidden.ip_address 10.10.3.203 \
--logos.0.res default \
--logos.0.url 'https://example.com/logos/default.png' \
--logos.1.res low \
--logos.1.url 'https://example.com/logos/low.png' \
--visible.'Account Number' 981266321 \
--visible.location 'California, USA' \
--visible.username 'Bill Smith' \
--ttl 120
```
#### getApprovalRequest({ id }, [callback])
Get information about an approval request.
###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -788,6 +970,7 @@ 2. `args.id` _(string)_: the id of the approval request.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
const response = await client.getApprovalRequest({ id: '550e8400-e29b-41d4-a716-446655440000' });

@@ -798,5 +981,5 @@

**Using promises**:
###### Using promises
```js
```javascript
client.getApprovalRequest({ id: '550e8400-e29b-41d4-a716-446655440000' })

@@ -811,5 +994,5 @@ .then(function(response) {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.getApprovalRequest({ id: '550e8400-e29b-41d4-a716-446655440000' }, function(err, res) {

@@ -822,3 +1005,10 @@ if (err) throw err;

##### verifyCallback({ body, headers, method, protocol, url }, [callback])
###### Using cli
```sh
❯ AUTHY_KEY=foobar authy phone get status 550e8400-e29b-41d4-a716-446655440000
```
#### verifyCallback({ body, headers, method, protocol, url }, [callback])
Authy callbacks contain a header (`X-Authy-Signature`) with an HTTP HMAC signature of the request. This signature can be used to verify the authenticity of the request.

@@ -830,3 +1020,4 @@

###### Arguments
##### Arguments
1. `args` _(Object)_: the required arguments object.

@@ -840,6 +1031,7 @@ 2. `args.body` _(Object)_: the parsed body of the request.

###### Example
**Using await/async (requires `babel`)**:
##### Example
```js
###### Using await/async (requires `babel`)
```javascript
await client.verifyCallback({

@@ -887,5 +1079,5 @@ body: {

**Using promises**:
###### Using promises
```js
```javascript
client.verifyCallback({

@@ -936,5 +1128,5 @@ body: {

**Using callbacks**:
###### Using callbacks
```js
```javascript
client.verifyCallback({

@@ -985,2 +1177,3 @@ body: {

## Tests
To test using a local installation of `node.js`:

@@ -1005,2 +1198,3 @@

## License
MIT

@@ -1010,3 +1204,3 @@

[npm-url]: https://npmjs.org/package/authy-client
[travis-image]: https://img.shields.io/travis/seegno/authy-client.svg?style=flat-square
[travis-url]: https://travis-ci.org/seegno/authy-client
[travis-image]: https://img.shields.io/travis/ruimarinho/authy-client.svg?style=flat-square
[travis-url]: https://travis-ci.org/ruimarinho/authy-client

Sorry, the diff of this file is too big to display

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