@toruslabs/torus-embed
Advanced tools
Comparing version 0.0.19 to 0.0.20
{ | ||
"name": "@toruslabs/torus-embed", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "Embed script for Torus", | ||
@@ -40,3 +40,3 @@ "directories": { | ||
"devDependencies": { | ||
"@babel/core": "^7.5.0", | ||
"@babel/core": "^7.5.5", | ||
"assert": "^2.0.0", | ||
@@ -47,10 +47,10 @@ "browserify": "^16.3.0", | ||
"envify": "^4.1.0", | ||
"eslint": "^6.0.1", | ||
"eslint": "^6.1.0", | ||
"eslint-config-airbnb-base": "^13.2.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-flowtype": "^3.11.1", | ||
"eslint-config-standard": "^13.0.1", | ||
"eslint-plugin-flowtype": "^3.12.2", | ||
"eslint-plugin-html": "^6.0.0", | ||
"eslint-plugin-import": "^2.18.0", | ||
"eslint-plugin-mocha": "^5.3.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-mocha": "^6.0.0", | ||
"eslint-plugin-node": "^9.1.0", | ||
@@ -60,8 +60,8 @@ "eslint-plugin-prettier": "^3.1.0", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"husky": "^3.0.0", | ||
"lint-staged": "^9.1.0", | ||
"mocha": "^6.1.4", | ||
"husky": "^3.0.2", | ||
"lint-staged": "^9.2.1", | ||
"mocha": "^6.2.0", | ||
"mocha-eslint": "^5.0.0", | ||
"prettier": "^1.18.2", | ||
"puppeteer": "^1.18.1", | ||
"puppeteer": "^1.19.0", | ||
"uglifyify": "^5.0.1" | ||
@@ -68,0 +68,0 @@ }, |
@@ -11,4 +11,4 @@ // Torus loading message | ||
const iframeIntegrity = 'sha384-//xcFLc4lT80ef8s37hakGrXi7Duqcvkmny9o4IcV+HNwKsvMgagS4sIoB1ybZ24' | ||
torusUrl = 'https://app.tor.us/v0.0.17' | ||
const iframeIntegrity = 'sha384-PLiyjpbIYFFGZyPT1cLo555dYldaLQO0qZd0C1NZuJnUZjoMdFIk9t3E7uhk0bxO' | ||
torusUrl = 'https://app.tor.us/v0.0.18' | ||
logLevel = 'error' | ||
@@ -37,2 +37,5 @@ | ||
const embedUtils = require('./embedUtils.js') | ||
const httpFunctions = require('./utils/httpHelpers.js') | ||
const configuration = require('./config.js') | ||
// const styleColor = document.currentScript.getAttribute('style-color') | ||
@@ -279,2 +282,50 @@ let stylePosition = '' | ||
/** | ||
* Expose the getPublicKey API to the Dapp through window.torus object | ||
* @param {String} email Email address of the user | ||
*/ | ||
window.torus.getPublicKey = function(email) { | ||
// Select random node from the list of endpoints | ||
const randomNumber = Math.floor(Math.random() * configuration.torusNodeEndpoints.length) | ||
const node = configuration.torusNodeEndpoints[randomNumber] | ||
return new Promise((resolve, reject) => { | ||
httpFunctions | ||
.post( | ||
node, | ||
httpFunctions.generateJsonRPCObject('VerifierLookupRequest', { | ||
verifier: 'google', | ||
verifier_id: email | ||
}) | ||
) | ||
.catch(err => console.error(err)) | ||
.then(lookupShare => { | ||
if (lookupShare.error) { | ||
return httpFunctions.post( | ||
node, | ||
httpFunctions.generateJsonRPCObject('KeyAssign', { | ||
verifier: 'google', | ||
verifier_id: email | ||
}) | ||
) | ||
} else if (lookupShare.result) { | ||
return httpFunctions.getLookupPromise(lookupShare) | ||
} | ||
}) | ||
.catch(err => console.error(err)) | ||
.then(lookupShare => { | ||
log.info('completed') | ||
log.info(lookupShare) | ||
var ethAddress = lookupShare.result.keys[0].address | ||
log.info(ethAddress) | ||
resolve(ethAddress) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
reject(err) | ||
}) | ||
}) | ||
} | ||
window.torus.setProvider = function(network, type) { | ||
@@ -294,6 +345,6 @@ var providerChangeStream = window.torus.communicationMux.getStream('provider_change') | ||
console.log(`Torus detected another web3. | ||
Torus will not work reliably with another web3 extension. | ||
This usually happens if you have two Torus' installed, | ||
or Torus and another web3 extension. Please remove one | ||
and try again.`) | ||
Torus will not work reliably with another web3 extension. | ||
This usually happens if you have two Torus' installed, | ||
or Torus and another web3 extension. Please remove one | ||
and try again.`) | ||
} | ||
@@ -300,0 +351,0 @@ |
@@ -199,5 +199,3 @@ const pump = require('pump') | ||
// eslint-disable-next-line max-len | ||
var message = `The MetaMask Web3 object does not support synchronous methods like ${ | ||
payload.method | ||
} without a callback parameter. See ${link} for details.` | ||
var message = `The MetaMask Web3 object does not support synchronous methods like ${payload.method} without a callback parameter. See ${link} for details.` | ||
throw new Error(message) | ||
@@ -204,0 +202,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
Network access
Supply chain riskThis module accesses the network.
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
36737
17
778
1