no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / webauthn / nsIWebAuthnService.idl
blob6525508057485a59f6d5b637e83aa638d5bb0cb0
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 bool 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 bool isUVPAA;
42 void makeCredential(
43 in uint64_t aTransactionId,
44 in uint64_t browsingContextId,
45 in nsIWebAuthnRegisterArgs args,
46 in nsIWebAuthnRegisterPromise promise);
48 void getAssertion(
49 in uint64_t aTransactionId,
50 in uint64_t browsingContextId,
51 in nsIWebAuthnSignArgs args,
52 in nsIWebAuthnSignPromise promise);
54 // Cancel the ongoing transaction and any prompts that are shown, but do not reject
55 // its promise. This is used by the IPC parent when it receives an abort signal.
56 // The IPC child has already rejected the promises at this point.
57 [noscript] void reset();
59 // Cancel the ongoing transaction. Reject its promise, but do not cancel
60 // prompts. This is used by WebAuthnPromptHelper when the user hits the
61 // "cancel" button.
62 void cancel(in uint64_t aTransactionId);
64 // `hasPendingConditionalGet` returns the transaction ID of a pending
65 // conditionally-mediated getAssertion promise. The browsing context and
66 // origin arguments must match those of the pending promise. If there is no
67 // pending getAssertion promise, or the browsing context and origin do not
68 // match, then `hasPendingConditionalGet` returns 0.
69 uint64_t hasPendingConditionalGet(in uint64_t aBrowsingContextId, in AString aOrigin);
71 // If there is a pending conditionally-mediated getAssertion promise with
72 // transaction ID equal to `aTransactionId`, `getAutoFillEntries` returns
73 // an nsIWebAuthnAutoFillEntry for each silently discoverable credential
74 // that can be used to fullfill the request.
75 Array<nsIWebAuthnAutoFillEntry> getAutoFillEntries(in uint64_t aTransactionId);
77 // A pending conditionally-mediated getAssertion promise is resolved by
78 // calling `selectAutoFillEntry` or `resumeConditionalGet`.
79 // `selectAutoFillEntry` specifies the credential ID that should be used to
80 // fulfill the request, whereas `resumeConditionalGet` indicates that any
81 // allowed credential can be used.
82 void selectAutoFillEntry(in uint64_t aTransactionId, in Array<uint8_t> aCredentialId);
83 void resumeConditionalGet(in uint64_t aTransactionId);
85 void pinCallback(in uint64_t aTransactionId, in ACString aPin);
86 void resumeMakeCredential(in uint64_t aTransactionId, in bool aForceNoneAttestation);
87 void selectionCallback(in uint64_t aTransactionId, in uint64_t aIndex);
89 // Adds a virtual (software) authenticator for use in tests (particularly
90 // tests run via WebDriver). See
91 // https://w3c.github.io/webauthn/#sctn-automation-add-virtual-authenticator.
92 uint64_t addVirtualAuthenticator(
93 in ACString protocol,
94 in ACString transport,
95 in bool hasResidentKey,
96 in bool hasUserVerification,
97 in bool isUserConsenting,
98 in bool isUserVerified);
100 // Removes a previously-added virtual authenticator, as identified by its
101 // id. See
102 // https://w3c.github.io/webauthn/#sctn-automation-remove-virtual-authenticator
103 void removeVirtualAuthenticator(in uint64_t authenticatorId);
105 // Adds a credential to a previously-added authenticator. See
106 // https://w3c.github.io/webauthn/#sctn-automation-add-credential
107 void addCredential(
108 in uint64_t authenticatorId,
109 in ACString credentialId,
110 in bool isResidentCredential,
111 in ACString rpId,
112 in ACString privateKey,
113 in ACString userHandle,
114 in uint32_t signCount);
116 // Gets all credentials that have been added to a virtual authenticator.
117 // See https://w3c.github.io/webauthn/#sctn-automation-get-credentials
118 Array<nsICredentialParameters> getCredentials(in uint64_t authenticatorId);
120 // Removes a credential from a virtual authenticator. See
121 // https://w3c.github.io/webauthn/#sctn-automation-remove-credential
122 void removeCredential(in uint64_t authenticatorId, in ACString credentialId);
124 // Removes all credentials from a virtual authenticator. See
125 // https://w3c.github.io/webauthn/#sctn-automation-remove-all-credentials
126 void removeAllCredentials(in uint64_t authenticatorId);
128 // Sets the "isUserVerified" bit on a virtual authenticator. See
129 // https://w3c.github.io/webauthn/#sctn-automation-set-user-verified
130 void setUserVerified(in uint64_t authenticatorId, in bool isUserVerified);
132 // about:webauthn-specific functions
133 void listen();
134 void runCommand(in ACString aCommand);