Skip to content

push.subscribe

Adds a device’s push subscription, or replaces the one of the same endpoint (PRT-242).

/** `push.subscribe` params (PRT-242): a device's push subscription; the same endpoint again replaces it. */
export type PushSubscribeParams = {
/** The push service's URL for this device (`https:`). */
endpoint: string;
keys: PushSubscriptionKeys;
/** What the device is, for `push.devices` (e.g. the browser's user agent). */
label?: string | null;
};
/** No params, or the `{}` result. */
export type Empty = Record<string, never>;
/** A push subscription's keys, as `PushSubscription.toJSON().keys` gives them (unpadded base64url). */
export type PushSubscriptionKeys = {
/** The device's 16-byte authentication secret. */
auth: string;
/** The device's P-256 public key, uncompressed. */
p256dh: string;
};