1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/push-api/
12 enum PushEncryptionKeyName
18 dictionary PushSubscriptionKeys
24 dictionary PushSubscriptionJSON
27 // FIXME: bug 1493860: should this "= {}" be here? For that matter, this
28 // PushSubscriptionKeys thing is not even in the spec; "keys" is a record
30 PushSubscriptionKeys keys = {};
31 EpochTimeStamp? expirationTime;
34 dictionary PushSubscriptionInit
36 required USVString endpoint;
37 required USVString scope;
38 ArrayBuffer? p256dhKey;
39 ArrayBuffer? authSecret;
40 BufferSource? appServerKey;
41 EpochTimeStamp? expirationTime = null;
44 [Exposed=(Window,Worker), Func="ServiceWorkerVisible"]
45 interface PushSubscription
48 constructor(PushSubscriptionInit initDict);
50 readonly attribute USVString endpoint;
51 readonly attribute PushSubscriptionOptions options;
52 readonly attribute EpochTimeStamp? expirationTime;
54 ArrayBuffer? getKey(PushEncryptionKeyName name);
55 [NewObject, UseCounter]
56 Promise<boolean> unsubscribe();
58 // Implements the custom serializer specified in Push API, section 9.
60 PushSubscriptionJSON toJSON();