use of im.actor.core.api.ApiEncyptedBoxKey in project actor-platform by actorapp.
the class EncryptedMsgActor method onDecrypt.
public void onDecrypt(int uid, ApiEncryptedMessage message) {
Log.d(TAG, "onDecrypt:" + uid);
final long start = im.actor.runtime.Runtime.getActorTime();
ArrayList<EncryptedBoxKey> encryptedBoxKeys = new ArrayList<EncryptedBoxKey>();
for (ApiEncyptedBoxKey key : message.getBox().getKeys()) {
if (key.getUsersId() == myUid()) {
encryptedBoxKeys.add(new EncryptedBoxKey(key.getUsersId(), key.getKeyGroupId(), key.getAlgType(), key.getEncryptedKey()));
}
}
final EncryptedBox encryptedBox = new EncryptedBox(encryptedBoxKeys.toArray(new EncryptedBoxKey[0]), message.getBox().getEncPackage());
// TODO: Implement
// ask(context().getEncryption().getEncryptedChatManager(uid), new EncryptedPeerActor.DecryptBox(encryptedBox), new AskCallback() {
// @Override
// public void onResult(Object obj) {
// Log.d(TAG, "onDecrypt:onResult in " + (Runtime.getActorTime() - start) + " ms");
// EncryptedPeerActor.DecryptBoxResponse re = (EncryptedPeerActor.DecryptBoxResponse) obj;
// try {
// ApiMessage message = ApiMessage.fromBytes(re.getData());
// Log.d(TAG, "onDecrypt:onResult " + message);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public void onError(Exception e) {
// Log.d(TAG, "onDecrypt:onError");
// e.printStackTrace();
// }
// });
}
Aggregations