dom/webauthn/PWebAuthnTransaction.ipdl
author Dave Townsend <dtownsend@oxymoronical.com>
Sun, 13 Jan 2019 17:44:29 -0800
changeset 453676 edca8877b0505cd1c31beaf6d907ca32e022aa52
parent 420502 7a8d360f8c818f8c762f68b795b151db629295a8
child 454832 828fe91e878b700d0135adb3f45a9554694e4498
permissions -rw-r--r--
Backing out Bug 1518799 (changeset eace4709948c) because the target page is not yet available. a=backout

/* 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/. */

/*
 * IPC Transaction protocol for the WebAuthn DOM API. This IPC protocol allows
 * the content process to call to the parent to access hardware for
 * authentication registration and challenges. All transactions start in the
 * child process, and the parent replies with a "Confirm*" message, or a
 * "Cancel" message if there was an error (no hardware available, no registered
 * keys, etc) or interruption (another transaction was started in another
 * content process). Similarly, the content process can also request a cancel,
 * either triggered explicitly by the user/script or due to UI events like
 * selecting a different tab.
 */

include protocol PBackground;

using struct mozilla::null_t from "ipc/IPCMessageUtils.h";

namespace mozilla {
namespace dom {

struct WebAuthnAuthenticatorSelection {
  bool requireResidentKey;
  bool requireUserVerification;
  bool requirePlatformAttachment;
};

struct WebAuthnScopedCredential {
  uint8_t[] id;
  uint8_t transports;
};

struct WebAuthnExtensionAppId {
  uint8_t[] AppId;
};

union WebAuthnExtension {
  WebAuthnExtensionAppId;
};

struct WebAuthnExtensionResultAppId {
  bool AppId;
};

union WebAuthnExtensionResult {
  WebAuthnExtensionResultAppId;
};

struct WebAuthnMakeCredentialExtraInfo {
  WebAuthnExtension[] Extensions;
  WebAuthnAuthenticatorSelection AuthenticatorSelection;
  bool RequestDirectAttestation;
};

union WebAuthnMaybeMakeCredentialExtraInfo {
  WebAuthnMakeCredentialExtraInfo;
  null_t;
};

struct WebAuthnMakeCredentialInfo {
  nsString Origin;
  nsString RpId;
  uint8_t[] Challenge;
  nsCString ClientDataJSON;
  uint32_t TimeoutMS;
  WebAuthnScopedCredential[] ExcludeList;
  WebAuthnMaybeMakeCredentialExtraInfo Extra;
};

struct WebAuthnMakeCredentialResult {
  nsCString ClientDataJSON;
  uint8_t[] AttestationObject;
  uint8_t[] KeyHandle;
  /* Might be empty if the token implementation doesn't support CTAP1. */
  uint8_t[] RegistrationData;
};

struct WebAuthnGetAssertionExtraInfo {
  WebAuthnExtension[] Extensions;
  bool RequireUserVerification;
};

union WebAuthnMaybeGetAssertionExtraInfo {
  WebAuthnGetAssertionExtraInfo;
  null_t;
};

struct WebAuthnGetAssertionInfo {
  nsString Origin;
  nsString RpId;
  uint8_t[] Challenge;
  nsCString ClientDataJSON;
  uint32_t TimeoutMS;
  WebAuthnScopedCredential[] AllowList;
  WebAuthnMaybeGetAssertionExtraInfo Extra;
};

struct WebAuthnGetAssertionResult {
  nsCString ClientDataJSON;
  uint8_t[] KeyHandle;
  uint8_t[] Signature;
  uint8_t[] AuthenticatorData;
  WebAuthnExtensionResult[] Extensions;
  /* Might be empty if the token implementation doesn't support CTAP1. */
  uint8_t[] SignatureData;
};

async protocol PWebAuthnTransaction {
  manager PBackground;

  parent:
    async RequestRegister(uint64_t aTransactionId, WebAuthnMakeCredentialInfo aTransactionInfo);
    async RequestSign(uint64_t aTransactionId, WebAuthnGetAssertionInfo aTransactionInfo);
    async RequestCancel(uint64_t aTransactionId);
    async DestroyMe();

  child:
    async __delete__();
    async ConfirmRegister(uint64_t aTransactionId, WebAuthnMakeCredentialResult aResult);
    async ConfirmSign(uint64_t aTransactionId, WebAuthnGetAssertionResult aResult);
    async Abort(uint64_t aTransactionId, nsresult Error);
};

}
}