Bug 1685822 [wpt PR 27117] - [Import Maps] Add tests for rejecting multiple import...
[gecko.git] / dom / webauthn / PWebAuthnTransaction.ipdl
blob906c686824726c6b17bd5a89d88bbabbe1057f1e
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/. */
5 /*
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.
15  */
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";
24 namespace mozilla {
25 namespace dom {
27 struct WebAuthnAuthenticatorSelection {
28   bool requireResidentKey;
29   UserVerificationRequirement userVerificationRequirement;
30   AuthenticatorAttachment? authenticatorAttachment;
33 struct WebAuthnScopedCredential {
34   uint8_t[] id;
35   uint8_t transports;
38 struct WebAuthnExtensionAppId {
39   uint8_t[] AppId;
40   nsString appIdentifier;
43 struct WebAuthnExtensionHmacSecret {
44   bool hmacCreateSecret;
47 union WebAuthnExtension {
48   WebAuthnExtensionAppId;
49   WebAuthnExtensionHmacSecret;
52 struct WebAuthnExtensionResultAppId {
53   bool AppId;
56 struct WebAuthnExtensionResultHmacSecret {
57   bool hmacCreateSecret;
60 union WebAuthnExtensionResult {
61   WebAuthnExtensionResultAppId;
62   WebAuthnExtensionResultHmacSecret;
65 struct WebAuthnMakeCredentialRpInfo {
66   nsString Name;
67   nsString Icon;
70 struct WebAuthnMakeCredentialUserInfo {
71   uint8_t[] Id;
72   nsString Name;
73   nsString Icon;
74   nsString DisplayName;
77 struct CoseAlg {
78   long alg;
81 struct WebAuthnMakeCredentialExtraInfo {
82   WebAuthnMakeCredentialRpInfo Rp;
83   WebAuthnMakeCredentialUserInfo User;
84   CoseAlg[] coseAlgs;
85   WebAuthnExtension[] Extensions;
86   WebAuthnAuthenticatorSelection AuthenticatorSelection;
87   AttestationConveyancePreference attestationConveyancePreference;
90 struct WebAuthnMakeCredentialInfo {
91   nsString Origin;
92   nsString RpId;
93   uint8_t[] Challenge;
94   nsCString ClientDataJSON;
95   uint32_t TimeoutMS;
96   WebAuthnScopedCredential[] ExcludeList;
97   WebAuthnMakeCredentialExtraInfo? Extra;
98   uint64_t BrowsingContextId;
101 struct WebAuthnMakeCredentialResult {
102   nsCString ClientDataJSON;
103   uint8_t[] AttestationObject;
104   uint8_t[] KeyHandle;
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 {
116   nsString Origin;
117   nsString RpId;
118   uint8_t[] Challenge;
119   nsCString ClientDataJSON;
120   uint32_t TimeoutMS;
121   WebAuthnScopedCredential[] AllowList;
122   WebAuthnGetAssertionExtraInfo? Extra;
123   uint64_t BrowsingContextId;
126 struct WebAuthnGetAssertionResult {
127   nsCString ClientDataJSON;
128   uint8_t[] KeyHandle;
129   uint8_t[] Signature;
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 {
138   manager PBackground;
140   parent:
141     async RequestRegister(uint64_t aTransactionId, WebAuthnMakeCredentialInfo aTransactionInfo);
142     async RequestSign(uint64_t aTransactionId, WebAuthnGetAssertionInfo aTransactionInfo);
143     async RequestCancel(uint64_t aTransactionId);
144     async DestroyMe();
146   child:
147     async __delete__();
148     async ConfirmRegister(uint64_t aTransactionId, WebAuthnMakeCredentialResult aResult);
149     async ConfirmSign(uint64_t aTransactionId, WebAuthnGetAssertionResult aResult);
150     async Abort(uint64_t aTransactionId, nsresult Error);