package app.fedilab.android.helper; import android.content.Context; import android.util.Base64; import org.unifiedpush.android.connector.Registration; import java.util.List; import java.util.Random; import app.fedilab.android.activities.BaseMainActivity; import app.fedilab.android.client.Entities.Account; public class PushNotifications { public void registerPushNotifications(Context context, Account account, String endpoint, String server_key) { ECDH ecdh = new ECDH(); String pubKey = ecdh.getPublicKey(context, account); byte[] randBytes = new byte[16]; new Random().nextBytes(randBytes); String auth = Base64.encodeToString(randBytes, Base64.DEFAULT); //register ecdh.saveServerKey(context, server_key); } public static void getDistributors(Context context) { List distributors = new Registration().getDistributors(context); if (distributors.isEmpty()) { } else { } } public void displayNotification(Context context, Account account, String ciphered) { ECDH ecdh = new ECDH(); byte[] secret = ecdh.getSecret(context, account); //process with the event // https://openacs.org/webpush-demo/report.html // decrypt using AES 128 GCM } }