YopassSharp 1.5.1

dotnet add package YopassSharp --version 1.5.1
                    
NuGet\Install-Package YopassSharp -Version 1.5.1
                    
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="YopassSharp" Version="1.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YopassSharp" Version="1.5.1" />
                    
Directory.Packages.props
<PackageReference Include="YopassSharp" />
                    
Project file
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 YopassSharp --version 1.5.1
                    
#r "nuget: YopassSharp, 1.5.1"
                    
#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 YopassSharp@1.5.1
                    
#: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=YopassSharp&version=1.5.1
                    
Install as a Cake Addin
#tool nuget:?package=YopassSharp&version=1.5.1
                    
Install as a Cake Tool

YopassSharp

YopassSharp is a C# client library for Yopass, a secure sharing solution for secrets using end-to-end encryption.

This library allows you to easily create encrypted secret links programmatically.


🚀 Features

  • Create encrypted Yopass links directly from C#
  • Strong AES-256 + PGP encryption under the hood (via BouncyCastle)
  • Fully configurable API endpoints, decryption key length, and HTTP method
  • Async/await support
  • Built-in URL builders for short and full links

📦 Installation

dotnet add package YopassSharp

🛠 API Overview

YopassClient

Main class to create secure links. Implements IYopassClient.

Methods:

  • Task<YopassResult> CreateLinkAsync(string message)
    Creates a secret using a randomly generated decryption key and default expiration (OneHour).

  • Task<YopassResult> CreateLinkAsync(string message, string? decryptenKey)
    Creates a secret using a provided or generated decryption key and default expiration (OneHour).

  • Task<YopassResult> CreateLinkAsync(string message, ExpirationSeconds expiration)
    Creates a secret using a randomly generated decryption key and a custom expiration.

  • Task<YopassResult> CreateLinkAsync(string message, string? decryptenKey, ExpirationSeconds expiration)
    Creates a secret using a provided or generated decryption key and a custom expiration.


YopassResult

YopassResult represents the outcome of creating a Yopass link. It contains all important information about the secret, including ID, decryption key, generated URLs, and status.

class YopassResult
{
    bool Success;             // True if the link creation was successful
    string SecretId = "";    // Unique secret ID returned by the Yopass API
    string DecryptenKey = ""; // Key needed to decrypt the secret

    // Short link (example)
    string ShortUrl => "https://yopass.se/#/s/abcd1234";

    // Full link (example)
    string FullUrl => "https://yopass.se/#/s/abcd1234#mySecretKey";

    string? ErrorMessage = null; // Error message if creation failed
}

Field Explanation:

  • Success – Indicates whether the secret creation was successful.
  • SecretId – Unique identifier of the secret returned by the Yopass server.
  • DecryptenKey – The key used to decrypt the secret; required to read the content.
  • ShortUrl – Short link pointing to the secret page (without the key). Useful when the key is sent separately.
  • FullUrl – Full link including the decryption key. Can be used directly to access the secret.
  • ErrorMessage – Contains the error message if creation failed (e.g., network or API errors).

Example Usage:

var result = await client.CreateLinkAsync("My secret password");

if (result.Success)
{
    Console.WriteLine(result.ShortUrl); // e.g., https://yopass.se/#/s/abcd1234
    Console.WriteLine(result.FullUrl);  // e.g., https://yopass.se/#/s/abcd1234#mySecretKey
}
else
{
    Console.WriteLine(result.ErrorMessage); // e.g., "API request failed"
}

YopassConfig

Defines configuration for YopassClient.

Default values:

  • UrlBase: yopass.se
  • ApiBase: api.yopass.se
  • ApiEndpoint: secret
  • Method: POST
  • DecryptenKeyLength: 12

You can override this by providing a custom config.


⚡ Quickstart

using System;
using System.Threading.Tasks;
using YopassSharp;

class Program
{
    static async Task Main()
    {
        var client = new YopassClient();

        var result = await client.CreateLinkAsync("Hello secure world!");

        if (result.Success)
        {
            Console.WriteLine($"Short URL: {result.ShortUrl}");
            Console.WriteLine($"Full URL: {result.FullUrl}");
        }
        else
        {
            Console.WriteLine($"Error: {result.ErrorMessage}");
        }
    }
}

⚙️ Configuration

using YopassSharp;
using YopassSharp.Config;
using RestSharp;

var config = new YopassConfig(
    urlBase: "yourdomain.de",
    apiBase: "api.yourdomain.de",
    apiEndpoint: "secret",
    method: Method.Post,
    decryptenKeyLength: 16
);

var client = new YopassClient(config);

var result = await client.CreateLinkAsync("Custom instance test", ExpirationSeconds.OneDay);
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.

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.5.1 202 9/30/2025