1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 * IPC Transaction protocol for the WebAuthn DOM API. This IPC protocol allows
7 * the content process to call to the parent to access hardware for
8 * authentication registration and challenges. All transactions start in the
9 * child process, and the parent replies with a "Confirm*" message, or a
10 * "Cancel" message if there was an error (no hardware available, no registered
11 * keys, etc) or interruption (another transaction was started in another
12 * content process). Similarly, the content process can also request a cancel,
13 * either triggered explicitly by the user/script or due to UI events like
14 * selecting a different tab.
17 include protocol PBackground;
19 using mozilla::dom::AttestationConveyancePreference from "mozilla/dom/WebAuthnUtil.h";
20 using mozilla::dom::AuthenticatorAttachment from "mozilla/dom/WebAuthnUtil.h";
21 using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
22 using mozilla::dom::UserVerificationRequirement from "mozilla/dom/WebAuthnUtil.h";
27 struct WebAuthnAuthenticatorSelection {
28 bool requireResidentKey;
29 UserVerificationRequirement userVerificationRequirement;
30 AuthenticatorAttachment? authenticatorAttachment;
33 struct WebAuthnScopedCredential {
38 struct WebAuthnExtensionAppId {
40 nsString appIdentifier;
43 struct WebAuthnExtensionHmacSecret {
44 bool hmacCreateSecret;
47 union WebAuthnExtension {
48 WebAuthnExtensionAppId;
49 WebAuthnExtensionHmacSecret;
52 struct WebAuthnExtensionResultAppId {
56 struct WebAuthnExtensionResultHmacSecret {
57 bool hmacCreateSecret;
60 union WebAuthnExtensionResult {
61 WebAuthnExtensionResultAppId;
62 WebAuthnExtensionResultHmacSecret;
65 struct WebAuthnMakeCredentialRpInfo {
70 struct WebAuthnMakeCredentialUserInfo {
81 struct WebAuthnMakeCredentialExtraInfo {
82 WebAuthnMakeCredentialRpInfo Rp;
83 WebAuthnMakeCredentialUserInfo User;
85 WebAuthnExtension[] Extensions;
86 WebAuthnAuthenticatorSelection AuthenticatorSelection;
87 AttestationConveyancePreference attestationConveyancePreference;
90 struct WebAuthnMakeCredentialInfo {
94 nsCString ClientDataJSON;
96 WebAuthnScopedCredential[] ExcludeList;
97 WebAuthnMakeCredentialExtraInfo? Extra;
98 uint64_t BrowsingContextId;
101 struct WebAuthnMakeCredentialResult {
102 nsCString ClientDataJSON;
103 uint8_t[] AttestationObject;
105 /* Might be empty if the token implementation doesn't support CTAP1. */
106 uint8_t[] RegistrationData;
107 WebAuthnExtensionResult[] Extensions;
110 struct WebAuthnGetAssertionExtraInfo {
111 WebAuthnExtension[] Extensions;
112 UserVerificationRequirement userVerificationRequirement;
115 struct WebAuthnGetAssertionInfo {
119 nsCString ClientDataJSON;
121 WebAuthnScopedCredential[] AllowList;
122 WebAuthnGetAssertionExtraInfo? Extra;
123 uint64_t BrowsingContextId;
126 struct WebAuthnGetAssertionResult {
127 nsCString ClientDataJSON;
130 uint8_t[] AuthenticatorData;
131 WebAuthnExtensionResult[] Extensions;
132 /* Might be empty if the token implementation doesn't support CTAP1. */
133 uint8_t[] SignatureData;
134 uint8_t[] UserHandle;
137 async protocol PWebAuthnTransaction {
141 async RequestRegister(uint64_t aTransactionId, WebAuthnMakeCredentialInfo aTransactionInfo);
142 async RequestSign(uint64_t aTransactionId, WebAuthnGetAssertionInfo aTransactionInfo);
143 async RequestCancel(uint64_t aTransactionId);
148 async ConfirmRegister(uint64_t aTransactionId, WebAuthnMakeCredentialResult aResult);
149 async ConfirmSign(uint64_t aTransactionId, WebAuthnGetAssertionResult aResult);
150 async Abort(uint64_t aTransactionId, nsresult Error);