aboutsummaryrefslogtreecommitdiffstats
path: root/authy.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-03-09 22:30:48 -0700
committerAdam Soltys <[email protected]>2020-03-09 22:30:48 -0700
commit629701a87138e2fedb69e260bc3951cb567b322c (patch)
tree769758de86cc9f99df8789e894f15ffc5a714c72 /authy.js
parent4e2d9a84e9561ce2a95b0f72e424b6bf38cdd74b (diff)
downloadcoinos-server-629701a87138e2fedb69e260bc3951cb567b322c.tar.gz
coinos-server-629701a87138e2fedb69e260bc3951cb567b322c.zip
log binance error
Diffstat (limited to 'authy.js')
-rw-r--r--authy.js54
1 files changed, 0 insertions, 54 deletions
diff --git a/authy.js b/authy.js
deleted file mode 100644
index bfca8672..00000000
--- a/authy.js
+++ /dev/null
@@ -1,54 +0,0 @@
-const { Client } = require("authy-client");
-const config = require("./config");
-
-const authy = new Client({ key: config.authy.key });
-
-module.exports = async user => {
- let { authyId } = user;
-
- const res = await authy.createApprovalRequest(
- {
- authyId: user.authyId,
- details: {
- visible: {
- User: user.name
- }
- },
- logos: [
- {
- res: "default",
- url: "https://coinos.io/static/img/coinos.png"
- }
- ],
- message: "Login to CoinOS"
- },
- {
- ttl: 120
- }
- );
-
- let counter = 0;
-
- return new Promise((resolve, reject) => {
- let poll = setInterval(async () => {
- counter++;
- const r = await authy.getApprovalRequest({
- id: res.approval_request.uuid
- });
- if (r.approval_request.status === "approved") {
- clearInterval(poll);
- resolve(true);
- }
-
- if (r.approval_request.status === "denied") {
- clearInterval(poll);
- resolve(false);
- }
-
- if (counter > 60) {
- clearInterval(poll);
- reject(false);
- }
- }, 1000);
- });
-};