nsIWebAuthnService.idl (5968B)
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/. */ 5 6 #include "nsISupports.idl" 7 #include "nsIWebAuthnArgs.idl" 8 #include "nsIWebAuthnPromise.idl" 9 10 [scriptable, uuid(6c4ecd9f-57c0-4d7d-8080-bf6e4d499f8f)] 11 interface nsICredentialParameters : nsISupports 12 { 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; 19 }; 20 21 [scriptable, uuid(686d552e-a39d-4ba2-8127-faca54274039)] 22 interface nsIWebAuthnAutoFillEntry: nsISupports 23 { 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; 29 30 readonly attribute octet provider; 31 readonly attribute AString userName; 32 readonly attribute AString rpId; 33 readonly attribute Array<uint8_t> credentialId; 34 }; 35 36 [scriptable, uuid(e236a9b4-a26f-11ed-b6cc-07a9834e19b1)] 37 interface nsIWebAuthnService : nsISupports 38 { 39 // IsUserVerifyingPlatformAuthenticatorAvailable 40 readonly attribute boolean isUVPAA; 41 42 [noscript] 43 void makeCredential( 44 in uint64_t aTransactionId, 45 in uint64_t browsingContextId, 46 in nsIWebAuthnRegisterArgs args, 47 in nsIWebAuthnRegisterPromise promise); 48 49 [noscript] 50 void getAssertion( 51 in uint64_t aTransactionId, 52 in uint64_t browsingContextId, 53 in nsIWebAuthnSignArgs args, 54 in nsIWebAuthnSignPromise promise); 55 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(); 60 61 // Cancel the ongoing transaction. Reject its promise, but do not cancel 62 // prompts. This is used by WebAuthnPromptHelper when the user hits the 63 // "cancel" button. 64 void cancel(in uint64_t aTransactionId); 65 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); 72 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); 78 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); 86 87 void pinCallback(in uint64_t aTransactionId, in AUTF8String aPin); 88 void setHasAttestationConsent(in uint64_t aTransactionId, in boolean aHasConsent); 89 void selectionCallback(in uint64_t aTransactionId, in uint64_t aIndex); 90 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 ACString addVirtualAuthenticator( 95 in ACString protocol, 96 in ACString transport, 97 in boolean hasResidentKey, 98 in boolean hasUserVerification, 99 in boolean isUserConsenting, 100 in boolean isUserVerified); 101 102 // Removes a previously-added virtual authenticator, as identified by its 103 // id. See 104 // https://w3c.github.io/webauthn/#sctn-automation-remove-virtual-authenticator 105 void removeVirtualAuthenticator(in ACString authenticatorId); 106 107 // Adds a credential to a previously-added authenticator. See 108 // https://w3c.github.io/webauthn/#sctn-automation-add-credential 109 void addCredential( 110 in ACString authenticatorId, 111 in ACString credentialId, 112 in boolean isResidentCredential, 113 in ACString rpId, 114 in ACString privateKey, 115 in ACString userHandle, 116 in uint32_t signCount); 117 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 ACString authenticatorId); 121 122 // Removes a credential from a virtual authenticator. See 123 // https://w3c.github.io/webauthn/#sctn-automation-remove-credential 124 void removeCredential(in ACString authenticatorId, in ACString credentialId); 125 126 // Removes all credentials from a virtual authenticator. See 127 // https://w3c.github.io/webauthn/#sctn-automation-remove-all-credentials 128 void removeAllCredentials(in ACString authenticatorId); 129 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 ACString authenticatorId, in boolean isUserVerified); 133 134 // about:webauthn-specific functions 135 void listen(); 136 void runCommand(in ACString aCommand); 137 };