Skip to main content

web_sys/features/
gen_PublicKeyCredentialCreationOptions.rs

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