Bug 1874684 - Part 6: Limit day length calculations to safe integers. r=mgaudet
[gecko.git] / dom / webauthn / PWebAuthnTransaction.ipdl
blob229fb7899d1edc2c260595f2bd828b62d25ebc70
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::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
21 namespace mozilla {
22 namespace dom {
24 struct WebAuthnAuthenticatorSelection {
25   nsString residentKey;
26   nsString userVerificationRequirement;
27   nsString? authenticatorAttachment;
30 struct WebAuthnScopedCredential {
31   uint8_t[] id;
32   uint8_t transports;
35 struct WebAuthnExtensionAppId {
36   nsString appIdentifier;
39 struct WebAuthnExtensionCredProps {
40   bool credProps;
43 struct WebAuthnExtensionHmacSecret {
44   bool hmacCreateSecret;
47 struct WebAuthnExtensionMinPinLength {
48   bool minPinLength;
51 union WebAuthnExtension {
52   WebAuthnExtensionAppId;
53   WebAuthnExtensionCredProps;
54   WebAuthnExtensionHmacSecret;
55   WebAuthnExtensionMinPinLength;
58 struct WebAuthnExtensionResultAppId {
59   bool AppId;
62 struct WebAuthnExtensionResultCredProps {
63   bool rk;
66 struct WebAuthnExtensionResultHmacSecret {
67   bool hmacCreateSecret;
70 union WebAuthnExtensionResult {
71   WebAuthnExtensionResultAppId;
72   WebAuthnExtensionResultCredProps;
73   WebAuthnExtensionResultHmacSecret;
76 struct WebAuthnMakeCredentialRpInfo {
77   nsString Name;
80 struct WebAuthnMakeCredentialUserInfo {
81   uint8_t[] Id;
82   nsString Name;
83   nsString DisplayName;
86 struct CoseAlg {
87   long alg;
90 struct WebAuthnMakeCredentialInfo {
91   nsString Origin;
92   nsString RpId;
93   uint8_t[] Challenge;
94   nsCString ClientDataJSON;
95   uint32_t TimeoutMS;
96   WebAuthnScopedCredential[] ExcludeList;
97   WebAuthnMakeCredentialRpInfo Rp;
98   WebAuthnMakeCredentialUserInfo User;
99   CoseAlg[] coseAlgs;
100   WebAuthnExtension[] Extensions;
101   WebAuthnAuthenticatorSelection AuthenticatorSelection;
102   nsString attestationConveyancePreference;
103   uint64_t BrowsingContextId;
106 struct WebAuthnMakeCredentialResult {
107   nsCString ClientDataJSON;
108   uint8_t[] AttestationObject;
109   uint8_t[] KeyHandle;
110   nsString[] Transports;
111   WebAuthnExtensionResult[] Extensions;
112   nsString? AuthenticatorAttachment;
115 struct WebAuthnGetAssertionInfo {
116   nsString Origin;
117   nsString RpId;
118   uint8_t[] Challenge;
119   nsCString ClientDataJSON;
120   uint32_t TimeoutMS;
121   WebAuthnScopedCredential[] AllowList;
122   WebAuthnExtension[] Extensions;
123   nsString userVerificationRequirement;
124   bool ConditionallyMediated;
125   uint64_t BrowsingContextId;
128 struct WebAuthnGetAssertionResult {
129   nsCString ClientDataJSON;
130   uint8_t[] KeyHandle;
131   uint8_t[] Signature;
132   uint8_t[] AuthenticatorData;
133   WebAuthnExtensionResult[] Extensions;
134   uint8_t[] UserHandle;
135   nsString? AuthenticatorAttachment;
138 [ManualDealloc]
139 async protocol PWebAuthnTransaction {
140   manager PBackground;
142   parent:
143     async RequestRegister(uint64_t aTransactionId, WebAuthnMakeCredentialInfo aTransactionInfo);
144     async RequestSign(uint64_t aTransactionId, WebAuthnGetAssertionInfo aTransactionInfo);
145     async RequestIsUVPAA() returns (bool available);
146     [Tainted] async RequestCancel(uint64_t aTransactionId);
147     async DestroyMe();
149   child:
150     async __delete__();
151     async ConfirmRegister(uint64_t aTransactionId, WebAuthnMakeCredentialResult aResult);
152     async ConfirmSign(uint64_t aTransactionId, WebAuthnGetAssertionResult aResult);
153     async Abort(uint64_t aTransactionId, nsresult Error);