public String getJsonString() { return Global.JSON.stringify(this); }
public String getJsonString() { return Global.JSON.stringify(this); }
/** * Serializes this object to JSON. * * @return {string} JSON formatted object (with JSON-LD fields). * @method toJson */ public String toJson() { // This method serializes the fields in alphabetical order. // This is to prevent signature based errors. Object o = atIfy(); return JSGlobal.JSON.stringify(o); }
@Override public void $invoke(Array<EcIdentity> pks) { success.$invoke(JSGlobal.JSON.stringify(signatures)); } });
@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>() {
@Override public void $invoke(Object p1) { EcRemoteLinkedData d = new EcRemoteLinkedData("", ""); d.copyFrom(p1); if (d.getFullType() == null) { EcRepository.findBlocking(originalUrl, Global.JSON.stringify(p1), new Object(), 0); return; } JSObjectAdapter.$put(cache, originalUrl, d); if (d.id != null) JSObjectAdapter.$put(cache, d.id, d); } }, new Callback1<String>() {
/** * Serializes the field into a compact form for RSA encryption. * * @return {string} string * @method toEncryptableJson */ public String toEncryptableJson() { Map<String, Object> o = JSObjectAdapter.$properties(new Object()); o.$put("v", iv); if (id != null) o.$put("d", id); o.$put("s", secret); if (field != null) o.$put("f", field); return JSGlobal.JSON.stringify(o); }
private static void getHandleData(Object p1, String originalUrl, Callback1<EcRemoteLinkedData> success, Callback1<String> failure, String finalUrl) { JSObjectAdapter.$properties(fetching).$delete(originalUrl); EcRemoteLinkedData d = new EcRemoteLinkedData("", ""); d.copyFrom(p1); if (d.getFullType() == null) { EcRepository.find(originalUrl, Global.JSON.stringify(p1), new Object(), 0, success, failure); return; } if (caching) { JSObjectAdapter.$put(cache, finalUrl, d); if (d.id != null) JSObjectAdapter.$put(cache, d.id, d); //See eduworks/ec#1 - fray. //JSObjectAdapter.$put(cache, d.shortId(), d); } success.$invoke(d); }
@Override public void $invoke(Array<EcIdentity> pks) { Array cache = null; String stringified = JSGlobal.JSON.stringify(signatures); if (signatureSheetCaching) { cache = new Array(); cache.$set(0, new Date().getTime() + finalDuration); cache.$set(1, stringified); JSObjectAdapter.$put(signatureSheetCache, server, cache); } success.$invoke(stringified); } });
/** * Writes contact data to localstorage. * * @memberOf EcIdentityManager * @method saveIdentities * @static */ public static void saveIdentities() { Array<Object> c = new Array<Object>(); for (int i = 0; i < ids.$length(); i++) { Object o = new Object(); Map<String, Object> props = JSObjectAdapter.$properties(o); EcIdentity identity = ids.$get(i); props.$put("displayName", identity.displayName); props.$put("ppk", identity.ppk.toPem()); props.$put("source", identity.source); c.push(o); } Global.localStorage.$put("identities", JSGlobal.JSON.stringify(c)); }
/** * Writes contact data to localstorage. * * @memberOf EcIdentityManager * @method saveContacts * @static */ private static void saveContacts() { Array<Object> c = new Array<Object>(); for (int i = 0; i < contacts.$length(); i++) { Object o = new Object(); Map<String, Object> props = JSObjectAdapter.$properties(o); EcContact contact = contacts.$get(i); props.$put("displayName", contact.displayName); props.$put("pk", contact.pk.toPem()); props.$put("source", contact.source); c.push(o); } Global.localStorage.$put("contacts", JSGlobal.JSON.stringify(c)); }
/** * Create a signature sheet, authorizing movement of data outside of our * control. * * @param {String[]} identityPksinPem Which identities to create signatures * for. * @param {long} duration Length of time in milliseconds to authorize * control. * @param {String} server Server that we are authorizing. * @return {String} JSON Array containing signatures. * @memberOf EcIdentityManager * @method signatureSheetFor * @static */ public static String signatureSheetFor(Array<String> identityPksinPem, long duration, String server) { Array<Object> signatures = new Array<Object>(); for (int j = 0; j < ids.$length(); j++) { EcPpk ppk = ids.$get(j).ppk; EcPk pk = ppk.toPk(); if (identityPksinPem != null) { for (int i = 0; i < identityPksinPem.$length(); i++) { EcPk ownerPpk = EcPk.fromPem(identityPksinPem.$get(i).trim()); if (pk.equals(ownerPpk)) { signatures.push(createSignature(duration, server, ppk).atIfy()); } } } } return JSGlobal.JSON.stringify(signatures); }
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));
fd.append("data", Global.JSON.stringify(cacheUrls)); final EcRepository me = this; if (unsigned) {
/** * 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); }
cacheKey = JSGlobal.JSON.stringify(paramProps) + query; if (JSObjectAdapter.$get(cache, cacheKey) != null) { handleSearchResults((Array<EcRemoteLinkedData>) JSObjectAdapter.$get(cache, cacheKey), eachSuccess, success, failure); fd.append("data", query); if (params != null) { fd.append("searchParams", Global.JSON.stringify(params));
signatures.push(createSignature(duration, server, ppk).atIfy()); String stringified = JSGlobal.JSON.stringify(signatures); if (signatureSheetCaching) { cache = new Array();