From 2945d52cd54cd77f7514d2633aa0a1b6931f653b Mon Sep 17 00:00:00 2001 From: Kyle Machulis Date: Wed, 19 Apr 2017 16:19:28 -0700 Subject: [PATCH] Bug 1323339 - IPDL for WebAuthn Protocol and PBackground additions; r=jcj r=baku MozReview-Commit-ID: 3WzTVZEdjia --- dom/webauthn/PWebAuthnTransaction.ipdl | 56 ++++++++++++++++++++++++++ dom/webauthn/moz.build | 4 ++ ipc/glue/PBackground.ipdl | 4 ++ 3 files changed, 64 insertions(+) create mode 100644 dom/webauthn/PWebAuthnTransaction.ipdl diff --git a/dom/webauthn/PWebAuthnTransaction.ipdl b/dom/webauthn/PWebAuthnTransaction.ipdl new file mode 100644 index 000000000000..473f17d4a0d4 --- /dev/null +++ b/dom/webauthn/PWebAuthnTransaction.ipdl @@ -0,0 +1,56 @@ +/* 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; + +namespace mozilla { +namespace dom { + +struct WebAuthnScopedCredentialDescriptor { + // Converted from mozilla::dom::ScopedCredentialType enum + uint32_t type; + uint8_t[] id; + // Converted from mozilla::dom::WebAuthnTransport enum + uint32_t[] transports; +}; + +struct WebAuthnExtension { + /* TODO Fill in with predefined extensions */ +}; + +struct WebAuthnTransactionInfo { + uint8_t[] RpIdHash; + uint8_t[] ClientDataHash; + uint32_t TimeoutMS; + WebAuthnScopedCredentialDescriptor[] Descriptors; + WebAuthnExtension[] Extensions; +}; + +async protocol PWebAuthnTransaction { + manager PBackground; + parent: + async __delete__(); + async RequestRegister(WebAuthnTransactionInfo aTransactionInfo); + async RequestSign(WebAuthnTransactionInfo aTransactionInfo); + async RequestCancel(); + child: + async ConfirmRegister(uint8_t[] RegBuffer, uint8_t[] SigBuffer); + async ConfirmSign(uint8_t[] CredentialID, uint8_t[] ReplyBuffer); + async Cancel(nsresult Error); +}; + +} +} diff --git a/dom/webauthn/moz.build b/dom/webauthn/moz.build index bebaba8301f4..69a9f2673697 100644 --- a/dom/webauthn/moz.build +++ b/dom/webauthn/moz.build @@ -7,6 +7,10 @@ with Files("**"): BUG_COMPONENT = ("Core", "DOM: Device Interfaces") +IPDL_SOURCES += [ + 'PWebAuthnTransaction.ipdl' +] + EXPORTS.mozilla.dom += [ 'NSSU2FTokenRemote.h', 'ScopedCredential.h', diff --git a/ipc/glue/PBackground.ipdl b/ipc/glue/PBackground.ipdl index 6e472b311c5b..b26c52dc5cd4 100644 --- a/ipc/glue/PBackground.ipdl +++ b/ipc/glue/PBackground.ipdl @@ -23,6 +23,7 @@ include protocol PQuota; include protocol PChildToParentStream; include protocol PParentToChildStream; include protocol PServiceWorkerManager; +include protocol PWebAuthnTransaction; include protocol PUDPSocket; include protocol PVsync; @@ -69,6 +70,7 @@ sync protocol PBackground manages PChildToParentStream; manages PParentToChildStream; manages PServiceWorkerManager; + manages PWebAuthnTransaction; manages PUDPSocket; manages PVsync; @@ -116,6 +118,8 @@ parent: async PMemoryStream(uint64_t aSize); + async PWebAuthnTransaction(); + child: async PCache(); async PCacheStreamControl();