SpiceDb 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package SpiceDb --version 1.0.5
                    
NuGet\Install-Package SpiceDb -Version 1.0.5
                    
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="SpiceDb" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpiceDb" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="SpiceDb" />
                    
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 SpiceDb --version 1.0.5
                    
#r "nuget: SpiceDb, 1.0.5"
                    
#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 SpiceDb@1.0.5
                    
#: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=SpiceDb&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=SpiceDb&version=1.0.5
                    
Install as a Cake Tool

SpiceDb

Simple SpiceDb client based on SpiceDB.Hierarchical.UI - Works with AuthZed

https://github.com/MaheshBailwal/SpiceDB.Hierarchical.UI

Available on Nuget at https://www.nuget.org/packages/SpiceDb

Usage

Install

Install the package using NuGet
Install-Package SpiceDb

Example Using UserSecrets

using Microsoft.Extensions.Configuration;
using SpiceDb.Example;
using SpiceDb.Example.MyObjects;
using SpiceDb.Models;

// This is just to keep the server address and token private
var builder = new ConfigurationBuilder()
	.AddUserSecrets(typeof(Secrets).Assembly)
	.AddEnvironmentVariables();
var configurationRoot = builder.Build();

var secrets = configurationRoot.GetSection("AuthZed").Get<Secrets>();

if (secrets is null)
	throw new ArgumentException("Invalid secrets configuration");

// var serverAddress = "https://grpc.authzed.com";
var client = new SpiceDb.Client(secrets.ServerAddress, secrets.Token);

// Add relationship where user:bob is a reader of document:firstdoc
client.AddRelation("arch/document:firstdoc#reader@arch/user:bob");
client.AddRelation(new Relationship("arch/document:firstdoc", "reader", "arch/user:jacob"));

// This approach uses a little syntactic sugar to define each of the relations
client.AddRelation(ZedUser.WithId("carmella").CanRead(ZedDocument.WithId("firstdoc")));

// Check to see if user:bob is in fact now a reader of document:firstdoc
var bobCanRead = client.CheckPermission(new Permission("arch/document:firstdoc#reader@arch/user:bob"));

Console.WriteLine($"Can user bob read document:firstdoc? {bobCanRead.HasPermission}");
// true

// Check to see if user:carmella is in fact now a reader of document:firstdoc
var carmellaCanRead = client.CheckPermission(ZedUser.WithId("carmella").CanRead(ZedDocument.WithId("firstdoc")));

Console.WriteLine($"Can user carmella read document:firstdoc? {carmellaCanRead.HasPermission}");
// true


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.  net9.0 was computed.  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.6.2 807 6/17/2025
1.6.1 6,217 3/11/2025
1.6.0 15,002 11/30/2024
1.5.3 113,723 7/9/2024
1.5.2 35,672 5/20/2024
1.5.1 14,029 4/23/2024
1.5.0 4,065 4/11/2024
1.4.9 145 4/11/2024
1.4.8 126 4/11/2024
1.4.7 419 4/8/2024
1.4.6 128 4/8/2024
1.4.5 169 4/7/2024
1.4.4 149 4/6/2024
1.4.3 7,100 3/6/2024
1.4.2 165 2/21/2024
1.4.1 51,560 10/27/2023
1.4.0 2,725 8/17/2023
1.3.8 439 4/5/2023
1.3.7 267 4/5/2023
1.3.6 665 2/28/2023
1.3.5 311 2/21/2023
1.3.4 509 2/21/2023
1.3.3 304 2/20/2023
1.3.2 325 2/19/2023
1.2.8 326 2/17/2023
1.2.7 313 2/16/2023
1.2.5 310 2/16/2023
1.2.4 354 2/16/2023
1.2.2 329 2/16/2023
1.2.1 324 2/16/2023
1.2.0 301 2/16/2023
1.1.9 322 2/15/2023
1.1.8 358 2/15/2023
1.1.7 316 2/15/2023
1.1.6 306 2/15/2023
1.1.5 341 2/14/2023
1.1.4 350 2/14/2023
1.1.3 330 2/14/2023
1.1.2 336 2/14/2023
1.1.0 318 2/14/2023
1.0.7 345 2/14/2023
1.0.6 350 2/11/2023
1.0.5 343 2/11/2023
1.0.3 342 2/11/2023
1.0.1 338 2/11/2023
1.0.0 433 2/11/2023