@@ -35,6 +35,8 @@ var _authMessages = require('./authMessages');
3535
3636var _authConstants = require('./authConstants');
3737
38+ var _profiles = require('../profiles');
39+
3840function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3941
4042/**
@@ -54,6 +56,7 @@ function generateAndStoreTransitKey() {
5456 * @return {String} the hex encoded private key
5557 * @private
5658 */
59+
5760function getTransitKey() {
5861 return localStorage.getItem(_authConstants.BLOCKSTACK_APP_PRIVATE_KEY_LABEL);
5962}
@@ -188,13 +191,29 @@ function handlePendingSignIn() {
188191
189192 var userData = {
190193 username: tokenPayload.username,
191- profile: tokenPayload.profile ,
194+ profile: null ,
192195 appPrivateKey: appPrivateKey,
193196 coreSessionToken: coreSessionToken,
194197 authResponseToken: authResponseToken
195198 };
196- window.localStorage.setItem(_authConstants.BLOCKSTACK_STORAGE_LABEL, JSON.stringify(userData));
197- resolve(userData);
199+ var profileURL = tokenPayload.profile_url;
200+ if (profileURL !== undefined && profileURL !== null) {
201+ fetch(profileURL).then(function (response) {
202+ return response.text();
203+ }).then(function (response) {
204+ return JSON.parse(response);
205+ }).then(function (wrappedProfile) {
206+ return (0, _profiles.extractProfile)(wrappedProfile[0].token);
207+ }).then(function (profile) {
208+ userData.profile = profile;
209+ window.localStorage.setItem(_authConstants.BLOCKSTACK_STORAGE_LABEL, JSON.stringify(userData));
210+ resolve(userData);
211+ });
212+ } else {
213+ userData.profile = tokenPayload.profile;
214+ window.localStorage.setItem(_authConstants.BLOCKSTACK_STORAGE_LABEL, JSON.stringify(userData));
215+ resolve(userData);
216+ }
198217 } else {
199218 reject();
200219 }
@@ -224,7 +243,7 @@ function signUserOut() {
224243 window.location = redirectURL;
225244 }
226245}
227- },{"../index":11,"../utils":35,"./authConstants":2,"./authMessages":3,"./index":7,"custom-protocol-detection-blockstack":298,"jsontokens":381,"query-string":478}],2:[function(require,module,exports){
246+ },{"../index":11,"../profiles":13,"../ utils":35,"./authConstants":2,"./authMessages":3,"./index":7,"custom-protocol-detection-blockstack":298,"jsontokens":381,"query-string":478}],2:[function(require,module,exports){
228247'use strict';
229248
230249Object.defineProperty(exports, "__esModule", {
@@ -290,6 +309,7 @@ function makeAuthRequest() {
290309 manifest_uri: manifestURI,
291310 redirect_uri: redirectURI,
292311 version: VERSION,
312+ do_not_include_profile: true,
293313 scopes: scopes
294314 };
295315
@@ -337,10 +357,14 @@ function makeAuthResponse(privateKey) {
337357 var privateKeyPayload = appPrivateKey;
338358 var coreTokenPayload = coreToken;
339359 var additionalProperties = {};
340- if (transitPublicKey !== undefined && transitPublicKey !== null && appPrivateKey !== undefined && appPrivateKey !== null && coreToken !== undefined && coreToken !== null) {
360+ if (appPrivateKey !== undefined && appPrivateKey !== null) {
341361 console.log('blockstack.js: generating v' + VERSION + ' auth response');
342- privateKeyPayload = encryptPrivateKey(transitPublicKey, appPrivateKey);
343- coreTokenPayload = encryptPrivateKey(transitPublicKey, coreToken);
362+ if (transitPublicKey !== undefined && transitPublicKey !== null) {
363+ privateKeyPayload = encryptPrivateKey(transitPublicKey, appPrivateKey);
364+ if (coreToken !== undefined && coreToken !== null) {
365+ coreTokenPayload = encryptPrivateKey(transitPublicKey, coreToken);
366+ }
367+ }
344368 additionalProperties = {
345369 email: metadata.email ? metadata.email : null,
346370 profile_url: metadata.profileUrl ? metadata.profileUrl : null,
@@ -2589,7 +2613,7 @@ function extractProfile(token) {
25892613 if (publicKeyOrAddress) {
25902614 decodedToken = verifyProfileToken(token, publicKeyOrAddress);
25912615 } else {
2592- decodedToken = decodedToken (token);
2616+ decodedToken = (0, _jsontokens.decodeToken) (token);
25932617 }
25942618
25952619 var profile = {};
@@ -11883,7 +11907,7 @@ module.exports={
1188311907 "_args": [
1188411908 [
1188511909 "bigi@1.4.2",
11886- "/Users/larry/git /blockstack.js"
11910+ "/home/aaron/devel /blockstack.js"
1188711911 ]
1188811912 ],
1188911913 "_from": "bigi@1.4.2",
@@ -11909,7 +11933,7 @@ module.exports={
1190911933 ],
1191011934 "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",
1191111935 "_spec": "1.4.2",
11912- "_where": "/Users/larry/git /blockstack.js",
11936+ "_where": "/home/aaron/devel /blockstack.js",
1191311937 "bugs": {
1191411938 "url": "https://github.com/cryptocoinjs/bigi/issues"
1191511939 },
@@ -40836,29 +40860,34 @@ exports.isHtml = function(str) {
4083640860
4083740861},{"./parse":286,"dom-serializer":299}],289:[function(require,module,exports){
4083840862module.exports={
40839- "_from": "cheerio@^0.22.0",
40863+ "_args": [
40864+ [
40865+ "cheerio@0.22.0",
40866+ "/home/aaron/devel/blockstack.js"
40867+ ]
40868+ ],
40869+ "_from": "cheerio@0.22.0",
4084040870 "_id": "cheerio@0.22.0",
4084140871 "_inBundle": false,
4084240872 "_integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=",
4084340873 "_location": "/cheerio",
4084440874 "_phantomChildren": {},
4084540875 "_requested": {
40846- "type": "range ",
40876+ "type": "version ",
4084740877 "registry": true,
40848- "raw": "cheerio@^ 0.22.0",
40878+ "raw": "cheerio@0.22.0",
4084940879 "name": "cheerio",
4085040880 "escapedName": "cheerio",
40851- "rawSpec": "^ 0.22.0",
40881+ "rawSpec": "0.22.0",
4085240882 "saveSpec": null,
40853- "fetchSpec": "^ 0.22.0"
40883+ "fetchSpec": "0.22.0"
4085440884 },
4085540885 "_requiredBy": [
4085640886 "/"
4085740887 ],
4085840888 "_resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz",
40859- "_shasum": "a9baa860a3f9b595a6b81b1a86873121ed3a269e",
40860- "_spec": "cheerio@^0.22.0",
40861- "_where": "/Users/larry/git/blockstack.js",
40889+ "_spec": "0.22.0",
40890+ "_where": "/home/aaron/devel/blockstack.js",
4086240891 "author": {
4086340892 "name": "Matt Mueller",
4086440893 "email": "mattmuelle@gmail.com",
@@ -40867,7 +40896,6 @@ module.exports={
4086740896 "bugs": {
4086840897 "url": "https://github.com/cheeriojs/cheerio/issues"
4086940898 },
40870- "bundleDependencies": false,
4087140899 "dependencies": {
4087240900 "css-select": "~1.2.0",
4087340901 "dom-serializer": "~0.1.0",
@@ -40886,7 +40914,6 @@ module.exports={
4088640914 "lodash.reject": "^4.4.0",
4088740915 "lodash.some": "^4.4.0"
4088840916 },
40889- "deprecated": false,
4089040917 "description": "Tiny, fast, and elegant implementation of core jQuery designed specifically for the server",
4089140918 "devDependencies": {
4089240919 "benchmark": "^2.1.0",
@@ -49085,21 +49112,27 @@ utils.encode = function encode(arr, enc) {
4908549112
4908649113},{}],350:[function(require,module,exports){
4908749114module.exports={
49088- "_from": "elliptic@^6.4.0",
49115+ "_args": [
49116+ [
49117+ "elliptic@6.4.0",
49118+ "/home/aaron/devel/blockstack.js"
49119+ ]
49120+ ],
49121+ "_from": "elliptic@6.4.0",
4908949122 "_id": "elliptic@6.4.0",
4909049123 "_inBundle": false,
4909149124 "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",
4909249125 "_location": "/elliptic",
4909349126 "_phantomChildren": {},
4909449127 "_requested": {
49095- "type": "range ",
49128+ "type": "version ",
4909649129 "registry": true,
49097- "raw": "elliptic@^ 6.4.0",
49130+ "raw": "elliptic@6.4.0",
4909849131 "name": "elliptic",
4909949132 "escapedName": "elliptic",
49100- "rawSpec": "^ 6.4.0",
49133+ "rawSpec": "6.4.0",
4910149134 "saveSpec": null,
49102- "fetchSpec": "^ 6.4.0"
49135+ "fetchSpec": "6.4.0"
4910349136 },
4910449137 "_requiredBy": [
4910549138 "/",
@@ -49109,17 +49142,15 @@ module.exports={
4910949142 "/jsontokens"
4911049143 ],
4911149144 "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",
49112- "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df",
49113- "_spec": "elliptic@^6.4.0",
49114- "_where": "/Users/larry/git/blockstack.js",
49145+ "_spec": "6.4.0",
49146+ "_where": "/home/aaron/devel/blockstack.js",
4911549147 "author": {
4911649148 "name": "Fedor Indutny",
4911749149 "email": "fedor@indutny.com"
4911849150 },
4911949151 "bugs": {
4912049152 "url": "https://github.com/indutny/elliptic/issues"
4912149153 },
49122- "bundleDependencies": false,
4912349154 "dependencies": {
4912449155 "bn.js": "^4.4.0",
4912549156 "brorand": "^1.0.1",
@@ -49129,7 +49160,6 @@ module.exports={
4912949160 "minimalistic-assert": "^1.0.0",
4913049161 "minimalistic-crypto-utils": "^1.0.0"
4913149162 },
49132- "deprecated": false,
4913349163 "description": "EC cryptography",
4913449164 "devDependencies": {
4913549165 "brfs": "^1.4.3",
@@ -61672,44 +61702,47 @@ utils.intFromLE = intFromLE;
6167261702
6167361703},{"bn.js":433}],450:[function(require,module,exports){
6167461704module.exports={
61675- "_from": "elliptic@^5.1.0",
61705+ "_args": [
61706+ [
61707+ "elliptic@5.2.1",
61708+ "/home/aaron/devel/blockstack.js"
61709+ ]
61710+ ],
61711+ "_from": "elliptic@5.2.1",
6167661712 "_id": "elliptic@5.2.1",
6167761713 "_inBundle": false,
6167861714 "_integrity": "sha1-+ilLZWPG3bybo9yFlGh66ECFjxA=",
6167961715 "_location": "/jsontokens/key-encoder/elliptic",
6168061716 "_phantomChildren": {},
6168161717 "_requested": {
61682- "type": "range ",
61718+ "type": "version ",
6168361719 "registry": true,
61684- "raw": "elliptic@^5.1.0 ",
61720+ "raw": "elliptic@5.2.1 ",
6168561721 "name": "elliptic",
6168661722 "escapedName": "elliptic",
61687- "rawSpec": "^5.1.0 ",
61723+ "rawSpec": "5.2.1 ",
6168861724 "saveSpec": null,
61689- "fetchSpec": "^5.1.0 "
61725+ "fetchSpec": "5.2.1 "
6169061726 },
6169161727 "_requiredBy": [
6169261728 "/jsontokens/key-encoder"
6169361729 ],
6169461730 "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-5.2.1.tgz",
61695- "_shasum": "fa294b6563c6ddbc9ba3dc8594687ae840858f10",
61696- "_spec": "elliptic@^5.1.0",
61697- "_where": "/Users/larry/git/blockstack.js/node_modules/jsontokens/node_modules/key-encoder",
61731+ "_spec": "5.2.1",
61732+ "_where": "/home/aaron/devel/blockstack.js",
6169861733 "author": {
6169961734 "name": "Fedor Indutny",
6170061735 "email": "fedor@indutny.com"
6170161736 },
6170261737 "bugs": {
6170361738 "url": "https://github.com/indutny/elliptic/issues"
6170461739 },
61705- "bundleDependencies": false,
6170661740 "dependencies": {
6170761741 "bn.js": "^3.1.1",
6170861742 "brorand": "^1.0.1",
6170961743 "hash.js": "^1.0.0",
6171061744 "inherits": "^2.0.1"
6171161745 },
61712- "deprecated": false,
6171361746 "description": "EC cryptography",
6171461747 "devDependencies": {
6171561748 "browserify": "^3.44.2",
0 commit comments