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