Class WebPushSubscription

Object
org.mozilla.geckoview.WebPushSubscription
All Implemented Interfaces:
Parcelable

public class WebPushSubscription extends Object implements Parcelable
This class represents a single Web Push subscription, as described in the Web Push API specification.

This is a low-level interface, allowing applications to do all of the heavy lifting themselves. It is recommended that consumers have a thorough understanding of the Web Push API, especially RFC 8291.

Only trivial sanity checks are performed on the values held here. The application must ensure it is generating compliant keys/secrets itself.

  • Field Details

    • scope

      @NonNull public final String scope
      The Service Worker scope associated with this subscription.
      See Also:
    • endpoint

      @NonNull public final String endpoint
      The Web Push endpoint for this subscription. This is the URL of a web service which implements the Web Push protocol.
      See Also:
    • appServerKey

      @Nullable public final byte[] appServerKey
      This is an optional public key provided by the application server to authenticate itself with the endpoint, formatted according to X9.62.

      This key is used for VAPID, the Voluntary Application Server Identification (VAPID) for Web Push, from RFC 8292.

      See Also:
    • browserPublicKey

      @NonNull public final byte[] browserPublicKey
      The P-256 EC public key, formatted as X9.62, generated by the embedder, to be provided to the app server for message encryption.
      See Also:
    • authSecret

      @NonNull public final byte[] authSecret
      16 byte secret key, generated by the embedder, to be provided to the app server for use in encrypting and authenticating messages sent to the endpoint.
      See Also:
    • CREATOR

      public static final Parcelable.Creator<WebPushSubscription> CREATOR
  • Constructor Details

    • WebPushSubscription

      public WebPushSubscription(@NonNull String scope, @NonNull String endpoint, @Nullable byte[] appServerKey, @NonNull byte[] browserPublicKey, @NonNull byte[] authSecret)
  • Method Details