dom/webidl/RTCIdentityProvider.webidl
author James Cheng <jacheng@mozilla.com>
Fri, 05 Aug 2016 13:23:44 -0400
changeset 308428 8ee6f2eb8b349a351f6f76585eb85e0ec2b5c475
parent 290187 f1ad49c0b7219e69880fc23fd0d018e5b8ec72a8
child 411707 50c255c237f1bf3d12fa8367395ee314d306963e
permissions -rw-r--r--
Bug 1291229 - Fix typo for moving Java bindings to mozilla::java namespace. r=jchen MozReview-Commit-ID: KGAS6EhnwAI

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * http://w3c.github.io/webrtc-pc/ (with https://github.com/w3c/webrtc-pc/pull/178)
 */

[NoInterfaceObject]
interface RTCIdentityProviderRegistrar {
  void register(RTCIdentityProvider idp);

  /* Whether an IdP was passed to register() to chrome code. */
  [ChromeOnly]
  readonly attribute boolean hasIdp;
  /* The following two chrome-only functions forward to the corresponding
   * function on the registered IdP.  This is necessary because the
   * JS-implemented WebIDL can't see these functions on `idp` above, chrome JS
   * gets an Xray onto the content code that suppresses functions, see
   * https://developer.mozilla.org/en-US/docs/Xray_vision#Xrays_for_JavaScript_objects
   */
  /* Forward to idp.generateAssertion() */
  [ChromeOnly, Throws]
  Promise<RTCIdentityAssertionResult>
  generateAssertion(DOMString contents, DOMString origin,
                    optional DOMString usernameHint);
  /* Forward to idp.validateAssertion() */
  [ChromeOnly, Throws]
  Promise<RTCIdentityValidationResult>
  validateAssertion(DOMString assertion, DOMString origin);
};

dictionary RTCIdentityProvider {
  required GenerateAssertionCallback generateAssertion;
  required ValidateAssertionCallback validateAssertion;
};

callback GenerateAssertionCallback =
  Promise<RTCIdentityAssertionResult>
    (DOMString contents, DOMString origin, optional DOMString usernameHint);
callback ValidateAssertionCallback =
  Promise<RTCIdentityValidationResult> (DOMString assertion, DOMString origin);

dictionary RTCIdentityAssertionResult {
  required RTCIdentityProviderDetails idp;
  required DOMString assertion;
};

dictionary RTCIdentityProviderDetails {
  required DOMString domain;
  DOMString protocol = "default";
};

dictionary RTCIdentityValidationResult {
  required DOMString identity;
  required DOMString contents;
};