From 27a15f2084d11a25380da13f7a60a95fd410114d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 6 Dec 2024 07:42:49 +0100 Subject: [PATCH] Update `keyring` to the latest version (#5751) Hopefully this helps with improving WSL2 support. --- Cargo.lock | 507 +++++------------- Cargo.toml | 2 +- crates/gitbutler-secret/src/secret.rs | 24 +- crates/gitbutler-testsupport/src/secrets.rs | 11 +- .../tests/secret/credentials.rs | 12 +- 5 files changed, 163 insertions(+), 393 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44999cea88..f9ef0fe68a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -214,7 +214,7 @@ dependencies = [ "wayland-backend", "wayland-client", "wayland-protocols", - "zbus 4.4.0", + "zbus", ] [[package]] @@ -233,23 +233,13 @@ dependencies = [ "wait-timeout", ] -[[package]] -name = "async-broadcast" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" -dependencies = [ - "event-listener 2.5.3", - "futures-core", -] - [[package]] name = "async-broadcast" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" dependencies = [ - "event-listener 5.3.1", + "event-listener", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -275,52 +265,20 @@ checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.1", - "futures-lite 2.3.0", + "fastrand", + "futures-lite", "slab", ] -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock 2.8.0", - "autocfg", - "blocking", - "futures-lite 1.13.0", -] - [[package]] name = "async-fs" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" dependencies = [ - "async-lock 3.4.0", + "async-lock", "blocking", - "futures-lite 2.3.0", -] - -[[package]] -name = "async-io" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" -dependencies = [ - "async-lock 2.8.0", - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-lite 1.13.0", - "log", - "parking", - "polling 2.8.0", - "rustix 0.37.27", - "slab", - "socket2 0.4.10", - "waker-fn", + "futures-lite", ] [[package]] @@ -329,56 +287,30 @@ version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" dependencies = [ - "async-lock 3.4.0", + "async-lock", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.3.0", + "futures-lite", "parking", - "polling 3.7.3", - "rustix 0.38.41", + "polling", + "rustix", "slab", "tracing", "windows-sys 0.59.0", ] -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener 2.5.3", -] - [[package]] name = "async-lock" version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 5.3.1", + "event-listener", "event-listener-strategy", "pin-project-lite", ] -[[package]] -name = "async-process" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" -dependencies = [ - "async-io 1.13.0", - "async-lock 2.8.0", - "async-signal", - "blocking", - "cfg-if", - "event-listener 3.1.0", - "futures-lite 1.13.0", - "rustix 0.38.41", - "windows-sys 0.48.0", -] - [[package]] name = "async-process" version = "2.3.0" @@ -386,15 +318,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel", - "async-io 2.3.4", - "async-lock 3.4.0", + "async-io", + "async-lock", "async-signal", "async-task", "blocking", "cfg-if", - "event-listener 5.3.1", - "futures-lite 2.3.0", - "rustix 0.38.41", + "event-listener", + "futures-lite", + "rustix", "tracing", ] @@ -415,13 +347,13 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ - "async-io 2.3.4", - "async-lock 3.4.0", + "async-io", + "async-lock", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.41", + "rustix", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -661,7 +593,7 @@ dependencies = [ "async-channel", "async-task", "futures-io", - "futures-lite 2.3.0", + "futures-lite", "piper", ] @@ -1392,7 +1324,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "socket2 0.5.7", + "socket2", "windows-sys 0.52.0", ] @@ -1467,24 +1399,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a" [[package]] -name = "deranged" -version = "0.3.11" +name = "dbus" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" dependencies = [ - "powerfmt", - "serde", + "libc", + "libdbus-sys", + "winapi", ] [[package]] -name = "derivative" -version = "2.2.0" +name = "dbus-secret-service" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "b42a16374481d92aed73ae45b1f120207d8e71d24fb89f357fadbd8f946fd84b" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "aes", + "block-padding", + "cbc", + "dbus", + "futures-util", + "hkdf", + "num", + "once_cell", + "rand 0.8.5", + "sha2", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", ] [[package]] @@ -1809,23 +1759,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-listener" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "event-listener" version = "5.3.1" @@ -1843,7 +1776,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" dependencies = [ - "event-listener 5.3.1", + "event-listener", "pin-project-lite", ] @@ -1856,15 +1789,6 @@ dependencies = [ "serde", ] -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - [[package]] name = "fastrand" version = "2.1.1" @@ -1895,7 +1819,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ - "memoffset 0.9.1", + "memoffset", "rustc_version", ] @@ -2086,28 +2010,13 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-lite" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.1.1", + "fastrand", "futures-core", "futures-io", "parking", @@ -2285,7 +2194,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc3655aa6818d65bc620d6911f05aa7b6aeb596291e1e9f79e52df85583d1e30" dependencies = [ - "rustix 0.38.41", + "rustix", "windows-targets 0.52.6", ] @@ -2608,7 +2517,7 @@ dependencies = [ "assert_cmd", "futures", "gix-path", - "nix 0.29.0", + "nix", "rand 0.8.5", "serde", "sysinfo", @@ -3448,7 +3357,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2bfe6249cfea6d0c0e0990d5226a4cb36f030444ba9e35e0639275db8f98575" dependencies = [ - "fastrand 2.1.1", + "fastrand", "gix-features 0.38.2", "gix-utils", ] @@ -3459,7 +3368,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34740384d8d763975858fa2c176b68652a6fcc09f616e24e3ce967b0d370e4d8" dependencies = [ - "fastrand 2.1.1", + "fastrand", "gix-features 0.39.1", "gix-utils", ] @@ -3579,7 +3488,7 @@ dependencies = [ "itoa 1.0.11", "libc", "memmap2", - "rustix 0.38.41", + "rustix", "smallvec", "thiserror 1.0.69", ] @@ -3607,7 +3516,7 @@ dependencies = [ "itoa 1.0.11", "libc", "memmap2", - "rustix 0.38.41", + "rustix", "smallvec", "thiserror 2.0.3", ] @@ -3817,7 +3726,7 @@ dependencies = [ "gix-command", "gix-config-value", "parking_lot", - "rustix 0.38.41", + "rustix", "thiserror 2.0.3", ] @@ -4042,7 +3951,7 @@ checksum = "33fd7cd1816d78db635003c9e3fc667a1671689c678de2b92ce7c71ed2d58686" dependencies = [ "bstr", "crc", - "fastrand 2.1.1", + "fastrand", "fs_extra", "gix-discover 0.32.0", "gix-fs 0.11.3", @@ -4142,7 +4051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba427e3e9599508ed98a6ddf8ed05493db114564e338e41f6a996d2e4790335f" dependencies = [ "bstr", - "fastrand 2.1.1", + "fastrand", "unicode-normalization", ] @@ -4611,7 +4520,7 @@ dependencies = [ "http-body", "hyper", "pin-project-lite", - "socket2 0.5.7", + "socket2", "tokio", "tower-service", "tracing", @@ -4905,17 +4814,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.9", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.10.1" @@ -5140,16 +5038,18 @@ dependencies = [ [[package]] name = "keyring" -version = "2.3.3" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363387f0019d714aa60cc30ab4fe501a747f4c08fc58f069dd14be971bd495a0" +checksum = "2f8fe839464d4e4b37d756d7e910063696af79a7e877282cb1825e4ec5f10833" dependencies = [ "byteorder", - "lazy_static", + "dbus-secret-service", "linux-keyutils", + "log", "secret-service", - "security-framework", - "windows-sys 0.52.0", + "security-framework 2.11.1", + "security-framework 3.0.1", + "windows-sys 0.59.0", ] [[package]] @@ -5230,6 +5130,15 @@ version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +[[package]] +name = "libdbus-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" +dependencies = [ + "pkg-config", +] + [[package]] name = "libgit2-sys" version = "0.17.0+1.8.1" @@ -5321,12 +5230,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -5440,15 +5343,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.1" @@ -5548,7 +5442,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] @@ -5589,18 +5483,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", -] - [[package]] name = "nix" version = "0.29.0" @@ -5611,7 +5493,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "libc", - "memoffset 0.9.1", + "memoffset", ] [[package]] @@ -6405,7 +6287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.1.1", + "fastrand", "futures-io", ] @@ -6469,22 +6351,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "polling" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - [[package]] name = "polling" version = "3.7.3" @@ -6495,7 +6361,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.41", + "rustix", "tracing", "windows-sys 0.59.0", ] @@ -6745,7 +6611,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.7", + "socket2", "thiserror 1.0.69", "tokio", "tracing", @@ -6776,7 +6642,7 @@ checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" dependencies = [ "libc", "once_cell", - "socket2 0.5.7", + "socket2", "tracing", "windows-sys 0.59.0", ] @@ -7177,20 +7043,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.37.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - [[package]] name = "rustix" version = "0.38.41" @@ -7200,7 +7052,7 @@ dependencies = [ "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.14", + "linux-raw-sys", "windows-sys 0.52.0", ] @@ -7336,9 +7188,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "secret-service" -version = "3.1.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5204d39df37f06d1944935232fd2dfe05008def7ca599bf28c0800366c8a8f9" +checksum = "e4d35ad99a181be0a60ffcbe85d680d98f87bdc4d7644ade319b87076b9dbfd4" dependencies = [ "aes", "cbc", @@ -7350,7 +7202,7 @@ dependencies = [ "rand 0.8.5", "serde", "sha2", - "zbus 3.15.2", + "zbus", ] [[package]] @@ -7366,6 +7218,19 @@ dependencies = [ "security-framework-sys", ] +[[package]] +name = "security-framework" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + [[package]] name = "security-framework-sys" version = "2.12.0" @@ -7717,16 +7582,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.7" @@ -8338,7 +8193,7 @@ dependencies = [ "tauri", "thiserror 1.0.69", "windows-sys 0.59.0", - "zbus 4.4.0", + "zbus", ] [[package]] @@ -8501,9 +8356,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand 2.1.1", + "fastrand", "once_cell", - "rustix 0.38.41", + "rustix", "windows-sys 0.59.0", ] @@ -8661,7 +8516,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.7", + "socket2", "tokio-macros", "tracing", "windows-sys 0.52.0", @@ -8814,7 +8669,7 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "socket2 0.5.7", + "socket2", "tokio", "tokio-stream", "tower 0.4.13", @@ -8999,7 +8854,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.1", + "memoffset", "tempfile", "winapi", ] @@ -9223,12 +9078,6 @@ dependencies = [ "libc", ] -[[package]] -name = "waker-fn" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" - [[package]] name = "walkdir" version = "2.5.0" @@ -9348,7 +9197,7 @@ checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.41", + "rustix", "scoped-tls", "smallvec", "wayland-sys", @@ -9361,7 +9210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d" dependencies = [ "bitflags 2.6.0", - "rustix 0.38.41", + "rustix", "wayland-backend", "wayland-scanner", ] @@ -10022,8 +9871,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", - "linux-raw-sys 0.4.14", - "rustix 0.38.41", + "linux-raw-sys", + "rustix", ] [[package]] @@ -10066,70 +9915,29 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zbus" -version = "3.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6" -dependencies = [ - "async-broadcast 0.5.1", - "async-executor", - "async-fs 1.6.0", - "async-io 1.13.0", - "async-lock 2.8.0", - "async-process 1.8.1", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "byteorder", - "derivative", - "enumflags2", - "event-listener 2.5.3", - "futures-core", - "futures-sink", - "futures-util", - "hex", - "nix 0.26.4", - "once_cell", - "ordered-stream", - "rand 0.8.5", - "serde", - "serde_repr", - "sha1", - "static_assertions", - "tracing", - "uds_windows", - "winapi", - "xdg-home", - "zbus_macros 3.15.2", - "zbus_names 2.6.1", - "zvariant 3.15.2", -] - [[package]] name = "zbus" version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" dependencies = [ - "async-broadcast 0.7.1", + "async-broadcast", "async-executor", - "async-fs 2.1.2", - "async-io 2.3.4", - "async-lock 3.4.0", - "async-process 2.3.0", + "async-fs", + "async-io", + "async-lock", + "async-process", "async-recursion", "async-task", "async-trait", "blocking", "enumflags2", - "event-listener 5.3.1", + "event-listener", "futures-core", "futures-sink", "futures-util", "hex", - "nix 0.29.0", + "nix", "ordered-stream", "rand 0.8.5", "serde", @@ -10141,23 +9949,9 @@ dependencies = [ "uds_windows", "windows-sys 0.52.0", "xdg-home", - "zbus_macros 4.4.0", - "zbus_names 3.0.0", - "zvariant 4.2.0", -] - -[[package]] -name = "zbus_macros" -version = "3.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "regex", - "syn 1.0.109", - "zvariant_utils 1.0.1", + "zbus_macros", + "zbus_names", + "zvariant", ] [[package]] @@ -10170,18 +9964,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.89", - "zvariant_utils 2.1.0", -] - -[[package]] -name = "zbus_names" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d" -dependencies = [ - "serde", - "static_assertions", - "zvariant 3.15.2", + "zvariant_utils", ] [[package]] @@ -10192,7 +9975,7 @@ checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" dependencies = [ "serde", "static_assertions", - "zvariant 4.2.0", + "zvariant", ] [[package]] @@ -10329,20 +10112,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "zvariant" -version = "3.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db" -dependencies = [ - "byteorder", - "enumflags2", - "libc", - "serde", - "static_assertions", - "zvariant_derive 3.15.2", -] - [[package]] name = "zvariant" version = "4.2.0" @@ -10354,20 +10123,7 @@ dependencies = [ "serde", "static_assertions", "url", - "zvariant_derive 4.2.0", -] - -[[package]] -name = "zvariant_derive" -version = "3.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", - "zvariant_utils 1.0.1", + "zvariant_derive", ] [[package]] @@ -10380,18 +10136,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.89", - "zvariant_utils 2.1.0", -] - -[[package]] -name = "zvariant_utils" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "zvariant_utils", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2076d48c76..bcd70418f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ uuid = { version = "1.11.0", features = ["v4", "serde"] } serde = { version = "1.0", features = ["derive"] } thiserror = "2.0.3" tokio = { version = "1.41.1", default-features = false } -keyring = "2.3.3" +keyring = { version = "3.6.1", features = ["apple-native", "windows-native", "linux-native", "crypto-rust"] } anyhow = "1.0.93" parking_lot = "0.12.3" futures = "0.3.31" diff --git a/crates/gitbutler-secret/src/secret.rs b/crates/gitbutler-secret/src/secret.rs index cdbce76e6d..241ac4e338 100644 --- a/crates/gitbutler-secret/src/secret.rs +++ b/crates/gitbutler-secret/src/secret.rs @@ -27,7 +27,7 @@ pub enum Namespace { pub fn persist(handle: &str, secret: &Sensitive, namespace: Namespace) -> Result<()> { let entry = entry_for(handle, namespace)?; if secret.0.is_empty() { - entry.delete_password()?; + entry.delete_credential()?; } else { entry.set_password(&secret.0)?; } @@ -45,7 +45,7 @@ pub fn retrieve(handle: &str, namespace: Namespace) -> Result Result<()> { - Ok(entry_for(handle, namespace)?.delete_password()?) + Ok(entry_for(handle, namespace)?.delete_credential()?) } /// Use this `identifier` as 'namespace' for identifying secrets. @@ -155,7 +155,7 @@ pub mod git_credentials { fn set_password(&self, password: &str) -> keyring::Result<()> { // credential helper on macos can't overwrite existing values apparently, workaround that. #[cfg(target_os = "macos")] - self.delete_password().ok(); + self.delete_credential().ok(); let (mut cascade, action, prompt) = self .store .credentials(&self.handle, Some(password)) @@ -184,8 +184,20 @@ pub mod git_credentials { } } + fn as_any(&self) -> &dyn Any { + self + } + + fn set_secret(&self, _password: &[u8]) -> keyring::Result<()> { + unreachable!("unused") + } + + fn get_secret(&self) -> keyring::Result> { + unreachable!("unused") + } + #[instrument(skip(self), err(Debug))] - fn delete_password(&self) -> keyring::Result<()> { + fn delete_credential(&self) -> keyring::Result<()> { let (mut cascade, action, prompt) = self .store .credentials(&self.handle, None) @@ -197,10 +209,6 @@ pub mod git_credentials { .map_err(|err| keyring::Error::PlatformFailure(err.into()))?; Ok(()) } - - fn as_any(&self) -> &dyn Any { - self - } } pub(super) struct Builder { diff --git a/crates/gitbutler-testsupport/src/secrets.rs b/crates/gitbutler-testsupport/src/secrets.rs index 7c4beb60c4..aadbebaa5b 100644 --- a/crates/gitbutler-testsupport/src/secrets.rs +++ b/crates/gitbutler-testsupport/src/secrets.rs @@ -1,3 +1,4 @@ +use keyring::Result; use std::any::Any; /// Assure we have a mock secrets store so tests don't start writing secrets into the user's actual store, @@ -16,11 +17,19 @@ impl keyring::credential::CredentialApi for BlackholeCredential { Ok(()) } + fn set_secret(&self, _password: &[u8]) -> Result<()> { + unreachable!("unused") + } + fn get_password(&self) -> keyring::Result { Err(keyring::Error::NoEntry) } - fn delete_password(&self) -> keyring::Result<()> { + fn get_secret(&self) -> Result> { + unreachable!("unused") + } + + fn delete_credential(&self) -> keyring::Result<()> { Ok(()) } diff --git a/crates/gitbutler-user/tests/secret/credentials.rs b/crates/gitbutler-user/tests/secret/credentials.rs index fad4fd6622..d70e34adc0 100644 --- a/crates/gitbutler-user/tests/secret/credentials.rs +++ b/crates/gitbutler-user/tests/secret/credentials.rs @@ -6,7 +6,7 @@ use std::{ use keyring::{ credential::{CredentialApi, CredentialBuilderApi, CredentialPersistence}, - Credential, + Credential, Result, }; #[derive(Default)] @@ -29,6 +29,10 @@ impl CredentialApi for Entry { Ok(()) } + fn set_secret(&self, _password: &[u8]) -> Result<()> { + unreachable!("unused") + } + fn get_password(&self) -> keyring::Result { match self.store.lock().unwrap().0.get(&self.handle) { Some(secret) => Ok(secret.clone()), @@ -36,7 +40,11 @@ impl CredentialApi for Entry { } } - fn delete_password(&self) -> keyring::Result<()> { + fn get_secret(&self) -> Result> { + unreachable!("unused") + } + + fn delete_credential(&self) -> keyring::Result<()> { self.store.lock().unwrap().0.remove(&self.handle); Ok(()) }