Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getClaimInfo({ claim, context, extraParams }) {
const { userDid, userPk, walletOS, sessionDid, walletVersion } = context;
const result =
typeof claim === 'function'
? await claim({
userDid: userDid ? toAddress(userDid) : '',
userPk: userPk || '',
sessionDid: sessionDid || '',
walletOS,
walletVersion,
extraParams,
})
: claim;
const chainInfoParams = Object.assign({}, context, extraParams);
const chainInfo = this.getChainInfo(chainInfoParams, result.chainInfo || undefined);
ForgeSDK.connect(chainInfo.host, { chainId: chainInfo.id, name: chainInfo.id });
result.chainInfo = chainInfo;
return result;
}
return new Promise(async (resolve, reject) => {
try {
const { iss, action = 'responseAuth', requestedClaims } = await this._verify(
data,
'userPk',
'userInfo',
locale,
enforceTimestamp
);
resolve({
token: data.token,
userDid: toAddress(iss),
userPk: data.userPk,
claims: requestedClaims,
action,
});
debug('verify.context', { userPk: data.userPk, userDid: toAddress(iss), action });
debug('verify.claims', requestedClaims);
} catch (err) {
reject(err);
}
});
}