spicedb

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package spicedb contains SpiceDB adapter contracts and configuration for authz.

The first production implementation should live here and implement:

  • authz.Authorizer via CheckPermission
  • authz.RelationshipWriter via WriteRelationships/DeleteRelationships
  • authz.ResourceLookup via LookupResources
  • authz.SubjectLookup via LookupSubjects
  • authz.SchemaManager via ReadSchema/WriteSchema

Index

Constants

View Source
const DefaultSchema = `` /* 1607-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client adapts AuthZed's official authzed-go gRPC SDK to Kernel authz.

func New

func New(cfg Config, opts ...grpc.DialOption) (*Client, error)

func (*Client) BatchCheck

func (*Client) Check

func (c *Client) Check(ctx context.Context, req authz.CheckRequest) (authz.Decision, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DeleteRelationships

func (c *Client) DeleteRelationships(ctx context.Context, filter authz.RelationshipFilter) (authz.WriteResult, error)

func (*Client) InstallDefaultSchema

func (c *Client) InstallDefaultSchema(ctx context.Context) error

func (*Client) LookupResources

func (*Client) LookupSubjects

func (*Client) ReadRelationships

func (c *Client) ReadRelationships(ctx context.Context, filter authz.RelationshipFilter) ([]authz.Relationship, error)

func (*Client) ReadSchema

func (c *Client) ReadSchema(ctx context.Context) (authz.Schema, error)

func (*Client) ValidateSchema

func (c *Client) ValidateSchema(ctx context.Context, schema authz.Schema) error

func (*Client) WriteRelationships

func (c *Client) WriteRelationships(ctx context.Context, relationships ...authz.Relationship) (authz.WriteResult, error)

func (*Client) WriteSchema

func (c *Client) WriteSchema(ctx context.Context, schema authz.Schema) error

type Config

type Config struct {
	Endpoint string `json:"endpoint" yaml:"endpoint"`
	Token    string `json:"token" yaml:"token"`

	Transport Transport     `json:"transport" yaml:"transport"`
	Insecure  bool          `json:"insecure" yaml:"insecure"`
	Timeout   time.Duration `json:"timeout" yaml:"timeout"`

	// FullyConsistent is useful during early development. Production hot paths
	// should prefer at-least-as-fresh with a stored consistency token when needed.
	FullyConsistent bool `json:"fully_consistent" yaml:"fully_consistent"`

	// Logger is the component logger. If nil, spicedb uses logx.DefaultLogger().
	Logger logx.Logger `json:"-" yaml:"-"`

	// Metrics is the optional metrics manager for SpiceDB backend calls.
	Metrics metricsx.Manager `json:"-" yaml:"-"`

	// MetricsEnabled controls whether SpiceDB backend calls record metrics.
	MetricsEnabled bool `json:"metrics_enabled" yaml:"metrics_enabled"`
}

func (Config) Normalized

func (c Config) Normalized() Config

type Transport

type Transport string
const (
	TransportGRPC Transport = "grpc"
	TransportHTTP Transport = "http"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL