ModPosh.PasswordSafeClient 1.2.0

dotnet add package ModPosh.PasswordSafeClient --version 1.2.0                
NuGet\Install-Package ModPosh.PasswordSafeClient -Version 1.2.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="ModPosh.PasswordSafeClient" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ModPosh.PasswordSafeClient --version 1.2.0                
#r "nuget: ModPosh.PasswordSafeClient, 1.2.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.
// Install ModPosh.PasswordSafeClient as a Cake Addin
#addin nuget:?package=ModPosh.PasswordSafeClient&version=1.2.0

// Install ModPosh.PasswordSafeClient as a Cake Tool
#tool nuget:?package=ModPosh.PasswordSafeClient&version=1.2.0                
Latest Version Nuget.org Issues License Discord
Latest Version Nuget.org GitHub issues GitHub license Discord Server

ModPosh.PasswordSafeClient

ModPosh.PasswordSafeClient is a C# client library for interacting with the PasswordSafe API. It allows developers to manage credentials within projects by providing a simple and flexible API interface. This client supports basic operations such as retrieving, creating, updating, and deleting credentials, and it uses an authentication token to securely communicate with the API.

Features

  • Retrieve all credentials for a project.
  • Retrieve a specific credential by its ID.
  • Create new credentials.
  • Update existing credentials.
  • Delete credentials from a project.
  • Supports token-based authentication (X-Auth-Token).

Installation

You can install ModPosh.PasswordSafeClient via NuGet:

dotnet add package ModPosh.PasswordSafeClient

Or by adding it to your csproj file:

<PackageReference Include="ModPosh.PasswordSafeClient" Version="1.0.0" />

Usage in C# Project

1. Initialize the Client

You need to pass an HttpClient and an authentication token (X-Auth-Token) to create an instance of the PasswordSafeClient.

Example
using ModPosh.PasswordSafeClient;
using ModPosh.PasswordSafeClient.Factory;
using System.Net.Http;

var httpClient = new HttpClient { BaseAddress = new Uri("https://pwdsafe.rackspace.net") };
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");

string authToken = "your-auth-token";  // Replace with a valid token
var passwordSafeClient = PasswordSafeClientFactory.Create(httpClient, authToken);

// Example usage: Retrieve a specific credential
int projectId = 30795;
int credentialId = 320223;

var credential = await passwordSafeClient.CredentialsService.GetCredentialAsync(projectId, credentialId);
Console.WriteLine($"Credential Description: {credential.Description}");

Usage via PowerShell

You can also use ModPosh.PasswordSafeClient in PowerShell by importing it into your script.

1. Load the Assembly

Add-Type -Path "path\to\ModPosh.PasswordSafeClient.dll"

2. Set up the HttpClient and Token

# Create an instance of HttpClient
$httpClient = [System.Net.Http.HttpClient]::new()
$httpClient.BaseAddress = [Uri]::new("https://pwdsafe.rackspace.net")
$httpClient.DefaultRequestHeaders.Add("Accept", "application/json")

# Set your authentication token
$authToken = "your-auth-token"  # Replace with the actual token

# Create the PasswordSafeClient
$passwordSafeClient = [ModPosh.PasswordSafeClient.Factory.PasswordSafeClientFactory]::Create($httpClient, $authToken)

# Set the project and credential IDs
$projectId = 30795  # Replace with your project ID
$credentialId = 320223  # Replace with your credential ID

# Retrieve the credential
$credential = $passwordSafeClient.CredentialsService.GetCredentialAsync($projectId, $credentialId).GetAwaiter().GetResult()

# Output the credential information
$credential | ConvertTo-Json -Depth 5

Implemented Services

CredentialsService

  • Task<List<Credential>> GetAllCredentialsAsync(int projectId)

    • Retrieves all credentials for a specific project.
  • Task<Credential> GetCredentialAsync(int projectId, int credentialId)

    • Retrieves a specific credential by its ID.
  • Task<Credential> CreateCredentialAsync(int projectId, CredentialRequest credentialRequest)

    • Creates a new credential for the project.
  • Task UpdateCredentialAsync(int projectId, int credentialId, CredentialRequest credentialRequest)

    • Updates an existing credential.
  • Task DeleteCredentialAsync(int projectId, int credentialId)

    • Deletes a credential from the project.
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.2.0 105 10/19/2024
1.0.0 85 10/17/2024