GnomeStack.Os.Secrets
0.1.3
dotnet add package GnomeStack.Os.Secrets --version 0.1.3
NuGet\Install-Package GnomeStack.Os.Secrets -Version 0.1.3
<PackageReference Include="GnomeStack.Os.Secrets" Version="0.1.3" />
paket add GnomeStack.Os.Secrets --version 0.1.3
#r "nuget: GnomeStack.Os.Secrets, 0.1.3"
// Install GnomeStack.Os.Secrets as a Cake Addin #addin nuget:?package=GnomeStack.Os.Secrets&version=0.1.3 // Install GnomeStack.Os.Secrets as a Cake Tool #tool nuget:?package=GnomeStack.Os.Secrets&version=0.1.3
GnomeStack.Os.Secrets
Provides KeyTar like support for libsecret, Windows Credential Manager, and macOS Keychain for .NET.
The main class OsSecretVault
does not yet support listing credential as the Darwin ("MacOS")
implementation does not yet implement it. It does support setting, getting, and deleting
credentials.
Similar to node-keytar, the linux implementation uses libsecret. It requires libsecret and the gnome-keyring schema to be installed. No promises on supporting other schemas.
- Debian/Ubuntu:
sudo apt-get install libsecret-1-dev
- Red Hat-based:
sudo yum install libsecret-devel
- Arch Linux:
sudo pacman -S libsecret
The macOS implementation uses the Keychain API and windows uses the Credential Manager API.
The windows implementation uses Enterprise persistence by default. If you want to use
local, you'll need to use the WinCredManager
class directly.
Usage
// basically service, account, password
OsSecretVault.SetSecret("myapp", "myuser", "mypassword"); // you can also pass in a byte[] instead of a string
var password = OsSecretVault.GetSecret("myapp", "myuser");
// various options for getting the password
// as bytes and chars can be cleared from memory while strings
// cannot since they are immutable. SecureString is provided
// to support powershell despite Microsoft wanting
to deprecate SecureString.
var pwBytes = OsSecretVault.GetSecretAsBytes("myapp", "myuser");
var pwChars = OsSecretVault.GetSecretAsChars("myapp", "myuser");
var secureString = OsSecretVault.GetSecretAsSecureString("myapp", "myuser");
OsSecretVault.DeleteSecret("myapp", "myuser");
// you may call the os specific implementations directly
LibSecret.SetSecret("unit", "test", "password");
WinCredManager.SetSecret("unit", "test", "password");
KeyChain.SetSecret("unit", "test", "password");
MIT License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# CHANGE LOG
## 0.1.2 initial creation
- Initial creation with basic functionality for Linux, Windows, and MacOS.
- Implement GetSecret, SetSecret, and DeleteSecret.
- Attempt to implement basic compatibility with node-keytar.