Skip to content

Commit

Permalink
Update Web Authentication API to level 3 (#4000)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jul 28, 2024
1 parent 9e6b1bc commit 168b801
Show file tree
Hide file tree
Showing 47 changed files with 3,465 additions and 48 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
* Allow imported async functions to return any type that can be converted from a `JsValue`.
[#3919](https://github.com/rustwasm/wasm-bindgen/pull/3919)

* Update Web Authentication API to level 3.
[#4000](https://github.com/rustwasm/wasm-bindgen/pull/4000)

### Fixed

* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`.
Expand Down
23 changes: 23 additions & 0 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,22 @@ AudioWorkletNode = ["AudioNode", "EventTarget"]
AudioWorkletNodeOptions = []
AudioWorkletProcessor = []
AuthenticationExtensionsClientInputs = []
AuthenticationExtensionsClientInputsJson = []
AuthenticationExtensionsClientOutputs = []
AuthenticationExtensionsClientOutputsJson = []
AuthenticationExtensionsDevicePublicKeyInputs = []
AuthenticationExtensionsDevicePublicKeyOutputs = []
AuthenticationExtensionsLargeBlobInputs = []
AuthenticationExtensionsLargeBlobOutputs = []
AuthenticationExtensionsPrfInputs = []
AuthenticationExtensionsPrfOutputs = []
AuthenticationExtensionsPrfValues = []
AuthenticationResponseJson = []
AuthenticatorAssertionResponse = ["AuthenticatorResponse"]
AuthenticatorAssertionResponseJson = []
AuthenticatorAttachment = []
AuthenticatorAttestationResponse = ["AuthenticatorResponse"]
AuthenticatorAttestationResponseJson = []
AuthenticatorResponse = []
AuthenticatorSelectionCriteria = []
AuthenticatorTransport = []
Expand Down Expand Up @@ -238,6 +250,7 @@ Coordinates = []
CountQueuingStrategy = []
Credential = []
CredentialCreationOptions = []
CredentialPropertiesOutput = []
CredentialRequestOptions = []
CredentialsContainer = []
Crypto = []
Expand Down Expand Up @@ -757,6 +770,7 @@ KeyframeEffect = ["AnimationEffect"]
KeyframeEffectOptions = []
L10nElement = []
L10nValue = []
LargeBlobSupport = []
LatencyMode = []
LifecycleCallbacks = []
LineAlignSetting = []
Expand Down Expand Up @@ -1008,13 +1022,18 @@ PromiseRejectionEvent = ["Event"]
PromiseRejectionEventInit = []
PublicKeyCredential = ["Credential"]
PublicKeyCredentialCreationOptions = []
PublicKeyCredentialCreationOptionsJson = []
PublicKeyCredentialDescriptor = []
PublicKeyCredentialDescriptorJson = []
PublicKeyCredentialEntity = []
PublicKeyCredentialHints = []
PublicKeyCredentialParameters = []
PublicKeyCredentialRequestOptions = []
PublicKeyCredentialRequestOptionsJson = []
PublicKeyCredentialRpEntity = []
PublicKeyCredentialType = []
PublicKeyCredentialUserEntity = []
PublicKeyCredentialUserEntityJson = []
PushEncryptionKeyName = []
PushEvent = ["Event", "ExtendableEvent"]
PushEventInit = []
Expand Down Expand Up @@ -1052,6 +1071,7 @@ RegisterRequest = []
RegisterResponse = []
RegisteredKey = []
RegistrationOptions = []
RegistrationResponseJson = []
Request = []
RequestCache = []
RequestCredentials = []
Expand All @@ -1061,6 +1081,7 @@ RequestInit = []
RequestMediaKeySystemAccessNotification = []
RequestMode = []
RequestRedirect = []
ResidentKeyRequirement = []
ResizeObserver = []
ResizeObserverBoxOptions = []
ResizeObserverEntry = []
Expand Down Expand Up @@ -1396,6 +1417,8 @@ TextTrackList = ["EventTarget"]
TextTrackMode = []
TimeEvent = ["Event"]
TimeRanges = []
TokenBinding = []
TokenBindingStatus = []
Touch = []
TouchEvent = ["Event", "UiEvent"]
TouchEventInit = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pub enum AttestationConveyancePreference {
None = "none",
Indirect = "indirect",
Direct = "direct",
Enterprise = "enterprise",
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,103 @@ extern "C" {
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, setter = "appid")]
pub fn set_appid(this: &AuthenticationExtensionsClientInputs, val: &str);
#[doc = "Get the `appidExclude` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, getter = "appidExclude")]
pub fn get_appid_exclude(this: &AuthenticationExtensionsClientInputs) -> Option<String>;
#[doc = "Change the `appidExclude` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, setter = "appidExclude")]
pub fn set_appid_exclude(this: &AuthenticationExtensionsClientInputs, val: &str);
#[doc = "Get the `credProps` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, getter = "credProps")]
pub fn get_cred_props(this: &AuthenticationExtensionsClientInputs) -> Option<bool>;
#[doc = "Change the `credProps` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, setter = "credProps")]
pub fn set_cred_props(this: &AuthenticationExtensionsClientInputs, val: bool);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")]
#[doc = "Get the `devicePubKey` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsDevicePublicKeyInputs`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
#[wasm_bindgen(method, getter = "devicePubKey")]
pub fn get_device_pub_key(
this: &AuthenticationExtensionsClientInputs,
) -> Option<AuthenticationExtensionsDevicePublicKeyInputs>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")]
#[doc = "Change the `devicePubKey` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsDevicePublicKeyInputs`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
#[wasm_bindgen(method, setter = "devicePubKey")]
pub fn set_device_pub_key(
this: &AuthenticationExtensionsClientInputs,
val: &AuthenticationExtensionsDevicePublicKeyInputs,
);
#[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")]
#[doc = "Get the `largeBlob` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsLargeBlobInputs`*"]
#[wasm_bindgen(method, getter = "largeBlob")]
pub fn get_large_blob(
this: &AuthenticationExtensionsClientInputs,
) -> Option<AuthenticationExtensionsLargeBlobInputs>;
#[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")]
#[doc = "Change the `largeBlob` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsLargeBlobInputs`*"]
#[wasm_bindgen(method, setter = "largeBlob")]
pub fn set_large_blob(
this: &AuthenticationExtensionsClientInputs,
val: &AuthenticationExtensionsLargeBlobInputs,
);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AuthenticationExtensionsPrfInputs")]
#[doc = "Get the `prf` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsPrfInputs`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
#[wasm_bindgen(method, getter = "prf")]
pub fn get_prf(
this: &AuthenticationExtensionsClientInputs,
) -> Option<AuthenticationExtensionsPrfInputs>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AuthenticationExtensionsPrfInputs")]
#[doc = "Change the `prf` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsPrfInputs`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
#[wasm_bindgen(method, setter = "prf")]
pub fn set_prf(
this: &AuthenticationExtensionsClientInputs,
val: &AuthenticationExtensionsPrfInputs,
);
#[doc = "Get the `uvm` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, getter = "uvm")]
pub fn get_uvm(this: &AuthenticationExtensionsClientInputs) -> Option<bool>;
#[doc = "Change the `uvm` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"]
#[wasm_bindgen(method, setter = "uvm")]
pub fn set_uvm(this: &AuthenticationExtensionsClientInputs, val: bool);
}
impl AuthenticationExtensionsClientInputs {
#[doc = "Construct a new `AuthenticationExtensionsClientInputs`."]
Expand All @@ -35,6 +132,44 @@ impl AuthenticationExtensionsClientInputs {
self.set_appid(val);
self
}
#[deprecated = "Use `set_appid_exclude()` instead."]
pub fn appid_exclude(&mut self, val: &str) -> &mut Self {
self.set_appid_exclude(val);
self
}
#[deprecated = "Use `set_cred_props()` instead."]
pub fn cred_props(&mut self, val: bool) -> &mut Self {
self.set_cred_props(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")]
#[deprecated = "Use `set_device_pub_key()` instead."]
pub fn device_pub_key(
&mut self,
val: &AuthenticationExtensionsDevicePublicKeyInputs,
) -> &mut Self {
self.set_device_pub_key(val);
self
}
#[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")]
#[deprecated = "Use `set_large_blob()` instead."]
pub fn large_blob(&mut self, val: &AuthenticationExtensionsLargeBlobInputs) -> &mut Self {
self.set_large_blob(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "AuthenticationExtensionsPrfInputs")]
#[deprecated = "Use `set_prf()` instead."]
pub fn prf(&mut self, val: &AuthenticationExtensionsPrfInputs) -> &mut Self {
self.set_prf(val);
self
}
#[deprecated = "Use `set_uvm()` instead."]
pub fn uvm(&mut self, val: bool) -> &mut Self {
self.set_uvm(val);
self
}
}
impl Default for AuthenticationExtensionsClientInputs {
fn default() -> Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsClientInputsJSON)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `AuthenticationExtensionsClientInputsJson` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type AuthenticationExtensionsClientInputsJson;
}
#[cfg(web_sys_unstable_apis)]
impl AuthenticationExtensionsClientInputsJson {
#[doc = "Construct a new `AuthenticationExtensionsClientInputsJson`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for AuthenticationExtensionsClientInputsJson {
fn default() -> Self {
Self::new()
}
}
Loading

0 comments on commit 168b801

Please sign in to comment.