1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
7 #include
"nsIWebAuthnArgs.idl"
8 #include
"nsIWebAuthnPromise.idl"
10 [scriptable
, uuid(6c4ecd9f
-57c0
-4d7d
-8080-bf6e4d499f8f
)]
11 interface nsICredentialParameters
: nsISupports
13 readonly attribute ACString credentialId
;
14 readonly attribute
boolean isResidentCredential
;
15 readonly attribute ACString rpId
;
16 readonly attribute ACString privateKey
;
17 readonly attribute ACString userHandle
;
18 readonly attribute uint32_t signCount
;
21 [scriptable
, uuid(686d552e
-a39d
-4ba2
-8127-faca54274039
)]
22 interface nsIWebAuthnAutoFillEntry
: nsISupports
24 const octet PROVIDER_UNKNOWN
= 0;
25 const octet PROVIDER_TEST_TOKEN
= 1;
26 const octet PROVIDER_PLATFORM_WINDOWS
= 2;
27 const octet PROVIDER_PLATFORM_MACOS
= 3;
28 const octet PROVIDER_PLATFORM_ANDROID
= 4;
30 readonly attribute octet provider
;
31 readonly attribute AString userName
;
32 readonly attribute AString rpId
;
33 readonly attribute Array
<uint8_t
> credentialId
;
36 [scriptable
, uuid(e236a9b4
-a26f
-11ed
-b6cc
-07a9834e19b1
)]
37 interface nsIWebAuthnService
: nsISupports
39 // IsUserVerifyingPlatformAuthenticatorAvailable
40 readonly attribute
boolean isUVPAA
;
44 in uint64_t aTransactionId
,
45 in uint64_t browsingContextId
,
46 in nsIWebAuthnRegisterArgs args
,
47 in nsIWebAuthnRegisterPromise promise
);
51 in uint64_t aTransactionId
,
52 in uint64_t browsingContextId
,
53 in nsIWebAuthnSignArgs args
,
54 in nsIWebAuthnSignPromise promise
);
56 // Cancel the ongoing transaction and any prompts that are shown, but do not reject
57 // its promise. This is used by the IPC parent when it receives an abort signal.
58 // The IPC child has already rejected the promises at this point.
59 [noscript
] void reset
();
61 // Cancel the ongoing transaction. Reject its promise, but do not cancel
62 // prompts. This is used by WebAuthnPromptHelper when the user hits the
64 void cancel
(in uint64_t aTransactionId
);
66 // `hasPendingConditionalGet` returns the transaction ID of a pending
67 // conditionally-mediated getAssertion promise. The browsing context and
68 // origin arguments must match those of the pending promise. If there is no
69 // pending getAssertion promise, or the browsing context and origin do not
70 // match, then `hasPendingConditionalGet` returns 0.
71 uint64_t hasPendingConditionalGet
(in uint64_t aBrowsingContextId
, in AString aOrigin
);
73 // If there is a pending conditionally-mediated getAssertion promise with
74 // transaction ID equal to `aTransactionId`, `getAutoFillEntries` returns
75 // an nsIWebAuthnAutoFillEntry for each silently discoverable credential
76 // that can be used to fullfill the request.
77 Array
<nsIWebAuthnAutoFillEntry
> getAutoFillEntries
(in uint64_t aTransactionId
);
79 // A pending conditionally-mediated getAssertion promise is resolved by
80 // calling `selectAutoFillEntry` or `resumeConditionalGet`.
81 // `selectAutoFillEntry` specifies the credential ID that should be used to
82 // fulfill the request, whereas `resumeConditionalGet` indicates that any
83 // allowed credential can be used.
84 void selectAutoFillEntry
(in uint64_t aTransactionId
, in Array
<uint8_t
> aCredentialId
);
85 void resumeConditionalGet
(in uint64_t aTransactionId
);
87 void pinCallback
(in uint64_t aTransactionId
, in ACString aPin
);
88 void setHasAttestationConsent
(in uint64_t aTransactionId
, in boolean aHasConsent
);
89 void selectionCallback
(in uint64_t aTransactionId
, in uint64_t aIndex
);
91 // Adds a virtual (software) authenticator for use in tests (particularly
92 // tests run via WebDriver). See
93 // https://w3c.github.io/webauthn/#sctn-automation-add-virtual-authenticator.
94 uint64_t addVirtualAuthenticator
(
96 in ACString transport
,
97 in boolean hasResidentKey
,
98 in boolean hasUserVerification
,
99 in boolean isUserConsenting
,
100 in boolean isUserVerified
);
102 // Removes a previously-added virtual authenticator, as identified by its
104 // https://w3c.github.io/webauthn/#sctn-automation-remove-virtual-authenticator
105 void removeVirtualAuthenticator
(in uint64_t authenticatorId
);
107 // Adds a credential to a previously-added authenticator. See
108 // https://w3c.github.io/webauthn/#sctn-automation-add-credential
110 in uint64_t authenticatorId
,
111 in ACString credentialId
,
112 in boolean isResidentCredential
,
114 in ACString privateKey
,
115 in ACString userHandle
,
116 in uint32_t signCount
);
118 // Gets all credentials that have been added to a virtual authenticator.
119 // See https://w3c.github.io/webauthn/#sctn-automation-get-credentials
120 Array
<nsICredentialParameters
> getCredentials
(in uint64_t authenticatorId
);
122 // Removes a credential from a virtual authenticator. See
123 // https://w3c.github.io/webauthn/#sctn-automation-remove-credential
124 void removeCredential
(in uint64_t authenticatorId
, in ACString credentialId
);
126 // Removes all credentials from a virtual authenticator. See
127 // https://w3c.github.io/webauthn/#sctn-automation-remove-all-credentials
128 void removeAllCredentials
(in uint64_t authenticatorId
);
130 // Sets the "isUserVerified" bit on a virtual authenticator. See
131 // https://w3c.github.io/webauthn/#sctn-automation-set-user-verified
132 void setUserVerified
(in uint64_t authenticatorId
, in boolean isUserVerified
);
134 // about:webauthn-specific functions
136 void runCommand
(in ACString aCommand
);