cassproject 0.5.32 → 0.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -301,7 +301,7 @@ global.jsonld = require("jsonld");
|
|
|
301
301
|
toSignableJson() {
|
|
302
302
|
var d = JSON.parse(this.toJson());
|
|
303
303
|
if (
|
|
304
|
-
this.type.indexOf("http://schema.eduworks.com/")
|
|
304
|
+
this.type.indexOf("http://schema.eduworks.com/") == 0 &&
|
|
305
305
|
this.type.indexOf("/0.1/") != -1
|
|
306
306
|
) {
|
|
307
307
|
delete d["signature"];
|
|
@@ -147,13 +147,7 @@ module.exports = class EcOrganization extends schema.Organization {
|
|
|
147
147
|
async addOrgKey(newOrgPpk) {
|
|
148
148
|
var orgKeys = await this.getOrgKeys();
|
|
149
149
|
orgKeys.push(newOrgPpk);
|
|
150
|
-
|
|
151
|
-
this.ppkListToPemArrayString(orgKeys),
|
|
152
|
-
EcOrganization.ORG_PPK_SET_KEY,
|
|
153
|
-
this.owner,
|
|
154
|
-
this.reader
|
|
155
|
-
);
|
|
156
|
-
this[EcOrganization.ORG_PPK_SET_KEY] = newKeys;
|
|
150
|
+
this[EcOrganization.ORG_PPK_SET_KEY] = orgKeys;
|
|
157
151
|
}
|
|
158
152
|
/**
|
|
159
153
|
* Performs a rekey operation and saves the organization details to the server
|
|
@@ -248,13 +242,15 @@ module.exports = class EcOrganization extends schema.Organization {
|
|
|
248
242
|
async getOrgKeys(eim) {
|
|
249
243
|
var orgKeys = [];
|
|
250
244
|
var o = this[EcOrganization.ORG_PPK_SET_KEY];
|
|
251
|
-
if (o != null) {
|
|
245
|
+
if (o != null && (o.type === 'EncryptedValue' || o["@type"] === 'EncryptedValue')) {
|
|
252
246
|
var ev = new EcEncryptedValue();
|
|
253
247
|
ev.copyFrom(o);
|
|
254
248
|
var orgKeysPPKPems = JSON.parse(await ev.decryptIntoString(null, null, eim));
|
|
255
249
|
for (var i = 0; i < orgKeysPPKPems.length; i++) {
|
|
256
250
|
orgKeys.push(EcPpk.fromPem(orgKeysPPKPems[i]));
|
|
257
251
|
}
|
|
252
|
+
} else if (o) {
|
|
253
|
+
orgKeys = o;
|
|
258
254
|
}
|
|
259
255
|
return orgKeys;
|
|
260
256
|
}
|