public class PushService
extends java.lang.Object
| Constructor and Description |
|---|
PushService() |
PushService(java.security.KeyPair keyPair,
java.lang.String subject) |
PushService(java.lang.String gcmApiKey) |
PushService(java.lang.String publicKey,
java.lang.String privateKey,
java.lang.String subject) |
| Modifier and Type | Method and Description |
|---|---|
static Encrypted |
encrypt(byte[] buffer,
java.security.PublicKey userPublicKey,
byte[] userAuth,
int padSize)
Encrypt the payload using the user's public key using Elliptic Curve
Diffie Hellman cryptography over the prime256v1 curve.
|
org.apache.http.HttpResponse |
send(Notification notification)
Send a notification and wait for the response.
|
java.util.concurrent.Future<org.apache.http.HttpResponse> |
sendAsync(Notification notification)
Send a notification, but don't wait for the response.
|
PushService |
setGcmApiKey(java.lang.String gcmApiKey)
Set the Google Cloud Messaging (GCM) API key
|
PushService |
setKeyPair(java.security.KeyPair keyPair)
Set the public and private key (for VAPID).
|
PushService |
setPrivateKey(java.security.PrivateKey privateKey)
Set the private key (for VAPID)
|
PushService |
setPublicKey(java.security.PublicKey publicKey)
Set the public key (for VAPID)
|
PushService |
setSubject(java.lang.String subject)
Set the JWT subject (for VAPID)
|
protected boolean |
vapidEnabled()
Check if VAPID is enabled
|
public PushService()
public PushService(java.lang.String gcmApiKey)
public PushService(java.security.KeyPair keyPair,
java.lang.String subject)
public PushService(java.lang.String publicKey,
java.lang.String privateKey,
java.lang.String subject)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static Encrypted encrypt(byte[] buffer, java.security.PublicKey userPublicKey, byte[] userAuth, int padSize) throws java.security.GeneralSecurityException, java.io.IOException
java.security.GeneralSecurityExceptionjava.io.IOExceptionpublic org.apache.http.HttpResponse send(Notification notification) throws java.security.GeneralSecurityException, java.io.IOException, org.jose4j.lang.JoseException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
notification - java.security.GeneralSecurityExceptionjava.io.IOExceptionorg.jose4j.lang.JoseExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionpublic java.util.concurrent.Future<org.apache.http.HttpResponse> sendAsync(Notification notification) throws java.security.GeneralSecurityException, java.io.IOException, org.jose4j.lang.JoseException
notification - java.security.GeneralSecurityExceptionjava.io.IOExceptionorg.jose4j.lang.JoseExceptionpublic PushService setGcmApiKey(java.lang.String gcmApiKey)
gcmApiKey - public PushService setSubject(java.lang.String subject)
subject - public PushService setKeyPair(java.security.KeyPair keyPair)
keyPair - public PushService setPublicKey(java.security.PublicKey publicKey)
publicKey - public PushService setPrivateKey(java.security.PrivateKey privateKey)
privateKey - protected boolean vapidEnabled()