/** * Get Contact from PK (if we have it) * * @param {EcPk} pk PK to use to look up PPK * @return {EcPpk} PPK or null. * @memberOf EcIdentityManager * @method getContact * @static */ public static EcContact getContact(EcPk pk) { for (int i = 0; i < contacts.$length(); i++) { if (pk.equals(contacts.$get(i).pk)) { return contacts.$get(i); } } return null; }
/** * Get Identity from PK (if we have it) * * @param {EcPk} pk PK to use to look up PPK * @return {EcIdentity} identity or null. * @memberOf EcIdentityManager * @method getIdentity * @static */ public static EcIdentity getIdentity(EcPk pk) { for (int i = 0; i < ids.$length(); i++) { if (pk.equals(ids.$get(i).ppk.toPk())) { return ids.$get(i); } } return null; }
@Override public void $invoke(EcIdentity p1, final Callback0 incrementalSuccess) { EcPpk ppk = p1.ppk; EcPk pk = ppk.toPk(); boolean found = false; if (identityPksinPem != null) { for (int j = 0; j < identityPksinPem.$length(); j++) { EcPk ownerPpk = EcPk.fromPem(identityPksinPem.$get(j).trim()); if (pk.equals(ownerPpk)) { found = true; createSignatureAsync(duration, server, ppk, new Callback1<EbacSignature>() { @Override public void $invoke(EbacSignature p1) { signatures.push(p1.atIfy()); incrementalSuccess.$invoke(); } },failure); } } } if (!found) { incrementalSuccess.$invoke(); } } }, new Callback1<Array<EcIdentity>>() {
@Override public void $invoke(EcPk sub) { if (sub.equals(currentSubject)) { me.log(ip, "Matching Assertion found."); a.getAssertionDateAsync(new Callback1<Long>() {
/** * 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); }