@Override public void $invoke(String decryptedSecret) { if (!EcLinkedData.isProbablyJson(decryptedSecret)) { me.decryptSecretsByKeyAsync(decryptionKey, success, failure); } else { success.$invoke(EbacEncryptedSecret.fromEncryptableJson(JSGlobal.JSON.parse(decryptedSecret))); } } }, new Callback1<String>() {
@Override public void $invoke(Object o) { try { me.configuration = Global.JSON.parse(Global.JSON.stringify(o)); hello.init(o); me.oauthEnabled = true; initialized.$invoke(); } catch (Exception ex) { me.oauthEnabled = false; } } }, new Callback1<String>() {
private EbacEncryptedSecret tryDecryptSecretByKeyAndIndex(EcPpk decryptionKey, int j) { String decryptedSecret = null; decryptedSecret = EcRsaOaep.decrypt(decryptionKey, this.secret.$get(j)); if (EcLinkedData.isProbablyJson(decryptedSecret)) { EbacEncryptedSecret encryptedSecret = EbacEncryptedSecret.fromEncryptableJson(JSGlobal.JSON.parse(decryptedSecret)); return encryptedSecret; } return null; }
/** * Decrypts this encrypted value into an object * * @return The Decrypted Object * @memberOf EcEncryptedValue * @method decryptIntoObject */ public EcRemoteLinkedData decryptIntoObject() { String decryptRaw = decryptIntoString(); if (decryptRaw == null) { return null; } if (!EcLinkedData.isProbablyJson(decryptRaw)) { return null; } EcRemoteLinkedData decrypted = new EcRemoteLinkedData("", ""); decrypted.copyFrom((EcRemoteLinkedData) JSGlobal.JSON.parse(decryptRaw)); encryptOnSave(decrypted.id, true); decrypted.id = this.id; return (EcRemoteLinkedData) decrypted.deAtify(); }
@Override public void $invoke(String decryptRaw) { if (decryptRaw == null) { failure.$invoke("Could not decrypt data."); } if (!EcLinkedData.isProbablyJson(decryptRaw)) { failure.$invoke("Could not decrypt data."); } EcRemoteLinkedData decrypted = new EcRemoteLinkedData("", ""); decrypted.copyFrom((EcRemoteLinkedData) JSGlobal.JSON.parse(decryptRaw)); encryptOnSave(decrypted.id, true); success.$invoke((EcRemoteLinkedData) decrypted.deAtify()); } }, failure);
@Override public void $invoke(String decryptRaw) { if (decryptRaw == null) { failure.$invoke("Could not decrypt data."); } if (!EcLinkedData.isProbablyJson(decryptRaw)) { failure.$invoke("Could not decrypt data."); } EcRemoteLinkedData decrypted = new EcRemoteLinkedData("", ""); decrypted.copyFrom((EcRemoteLinkedData) JSGlobal.JSON.parse(decryptRaw)); encryptOnSave(decrypted.id, true); decrypted.id = id; success.$invoke((EcRemoteLinkedData) decrypted.deAtify()); } }, failure);
if (key.startsWith(stripNamespace + ":")) { if (EcArray.isArray(me.$get(key))) { JSObjectAdapter.$put(me, key.replace(stripNamespace + ":", ""), Global.JSON.parse(Global.JSON.stringify(me.$get(key)).replaceAll(stripNamespace + ":", ""))); } else if (EcObject.isObject(me.$get(key))) { JSObjectAdapter.$put(me, key.replace(stripNamespace + ":", ""), Global.JSON.parse(Global.JSON.stringify(me.$get(key)).replaceAll(stripNamespace + ":", ""))); } else JSObjectAdapter.$put(me, key.replace(stripNamespace + ":", ""), me.$get(key));
/** * Encodes the object in a form where it is ready to be signed. * This method is under long term review, and may change from version to version. * * @return ASCII-sort order encoded space-free and tab-free JSON-LD. * @method toSignableJson */ public String toSignableJson() { EcLinkedData d = (EcLinkedData) JSGlobal.JSON.parse(toJson()); if (type.indexOf("http://schema.eduworks.com/") != -1 && type.indexOf("/0.1/") != -1) { JSObjectAdapter.$properties(d).$delete("@signature"); JSObjectAdapter.$properties(d).$delete("@owner"); JSObjectAdapter.$properties(d).$delete("@reader"); JSObjectAdapter.$properties(d).$delete("@id"); } else { // Whom else has signed the object does not change the contents of // the object. JSObjectAdapter.$properties(d).$delete("@signature"); // Where the object resides does not change the contents of the // object, and provides server administration capabilities. JSObjectAdapter.$properties(d).$delete("@id"); // Who owns the object, or who can read the object *does* matter // though, as administrators should not be able to change the // ownership properties of the object in a clandestine fashion. } EcLinkedData e = new EcLinkedData(d.context, d.type); e.copyFrom(d); return e.toJson(); }
/** * Sets the subject of an assertion. Makes a few assumptions: Owners of the * object should be able to see and change the encrypted value. Owners and * readers of the object should be persisted. * * @param pk */ public void setSubject(EcPk pk) { Array<String> owners = new Array<String>(); Array<String> readers = null; if (reader == null) readers = new Array<String>(); else readers = (Array) Global.JSON.parse(Global.JSON.stringify(reader)); if (subject != null) { if (subject.owner != null) owners.concat(subject.owner); if (subject.reader != null) readers.concat(subject.reader); } if (owner != null) owners = owners.concat(owner); readers.push(pk.toPem()); subject = EcEncryptedValue.encryptValue(pk.toPem(), id, owners, readers); }
return; Array<Object> c = (Array<Object>) JSGlobal.JSON.parse((String) localStore); for (int i = 0; i < c.$length(); i++) { EcContact contact = new EcContact();
return; Array<Object> c = (Array<Object>) JSGlobal.JSON.parse((String) localStore); for (int i = 0; i < c.$length(); i++) { EcIdentity identity = new EcIdentity();