### Trim start matches example Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates trimming characters from the start of a string slice. ```rust let x: &[_] = &['1', '2']; assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12"); ``` -------------------------------- ### Trim prefix examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Experimental API examples for trimming a prefix, allowing for method chaining. ```rust #![feature(trim_prefix_suffix)] // Prefix present - removes it assert_eq!("foo:bar".trim_prefix("foo:"), "bar"); assert_eq!("foofoo".trim_prefix("foo"), "foo"); // Prefix absent - returns original string assert_eq!("foo:bar".trim_prefix("bar"), "foo:bar"); // Method chaining example assert_eq!("".trim_prefix('<').trim_suffix('>'), "https://example.com/"); ``` -------------------------------- ### Strip prefix and suffix examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search= Examples for removing prefixes or suffixes exactly once, returning an Option. ```rust assert_eq!("foo:bar".strip_prefix("foo:"), Some("bar")); assert_eq!("foo:bar".strip_prefix("bar"), None); assert_eq!("foofoo".strip_prefix("foo"), Some("foo")); ``` ```rust assert_eq!("bar:foo".strip_suffix(":foo"), Some("bar")); assert_eq!("bar:foo".strip_suffix("bar"), None); assert_eq!("foofoo".strip_suffix("foo"), Some("foo")); ``` -------------------------------- ### Example search queries Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/hid/framing/enum.HidCommand.html?search= Common search patterns for finding types and trait implementations. ```text * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Strip prefix examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of removing a prefix from a string slice, returning an Option. ```rust assert_eq!("foo:bar".strip_prefix("foo:"), Some("bar")); assert_eq!("foo:bar".strip_prefix("bar"), None); assert_eq!("foofoo".strip_prefix("foo"), Some("foo")); ``` -------------------------------- ### Trim suffix examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Experimental API examples for trimming a suffix, allowing for method chaining. ```rust #![feature(trim_prefix_suffix)] // Suffix present - removes it assert_eq!("bar:foo".trim_suffix(":foo"), "bar"); assert_eq!("foofoo".trim_suffix("foo"), "foo"); // Suffix absent - returns original string assert_eq!("bar:foo".trim_suffix("bar"), "bar:foo"); ``` -------------------------------- ### start_discovery_for_service_data Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/index.html?search=std%3A%3Avec Starts discovery for devices with specific service data. ```APIDOC ## start_discovery_for_service_data ### Description Initiates the discovery process for BLE devices advertising specific service data. ### Signature `pub fn start_discovery_for_service_data() -> Result<(), Error>` ``` -------------------------------- ### Check string prefix Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Verifies if the string starts with a specific pattern. ```rust let bananas = "bananas"; assert!(bananas.starts_with("bana")); assert!(!bananas.starts_with("nana")); ``` ```rust let bananas = "bananas"; // Note that both of these assert successfully. assert!(bananas.starts_with(&['b', 'a', 'n', 'a'])); assert!(bananas.starts_with(&['a', 'b', 'c', 'd'])); ``` -------------------------------- ### pub async fn start_discovery_for_service_data(uuids: &[Uuid]) -> Result)> + use<'_>, Error> Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/manager/fn.start_discovery_for_service_data.html Starts a discovery for devices advertising service data on any of the provided UUIDs. ```APIDOC ## Function: start_discovery_for_service_data ### Description Starts a discovery for devices advertising service data on any of the provided UUIDs. ### Signature `pub async fn start_discovery_for_service_data(uuids: &[Uuid]) -> Result)> + use<'_>, Error>` ### Parameters - **uuids** (&[Uuid]) - A slice of UUIDs to filter the service data discovery. ### Returns - **Result)> + use<'_>, Error>** - A stream of discovered devices, their associated adapter, and the service data, or an error if the discovery could not be started. ``` -------------------------------- ### Strip suffix examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of removing a suffix from a string slice, returning an Option. ```rust assert_eq!("bar:foo".strip_suffix(":foo"), Some("bar")); assert_eq!("bar:foo".strip_suffix("bar"), None); assert_eq!("foofoo".strip_suffix("foo"), Some("foo")); ``` -------------------------------- ### Splitting Slices Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html Examples of splitting a slice into the first/last element and the remainder. ```rust let x = &[0, 1, 2]; if let Some((first, elements)) = x.split_first() { assert_eq!(first, &0); assert_eq!(elements, &[1, 2]); } ``` ```rust let x = &[0, 1, 2]; if let Some((last, elements)) = x.split_last() { assert_eq!(last, &2); assert_eq!(elements, &[0, 1]); } ``` -------------------------------- ### Function signature for start_discovery_for_service_data Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/manager/fn.start_discovery_for_service_data.html?search=std%3A%3Avec The function signature for starting a discovery process for devices advertising service data. ```rust pub async fn start_discovery_for_service_data( uuids: &[Uuid], ) -> Result)> + use<'_>, Error> ``` -------------------------------- ### Construct a GET RESPONSE command Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/commands/fn.command_get_response.html Creates a GetResponseCommand instance using the specified parameters. ```rust pub fn command_get_response(p1: u8, p2: u8, le: u8) -> GetResponseCommand ``` -------------------------------- ### Reference Result Values Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/type.RelatedOriginsResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of using as_ref and as_mut to work with references to Result contents. ```rust let x: Result = Ok(2); assert_eq!(x.as_ref(), Ok(&2)); let x: Result = Err("Error"); assert_eq!(x.as_ref(), Err(&"Error")); ``` ```rust fn mutate(r: &mut Result) { match r.as_mut() { Ok(v) => *v = 42, Err(e) => *e = 0, } } let mut x: Result = Ok(2); mutate(&mut x); assert_eq!(x.unwrap(), 42); let mut x: Result = Err(13); mutate(&mut x); assert_eq!(x.unwrap_err(), 0); ``` -------------------------------- ### libwebauthn::transport::ble::btleplug::start_discovery_for_service_data Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/index.html?search= Starts the discovery process for BLE devices with specific service data. ```APIDOC ## start_discovery_for_service_data ### Description Initiates the discovery process to find BLE devices advertising specific FIDO service data. ### Signature `pub fn start_discovery_for_service_data() -> Result<(), Error>` ``` -------------------------------- ### Experimental trim prefix and suffix examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search= Nightly-only APIs that return the original string if the pattern is absent, facilitating method chaining. ```rust #![feature(trim_prefix_suffix)] // Prefix present - removes it assert_eq!("foo:bar".trim_prefix("foo:"), "bar"); assert_eq!("foofoo".trim_prefix("foo"), "foo"); // Prefix absent - returns original string assert_eq!("foo:bar".trim_prefix("bar"), "foo:bar"); // Method chaining example assert_eq!("".trim_prefix('<').trim_suffix('>'), "https://example.com/"); ``` ```rust #![feature(trim_prefix_suffix)] // Suffix present - removes it assert_eq!("bar:foo".trim_suffix(":foo"), "bar"); assert_eq!("foofoo".trim_suffix("foo"), "foo"); // Suffix absent - returns original string assert_eq!("bar:foo".trim_suffix("bar"), "bar:foo"); ``` -------------------------------- ### Create WellKnownRelatedOriginsSource instance Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/struct.WellKnownRelatedOriginsSource.html?search= Initializes a new source using the provided HTTP client. ```rust pub fn from_client(http: C) -> Self ``` -------------------------------- ### FromIterator Result Collection Examples Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/type.RelatedOriginsResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how collecting an iterator of Results short-circuits on the first Err encountered. ```rust let v = vec![1, 2]; let res: Result, &'static str> = v.iter().map(|x: &u32| x.checked_add(1).ok_or("Overflow!") ).collect(); assert_eq!(res, Ok(vec![2, 3])); ``` ```rust let v = vec![1, 2, 0]; let res: Result, &'static str> = v.iter().map(|x: &u32| x.checked_sub(1).ok_or("Underflow!") ).collect(); assert_eq!(res, Err("Underflow!")); ``` ```rust let v = vec![3, 2, 1, 10]; let mut shared = 0; let res: Result, &'static str> = v.iter().map(|x: &u32| { shared += x; x.checked_sub(2).ok_or("Underflow!") }).collect(); assert_eq!(res, Err("Underflow!")); assert_eq!(shared, 6); ``` -------------------------------- ### CableKnownDevice::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/known_devices/struct.CableKnownDevice.html Creates a new instance of a CableKnownDevice using the provided hint, device information, and a device info store. ```APIDOC ## pub async fn new(hint: ClientPayloadHint, device_info: &CableKnownDeviceInfo, store: Arc) -> Result ### Description Initializes a new CableKnownDevice instance. ### Parameters - **hint** (ClientPayloadHint) - The client payload hint. - **device_info** (&CableKnownDeviceInfo) - Reference to the device information. - **store** (Arc) - The device information store. ### Returns - **Result** - Returns the new device instance or a CableError if initialization fails. ``` -------------------------------- ### DafsaFilePublicSuffixList Initialization Methods Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/psl/dafsa/struct.DafsaFilePublicSuffixList.html?search= Methods to initialize the list from a file path or the system default. ```rust pub fn from_path(path: impl AsRef) -> Result ``` ```rust pub fn from_system_file() -> Result ``` -------------------------------- ### new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/connection/struct.Connection.html?search=u32+-%3E+bool Creates a new Connection instance using the provided peripheral, services, and FIDO revision. ```APIDOC ### pub async fn new(peripheral: &Peripheral, services: &FidoEndpoints, revision: &FidoRevision) -> Result Creates a new connection to a FIDO BLE peripheral. ``` -------------------------------- ### fn get Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/trait.HttpClient.html?search=std%3A%3Avec Performs a minimal HTTP GET request to the specified URL. Implementations must ensure no credentials or Referer headers are sent, follow only https:// redirects, and enforce limits on body size and request duration. ```APIDOC ## fn get(url: &Url) -> Pin>, HttpClientError>> + Send + 'async_trait>> ### Description Performs an HTTP GET request to fetch a well-known document. The implementation must adhere to strict security requirements including no credentials, no Referer header, and https-only redirects. ### Parameters - **url** (&Url) - Required - The URL to fetch. ### Returns - **Result>, HttpClientError>** - A future resolving to the HTTP response containing the raw body as a byte vector or an HttpClientError. ``` -------------------------------- ### Create New String Source: https://docs.rs/libwebauthn/latest/libwebauthn/pin/persistent_token/type.PersistentTokenRecordId.html?search=u32+-%3E+bool Initialize an empty String instance. ```rust let s = String::new(); ``` -------------------------------- ### webauthn_get_assertion Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/channel/struct.BleChannel.html?search= Performs a WebAuthn get assertion operation. ```APIDOC ## fn webauthn_get_assertion(&mut self, op: &GetAssertionRequest) -> Pin>>>> ### Description Retrieves an assertion for a credential using the WebAuthn protocol. ### Parameters - **op** (GetAssertionRequest) - The get assertion request parameters. ### Returns - **Result>** - A future resolving to the assertion response or a transport error. ``` -------------------------------- ### command_ctap_msg Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/commands/fn.command_ctap_msg.html?search=std%3A%3Avec Constructs a GET MSG command for NFC transport. ```APIDOC ## command_ctap_msg ### Description Constructs a `GET MSG` command for NFC transport. ### Signature `pub fn command_ctap_msg(has_more: bool, payload: &[u8]) -> CtapMsgCommand<'_>` ### Parameters - **has_more** (bool) - Indicates if there is more data. - **payload** (&[u8]) - The data payload for the command. ### Returns - **CtapMsgCommand** - A command object representing the `GET MSG` request. ``` -------------------------------- ### pub async fn is_available() -> bool Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/manager/fn.is_available.html?search= Checks if a Bluetooth adapter is available on the system. ```APIDOC ## is_available ### Description Checks if a Bluetooth adapter is available on the system. ### Signature `pub async fn is_available() -> bool` ### Returns - **bool** - Returns true if a Bluetooth adapter is available, false otherwise. ``` -------------------------------- ### command_ctap_msg Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/commands/fn.command_ctap_msg.html?search=u32+-%3E+bool Constructs a GET MSG command for NFC transport. ```APIDOC ## command_ctap_msg ### Description Constructs a `GET MSG` command for NFC transport. ### Signature `pub fn command_ctap_msg(has_more: bool, payload: &[u8]) -> CtapMsgCommand<'_>` ### Parameters - **has_more** (bool) - Indicates if there is more data. - **payload** (&[u8]) - The message payload. ### Returns - **CtapMsgCommand** - A command object representing the GET MSG request. ``` -------------------------------- ### pub async fn is_available() -> bool Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/manager/fn.is_available.html?search=std%3A%3Avec Checks if a Bluetooth adapter is available on the system. ```APIDOC ## Function: is_available ### Description Checks if a Bluetooth adapter is available on the system. ### Signature `pub async fn is_available() -> bool` ### Returns - **bool**: Returns true if a Bluetooth adapter is available, false otherwise. ``` -------------------------------- ### Info implementation methods Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/pcsc/struct.Info.html?search= Methods for creating a new Info instance and establishing an NFC channel. ```rust pub fn new(name: &CStr) -> Self ``` ```rust pub fn channel( &self, settings: ChannelSettings, ) -> Result, NfcError> ``` -------------------------------- ### command_ctap_msg Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/commands/fn.command_ctap_msg.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Constructs a GET MSG command for NFC communication. ```APIDOC ## Function: command_ctap_msg ### Description Constructs a `GET MSG` command for use in NFC transport. ### Signature `pub fn command_ctap_msg(has_more: bool, payload: &[u8]) -> CtapMsgCommand<'_>` ### Parameters - **has_more** (bool) - Indicates if there is more data to follow. - **payload** (&[u8]) - The byte slice containing the command payload. ### Returns - **CtapMsgCommand** - A command object configured for the GET MSG operation. ``` -------------------------------- ### HidChannel::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/hid/channel/struct.HidChannel.html?search=u32+-%3E+bool Creates a new HidChannel instance. ```APIDOC ## pub async fn new(device: &'d HidDevice, settings: ChannelSettings) -> Result, WebAuthnError> ### Description Creates a new HidChannel instance associated with the provided HidDevice and settings. ``` -------------------------------- ### WebAuthn::webauthn_get_assertion Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/channel/struct.BleChannel.html?search=u32+-%3E+bool Initiates the get assertion operation for WebAuthn. ```APIDOC ## fn webauthn_get_assertion ### Description Performs the WebAuthn get assertion operation using the provided request parameters. ### Parameters - **op** (GetAssertionRequest) - Required - The request object containing assertion details. ### Returns - **Result** - A future resolving to the assertion response or a transport error. ``` -------------------------------- ### Trim start of string Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Removes leading whitespace from a string slice. ```rust let s = " עברית "; assert!(Some('ע') == s.trim_start().chars().next()); ``` -------------------------------- ### Perform a WebAuthn Make Credential ceremony Source: https://docs.rs/libwebauthn/latest/libwebauthn/index.html?search= Demonstrates the full flow of enumerating HID devices, handling user verification updates via a background task, and executing a make-credential ceremony. ```rust use libwebauthn::ops::webauthn::{ MakeCredentialRequest, OriginValidation, RelatedOrigins, RequestOrigin, RequestSettings, SystemPublicSuffixList, }; use libwebauthn::transport::hid::list_devices; use libwebauthn::transport::{Channel, ChannelSettings, Device}; use libwebauthn::webauthn::WebAuthn; use libwebauthn::UvUpdate; // 1. Enumerate authenticators on your transport of choice (HID shown here). let devices = list_devices().await?; for mut device in devices { // 2. Open a channel to the device. let mut channel = device.channel(ChannelSettings::default()).await?; // 3. Drive user-verification updates on a separate task: each update // carries the means to answer it. See `examples/ceremony/`. let mut updates = channel.get_ux_update_receiver(); tokio::spawn(async move { while let Ok(update) = updates.recv().await { match update { UvUpdate::PresenceRequired => println!("Touch your authenticator"), UvUpdate::PinRequired(request) => { let _ = request.send_pin("the user's PIN"); } _ => {} } } }); // 4. Build a request from its WebAuthn IDL JSON. let origin: RequestOrigin = "https://example.org".try_into().expect("invalid origin"); let psl = SystemPublicSuffixList::auto().expect("public suffix list unavailable"); let settings = RequestSettings { origin: OriginValidation::Validate { public_suffix_list: &psl, related_origins: RelatedOrigins::Disabled, }, }; let request_json = r#"{ "rp": { "id": "example.org", "name": "Example" } }"#; // abbreviated let request = MakeCredentialRequest::prepare(&origin, request_json, &settings).await?; // 5. Run the ceremony on the channel. let _response = channel.webauthn_make_credential(&request).await?; } ``` -------------------------------- ### Initialize Channel Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/pcsc/struct.Channel.html Creates a new Channel instance using the provided info and context. ```rust pub fn new(info: &Info, context: Context) -> Result ``` -------------------------------- ### pub async fn list_devices() -> Result, HidError> Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/hid/device/fn.list_devices.html?search=std%3A%3Avec Retrieves a list of available HID devices. ```APIDOC ## list_devices ### Description Retrieves a list of available HID devices. ### Signature `pub async fn list_devices() -> Result, HidError>` ### Returns - **Result, HidError>** - A result containing a vector of `HidDevice` objects on success, or a `HidError` on failure. ``` -------------------------------- ### Initialize a new CableKnownDevice Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/known_devices/struct.CableKnownDevice.html Asynchronous constructor for creating a new instance of CableKnownDevice using a store for device information. ```rust pub async fn new( hint: ClientPayloadHint, device_info: &CableKnownDeviceInfo, store: Arc, ) -> Result ``` -------------------------------- ### WebAuthn Get Assertion Method Source: https://docs.rs/libwebauthn/latest/libwebauthn/webauthn/trait.WebAuthn.html?search=std%3A%3Avec Signature for the assertion retrieval method. ```rust fn webauthn_get_assertion<'life0, 'life1, 'async_trait>( &'life0 mut self, op: &'life1 GetAssertionRequest, ) -> Pin>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, ``` -------------------------------- ### PinUvAuthProtocolTwo Implementation Methods Source: https://docs.rs/libwebauthn/latest/libwebauthn/pin/struct.PinUvAuthProtocolTwo.html?search=std%3A%3Avec Methods for initializing the protocol and performing cryptographic operations like encapsulation, encryption, decryption, and authentication. ```rust pub fn new() -> Self ``` ```rust fn default() -> Self ``` ```rust fn version(&self) -> Ctap2PinUvAuthProtocol ``` ```rust fn encapsulate( &self, peer_public_key: &PublicKey, ) -> Result<(PublicKey, Vec), PlatformError> ``` ```rust fn encrypt( &self, key: &[u8], plaintext: &[u8], ) -> Result, PlatformError> ``` ```rust fn decrypt( &self, key: &[u8], ciphertext: &[u8], ) -> Result, PlatformError> ``` ```rust fn authenticate( &self, key: &[u8], message: &[u8], ) -> Result, PlatformError> ``` -------------------------------- ### command_get_response Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/commands/index.html?search= Constructs a GET RESPONSE (0xC0) command for NFC transport. ```APIDOC ## command_get_response ### Description Constructs a `GET RESPONSE` (0xC0) command used for NFC communication. ### Signature `pub fn command_get_response() -> GetResponseCommand` ``` -------------------------------- ### Get fingerprint sensor info Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/channel/struct.CableChannel.html Retrieves information about the fingerprint sensor. ```rust fn get_fingerprint_sensor_info<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin::TransportError>>> + Send + 'async_trait>> where 'life0: 'async_trait, C: 'async_trait, ``` -------------------------------- ### Get biometric modality Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/channel/struct.CableChannel.html Retrieves the biometric modality supported by the device. ```rust fn get_bio_modality<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin::TransportError>>> + Send + 'async_trait>> where 'life0: 'async_trait, C: 'async_trait, ``` -------------------------------- ### Connection::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/connection/struct.Connection.html?search= Creates a new Connection instance. ```APIDOC ## pub async fn new(peripheral: &Peripheral, services: &FidoEndpoints, revision: &FidoRevision) -> Result ### Description Creates a new Connection instance using the provided peripheral, FIDO endpoints, and revision. ### Parameters - **peripheral** (&Peripheral) - Required - The BLE peripheral to connect to. - **services** (&FidoEndpoints) - Required - The FIDO endpoints to use. - **revision** (&FidoRevision) - Required - The FIDO revision to use. ### Returns - **Result** - Returns the new Connection instance or an Error if initialization fails. ``` -------------------------------- ### Check string length Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates how to get the length of the string in bytes. ```rust let len = "foo".len(); assert_eq!(3, len); assert_eq!("ƒoo".len(), 4); // fancy f! assert_eq!("ƒoo".chars().count(), 3); ``` -------------------------------- ### CableKnownDevice::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/known_devices/struct.CableKnownDevice.html?search=std%3A%3Avec Creates a new instance of a CableKnownDevice. ```APIDOC ## pub async fn new(hint: ClientPayloadHint, device_info: &CableKnownDeviceInfo, store: Arc) -> Result ### Description Creates a new CableKnownDevice instance using the provided payload hint, device information, and a device info store. ### Parameters - **hint** (ClientPayloadHint) - Required - The client payload hint. - **device_info** (&CableKnownDeviceInfo) - Required - The device information. - **store** (Arc) - Required - The store for device information. ### Returns - **Result** - Returns the new device instance or a CableError if initialization fails. ``` -------------------------------- ### Start new biometric enrollment Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/channel/struct.CableChannel.html Initiates a new biometric enrollment process. ```rust fn start_new_bio_enrollment<'life0, 'async_trait>( &'life0 mut self, enrollment_timeout: Option, timeout: Duration, ) -> Pin, Ctap2LastEnrollmentSampleStatus, u64), Error<::TransportError>>> + Send + 'async_trait>> where 'life0: 'async_trait, C: 'async_trait, ``` -------------------------------- ### CableKnownDevice::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/known_devices/struct.CableKnownDevice.html?search= Creates a new instance of CableKnownDevice. ```APIDOC ## pub async fn new(hint: ClientPayloadHint, device_info: &CableKnownDeviceInfo, store: Arc) -> Result ### Description Creates a new CableKnownDevice instance using the provided hint, device information, and storage interface. ### Parameters - **hint** (ClientPayloadHint) - Required - The client payload hint. - **device_info** (&CableKnownDeviceInfo) - Required - Reference to the known device information. - **store** (Arc) - Required - The storage implementation for device information. ### Returns - **Result** - Returns the new CableKnownDevice instance or a CableError if initialization fails. ``` -------------------------------- ### Trim start matches with patterns Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Removes prefixes that match a given pattern. ```rust assert_eq!("11foo1bar11".trim_start_matches('1'), "foo1bar11"); assert_eq!("123foo1bar123".trim_start_matches(char::is_numeric), "foo1bar123"); ``` -------------------------------- ### DafsaFilePublicSuffixList::from_system_file Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/psl/dafsa/struct.DafsaFilePublicSuffixList.html Creates a new DafsaFilePublicSuffixList by reading the system-managed .dafsa file. ```APIDOC ## pub fn from_system_file() -> Result ### Description Reads the system-managed .dafsa PSL file located at the predefined SYSTEM_PSL_DAFSA_PATH. ### Returns - **Result** - Returns the initialized struct or a load error. ``` -------------------------------- ### pub async fn is_available() -> bool Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/fn.is_available.html Checks if the Cable/Hybrid transport is available on the system. Cable depends on a Bluetooth adapter for BLE advertisement discovery. ```APIDOC ## is_available ### Description Checks if the Cable/Hybrid transport is available on the system. Cable depends on a Bluetooth adapter for BLE advertisement discovery. ### Signature `pub async fn is_available() -> bool` ### Returns - **bool** - Returns true if the Cable/Hybrid transport is available, false otherwise. ``` -------------------------------- ### Match patterns with indices Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns an iterator over disjoint matches and their starting indices. ```rust let v: Vec<_> = "abcXXXabcYYYabc".match_indices("abc").collect(); assert_eq!(v, [(0, "abc"), (6, "abc"), (12, "abc")]); let v: Vec<_> = "1abcabc2".match_indices("abc").collect(); assert_eq!(v, [(1, "abc"), (4, "abc")]); let v: Vec<_> = "ababa".match_indices("aba").collect(); assert_eq!(v, [(0, "aba")]); // only the first `aba` ``` -------------------------------- ### Connection::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/connection/struct.Connection.html Creates a new Connection instance using the provided peripheral, services, and revision. ```APIDOC ## pub async fn new(peripheral: &Peripheral, services: &FidoEndpoints, revision: &FidoRevision) -> Result ### Description Initializes a new BLE connection for FIDO communication. ### Parameters - **peripheral** (&Peripheral) - The BLE peripheral to connect to. - **services** (&FidoEndpoints) - The FIDO service endpoints. - **revision** (&FidoRevision) - The FIDO revision to use. ### Returns - **Result** - Returns the new Connection instance or an Error if initialization fails. ``` -------------------------------- ### Check slice prefixes with starts_with Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html?search= Determines if a slice starts with a specific prefix. ```rust let v = [10, 40, 30]; assert!(v.starts_with(&[10])); assert!(v.starts_with(&[10, 40])); assert!(v.starts_with(&v)); assert!(!v.starts_with(&[50])); assert!(!v.starts_with(&[10, 50])); ``` ```rust let v = &[10, 40, 30]; assert!(v.starts_with(&[])); let v: &[u8] = &[]; assert!(v.starts_with(&[])); ``` -------------------------------- ### DafsaFilePublicSuffixList::from_path Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/psl/dafsa/struct.DafsaFilePublicSuffixList.html Creates a new DafsaFilePublicSuffixList by reading a libpsl .dafsa file from the specified path. ```APIDOC ## pub fn from_path(path: impl AsRef) -> Result ### Description Reads a libpsl .dafsa file from the provided path to initialize the Public Suffix List. ### Parameters - **path** (impl AsRef) - Required - The filesystem path to the .dafsa file. ### Returns - **Result** - Returns the initialized struct or a load error. ``` -------------------------------- ### Accessing Slice Elements Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html Examples of accessing the first and last elements of a slice. ```rust let v = [10, 40, 30]; assert_eq!(Some(&10), v.first()); let w: &[i32] = &[]; assert_eq!(None, w.first()); ``` ```rust let v = [10, 40, 30]; assert_eq!(Some(&30), v.last()); let w: &[i32] = &[]; assert_eq!(None, w.last()); ``` -------------------------------- ### Slice Length and Empty Check Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html Examples of checking the length and emptiness of a slice. ```rust let a = [1, 2, 3]; assert_eq!(a.len(), 3); ``` ```rust let a = [1, 2, 3]; assert!(!a.is_empty()); let b: &[i32] = &[]; assert!(b.is_empty()); ``` -------------------------------- ### HidChannel::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/hid/channel/struct.HidChannel.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new HidChannel instance associated with a specific HidDevice and settings. ```APIDOC ## pub async fn new(device: &'d HidDevice, settings: ChannelSettings) -> Result, WebAuthnError> ### Description Initializes a new HID channel for communication with the provided device using the specified settings. ### Parameters - **device** (&'d HidDevice) - The HID device to communicate with. - **settings** (ChannelSettings) - Configuration settings for the channel. ``` -------------------------------- ### Get biometric enrollments Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/channel/struct.CableChannel.html Lists all existing biometric enrollment template IDs. ```rust fn get_bio_enrollments<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin, Error<::TransportError>>> + Send + 'async_trait>> where 'life0: 'async_trait, C: 'async_trait, ``` -------------------------------- ### Constructing DatFilePublicSuffixList Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/psl/dat/struct.DatFilePublicSuffixList.html?search= Methods to initialize the list from a file path or the system default path. ```rust pub fn from_path(path: impl AsRef) -> Result ``` ```rust pub fn from_system_file() -> Result ``` -------------------------------- ### Connection::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/connection/struct.Connection.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new Connection instance using the provided peripheral, services, and FIDO revision. ```APIDOC ## pub async fn new(peripheral: &Peripheral, services: &FidoEndpoints, revision: &FidoRevision) -> Result ### Description Initializes a new BLE connection for FIDO operations. ### Parameters - **peripheral** (&Peripheral) - The BLE peripheral to connect to. - **services** (&FidoEndpoints) - The FIDO endpoints configuration. - **revision** (&FidoRevision) - The FIDO revision to use. ``` -------------------------------- ### HttpClient::get Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/trait.HttpClient.html?search=u32+-%3E+bool Performs a minimal HTTP GET request to the specified URL. ```APIDOC ## fn get ### Description Performs a minimal HTTP GET request to fetch a well-known document. Implementations must not send credentials or Referer headers, must only follow https:// redirects, and must enforce limits on body size and request duration. ### Signature `fn get<'life0, 'life1, 'async_trait>(&'life0 self, url: &'life1 Url) -> Pin>, HttpClientError>> + Send + 'async_trait>>` ### Parameters - **url** (Url) - The target URL to fetch. ### Returns - **Result>, HttpClientError>** - A future resolving to the HTTP response containing the raw body bytes or an error. ``` -------------------------------- ### Get Last Element Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html?search= Returns the last element of the slice, or None if it is empty. ```rust let v = [10, 40, 30]; assert_eq!(Some(&30), v.last()); let w: &[i32] = &[]; assert_eq!(None, w.last()); ``` -------------------------------- ### Get First Element Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html?search= Returns the first element of the slice, or None if it is empty. ```rust let v = [10, 40, 30]; assert_eq!(Some(&10), v.first()); let w: &[i32] = &[]; assert_eq!(None, w.first()); ``` -------------------------------- ### BleFrame::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/framing/struct.BleFrame.html?search=u32+-%3E+bool Creates a new BleFrame instance with the specified command and data. ```APIDOC ## pub fn new(cmd: BleCommand, data: &[u8]) -> Self ### Description Constructs a new `BleFrame` containing the provided `BleCommand` and byte data. ### Parameters - **cmd** (BleCommand) - The command associated with the frame. - **data** (&[u8]) - The payload data to be included in the frame. ``` -------------------------------- ### Map Result Values Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/type.RelatedOriginsResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Example of using map to transform the success value of a Result. ```rust let line = "1\n2\n3\n4\n"; for num in line.lines() { match num.parse::().map(|i| i * 2) { Ok(n) => println!("{n}"), Err(..) => {} } } ``` -------------------------------- ### BleFrameParser::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/framing/struct.BleFrameParser.html Creates a new instance of the BleFrameParser. ```APIDOC ## pub fn new() -> Self ### Description Creates a new instance of the BleFrameParser. ### Signature `pub fn new() -> Self` ``` -------------------------------- ### Convert Result to Option Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/type.RelatedOriginsResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of converting Result to Option using ok and err. ```rust let x: Result = Ok(2); assert_eq!(x.ok(), Some(2)); let x: Result = Err("Nothing here"); assert_eq!(x.ok(), None); ``` ```rust let x: Result = Ok(2); assert_eq!(x.err(), None); let x: Result = Err("Nothing here"); assert_eq!(x.err(), Some("Nothing here")); ``` -------------------------------- ### BleFrameParser::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/framing/struct.BleFrameParser.html?search= Creates a new instance of the BleFrameParser. ```APIDOC ## pub fn new() -> Self ### Description Creates a new instance of the BleFrameParser. ### Returns - **Self** - A new instance of BleFrameParser. ``` -------------------------------- ### Check Result with Predicates Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/type.RelatedOriginsResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of using is_ok_and and is_err_and to validate Result contents. ```rust let x: Result = Ok(2); assert_eq!(x.is_ok_and(|x| x > 1), true); let x: Result = Ok(0); assert_eq!(x.is_ok_and(|x| x > 1), false); let x: Result = Err("hey"); assert_eq!(x.is_ok_and(|x| x > 1), false); let x: Result = Ok("ownership".to_string()); assert_eq!(x.as_ref().is_ok_and(|x| x.len() > 1), true); println!("still alive {:?}", x); ``` ```rust use std::io::{Error, ErrorKind}; let x: Result = Err(Error::new(ErrorKind::NotFound, "!")); assert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true); let x: Result = Err(Error::new(ErrorKind::PermissionDenied, "!")); assert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false); let x: Result = Ok(123); assert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false); let x: Result = Err("ownership".to_string()); assert_eq!(x.as_ref().is_err_and(|x| x.len() > 1), true); println!("still alive {:?}", x); ``` -------------------------------- ### Check Result Status Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/related_origins/type.RelatedOriginsResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of using is_ok and is_err to check the status of a Result. ```rust let x: Result = Ok(-3); assert_eq!(x.is_ok(), true); let x: Result = Err("Some error message"); assert_eq!(x.is_ok(), false); ``` ```rust let x: Result = Ok(-3); assert_eq!(x.is_err(), false); let x: Result = Err("Some error message"); assert_eq!(x.is_err(), true); ``` -------------------------------- ### Create a Persistent CableQrCodeDevice Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/qr_code_device/struct.CableQrCodeDevice.html Generates a QR code linked to a known-device store, allowing for device persistence after connection. ```rust pub fn new_persistent( hint: QrCodeOperationHint, store: Arc, transports: CableTransports, ) -> Result ``` -------------------------------- ### Get raw pointer Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Obtains a raw pointer to the first byte of the string slice. ```rust let s = "Hello"; let ptr = s.as_ptr(); ``` -------------------------------- ### EphemeralDeviceInfoStore::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/known_devices/struct.EphemeralDeviceInfoStore.html?search= Creates a new instance of the EphemeralDeviceInfoStore. ```APIDOC ## pub fn new() -> Self ### Description Creates a new instance of the EphemeralDeviceInfoStore. ``` -------------------------------- ### Trim string prefixes and suffixes Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates trimming characters from the start or end of a string slice. ```rust assert_eq!("".trim_prefix('<').trim_suffix('>'), "https://example.com/"); ``` ```rust assert_eq!("11foo1bar11".trim_end_matches('1'), "11foo1bar"); assert_eq!("123foo1bar123".trim_end_matches(char::is_numeric), "123foo1bar"); let x: &[_] = &['1', '2']; assert_eq!("12foo1bar12".trim_end_matches(x), "12foo1bar"); ``` ```rust assert_eq!("1fooX".trim_end_matches(|c| c == '1' || c == 'X'), "1foo"); ``` ```rust assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11"); assert_eq!("123foo1bar123".trim_left_matches(char::is_numeric), "foo1bar123"); let x: &[_] = &['1', '2']; assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12"); ``` ```rust assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar"); assert_eq!("123foo1bar123".trim_right_matches(char::is_numeric), "123foo1bar"); let x: &[_] = &['1', '2']; assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar"); ``` ```rust assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "1foo"); ``` -------------------------------- ### EphemeralDeviceInfoStore::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/known_devices/struct.EphemeralDeviceInfoStore.html?search=std%3A%3Avec Creates a new instance of the EphemeralDeviceInfoStore. ```APIDOC ## pub fn new() -> Self ### Description Creates a new, empty instance of the EphemeralDeviceInfoStore. ``` -------------------------------- ### NfcChannel::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/channel/struct.NfcChannel.html?search=u32+-%3E+bool Creates a new instance of NfcChannel with the provided backend, context, and settings. ```APIDOC ## pub fn new(delegate: Box + Send + Sync>, ctx: Ctx, settings: ChannelSettings) -> Self ### Description Initializes a new NFC channel for communication with a WebAuthn device. ### Parameters - **delegate** (Box + Send + Sync>) - The NFC backend implementation. - **ctx** (Ctx) - The context associated with the channel. - **settings** (ChannelSettings) - Configuration settings for the channel. ``` -------------------------------- ### Trim ASCII whitespace from string start Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=std%3A%3Avec Removes leading ASCII whitespace, excluding U+000B. ```rust assert_eq!(" \t \u{3000}hello world\n".trim_ascii_start(), "\u{3000}hello world\n"); assert_eq!(" ".trim_ascii_start(), ""); assert_eq!("".trim_ascii_start(), ""); ``` -------------------------------- ### Reverse split slice by predicate Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html?search= Iterates over subslices separated by a predicate, starting from the end of the slice. ```rust let slice = [11, 22, 33, 0, 44, 55]; let mut iter = slice.rsplit(|num| *num == 0); assert_eq!(iter.next().unwrap(), &[44, 55]); assert_eq!(iter.next().unwrap(), &[11, 22, 33]); assert_eq!(iter.next(), None); ``` ```rust let v = &[0, 1, 1, 2, 3, 5, 8]; let mut it = v.rsplit(|n| *n % 2 == 0); assert_eq!(it.next().unwrap(), &[]); assert_eq!(it.next().unwrap(), &[3, 5]); assert_eq!(it.next().unwrap(), &[1, 1]); assert_eq!(it.next().unwrap(), &[]); assert_eq!(it.next(), None); ``` -------------------------------- ### connect Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/manager/index.html Connects to a device, discovers FIDO services, and selects the FIDO revision. Refuses unbonded LE links. ```APIDOC ### Function: connect() Connect, discover FIDO services on this device, and select the FIDO revision to be used. Refuses unbonded LE links (CTAP 2.2 §11.4). ``` -------------------------------- ### Trim ASCII Start Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/struct.Base64UrlString.html?search= Returns a byte slice with leading ASCII whitespace bytes removed. ```rust assert_eq!(b" \t hello world\n".trim_ascii_start(), b"hello world\n"); assert_eq!(b" ".trim_ascii_start(), b""); assert_eq!(b"".trim_ascii_start(), b""); ``` -------------------------------- ### PinUvAuthProtocolOne::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/pin/struct.PinUvAuthProtocolOne.html?search= Creates a new instance of the PinUvAuthProtocolOne struct. ```APIDOC ### pub fn new() -> Self Creates a new instance of the PinUvAuthProtocolOne protocol handler. ``` -------------------------------- ### connect Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/index.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Establishes a connection to a specified FIDO device. ```APIDOC ## connect ### Description Connects to a FIDO device identified by the provided parameters. ### Signature `pub fn connect(device: &FidoDevice) -> Result` ``` -------------------------------- ### Match Ctap2CommandCode Variants Source: https://docs.rs/libwebauthn/latest/libwebauthn/proto/ctap2/enum.Ctap2CommandCode.html Example of matching on Ctap2CommandCode variants to map them to their corresponding byte values. ```rust use libwebauthn::proto::ctap2::Ctap2CommandCode; let code = Ctap2CommandCode::AuthenticatorGetInfo; let _value: u8 = match code { Ctap2CommandCode::AuthenticatorMakeCredential => 0x01, Ctap2CommandCode::AuthenticatorGetAssertion => 0x02, Ctap2CommandCode::AuthenticatorGetInfo => 0x04, Ctap2CommandCode::AuthenticatorClientPin => 0x06, Ctap2CommandCode::AuthenticatorGetNextAssertion => 0x08, Ctap2CommandCode::AuthenticatorBioEnrollment => 0x09, Ctap2CommandCode::AuthenticatorBioEnrollmentPreview => 0x40, Ctap2CommandCode::AuthenticatorCredentialManagement => 0x0A, Ctap2CommandCode::AuthenticatorCredentialManagementPreview => 0x41, Ctap2CommandCode::AuthenticatorSelection => 0x0B, Ctap2CommandCode::AuthenticatorLargeBlobs => 0x0C, Ctap2CommandCode::AuthenticatorConfig => 0x0D, }; ``` -------------------------------- ### connect Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/ble/btleplug/index.html Establishes a connection to a specified FIDO device. ```APIDOC ## connect ### Description Establishes a connection to a FIDO device identified by the provided parameters. ### Signature `pub fn connect(device: &FidoDevice) -> Result` ``` -------------------------------- ### Construct a GET MSG command Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/commands/fn.command_ctap_msg.html Use this function to create a CtapMsgCommand instance for NFC communication. ```rust pub fn command_ctap_msg(has_more: bool, payload: &[u8]) -> CtapMsgCommand<'_> ``` -------------------------------- ### Create a Transient CableQrCodeDevice Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/cable/qr_code_device/struct.CableQrCodeDevice.html Generates a QR code for a device connection that will not be persisted. ```rust pub fn new_transient( hint: QrCodeOperationHint, transports: CableTransports, ) -> Result ``` -------------------------------- ### Get subslice safely Source: https://docs.rs/libwebauthn/latest/libwebauthn/ops/webauthn/idl/rpid/struct.RelyingPartyId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Safely retrieves a subslice, returning None if indices are invalid or out of bounds. ```rust let v = String::from("🗻∈🌏"); assert_eq!(Some("🗻"), v.get(0..4)); // indices not on UTF-8 sequence boundaries assert!(v.get(1..).is_none()); assert!(v.get(..8).is_none()); // out of bounds assert!(v.get(..42).is_none()); ``` -------------------------------- ### Info::new Source: https://docs.rs/libwebauthn/latest/libwebauthn/transport/nfc/pcsc/struct.Info.html?search=std%3A%3Avec Creates a new instance of Info using the provided name. ```APIDOC ### pub fn new(name: &CStr) -> Self Creates a new Info instance associated with the specified name. ```