Vali-Blob.OCI 1.0.0

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

Vali-Blob.OCI

NuGet License: MIT .NET

Oracle Cloud Infrastructure (OCI) Object Storage provider for Vali-Blob — the unified cloud storage abstraction library for .NET.

Implements IStorageProvider over OCI Object Storage with Pre-Authenticated Request (PAR) URL generation, resumable multipart uploads, and seamless DI registration.

OCI specifics:

  • Presigned URLs use Pre-Authenticated Requests (PARs) — each URL requires an API call to OCI (no local signing like AWS/GCP).
  • Metadata can only be set at upload time — in-place metadata updates require re-uploading the object.

Compatibility

Target Framework Supported
netstandard2.0 Yes
netstandard2.1 Yes
net6.0 Yes
net7.0 Yes
net8.0 Yes
net9.0 Yes

Installation

dotnet add package ValiBlob.Core
dotnet add package ValiBlob.OCI

Configuration

{
  "ValiBlob": {
    "DefaultProvider": "OCI"
  },
  "ValiBlob:OCI": {
    "Namespace":      "my-tenancy-namespace",
    "Bucket":         "my-bucket",
    "Region":         "us-ashburn-1",
    "TenancyId":      "ocid1.tenancy.oc1...",
    "UserId":         "ocid1.user.oc1...",
    "Fingerprint":    "xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
    "PrivateKeyPath": "/run/secrets/oci_api_key.pem"
  }
}

Alternatively, provide the private key content directly:

{
  "ValiBlob:OCI": {
    "Namespace":          "my-tenancy-namespace",
    "Bucket":             "my-bucket",
    "Region":             "us-ashburn-1",
    "TenancyId":          "ocid1.tenancy.oc1...",
    "UserId":             "ocid1.user.oc1...",
    "Fingerprint":        "xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
    "PrivateKeyContent":  "-----BEGIN RSA PRIVATE KEY-----\n..."
  }
}

Security: Store PrivateKeyPath or PrivateKeyContent via OCI Vault, environment variables, or a secrets manager. Never commit private keys to source control.


Registration

using ValiBlob.Core.DependencyInjection;
using ValiBlob.OCI.Extensions;

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "OCI")
    .UseOCI();

With pipeline

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "OCI")
    .UseOCI()
    .WithPipeline(p => p
        .UseValidation(v =>
        {
            v.AllowedExtensions = new[] { ".pdf", ".docx", ".xlsx" };
            v.MaxFileSizeBytes  = 200 * 1024 * 1024; // 200 MB
        })
    );

Usage

Upload

public class DocumentService(IStorageProvider storage)
{
    public async Task<string> UploadAsync(Stream content, string fileName)
    {
        var result = await storage.UploadAsync(new UploadRequest
        {
            Path        = StoragePath.From("documents", fileName),
            Content     = content,
            ContentType = "application/pdf",
            Metadata    = new Dictionary<string, string>
            {
                ["uploaded-by"] = "api-service",
                ["env"]         = "production"
            }
        });

        if (!result.IsSuccess)
            throw new Exception(result.ErrorMessage);

        return result.Value!.Url;
    }
}

Download

var result = await storage.DownloadAsync(new DownloadRequest
{
    Path = StoragePath.From("documents", "contract.pdf")
});

if (result.IsSuccess)
    await result.Value!.CopyToAsync(outputStream);

Pre-Authenticated Request (PAR) URL

// Download PAR — each call creates a new PAR in OCI
var url = await storage.GetPresignedDownloadUrlAsync(new PresignedUrlRequest
{
    Path      = StoragePath.From("reports", "q4-2024.pdf"),
    ExpiresIn = TimeSpan.FromHours(24)
});

if (url.IsSuccess)
    return Ok(new { downloadUrl = url.Value });

Resumable (multipart) upload

var session = await resumable.StartUploadAsync(new ResumableUploadRequest
{
    FileName    = "large-archive.zip",
    ContentType = "application/zip",
    TotalSize   = totalBytes
});

for (int i = 0; i < chunks.Count; i++)
{
    await resumable.UploadChunkAsync(new ResumableChunkRequest
    {
        SessionId  = session.SessionId,
        ChunkIndex = i,
        Data       = chunks[i]
    });
}

await resumable.CompleteUploadAsync(session.SessionId);

Features

Feature Supported
Upload / Download / Delete / List Yes
Exists check Yes
Copy / Move Yes
Metadata (set at upload time) Yes
In-place metadata update No — re-upload required
Presigned URLs (via OCI PARs) Yes
Resumable chunked uploads Yes
BucketOverride per request Yes
Polly retry resilience Yes

Options reference

Property Default Description
Namespace — OCI tenancy namespace (required)
Bucket — Object Storage bucket name (required)
Region — OCI region identifier (e.g. us-ashburn-1)
TenancyId — OCID of the tenancy
UserId — OCID of the API user
Fingerprint — API key fingerprint
PrivateKeyPath — Path to the PEM private key file
PrivateKeyContent — PEM private key as a string
ParExpiryMinutes 60 Default expiry for generated PARs

Documentation



Donations

If Vali-Blob is useful to you, consider supporting its development:


License

MIT License

Contributions

Issues and pull requests are welcome on GitHub.

Product 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 is compatible.  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.  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. 
.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 is compatible. 
.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. 
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.0.0 255 3/21/2026