Skip to main content

web_sys/features/
gen_PublicKeyCredentialCreationOptionsJson.rs

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