-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support global secrets (without namespace for build types) and provid…
…e commands in `tauri` crate That way globals secrets can be used from the UI directly.
- Loading branch information
Showing
7 changed files
with
100 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,6 @@ pub mod remotes; | |
pub mod undo; | ||
pub mod users; | ||
pub mod virtual_branches; | ||
pub mod secret; | ||
|
||
pub mod zip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::error::Error; | ||
use gitbutler_core::secret; | ||
use gitbutler_core::types::Sensitive; | ||
use tracing::instrument; | ||
|
||
#[tauri::command(async)] | ||
#[instrument(err(Debug))] | ||
pub async fn secret_get_global(handle: &str) -> Result<Option<String>, Error> { | ||
Ok(secret::retrieve(handle, secret::Namespace::Global)?.map(|s| s.0)) | ||
} | ||
|
||
#[tauri::command(async)] | ||
#[instrument(skip(secret), err(Debug), fields(secret = "<redacted>"))] | ||
pub async fn secret_set_global(handle: &str, secret: String) -> Result<(), Error> { | ||
Ok(secret::persist( | ||
handle, | ||
&Sensitive(secret), | ||
secret::Namespace::Global, | ||
)?) | ||
} |