1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 #[wasm_bindgen(
8 extends = "::js_sys::Object",
9 js_name = "PublicKeyCredentialCreationOptions"
10 )]
11 #[derive(Debug, Clone, PartialEq, Eq)]
12 #[doc = "The `PublicKeyCredentialCreationOptions` dictionary."]
13 #[doc = ""]
14 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
15 pub type PublicKeyCredentialCreationOptions;
16 #[cfg(feature = "AttestationConveyancePreference")]
17 #[doc = "Get the `attestation` field of this object."]
18 #[doc = ""]
19 #[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`, `PublicKeyCredentialCreationOptions`*"]
20 #[wasm_bindgen(method, getter = "attestation")]
21 pub fn get_attestation(
22 this: &PublicKeyCredentialCreationOptions,
23 ) -> Option<AttestationConveyancePreference>;
24 #[cfg(feature = "AttestationConveyancePreference")]
25 #[doc = "Change the `attestation` field of this object."]
26 #[doc = ""]
27 #[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`, `PublicKeyCredentialCreationOptions`*"]
28 #[wasm_bindgen(method, setter = "attestation")]
29 pub fn set_attestation(
30 this: &PublicKeyCredentialCreationOptions,
31 val: AttestationConveyancePreference,
32 );
33 #[cfg(web_sys_unstable_apis)]
34 #[doc = "Get the `attestationFormats` field of this object."]
35 #[doc = ""]
36 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
37 #[doc = ""]
38 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
40 #[wasm_bindgen(method, getter = "attestationFormats")]
41 pub fn get_attestation_formats(
42 this: &PublicKeyCredentialCreationOptions,
43 ) -> Option<::js_sys::Array<::js_sys::JsString>>;
44 #[cfg(web_sys_unstable_apis)]
45 #[doc = "Change the `attestationFormats` field of this object."]
46 #[doc = ""]
47 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
48 #[doc = ""]
49 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
51 #[wasm_bindgen(method, setter = "attestationFormats")]
52 pub fn set_attestation_formats(
53 this: &PublicKeyCredentialCreationOptions,
54 val: &[::js_sys::JsString],
55 );
56 #[cfg(feature = "AuthenticatorSelectionCriteria")]
57 #[doc = "Get the `authenticatorSelection` field of this object."]
58 #[doc = ""]
59 #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptions`*"]
60 #[wasm_bindgen(method, getter = "authenticatorSelection")]
61 pub fn get_authenticator_selection(
62 this: &PublicKeyCredentialCreationOptions,
63 ) -> Option<AuthenticatorSelectionCriteria>;
64 #[cfg(feature = "AuthenticatorSelectionCriteria")]
65 #[doc = "Change the `authenticatorSelection` field of this object."]
66 #[doc = ""]
67 #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptions`*"]
68 #[wasm_bindgen(method, setter = "authenticatorSelection")]
69 pub fn set_authenticator_selection(
70 this: &PublicKeyCredentialCreationOptions,
71 val: &AuthenticatorSelectionCriteria,
72 );
73 #[doc = "Get the `challenge` field of this object."]
74 #[doc = ""]
75 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
76 #[wasm_bindgen(method, getter = "challenge")]
77 pub fn get_challenge(this: &PublicKeyCredentialCreationOptions) -> ::js_sys::Object;
78 #[doc = "Change the `challenge` field of this object."]
79 #[doc = ""]
80 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
81 #[wasm_bindgen(method, setter = "challenge")]
82 pub fn set_challenge(this: &PublicKeyCredentialCreationOptions, val: &::js_sys::Object);
83 #[doc = "Change the `challenge` field of this object."]
84 #[doc = ""]
85 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
86 #[wasm_bindgen(method, setter = "challenge")]
87 pub fn set_challenge_buffer_source(
88 this: &PublicKeyCredentialCreationOptions,
89 val: &::js_sys::Object,
90 );
91 #[doc = "Change the `challenge` field of this object."]
92 #[doc = ""]
93 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
94 #[wasm_bindgen(method, setter = "challenge")]
95 pub fn set_challenge_u8_slice(this: &PublicKeyCredentialCreationOptions, val: &mut [u8]);
96 #[doc = "Change the `challenge` field of this object."]
97 #[doc = ""]
98 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
99 #[wasm_bindgen(method, setter = "challenge")]
100 pub fn set_challenge_u8_array(
101 this: &PublicKeyCredentialCreationOptions,
102 val: &::js_sys::Uint8Array,
103 );
104 #[doc = "Get the `excludeCredentials` field of this object."]
105 #[doc = ""]
106 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
107 #[wasm_bindgen(method, getter = "excludeCredentials")]
108 pub fn get_exclude_credentials(
109 this: &PublicKeyCredentialCreationOptions,
110 ) -> Option<::js_sys::Array>;
111 #[doc = "Change the `excludeCredentials` field of this object."]
112 #[doc = ""]
113 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
114 #[wasm_bindgen(method, setter = "excludeCredentials")]
115 pub fn set_exclude_credentials(
116 this: &PublicKeyCredentialCreationOptions,
117 val: &::wasm_bindgen::JsValue,
118 );
119 #[cfg(feature = "AuthenticationExtensionsClientInputs")]
120 #[doc = "Get the `extensions` field of this object."]
121 #[doc = ""]
122 #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialCreationOptions`*"]
123 #[wasm_bindgen(method, getter = "extensions")]
124 pub fn get_extensions(
125 this: &PublicKeyCredentialCreationOptions,
126 ) -> Option<AuthenticationExtensionsClientInputs>;
127 #[cfg(feature = "AuthenticationExtensionsClientInputs")]
128 #[doc = "Change the `extensions` field of this object."]
129 #[doc = ""]
130 #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialCreationOptions`*"]
131 #[wasm_bindgen(method, setter = "extensions")]
132 pub fn set_extensions(
133 this: &PublicKeyCredentialCreationOptions,
134 val: &AuthenticationExtensionsClientInputs,
135 );
136 #[cfg(web_sys_unstable_apis)]
137 #[doc = "Get the `hints` field of this object."]
138 #[doc = ""]
139 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
140 #[doc = ""]
141 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
142 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
143 #[wasm_bindgen(method, getter = "hints")]
144 pub fn get_hints(
145 this: &PublicKeyCredentialCreationOptions,
146 ) -> Option<::js_sys::Array<::js_sys::JsString>>;
147 #[cfg(web_sys_unstable_apis)]
148 #[doc = "Change the `hints` field of this object."]
149 #[doc = ""]
150 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
151 #[doc = ""]
152 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
153 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
154 #[wasm_bindgen(method, setter = "hints")]
155 pub fn set_hints(this: &PublicKeyCredentialCreationOptions, val: &[::js_sys::JsString]);
156 #[doc = "Get the `pubKeyCredParams` field of this object."]
157 #[doc = ""]
158 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
159 #[wasm_bindgen(method, getter = "pubKeyCredParams")]
160 pub fn get_pub_key_cred_params(this: &PublicKeyCredentialCreationOptions) -> ::js_sys::Array;
161 #[doc = "Change the `pubKeyCredParams` field of this object."]
162 #[doc = ""]
163 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
164 #[wasm_bindgen(method, setter = "pubKeyCredParams")]
165 pub fn set_pub_key_cred_params(
166 this: &PublicKeyCredentialCreationOptions,
167 val: &::wasm_bindgen::JsValue,
168 );
169 #[cfg(feature = "PublicKeyCredentialRpEntity")]
170 #[doc = "Get the `rp` field of this object."]
171 #[doc = ""]
172 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`*"]
173 #[wasm_bindgen(method, getter = "rp")]
174 pub fn get_rp(this: &PublicKeyCredentialCreationOptions) -> PublicKeyCredentialRpEntity;
175 #[cfg(feature = "PublicKeyCredentialRpEntity")]
176 #[doc = "Change the `rp` field of this object."]
177 #[doc = ""]
178 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`*"]
179 #[wasm_bindgen(method, setter = "rp")]
180 pub fn set_rp(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialRpEntity);
181 #[doc = "Get the `timeout` field of this object."]
182 #[doc = ""]
183 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
184 #[wasm_bindgen(method, getter = "timeout")]
185 pub fn get_timeout(this: &PublicKeyCredentialCreationOptions) -> Option<u32>;
186 #[doc = "Change the `timeout` field of this object."]
187 #[doc = ""]
188 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"]
189 #[wasm_bindgen(method, setter = "timeout")]
190 pub fn set_timeout(this: &PublicKeyCredentialCreationOptions, val: u32);
191 #[cfg(feature = "PublicKeyCredentialUserEntity")]
192 #[doc = "Get the `user` field of this object."]
193 #[doc = ""]
194 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialUserEntity`*"]
195 #[wasm_bindgen(method, getter = "user")]
196 pub fn get_user(this: &PublicKeyCredentialCreationOptions) -> PublicKeyCredentialUserEntity;
197 #[cfg(feature = "PublicKeyCredentialUserEntity")]
198 #[doc = "Change the `user` field of this object."]
199 #[doc = ""]
200 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialUserEntity`*"]
201 #[wasm_bindgen(method, setter = "user")]
202 pub fn set_user(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialUserEntity);
203}
204impl PublicKeyCredentialCreationOptions {
205 #[cfg(all(
206 feature = "PublicKeyCredentialRpEntity",
207 feature = "PublicKeyCredentialUserEntity",
208 ))]
209 #[doc = "Construct a new `PublicKeyCredentialCreationOptions`."]
210 #[doc = ""]
211 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`, `PublicKeyCredentialUserEntity`*"]
212 pub fn new(
213 challenge: &::js_sys::Object,
214 pub_key_cred_params: &::wasm_bindgen::JsValue,
215 rp: &PublicKeyCredentialRpEntity,
216 user: &PublicKeyCredentialUserEntity,
217 ) -> Self {
218 #[allow(unused_mut)]
219 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
220 ret.set_challenge(challenge);
221 ret.set_pub_key_cred_params(pub_key_cred_params);
222 ret.set_rp(rp);
223 ret.set_user(user);
224 ret
225 }
226 #[cfg(all(
227 feature = "PublicKeyCredentialRpEntity",
228 feature = "PublicKeyCredentialUserEntity",
229 ))]
230 #[doc = "Construct a new `PublicKeyCredentialCreationOptions`."]
231 #[doc = ""]
232 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`, `PublicKeyCredentialUserEntity`*"]
233 pub fn new_with_u8_slice(
234 challenge: &mut [u8],
235 pub_key_cred_params: &::wasm_bindgen::JsValue,
236 rp: &PublicKeyCredentialRpEntity,
237 user: &PublicKeyCredentialUserEntity,
238 ) -> Self {
239 #[allow(unused_mut)]
240 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
241 ret.set_challenge_u8_slice(challenge);
242 ret.set_pub_key_cred_params(pub_key_cred_params);
243 ret.set_rp(rp);
244 ret.set_user(user);
245 ret
246 }
247 #[cfg(all(
248 feature = "PublicKeyCredentialRpEntity",
249 feature = "PublicKeyCredentialUserEntity",
250 ))]
251 #[doc = "Construct a new `PublicKeyCredentialCreationOptions`."]
252 #[doc = ""]
253 #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`, `PublicKeyCredentialUserEntity`*"]
254 pub fn new_with_u8_array(
255 challenge: &::js_sys::Uint8Array,
256 pub_key_cred_params: &::wasm_bindgen::JsValue,
257 rp: &PublicKeyCredentialRpEntity,
258 user: &PublicKeyCredentialUserEntity,
259 ) -> Self {
260 #[allow(unused_mut)]
261 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
262 ret.set_challenge_u8_array(challenge);
263 ret.set_pub_key_cred_params(pub_key_cred_params);
264 ret.set_rp(rp);
265 ret.set_user(user);
266 ret
267 }
268 #[cfg(feature = "AttestationConveyancePreference")]
269 #[deprecated = "Use `set_attestation()` instead."]
270 pub fn attestation(&mut self, val: AttestationConveyancePreference) -> &mut Self {
271 self.set_attestation(val);
272 self
273 }
274 #[cfg(web_sys_unstable_apis)]
275 #[deprecated = "Use `set_attestation_formats()` instead."]
276 pub fn attestation_formats(&mut self, val: &[::js_sys::JsString]) -> &mut Self {
277 self.set_attestation_formats(val);
278 self
279 }
280 #[cfg(feature = "AuthenticatorSelectionCriteria")]
281 #[deprecated = "Use `set_authenticator_selection()` instead."]
282 pub fn authenticator_selection(&mut self, val: &AuthenticatorSelectionCriteria) -> &mut Self {
283 self.set_authenticator_selection(val);
284 self
285 }
286 #[deprecated = "Use `set_challenge()` instead."]
287 pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self {
288 self.set_challenge(val);
289 self
290 }
291 #[deprecated = "Use `set_exclude_credentials()` instead."]
292 pub fn exclude_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
293 self.set_exclude_credentials(val);
294 self
295 }
296 #[cfg(feature = "AuthenticationExtensionsClientInputs")]
297 #[deprecated = "Use `set_extensions()` instead."]
298 pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self {
299 self.set_extensions(val);
300 self
301 }
302 #[cfg(web_sys_unstable_apis)]
303 #[deprecated = "Use `set_hints()` instead."]
304 pub fn hints(&mut self, val: &[::js_sys::JsString]) -> &mut Self {
305 self.set_hints(val);
306 self
307 }
308 #[deprecated = "Use `set_pub_key_cred_params()` instead."]
309 pub fn pub_key_cred_params(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
310 self.set_pub_key_cred_params(val);
311 self
312 }
313 #[cfg(feature = "PublicKeyCredentialRpEntity")]
314 #[deprecated = "Use `set_rp()` instead."]
315 pub fn rp(&mut self, val: &PublicKeyCredentialRpEntity) -> &mut Self {
316 self.set_rp(val);
317 self
318 }
319 #[deprecated = "Use `set_timeout()` instead."]
320 pub fn timeout(&mut self, val: u32) -> &mut Self {
321 self.set_timeout(val);
322 self
323 }
324 #[cfg(feature = "PublicKeyCredentialUserEntity")]
325 #[deprecated = "Use `set_user()` instead."]
326 pub fn user(&mut self, val: &PublicKeyCredentialUserEntity) -> &mut Self {
327 self.set_user(val);
328 self
329 }
330}