1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 20:24:01 +00:00

PM-21845: Beginning of experiment

This commit is contained in:
Colton Hurst
2025-05-22 08:45:05 -04:00
parent 0555d827c6
commit 838b8ae03a
4 changed files with 165 additions and 19 deletions

View File

@@ -362,6 +362,14 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "autotype"
version = "0.0.0"
dependencies = [
"windows 0.61.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-core 0.61.2",
]
[[package]]
name = "backtrace"
version = "0.3.75"
@@ -897,8 +905,8 @@ dependencies = [
"tokio-util",
"typenum",
"widestring",
"windows 0.61.1",
"windows-future",
"windows 0.61.1 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-future 0.2.0",
"zbus 4.4.0",
"zbus_polkit",
"zeroizing-alloc",
@@ -2929,7 +2937,7 @@ dependencies = [
"ntapi",
"objc2-core-foundation",
"objc2-io-kit",
"windows 0.61.1",
"windows 0.61.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3527,11 +3535,23 @@ version = "0.61.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419"
dependencies = [
"windows-collections",
"windows-collections 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-core 0.61.0",
"windows-future",
"windows-link",
"windows-numerics",
"windows-future 0.2.0",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-numerics 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "windows"
version = "0.61.1"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-collections 0.2.0 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-core 0.61.2",
"windows-future 0.2.1",
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-numerics 0.2.0 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
]
[[package]]
@@ -3543,6 +3563,14 @@ dependencies = [
"windows-core 0.61.0",
]
[[package]]
name = "windows-collections"
version = "0.2.0"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-core 0.61.2",
]
[[package]]
name = "windows-core"
version = "0.57.0"
@@ -3561,11 +3589,23 @@ version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
dependencies = [
"windows-implement 0.60.0",
"windows-interface 0.59.1",
"windows-link",
"windows-implement 0.60.0 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-interface 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-result 0.3.2",
"windows-strings",
"windows-strings 0.4.0",
]
[[package]]
name = "windows-core"
version = "0.61.2"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-implement 0.60.0 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-interface 0.59.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-result 0.3.4",
"windows-strings 0.4.2",
]
[[package]]
@@ -3575,7 +3615,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32"
dependencies = [
"windows-core 0.61.0",
"windows-link",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "windows-future"
version = "0.2.1"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-core 0.61.2",
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
"windows-threading",
]
[[package]]
@@ -3600,6 +3650,16 @@ dependencies = [
"syn",
]
[[package]]
name = "windows-implement"
version = "0.60.0"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-interface"
version = "0.57.0"
@@ -3622,12 +3682,27 @@ dependencies = [
"syn",
]
[[package]]
name = "windows-interface"
version = "0.59.1"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-link"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
name = "windows-link"
version = "0.1.1"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
[[package]]
name = "windows-numerics"
version = "0.2.0"
@@ -3635,7 +3710,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
dependencies = [
"windows-core 0.61.0",
"windows-link",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "windows-numerics"
version = "0.2.0"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-core 0.61.2",
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
]
[[package]]
@@ -3644,9 +3728,9 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1da3e436dc7653dfdf3da67332e22bff09bb0e28b0239e1624499c7830842e"
dependencies = [
"windows-link",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-result 0.3.2",
"windows-strings",
"windows-strings 0.4.0",
]
[[package]]
@@ -3664,7 +3748,15 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
"windows-link",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "windows-result"
version = "0.3.4"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
]
[[package]]
@@ -3673,7 +3765,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
dependencies = [
"windows-link",
"windows-link 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "windows-strings"
version = "0.4.2"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
]
[[package]]
@@ -3725,6 +3825,14 @@ dependencies = [
"windows_x86_64_msvc 0.52.6",
]
[[package]]
name = "windows-threading"
version = "0.1.0"
source = "git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8#d09b4681de02560cf05bd3e57d7ea56b73f3b2f8"
dependencies = [
"windows-link 0.1.1 (git+https://github.com/microsoft/windows-rs.git?rev=d09b4681de02560cf05bd3e57d7ea56b73f3b2f8)",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
@@ -3784,7 +3892,7 @@ name = "windows_plugin_authenticator"
version = "0.0.0"
dependencies = [
"hex",
"windows 0.61.1",
"windows 0.61.1 (registry+https://github.com/rust-lang/crates.io-index)",
"windows-core 0.61.0",
]

View File

@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["napi", "core", "proxy", "macos_provider", "windows_plugin_authenticator"]
members = ["napi", "core", "proxy", "macos_provider", "windows_plugin_authenticator", "autotype"]
[workspace.package]
version = "0.0.0"

View File

@@ -0,0 +1,10 @@
[package]
name = "autotype"
version.workspace = true
license.workspace = true
edition.workspace = true
publish.workspace = true
[dependencies]
windows = { git = "https://github.com/microsoft/windows-rs.git", rev = "d09b4681de02560cf05bd3e57d7ea56b73f3b2f8", features = ["Win32_UI_Input_KeyboardAndMouse"] }
windows-core = { git = "https://github.com/microsoft/windows-rs.git", rev = "d09b4681de02560cf05bd3e57d7ea56b73f3b2f8" }

View File

@@ -0,0 +1,28 @@
use windows::Win32::UI::Input::KeyboardAndMouse::{RegisterHotKey, HOT_KEY_MODIFIERS, MOD_ALT};
/*
A safe wrapper around the unsafe RegisterHotKey Win32 function.
https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/UI/Input/KeyboardAndMouse/fn.RegisterHotKey.html
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey
*/
pub fn register_hotkey() -> std::result::Result<(), String> {
let r = unsafe { RegisterHotKey(None, 1, MOD_ALT, 42) }; // ALT + b
Ok(())
}
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}