Source code

Revision control

Other Tools

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/. */
4
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
*/
16
17
include protocol PBackground;
18
19
using mozilla::dom::AttestationConveyancePreference from "mozilla/dom/WebAuthnUtil.h";
20
using mozilla::dom::AuthenticatorAttachment from "mozilla/dom/WebAuthnUtil.h";
21
using mozilla::dom::UserVerificationRequirement from "mozilla/dom/WebAuthnUtil.h";
22
23
namespace mozilla {
24
namespace dom {
25
26
struct WebAuthnAuthenticatorSelection {
27
bool requireResidentKey;
28
UserVerificationRequirement userVerificationRequirement;
29
AuthenticatorAttachment? authenticatorAttachment;
30
};
31
32
struct WebAuthnScopedCredential {
33
uint8_t[] id;
34
uint8_t transports;
35
};
36
37
struct WebAuthnExtensionAppId {
38
uint8_t[] AppId;
39
nsString appIdentifier;
40
};
41
42
struct WebAuthnExtensionHmacSecret {
43
bool hmacCreateSecret;
44
};
45
46
union WebAuthnExtension {
47
WebAuthnExtensionAppId;
48
WebAuthnExtensionHmacSecret;
49
};
50
51
struct WebAuthnExtensionResultAppId {
52
bool AppId;
53
};
54
55
struct WebAuthnExtensionResultHmacSecret {
56
bool hmacCreateSecret;
57
};
58
59
union WebAuthnExtensionResult {
60
WebAuthnExtensionResultAppId;
61
WebAuthnExtensionResultHmacSecret;
62
};
63
64
struct WebAuthnMakeCredentialRpInfo {
65
nsString Name;
66
nsString Icon;
67
};
68
69
struct WebAuthnMakeCredentialUserInfo {
70
uint8_t[] Id;
71
nsString Name;
72
nsString Icon;
73
nsString DisplayName;
74
};
75
76
struct CoseAlg {
77
long alg;
78
};
79
80
struct WebAuthnMakeCredentialExtraInfo {
81
WebAuthnMakeCredentialRpInfo Rp;
82
WebAuthnMakeCredentialUserInfo User;
83
CoseAlg[] coseAlgs;
84
WebAuthnExtension[] Extensions;
85
WebAuthnAuthenticatorSelection AuthenticatorSelection;
86
AttestationConveyancePreference attestationConveyancePreference;
87
};
88
89
struct WebAuthnMakeCredentialInfo {
90
nsString Origin;
91
nsString RpId;
92
uint8_t[] Challenge;
93
nsCString ClientDataJSON;
94
uint32_t TimeoutMS;
95
WebAuthnScopedCredential[] ExcludeList;
96
WebAuthnMakeCredentialExtraInfo? Extra;
97
};
98
99
struct WebAuthnMakeCredentialResult {
100
nsCString ClientDataJSON;
101
uint8_t[] AttestationObject;
102
uint8_t[] KeyHandle;
103
/* Might be empty if the token implementation doesn't support CTAP1. */
104
uint8_t[] RegistrationData;
105
WebAuthnExtensionResult[] Extensions;
106
};
107
108
struct WebAuthnGetAssertionExtraInfo {
109
WebAuthnExtension[] Extensions;
110
UserVerificationRequirement userVerificationRequirement;
111
};
112
113
struct WebAuthnGetAssertionInfo {
114
nsString Origin;
115
nsString RpId;
116
uint8_t[] Challenge;
117
nsCString ClientDataJSON;
118
uint32_t TimeoutMS;
119
WebAuthnScopedCredential[] AllowList;
120
WebAuthnGetAssertionExtraInfo? Extra;
121
};
122
123
struct WebAuthnGetAssertionResult {
124
nsCString ClientDataJSON;
125
uint8_t[] KeyHandle;
126
uint8_t[] Signature;
127
uint8_t[] AuthenticatorData;
128
WebAuthnExtensionResult[] Extensions;
129
/* Might be empty if the token implementation doesn't support CTAP1. */
130
uint8_t[] SignatureData;
131
uint8_t[] UserHandle;
132
};
133
134
async protocol PWebAuthnTransaction {
135
manager PBackground;
136
137
parent:
138
async RequestRegister(uint64_t aTransactionId, WebAuthnMakeCredentialInfo aTransactionInfo);
139
async RequestSign(uint64_t aTransactionId, WebAuthnGetAssertionInfo aTransactionInfo);
140
async RequestCancel(uint64_t aTransactionId);
141
async DestroyMe();
142
143
child:
144
async __delete__();
145
async ConfirmRegister(uint64_t aTransactionId, WebAuthnMakeCredentialResult aResult);
146
async ConfirmSign(uint64_t aTransactionId, WebAuthnGetAssertionResult aResult);
147
async Abort(uint64_t aTransactionId, nsresult Error);
148
};
149
150
}
151
}