@unumid/server-sdk
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -91,3 +91,3 @@ "use strict"; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var publicKeyInfoResponse, publicKeyInfos, issuerPublicKeyInfos, publicKeyInfoResponse_1, encryptCredentialPromises, _a, creds, proofOfCreds, sendEncryptedVersionedCredentials, promises, latestVersion, resultantCredentials; | ||
var publicKeyInfoResponse, publicKeyInfos, issuerPublicKeyInfos, publicKeyInfoResponse_1, encryptCredentialPromises, _a, creds, proofOfCreds, sendEncryptedVersionedCredentials, latestVersion, resultantCredentials; | ||
return __generator(this, function (_b) { | ||
@@ -140,15 +140,22 @@ switch (_b.label) { | ||
}); }; | ||
promises = versionList_1.versionList.map(function (version) { return sendEncryptedVersionedCredentials(version) | ||
// Send the credentials of each version of the encrypted credentials to the saas grouped by version and credentialIds. | ||
// Note: proofOf Credentials have a separate credentialId but the issuerCredentials share one (because same credential data) | ||
/** | ||
* HACK ALERT: making this blocking to allow for the sake of SaaS ReceiptGroup handling which is currently unable to handle async requests. | ||
* Situation is such that receipt groups are created keyed on credentialIds. This is so the ReceiptGroup has a chance to resolve so can be keyed on credentialId across versions. | ||
*/ | ||
return [4 /*yield*/, sendEncryptedVersionedCredentials('4.0.0')]; | ||
case 6: | ||
// Send the credentials of each version of the encrypted credentials to the saas grouped by version and credentialIds. | ||
// Note: proofOf Credentials have a separate credentialId but the issuerCredentials share one (because same credential data) | ||
/** | ||
* HACK ALERT: making this blocking to allow for the sake of SaaS ReceiptGroup handling which is currently unable to handle async requests. | ||
* Situation is such that receipt groups are created keyed on credentialIds. This is so the ReceiptGroup has a chance to resolve so can be keyed on credentialId across versions. | ||
*/ | ||
_b.sent(); | ||
sendEncryptedVersionedCredentials('3.0.0') | ||
.catch(function (err) { | ||
logger_1.default.error("Error sending encrypted credentials to SaaS: " + ((err === null || err === void 0 ? void 0 : err.message) || JSON.stringify(err))); | ||
logger_1.default.error("Error sending v3 encrypted credentials to SaaS: " + ((err === null || err === void 0 ? void 0 : err.message) || JSON.stringify(err))); | ||
return undefined; | ||
}); }); | ||
// wait for all versioned requests to finish or fail | ||
return [4 /*yield*/, Promise.all(promises).catch(function (err) { | ||
// this log message should not trigger because the catch is handled in the map above | ||
logger_1.default.error("[ShouldNotBeTriggered] Error sending encrypted credentials to SaaS: " + ((err === null || err === void 0 ? void 0 : err.message) || JSON.stringify(err))); | ||
})]; | ||
case 6: | ||
// wait for all versioned requests to finish or fail | ||
_b.sent(); | ||
}); | ||
latestVersion = versionList_1.versionList[versionList_1.versionList.length - 1]; | ||
@@ -155,0 +162,0 @@ resultantCredentials = creds.filter(function (credPair) { return (credPair.version === latestVersion && credPair.encryptedCredential.subject === subjectDid); }).map(function (credPair) { return credPair.credential; }); |
{ | ||
"name": "@unumid/server-sdk", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:UnumID/Server-SDK-TypeScript.git", |
{ | ||
"name": "@unumid/server-sdk", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:UnumID/Server-SDK-TypeScript.git", |
@@ -95,17 +95,15 @@ import { configData } from '../config'; | ||
// loop through the versions list and send all the encrypted credentials to the saas grouped by version and credentialIds. | ||
// Send the credentials of each version of the encrypted credentials to the saas grouped by version and credentialIds. | ||
// Note: proofOf Credentials have a separate credentialId but the issuerCredentials share one (because same credential data) | ||
const promises = versionList.map( | ||
(version) => sendEncryptedVersionedCredentials(version) | ||
.catch((err) => { | ||
logger.error(`Error sending encrypted credentials to SaaS: ${err?.message || JSON.stringify(err)}`); | ||
return undefined; | ||
}) | ||
); | ||
/** | ||
* HACK ALERT: making this blocking to allow for the sake of SaaS ReceiptGroup handling which is currently unable to handle async requests. | ||
* Situation is such that receipt groups are created keyed on credentialIds. This is so the ReceiptGroup has a chance to resolve so can be keyed on credentialId across versions. | ||
*/ | ||
await sendEncryptedVersionedCredentials('4.0.0'); | ||
// wait for all versioned requests to finish or fail | ||
await Promise.all(promises).catch((err) => { | ||
// this log message should not trigger because the catch is handled in the map above | ||
logger.error(`[ShouldNotBeTriggered] Error sending encrypted credentials to SaaS: ${err?.message || JSON.stringify(err)}`); | ||
}); | ||
sendEncryptedVersionedCredentials('3.0.0') | ||
.catch((err) => { | ||
logger.error(`Error sending v3 encrypted credentials to SaaS: ${err?.message || JSON.stringify(err)}`); | ||
return undefined; | ||
}); | ||
@@ -112,0 +110,0 @@ // grab all the credentials of the latest version and that were issued to the subject (to prevent duplicates if also "issuedToSelf", the issuer) from the CredentialPairs for the response |
@@ -126,3 +126,3 @@ import { configData } from '../../src/config'; | ||
// expect(mockMakeNetworkRequest.mock.calls[0][0].data.encryptedCredentials.length).toEqual(2); | ||
expect(mockMakeNetworkRequest.mock.calls[0][0].header.version).toEqual('3.0.0'); | ||
expect(mockMakeNetworkRequest.mock.calls[0][0].header.version).toEqual('4.0.0'); | ||
}); | ||
@@ -129,0 +129,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1439799
17043