https://github.com/itrooz/freedesktopsecrets-cs
C# library to implement the Freedesktop Secret Service API.
https://github.com/itrooz/freedesktopsecrets-cs
csharp dbus freedesktop linux
Last synced: 3 months ago
JSON representation
C# library to implement the Freedesktop Secret Service API.
- Host: GitHub
- URL: https://github.com/itrooz/freedesktopsecrets-cs
- Owner: iTrooz
- License: lgpl-2.1
- Created: 2025-02-15T17:32:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-17T00:11:22.000Z (about 1 year ago)
- Last Synced: 2025-02-17T00:25:26.460Z (about 1 year ago)
- Topics: csharp, dbus, freedesktop, linux
- Language: C#
- Homepage:
- Size: 104 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FreeDesktopSecrets-CS
Client library in C# to use the Freedesktop Secrets API
# What ?
The Freedesktop Secrets API is a standard for storing secrets (passwords, keys, etc.) in a secure way on a Linux system. It is implemented over dbus, which is a message bus system that allows communication between applications.
This library is a C# client to use this API.
# Install
Run
```bash
dotnet add package iTrooz.FreeDesktopSecrets
```
in your project directory to install the library.
# Usage
Sample usage of this library:
```csharp
var storage = FreeDesktopSecretsClient.FromSession(); // use the classic dbus session bus
await storage.ConnectAsync("TestApplication"); // Use this name for the API "folder" that will hold secrets
var itemKeys = await storage.ListItemKeysAsync(); // List keys of all secrets stored
foreach (var item in itemKeys)
Console.WriteLine(item);
await storage.CreateItemAsync(
"TestItem",
System.Text.Encoding.UTF8.GetBytes("TestString"),
true); // Store a secret
var secret = await storage.GetItemAsync("TestItem"); // Retrieve it
Console.WriteLine(System.Text.Encoding.UTF8.GetString(secret!)); // "TestString"
await storage.DeleteItemAsync("TestItem"); // Delete the secret
```
# Links
- Thanks to tmds for his [dbus library](https://github.com/tmds/Tmds.DBus)
- Inspiration: https://github.com/mitya57/FreeDesktopSecrets
- Freedesktop Secrets API Specification: https://specifications.freedesktop.org/secret-service-spec/latest-single/
# Licence
LGPL-2.1 OR LGPL-3.0-or-later with proxy clause (proxy being me, iTrooz)