Comparing version 0.3.2 to 0.3.3
@@ -61,2 +61,5 @@ 'use strict'; | ||
} | ||
if (params.verified) { | ||
payload.verified = params.verified; | ||
} | ||
if (params.notifications) { | ||
@@ -76,2 +79,4 @@ payload.permissions = ['notifications']; | ||
value: function receive(token) { | ||
var _this2 = this; | ||
var callbackUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
@@ -82,3 +87,15 @@ | ||
profile = _ref.profile; | ||
return _extends({}, profile, payload.own || {}, payload.capabilities && payload.capabilities.length === 1 ? { pushToken: payload.capabilities[0] } : {}, { address: payload.iss }); | ||
var credentials = _extends({}, profile, payload.own || {}, payload.capabilities && payload.capabilities.length === 1 ? { pushToken: payload.capabilities[0] } : {}, { address: payload.iss }); | ||
if (payload.verified) { | ||
return Promise.all(payload.verified.map(function (token) { | ||
return (0, _JWT.verifyJWT)(_this2.settings, token); | ||
})).then(function (verified) { | ||
return _extends({}, credentials, { verified: verified.map(function (v) { | ||
return _extends({}, v.payload, { jwt: v.jwt }); | ||
}) }); | ||
}); | ||
} else { | ||
return credentials; | ||
} | ||
}); | ||
@@ -85,0 +102,0 @@ } |
@@ -65,3 +65,3 @@ 'use strict'; | ||
} | ||
resolve({ payload: payload, profile: profile }); | ||
resolve({ payload: payload, profile: profile, jwt: jwt }); | ||
} else { | ||
@@ -68,0 +68,0 @@ return reject(new Error('Signature invalid for JWT')); |
{ | ||
"name": "uport", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Library for interacting with uport profiles and attestations", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -25,2 +25,5 @@ import { createJWT, verifyJWT } from './JWT' | ||
} | ||
if (params.verified) { | ||
payload.verified = params.verified | ||
} | ||
if (params.notifications) { | ||
@@ -37,5 +40,12 @@ payload.permissions = ['notifications'] | ||
receive (token, callbackUrl = null) { | ||
return verifyJWT(this.settings, token, callbackUrl).then(({payload, profile}) => ( | ||
{...profile, ...(payload.own || {}), ...(payload.capabilities && payload.capabilities.length === 1 ? {pushToken: payload.capabilities[0]} : {}), address: payload.iss} | ||
)) | ||
return verifyJWT(this.settings, token, callbackUrl).then(({payload, profile}) => { | ||
const credentials = {...profile, ...(payload.own || {}), ...(payload.capabilities && payload.capabilities.length === 1 ? {pushToken: payload.capabilities[0]} : {}), address: payload.iss} | ||
if (payload.verified) { | ||
return Promise.all(payload.verified.map(token => verifyJWT(this.settings, token))).then(verified => { | ||
return {...credentials, verified: verified.map(v => ({...v.payload, jwt: v.jwt}))} | ||
}) | ||
} else { | ||
return credentials | ||
} | ||
}) | ||
} | ||
@@ -42,0 +52,0 @@ |
@@ -49,3 +49,3 @@ import { createUnsignedToken, TokenVerifier, decodeToken } from 'jsontokens' | ||
} | ||
resolve({payload, profile}) | ||
resolve({payload, profile, jwt}) | ||
} else { | ||
@@ -57,1 +57,2 @@ return reject(new Error('Signature invalid for JWT')) | ||
} | ||
Sorry, the diff of this file is too big to display
573522
16804