uport-lite
Advanced tools
Comparing version 1.0.0-alpha to 1.0.0-alpha-2
@@ -319,3 +319,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
'0x2a': { | ||
registry: '0xeA8aC9cF5c3D02cfc30F65C04eD921D713062745', | ||
registry: '0x5f8e9351dc2d238fb878b6ae43aa740d62fc9758', | ||
rpcUrl: 'https://kovan.infura.io' | ||
@@ -337,2 +337,3 @@ // }, | ||
const networks = opts.networks ? Object.assign({}, defaultNetworks, opts.networks) : defaultNetworks | ||
function asciiToHex (string, delim) { | ||
@@ -339,0 +340,0 @@ return string.split('').map(function (c) { |
@@ -9,3 +9,3 @@ var $jscomp={scope:{},owns:function(a,b){return Object.prototype.hasOwnProperty.call(a,b)}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this); | ||
a.uri);d.accept&&c.setRequestHeader("accept",d.accept);d.data?(c.setRequestHeader("Content-Type","application/json"),c.send(JSON.stringify(d.data))):c.send()}function m(a){var b=n.decode(a),c=b.length-24;a=b.slice(1,c);b=b.slice(c,20+c);return{network:"0x"+k.encode(a),address:"0x"+k.encode(b)}}Object.defineProperty(b,"__esModule",{value:!0});b.eaeDecode=m;var n=c(0)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),k=c(0)("0123456789abcdef"),p="undefined"!==typeof window?window.XMLHttpRequest: | ||
c(2).XMLHttpRequest,l={"0x1":{registry:"0xab5c8051b9a1df1aab0149f8b0630848b7ecabf6",rpcUrl:"https://mainnet.infura.io"},"0x3":{registry:"0x41566e3a081f5032bdcad470adb797635ddfe1f0",rpcUrl:"https://ropsten.infura.io"},"0x2a":{registry:"0xeA8aC9cF5c3D02cfc30F65C04eD921D713062745",rpcUrl:"https://kovan.infura.io"}};a.exports=function(a){function b(a,b){return a.split("").map(function(a){return("0"+a.charCodeAt(0).toString(16)).slice(-2)}).join(b||"")}function c(a,b,c){return"undefined"===typeof b?a: | ||
c(2).XMLHttpRequest,l={"0x1":{registry:"0xab5c8051b9a1df1aab0149f8b0630848b7ecabf6",rpcUrl:"https://mainnet.infura.io"},"0x3":{registry:"0x41566e3a081f5032bdcad470adb797635ddfe1f0",rpcUrl:"https://ropsten.infura.io"},"0x2a":{registry:"0x5f8e9351dc2d238fb878b6ae43aa740d62fc9758",rpcUrl:"https://kovan.infura.io"}};a.exports=function(a){function b(a,b){return a.split("").map(function(a){return("0"+a.charCodeAt(0).toString(16)).slice(-2)}).join(b||"")}function c(a,b,c){return"undefined"===typeof b?a: | ||
c?(a+b).slice(-a.length):(b+a).substring(0,a.length)}function f(a,d,f,e){a+=c("0000000000000000000000000000000000000000000000000000000000000000",b(d));a+=c("0000000000000000000000000000000000000000000000000000000000000000",f.slice(2),!0);return a+=c("0000000000000000000000000000000000000000000000000000000000000000",e.slice(2),!0)}function e(a,b){var c="https://ropsten.infura.io/"+t;return a?d({uri:c,accept:"application/json",data:{method:"eth_call",params:[{to:"0xb9C1598e24650437a3055F7f66AC1820c419a679", | ||
@@ -12,0 +12,0 @@ data:"0x446d5aa4000000000000000000000000"+a.slice(2)},"latest"],id:1,jsonrpc:"2.0"}},function(a,c){if(a)return b(a);a=c.result.slice(130).slice(0,68);return b(null,n.encode(k.decode(a)))}):b(null)}function p(a,b,c,e){b=m(b);var g=m(c);if(b.network!==g.network)throw Error("Issuer and subject must be on the same network");if(!r[b.network])throw Error("Network id "+b.network+" is not configured");c=r[b.network].rpcUrl;var v=r[b.network].registry;a=f("0x447885f0",a,b.address,g.address);return d({uri:c+ |
@@ -19,3 +19,3 @@ 'use strict'; | ||
// uPortProfileIPFS1220 => 75506f727450726f66696c654950465331323230 | ||
//"uPortProfileIPFS1220","0xb08e78b8E17dC2874818d7F49055aBf08Ee9977D","0xB0F288F8EFA511962E11E37488DB0D2BCC7A5F304B1D4F3977EB0EC65814A52C" | ||
//"uPortProfileIPFS1220","0x39F79c6511940bB54Ca69a659c929DdD5a4c679F","0x39F79c6511940bB54Ca69a659c929DdD5a4c679F" | ||
@@ -33,4 +33,16 @@ it('finds valid default profile for address', function () { | ||
it('finds valid default profile for address on kovan', function () { | ||
return new Promise(function (resolve, reject) { | ||
registry('3511FZbtXjJbTHYz3NnLAXZwjgFVQq3tCfH', function (error, profile) { | ||
if (error) return reject(error); | ||
resolve(profile); | ||
}); | ||
}).then(function (profile) { | ||
return expect(profile.publicKey).toEqual('0x0466aa9f309dfb7624ae3b0a6b6ad6163145d977e088679252289816b90b2e5e9d58ea42a4b79f255731660d0c3e319a4fa54a6f1a73a88fd3c1b48a084269ab48'); | ||
}); | ||
}); | ||
it('finds valid default profile on private chain', function () { | ||
return new Promise(function (resolve, reject) { | ||
registry('5A8bRX9ShMLm7bXPn9SVX6hC7SG1HURF3tknToB', function (error, profile) { | ||
@@ -47,2 +59,3 @@ if (error) return reject(error); | ||
return new Promise(function (resolve, reject) { | ||
registry('2oVdmcz7BkWozm2JE4hHixRV8s5y3STqhPG', function (error, profile) { | ||
@@ -49,0 +62,0 @@ if (error) return reject(error); |
@@ -79,3 +79,3 @@ 'use strict'; | ||
'0x2a': { | ||
registry: '0xeA8aC9cF5c3D02cfc30F65C04eD921D713062745', | ||
registry: '0x5f8e9351dc2d238fb878b6ae43aa740d62fc9758', | ||
rpcUrl: 'https://kovan.infura.io' | ||
@@ -99,2 +99,3 @@ // }, | ||
var networks = opts.networks ? Object.assign({}, defaultNetworks, opts.networks) : defaultNetworks; | ||
function asciiToHex(string, delim) { | ||
@@ -101,0 +102,0 @@ return string.split('').map(function (c) { |
{ | ||
"name": "uport-lite", | ||
"version": "1.0.0-alpha", | ||
"version": "1.0.0-alpha-2", | ||
"description": "Lightweight library for looking up public profiles on uport-registry", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -12,3 +12,3 @@ import UportLite from '../index' | ||
// uPortProfileIPFS1220 => 75506f727450726f66696c654950465331323230 | ||
//"uPortProfileIPFS1220","0xb08e78b8E17dC2874818d7F49055aBf08Ee9977D","0xB0F288F8EFA511962E11E37488DB0D2BCC7A5F304B1D4F3977EB0EC65814A52C" | ||
//"uPortProfileIPFS1220","0x39F79c6511940bB54Ca69a659c929DdD5a4c679F","0x39F79c6511940bB54Ca69a659c929DdD5a4c679F" | ||
@@ -26,4 +26,16 @@ it('finds valid default profile for address', () => { | ||
it('finds valid default profile for address on kovan', () => { | ||
return new Promise((resolve, reject) => { | ||
registry('3511FZbtXjJbTHYz3NnLAXZwjgFVQq3tCfH', (error, profile) => { | ||
if (error) return reject(error) | ||
resolve(profile) | ||
}) | ||
}).then(profile => { | ||
return expect(profile.publicKey).toEqual('0x0466aa9f309dfb7624ae3b0a6b6ad6163145d977e088679252289816b90b2e5e9d58ea42a4b79f255731660d0c3e319a4fa54a6f1a73a88fd3c1b48a084269ab48') | ||
}) | ||
}) | ||
it('finds valid default profile on private chain', () => { | ||
return new Promise((resolve, reject) => { | ||
registry('5A8bRX9ShMLm7bXPn9SVX6hC7SG1HURF3tknToB', (error, profile) => { | ||
@@ -40,2 +52,3 @@ if (error) return reject(error) | ||
return new Promise((resolve, reject) => { | ||
registry('2oVdmcz7BkWozm2JE4hHixRV8s5y3STqhPG', (error, profile) => { | ||
@@ -42,0 +55,0 @@ if (error) return reject(error) |
@@ -73,3 +73,3 @@ var BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | ||
'0x2a': { | ||
registry: '0xeA8aC9cF5c3D02cfc30F65C04eD921D713062745', | ||
registry: '0x5f8e9351dc2d238fb878b6ae43aa740d62fc9758', | ||
rpcUrl: 'https://kovan.infura.io' | ||
@@ -91,2 +91,3 @@ // }, | ||
const networks = opts.networks ? Object.assign({}, defaultNetworks, opts.networks) : defaultNetworks | ||
function asciiToHex (string, delim) { | ||
@@ -93,0 +94,0 @@ return string.split('').map(function (c) { |
43977
956