SeliseBlocks.Secrets.OS
4.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SeliseBlocks.Secrets.OS --version 4.0.0
NuGet\Install-Package SeliseBlocks.Secrets.OS -Version 4.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SeliseBlocks.Secrets.OS" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SeliseBlocks.Secrets.OS" Version="4.0.0" />
<PackageReference Include="SeliseBlocks.Secrets.OS" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SeliseBlocks.Secrets.OS --version 4.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SeliseBlocks.Secrets.OS, 4.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SeliseBlocks.Secrets.OS@4.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SeliseBlocks.Secrets.OS&version=4.0.0
#tool nuget:?package=SeliseBlocks.Secrets.OS&version=4.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SeliseBlocks.Secrets.OS
Setup
services.AddBlocksSecrets();
builder.Services.Configure<MvcOptions>(options => options.Filters.Add<SecretExceptionFilter>());
Inject ISecretService wherever you need it.
Create
var secretId = await _secrets.SetAsync(new SetSecretRequest
{
Name = "smtp-password",
Value = plaintext,
Type = SecretTypes.Service,
});
var ids = await _secrets.SetManyAsync(
[
new SetSecretRequest { Name = "smtp-password", Value = pwd, Type = SecretTypes.Service },
new SetSecretRequest { Name = "smtp-host-key", Value = key, Type = SecretTypes.Service },
]);
// ids["smtp-password"] => "3f2a...c91"
Store the returned id on your own documents. Never the value.
Read
SecretResult? secret = await _secrets.GetAsync(secretId);
SecretListResult page = await _secrets.FindAsync(new SecretFilter
{
Search = "smtp",
Type = SecretTypes.Service,
PageNumber = 1,
PageSize = 20,
});
string value = await _secrets.GetValueAsync(secretId);
IReadOnlyDictionary<string, string> values = await _secrets.GetValuesAsync([id1, id2]);
Update and rotate
await _secrets.UpdateAsync(secretId, new UpdateSecretRequest
{
Name = "smtp-password-primary",
Description = "Outbound mail",
});
await _secrets.RotateAsync(secretId, new RotateSecretRequest { Value = newPlaintext });
Lifecycle
await _secrets.LockAsync(secretId);
await _secrets.UnlockAsync(secretId);
await _secrets.DeleteAsync(secretId);
await _secrets.RestoreAsync(secretId);
Access
await _secrets.UpdateAccessAsync(secretId, new SecretAccess
{
UserIds = { "user-1", "user-2" },
Roles = { "admin" },
});
Audit
SecretAuditListResult logs = await _secrets.GetAuditLogsAsync(new SecretAuditFilter
{
SecretId = secretId,
FromDate = DateTime.UtcNow.AddDays(-30),
PageNumber = 1,
PageSize = 20,
});
Errors
| Exception | HTTP |
|---|---|
SecretValidationException |
400 |
SecretAccessDeniedException |
403 |
SecretNotFoundException |
404 |
SecretStateException |
409 |
SecretVaultException |
502 |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Azure.Identity (>= 1.21.0)
- Azure.Security.KeyVault.Secrets (>= 4.11.0)
- MongoDB.Driver (>= 3.8.0)
- SeliseBlocks.Genesis.OS (>= 4.0.6)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SeliseBlocks.Secrets.OS:
| Package | Downloads |
|---|---|
|
SeliseBlocks.ReleaseDriver.OS
Blocks Release Driver |
GitHub repositories
This package is not used by any popular GitHub repositories.